Commit 76ae2649 authored by Connor Abbott's avatar Connor Abbott

Merge branch 'connor-updated-formats' into 'master'

Integrate Connor's updated formats

See merge request !17
parents 581fbdf1 5f57503c
......@@ -36,10 +36,12 @@ files_panfrost = files(
'pan_nondrm.c',
'pan_allocate.c',
'pan_assemble.c',
'pan_format.c',
'pan_swizzle.c',
'pan_blending.c',
'pan_blend_shaders.c',
'pan_wallpaper.c',
'pan_pretty_print.c'
)
inc_panfrost = [
......
......@@ -127,21 +127,23 @@ panfrost_shader_compile(struct panfrost_context *ctx, struct mali_shader_meta *m
varyings->varyings_stride[1] = 4 * sizeof(float);
/* Setup gl_Position and its weirdo analogue */
unsigned default_vec4_swizzle = panfrost_get_default_swizzle(4);
struct mali_attr_meta position_meta = {
.index = 1,
.type = 6, /* gl_Position */
.nr_components = MALI_POSITIVE(4),
.is_int_signed = 1,
.unknown1 = 0x1a22
.format = MALI_VARYING_POS,
.swizzle = default_vec4_swizzle,
.unknown1 = 0x2,
};
struct mali_attr_meta position_meta_prime = {
.index = 0,
.type = 7, /* float */
.nr_components = MALI_POSITIVE(4),
.is_int_signed = 1,
.unknown1 = 0x2490
.index = 1,
.format = MALI_RGBA16F,
/* TODO: Wat? yyyy swizzle? */
.swizzle = 0x249,
.unknown1 = 0x0,
};
varyings->vertex_only_varyings[0] = position_meta;
......@@ -152,20 +154,13 @@ panfrost_shader_compile(struct panfrost_context *ctx, struct mali_shader_meta *m
for (int i = 0; i < varying_count; ++i) {
struct mali_attr_meta vec4_varying_meta = {
.index = 0,
.type = 7, /* float */
.nr_components = MALI_POSITIVE(4),
.not_normalised = 1,
.unknown1 = 0x1a22,
/* mediump => half-floats */
.is_int_signed = 1,
.format = MALI_RGBA16F,
.swizzle = default_vec4_swizzle,
.unknown1 = 0x2,
/* Set offset to keep everything back-to-back in
* the same buffer */
.src_offset = 8 * i,
#ifdef T6XX
.unknown2 = 1,
#endif
};
varyings->varyings[i] = vec4_varying_meta;
......
......@@ -29,6 +29,7 @@
#include "pan_context.h"
#include "pan_swizzle.h"
#include "pan_format.h"
#include "util/macros.h"
#include "util/u_format.h"
......@@ -596,11 +597,6 @@ panfrost_invalidate_frame(struct panfrost_context *ctx)
if (ctx->rasterizer)
ctx->dirty |= PAN_DIRTY_RASTERIZER;
/* Uniforms are all discarded with the above stack discard */
for (int i = 0; i <= PIPE_SHADER_FRAGMENT; ++i)
ctx->constant_buffer[i].dirty = true;
/* XXX */
ctx->dirty |= PAN_DIRTY_SAMPLERS | PAN_DIRTY_TEXTURES;
}
......@@ -640,34 +636,6 @@ panfrost_emit_tiler_payload(struct panfrost_context *ctx)
memcpy(&ctx->payload_tiler, &payload_1, sizeof(payload_1));
}
static unsigned
panfrost_translate_texture_swizzle(enum pipe_swizzle s)
{
switch (s) {
case PIPE_SWIZZLE_X:
return MALI_CHANNEL_RED;
case PIPE_SWIZZLE_Y:
return MALI_CHANNEL_GREEN;
case PIPE_SWIZZLE_Z:
return MALI_CHANNEL_BLUE;
case PIPE_SWIZZLE_W:
return MALI_CHANNEL_ALPHA;
case PIPE_SWIZZLE_0:
return MALI_CHANNEL_ZERO;
case PIPE_SWIZZLE_1:
return MALI_CHANNEL_ONE;
default:
assert(0);
return 0;
}
}
static unsigned
translate_tex_wrap(enum pipe_tex_wrap w)
{
......@@ -1017,8 +985,8 @@ static void
panfrost_emit_vertex_data(struct panfrost_context *ctx)
{
/* TODO: Only update the dirtied buffers */
struct mali_attr attrs[PIPE_MAX_ATTRIBS];
struct mali_attr varyings[PIPE_MAX_ATTRIBS];
union mali_attr attrs[PIPE_MAX_ATTRIBS];
union mali_attr varyings[PIPE_MAX_ATTRIBS];
for (int i = 0; i < ctx->vertex_buffer_count; ++i) {
struct pipe_vertex_buffer *buf = &ctx->vertex_buffers[i];
......@@ -1063,9 +1031,9 @@ panfrost_emit_vertex_data(struct panfrost_context *ctx)
assert(ctx->varying_height < ctx->varying_mem.size);
}
ctx->payload_vertex.postfix.attributes = panfrost_upload_transient(ctx, attrs, ctx->vertex_buffer_count * sizeof(struct mali_attr));
ctx->payload_vertex.postfix.attributes = panfrost_upload_transient(ctx, attrs, ctx->vertex_buffer_count * sizeof(union mali_attr));
mali_ptr varyings_p = panfrost_upload_transient(ctx, &varyings, ctx->vs->varyings.varying_buffer_count * sizeof(struct mali_attr));
mali_ptr varyings_p = panfrost_upload_transient(ctx, &varyings, ctx->vs->varyings.varying_buffer_count * sizeof(union mali_attr));
ctx->payload_vertex.postfix.varyings = varyings_p;
ctx->payload_tiler.postfix.varyings = varyings_p;
}
......@@ -1302,7 +1270,7 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
for (int i = 0; i < PIPE_SHADER_TYPES; ++i) {
struct panfrost_constant_buffer *buf = &ctx->constant_buffer[i];
if (buf->dirty) {
if (i == PIPE_SHADER_VERTEX || i == PIPE_SHADER_FRAGMENT) {
/* It doesn't matter if we don't use all the memory;
* we'd need a dummy UBO anyway. Compute the max */
......@@ -1699,7 +1667,8 @@ panfrost_draw_vbo(
/* Fallback for non-ES draw modes */
if (info->mode >= PIPE_PRIM_QUADS) {
mode = PIPE_PRIM_TRIANGLE_STRIP;
printf("XXX: Missing non-ES draw mode\n");
mode = PIPE_PRIM_TRIANGLE_FAN;
/*
util_primconvert_save_rasterizer_state(ctx->primconvert, &ctx->rasterizer->base);
util_primconvert_draw_vbo(ctx->primconvert, info);
......@@ -1852,60 +1821,10 @@ panfrost_create_vertex_elements_state(
enum pipe_format fmt = elements[i].src_format;
const struct util_format_description *desc = util_format_description(fmt);
struct util_format_channel_description chan = desc->channel[0];
int type = 0;
switch (chan.type) {
case UTIL_FORMAT_TYPE_UNSIGNED:
case UTIL_FORMAT_TYPE_SIGNED:
if (chan.size == 8)
type = MALI_ATYPE_BYTE;
else if (chan.size == 16)
type = MALI_ATYPE_SHORT;
else if (chan.size == 32)
type = MALI_ATYPE_INT;
else {
printf("BAD INT SIZE %d\n", chan.size);
assert(0);
}
break;
case UTIL_FORMAT_TYPE_FLOAT:
type = MALI_ATYPE_FLOAT;
break;
default:
printf("Unknown atype %d\n", chan.type);
assert(0);
}
so->hw[i].type = type;
so->hw[i].not_normalised = !chan.normalized;
so->hw[i].unknown1 = 0x2;
so->hw[i].swizzle = panfrost_get_default_swizzle(desc->nr_channels);
/* Bit used for both signed/unsigned and full/half designation */
so->hw[i].is_int_signed =
(chan.type == UTIL_FORMAT_TYPE_SIGNED) ? 1 :
(chan.type == UTIL_FORMAT_TYPE_FLOAT && chan.size != 32) ? 1 :
0;
so->hw[i].nr_components = MALI_POSITIVE(desc->nr_channels);
so->nr_components[i] = desc->nr_channels;
/* The meaning of these magic values is unclear at the moment,
* but likely has to do with how attributes are padded */
unsigned unknown1_for_components[4] = {
0x2c82, /* float */
0x2c22, /* vec2 */
0x2a22, /* vec3 */
0x1a22, /* vec4 */
};
so->hw[i].unknown1 = unknown1_for_components[desc->nr_channels - 1];
so->hw[i].unknown2 = 0x1;
so->hw[i].format = panfrost_find_format(desc);
/* The field itself should probably be shifted over */
so->hw[i].src_offset = elements[i].src_offset;
......@@ -2096,7 +2015,7 @@ panfrost_set_constant_buffer(
/* Multiple constant buffers not yet supported */
assert(index == 0);
const void *cpu;
const uint8_t *cpu;
struct panfrost_resource *rsrc = (struct panfrost_resource *) (buf->buffer);
......@@ -2112,7 +2031,7 @@ panfrost_set_constant_buffer(
/* Copy the constant buffer into the driver context for later upload */
pbuf->buffer = malloc(sz);
memcpy(pbuf->buffer, cpu, sz);
memcpy(pbuf->buffer, cpu + buf->buffer_offset, sz);
}
static void
......@@ -2157,23 +2076,15 @@ panfrost_create_sampler_view(
/* TODO: Detect from format better */
const struct util_format_description *desc = util_format_description(prsrc->base.format);
bool depth = prsrc->base.format == PIPE_FORMAT_Z32_UNORM;
bool has_alpha = true;
bool alpha_only = prsrc->base.format == PIPE_FORMAT_A8_UNORM;
/* Compose the format swizzle with the descriptor swizzle to find the
* actual swizzle to send to the hardware */
unsigned char composed_swizzle[4];
unsigned char desc_swizzle[4] = {
unsigned char user_swizzle[4] = {
template->swizzle_r,
template->swizzle_g,
template->swizzle_b,
template->swizzle_a
};
util_format_compose_swizzles(desc->swizzle, desc_swizzle, composed_swizzle);
enum mali_format format = panfrost_find_format(desc);
struct mali_texture_descriptor texture_descriptor = {
.width = MALI_POSITIVE(texture->width0),
......@@ -2182,11 +2093,8 @@ panfrost_create_sampler_view(
/* TODO: Decode */
.format = {
.bottom = alpha_only ? 0x24 : ((depth ? 0x20 : 0x88)),
.unk1 = alpha_only ? 0x1 : (has_alpha ? 0x6 : 0xb),
.component_size = depth ? 0x5 : 0x3,
.nr_channels = MALI_POSITIVE((depth ? 2 : bytes_per_pixel)),
.typeA = depth ? 2 : 5,
.swizzle = panfrost_translate_swizzle_4(desc->swizzle),
.format = format,
.usage1 = 0x0,
.is_not_cubemap = 1,
......@@ -2198,10 +2106,7 @@ panfrost_create_sampler_view(
.usage2 = prsrc->has_afbc ? 0x1c : (prsrc->tiled ? 0x11 : 0x12),
},
.swizzle_r = panfrost_translate_texture_swizzle(composed_swizzle[0]),
.swizzle_g = panfrost_translate_texture_swizzle(composed_swizzle[1]),
.swizzle_b = panfrost_translate_texture_swizzle(composed_swizzle[2]),
.swizzle_a = panfrost_translate_texture_swizzle(composed_swizzle[3]),
.swizzle = panfrost_translate_swizzle_4(user_swizzle)
};
/* TODO: Other base levels require adjusting dimensions / level numbers / etc */
......
......@@ -172,7 +172,7 @@ struct panfrost_context {
unsigned vertex_count;
struct mali_attr attributes[PIPE_MAX_ATTRIBS];
union mali_attr attributes[PIPE_MAX_ATTRIBS];
unsigned varying_height;
......@@ -391,4 +391,7 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data);
struct panfrost_transfer
panfrost_vertex_tiler_job(struct panfrost_context *ctx, bool is_tiler, bool is_elided_tiler);
unsigned
panfrost_get_default_swizzle(unsigned components);
#endif
/*
* © Copyright 2018 Alyssa Rosenzweig
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
#include "pan_format.h"
/* From panwrap/panwrap-decoder, but we don't want to bring in all those headers */
char *panwrap_format_name(enum mali_format format);
/* Construct a default swizzle based on the number of components */
static unsigned
panfrost_translate_swizzle(enum pipe_swizzle s)
{
switch (s) {
case PIPE_SWIZZLE_X:
return MALI_CHANNEL_RED;
case PIPE_SWIZZLE_Y:
return MALI_CHANNEL_GREEN;
case PIPE_SWIZZLE_Z:
return MALI_CHANNEL_BLUE;
case PIPE_SWIZZLE_W:
return MALI_CHANNEL_ALPHA;
case PIPE_SWIZZLE_0:
case PIPE_SWIZZLE_NONE:
return MALI_CHANNEL_ZERO;
case PIPE_SWIZZLE_1:
return MALI_CHANNEL_ONE;
default:
assert(0);
return 0;
}
}
/* Translate a Gallium swizzle quad to a 12-bit Mali swizzle code */
unsigned
panfrost_translate_swizzle_4(const unsigned char swizzle[4])
{
unsigned out = 0;
for (unsigned i = 0; i < 4; ++i) {
unsigned translated = panfrost_translate_swizzle(swizzle[i]);
out |= (translated << (3*i));
}
return out;
}
unsigned
panfrost_get_default_swizzle(unsigned components)
{
unsigned char default_swizzles[4][4] = {
{PIPE_SWIZZLE_X, PIPE_SWIZZLE_0, PIPE_SWIZZLE_0, PIPE_SWIZZLE_1},
{PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_0, PIPE_SWIZZLE_1},
{PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_Z, PIPE_SWIZZLE_1},
{PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W},
};
assert(components >= 1 && components <= 4);
return panfrost_translate_swizzle_4(default_swizzles[components - 1]);
}
static unsigned
panfrost_translate_channel_width(unsigned size)
{
switch (size) {
case 8:
return MALI_CHANNEL_8;
case 16:
return MALI_CHANNEL_16;
case 32:
return MALI_CHANNEL_32;
default:
fprintf(stderr, "Unknown width %d\n", size);
assert(0);
return 0;
}
}
static unsigned
panfrost_translate_channel_type(unsigned type, unsigned size, bool norm) {
switch (type) {
case UTIL_FORMAT_TYPE_UNSIGNED:
return norm ? MALI_FORMAT_UNORM : MALI_FORMAT_UINT;
case UTIL_FORMAT_TYPE_SIGNED:
return norm ? MALI_FORMAT_SNORM : MALI_FORMAT_SINT;
case UTIL_FORMAT_TYPE_FLOAT:
if (size == 16) {
/* With FLOAT, fp16 */
return MALI_FORMAT_SINT;
} else if (size == 32) {
/* With FLOAT< fp32 */
return MALI_FORMAT_UNORM;
} else {
assert(0);
return 0;
}
default:
assert(0);
return 0;
}
}
/* Constructs a mali_format satisfying the specified Gallium format
* description */
enum mali_format
panfrost_find_format(const struct util_format_description *desc)
{
struct util_format_channel_description chan = desc->channel[0];
/* Check for special formats */
switch (desc->format) {
case PIPE_FORMAT_R10G10B10X2_UNORM:
case PIPE_FORMAT_B10G10R10X2_UNORM:
case PIPE_FORMAT_R10G10B10A2_UNORM:
case PIPE_FORMAT_B10G10R10A2_UNORM:
return MALI_RGB10_A2_UNORM;
case PIPE_FORMAT_R10G10B10X2_SNORM:
case PIPE_FORMAT_R10G10B10A2_SNORM:
case PIPE_FORMAT_B10G10R10A2_SNORM:
return MALI_RGB10_A2_SNORM;
case PIPE_FORMAT_R10G10B10A2_UINT:
case PIPE_FORMAT_B10G10R10A2_UINT:
return MALI_RGB10_A2UI;
/* TODO: ZS isn't really special case */
case PIPE_FORMAT_Z32_UNORM:
return MALI_Z32_UNORM;
default:
/* Fallthrough to default */
break;
}
/* Formats must match in channel count */
assert(desc->nr_channels >= 1 && desc->nr_channels <= 4);
unsigned format = MALI_NR_CHANNELS(desc->nr_channels);
switch (chan.type) {
case UTIL_FORMAT_TYPE_UNSIGNED:
case UTIL_FORMAT_TYPE_SIGNED:
/* Channel width */
format |= panfrost_translate_channel_width(chan.size);
/* Channel type */
format |= panfrost_translate_channel_type(chan.type, chan.size, chan.normalized);
break;
case UTIL_FORMAT_TYPE_FLOAT:
/* Float formats use a special width and encode width
* with type mixed */
format |= MALI_CHANNEL_FLOAT;
format |= panfrost_translate_channel_type(chan.type, chan.size, chan.normalized);
break;
default:
assert(0);
break;
}
return (enum mali_format) format;
}
/*
* © Copyright 2018 Alyssa Rosenzweig
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
#ifndef __PAN_FORMAT_H__
#define __PAN_FORMAT_H__
#include "pan_context.h"
#include "util/u_format.h"
unsigned
panfrost_translate_swizzle_4(const unsigned char swizzle[4]);
unsigned
panfrost_get_default_swizzle(unsigned components);
enum mali_format
panfrost_find_format(const struct util_format_description *desc);
#endif
/*
* © Copyright 2017-2098 The Panfrost Communiy
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "pan_pretty_print.h"
#include <stdio.h>
#define DEFINE_CASE(name) case MALI_## name: return "MALI_" #name
char *panwrap_format_name(enum mali_format format)
{
static char unk_format_str[5];
switch (format) {
DEFINE_CASE(RGB10_A2_UNORM);
DEFINE_CASE(RGB10_A2_SNORM);
DEFINE_CASE(RGB10_A2UI);
DEFINE_CASE(RGB10_A2I);
DEFINE_CASE(Z32_UNORM);
DEFINE_CASE(R32_FIXED);
DEFINE_CASE(RG32_FIXED);
DEFINE_CASE(RGB32_FIXED);
DEFINE_CASE(RGBA32_FIXED);
DEFINE_CASE(R11F_G11F_B10F);
DEFINE_CASE(VARYING_POS);
DEFINE_CASE(VARYING_DISCARD);
DEFINE_CASE(R8_SNORM);
DEFINE_CASE(R16_SNORM);
DEFINE_CASE(R32_SNORM);
DEFINE_CASE(RG8_SNORM);
DEFINE_CASE(RG16_SNORM);
DEFINE_CASE(RG32_SNORM);
DEFINE_CASE(RGB8_SNORM);
DEFINE_CASE(RGB16_SNORM);
DEFINE_CASE(RGB32_SNORM);
DEFINE_CASE(RGBA8_SNORM);
DEFINE_CASE(RGBA16_SNORM);
DEFINE_CASE(RGBA32_SNORM);
DEFINE_CASE(R8UI);
DEFINE_CASE(R16UI);
DEFINE_CASE(R32UI);
DEFINE_CASE(RG8UI);
DEFINE_CASE(RG16UI);
DEFINE_CASE(RG32UI);
DEFINE_CASE(RGB8UI);
DEFINE_CASE(RGB16UI);
DEFINE_CASE(RGB32UI);
DEFINE_CASE(RGBA8UI);
DEFINE_CASE(RGBA16UI);
DEFINE_CASE(RGBA32UI);
DEFINE_CASE(R8_UNORM);
DEFINE_CASE(R16_UNORM);
DEFINE_CASE(R32_UNORM);
DEFINE_CASE(R32F);
DEFINE_CASE(RG8_UNORM);
DEFINE_CASE(RG16_UNORM);
DEFINE_CASE(RG32_UNORM);
DEFINE_CASE(RG32F);
DEFINE_CASE(RGB8_UNORM);
DEFINE_CASE(RGB16_UNORM);
DEFINE_CASE(RGB32_UNORM);
DEFINE_CASE(RGB32F);
DEFINE_CASE(RGBA8_UNORM);
DEFINE_CASE(RGBA16_UNORM);
DEFINE_CASE(RGBA32_UNORM);
DEFINE_CASE(RGBA32F);
DEFINE_CASE(R8I);
DEFINE_CASE(R16I);
DEFINE_CASE(R32I);
DEFINE_CASE(RG8I);
DEFINE_CASE(R16F);
DEFINE_CASE(RG16I);
DEFINE_CASE(RG32I);
DEFINE_CASE(RG16F);
DEFINE_CASE(RGB8I);
DEFINE_CASE(RGB16I);
DEFINE_CASE(RGB32I);
DEFINE_CASE(RGB16F);
DEFINE_CASE(RGBA8I);
DEFINE_CASE(RGBA16I);
DEFINE_CASE(RGBA32I);
DEFINE_CASE(RGBA16F);
DEFINE_CASE(RGBA4);
DEFINE_CASE(RGBA8_2);
DEFINE_CASE(RGB10_A2_2);
default:
snprintf(unk_format_str, sizeof(unk_format_str), "0x%02x", format);
return unk_format_str;
}
}
#undef DEFINE_CASE
/*
* © Copyright 2017-2098 The Panfrost Communiy
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __PAN_PRETTY_H
#define __PAN_PRETTY_H
#include "panfrost-job.h"
char *panwrap_format_name(enum mali_format format);
#endif
......@@ -556,6 +556,13 @@ panfrost_is_format_supported( struct pipe_screen *screen,
return FALSE;
if (bind & PIPE_BIND_RENDER_TARGET) {
/* We don't support rendering into anything but RGBA8 yet. We
* need more formats for spec compliance, but for now, honesty
* is the best policy <3 */
if (!util_format_is_rgba8_variant(format_desc))
return FALSE;
if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS)
return FALSE;
......@@ -576,7 +583,7 @@ panfrost_is_format_supported( struct pipe_screen *screen,
if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC ||