panfrost: Complete format_to_bifrost_blend
Instead of matching on the PIPE format directly, match on the internal format of the tile buffer and pick the pixel format that corresponds to the internal tile buffer format (which differs from the format written back to memory in the general case). We add a number of missing formats to accomodate this, including the AU/PU variants of each tilebuffer pixel format, where the AU formats use the extra bits to store extra precision for dithering but the PU formats simply pad the extra bits with zeroes. For the moment we use AU everywhere. I'm not sure if there's a cost associated. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Tested-by: Christian Hewitt <christianshewitt@gmail.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7352>
This commit is contained in:
committed by
Marge Bot
parent
e1624b67dc
commit
44155fa661
@@ -261,35 +261,8 @@ bifrost_get_blend_desc(enum pipe_format fmt, unsigned rt)
|
||||
cfg.fixed_function.conversion.memory_format.srgb =
|
||||
desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB;
|
||||
|
||||
if (util_format_is_unorm8(desc)) {
|
||||
cfg.fixed_function.conversion.memory_format.format = MALI_RGBA8_2;
|
||||
continue;
|
||||
}
|
||||
|
||||
enum pipe_format linearized = util_format_linear(fmt);
|
||||
switch (linearized) {
|
||||
case PIPE_FORMAT_B5G6R5_UNORM:
|
||||
cfg.fixed_function.conversion.memory_format.format = MALI_R5G6B5;
|
||||
break;
|
||||
case PIPE_FORMAT_A4B4G4R4_UNORM:
|
||||
case PIPE_FORMAT_B4G4R4A4_UNORM:
|
||||
case PIPE_FORMAT_R4G4B4A4_UNORM:
|
||||
cfg.fixed_function.conversion.memory_format.format = MALI_RGBA4;
|
||||
break;
|
||||
case PIPE_FORMAT_R10G10B10A2_UNORM:
|
||||
case PIPE_FORMAT_B10G10R10A2_UNORM:
|
||||
case PIPE_FORMAT_R10G10B10X2_UNORM:
|
||||
case PIPE_FORMAT_B10G10R10X2_UNORM:
|
||||
cfg.fixed_function.conversion.memory_format.format = MALI_RGB10_A2_2;
|
||||
break;
|
||||
case PIPE_FORMAT_B5G5R5A1_UNORM:
|
||||
case PIPE_FORMAT_R5G5B5A1_UNORM:
|
||||
case PIPE_FORMAT_B5G5R5X1_UNORM:
|
||||
cfg.fixed_function.conversion.memory_format.format = MALI_RGB5_A1;
|
||||
break;
|
||||
default:
|
||||
unreachable("Invalid format");
|
||||
}
|
||||
cfg.fixed_function.conversion.memory_format.format =
|
||||
panfrost_format_to_bifrost_blend(desc, true);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -298,7 +298,7 @@ panfrost_emit_bifrost_blend(struct panfrost_batch *batch,
|
||||
|
||||
cfg.bifrost.internal.fixed_function.num_comps = format_desc->nr_channels;
|
||||
cfg.bifrost.internal.fixed_function.conversion.memory_format.format =
|
||||
panfrost_format_to_bifrost_blend(format_desc);
|
||||
panfrost_format_to_bifrost_blend(format_desc, true);
|
||||
if (dev->quirks & HAS_SWIZZLES) {
|
||||
cfg.bifrost.internal.fixed_function.conversion.memory_format.swizzle =
|
||||
panfrost_get_default_swizzle(4);
|
||||
|
||||
@@ -173,11 +173,22 @@
|
||||
<value name="RGBA16I" value="220"/>
|
||||
<value name="RGBA32I" value="221"/>
|
||||
<value name="RGBA16F" value="223"/>
|
||||
<value name="RGB5 A1" value="224"/>
|
||||
<value name="R5G6B5" value="226"/>
|
||||
<value name="RGBA4" value="232"/>
|
||||
<value name="RGBA8 2" value="237"/>
|
||||
<value name="RGB10 A2 2" value="238"/>
|
||||
<value name="RGB5 A1 AU" value="224"/>
|
||||
<value name="RGB5 A1 PU" value="225"/>
|
||||
<value name="R5G6B5 AU" value="226"/>
|
||||
<value name="R5G6B5 PU" value="227"/>
|
||||
<value name="Snap4 V" value="230"/>
|
||||
<value name="R32F RTZ" value="231"/>
|
||||
<value name="RGBA4 AU" value="232"/>
|
||||
<value name="RGBA4 PU" value="233"/>
|
||||
<value name="RGBA8 TB" value="237"/>
|
||||
<value name="RGB10 A2 TB" value="238"/>
|
||||
<value name="RG32F RTZ" value="239"/>
|
||||
<value name="Tess Vertex Pack" value="240"/>
|
||||
<value name="RGB8 A2 AU" value="241"/>
|
||||
<value name="RGB8 A2 PU" value="242"/>
|
||||
<value name="RGB32F RTZ" value="247"/>
|
||||
<value name="RGBA32F RTZ" value="255"/>
|
||||
</enum>
|
||||
|
||||
<enum name="RGB Component Order">
|
||||
|
||||
@@ -575,7 +575,7 @@ bifrost_load_emit_blend_rt(struct pan_pool *pool, void *out,
|
||||
cfg.bifrost.equation.color_mask = 0xf;
|
||||
cfg.bifrost.internal.fixed_function.num_comps = format_desc->nr_channels;
|
||||
cfg.bifrost.internal.fixed_function.conversion.memory_format.format =
|
||||
panfrost_format_to_bifrost_blend(format_desc);
|
||||
panfrost_format_to_bifrost_blend(format_desc, true);
|
||||
cfg.bifrost.internal.fixed_function.conversion.register_format =
|
||||
blit_type_to_reg_fmt(T);
|
||||
|
||||
|
||||
@@ -445,21 +445,35 @@ panfrost_invert_swizzle(const unsigned char *in, unsigned char *out)
|
||||
}
|
||||
|
||||
enum mali_format
|
||||
panfrost_format_to_bifrost_blend(const struct util_format_description *desc)
|
||||
panfrost_format_to_bifrost_blend(const struct util_format_description *desc, bool dither)
|
||||
{
|
||||
enum mali_format format = panfrost_pipe_format_table[desc->format].hw;
|
||||
assert(format);
|
||||
struct pan_blendable_format fmt = panfrost_blend_format(desc->format);
|
||||
|
||||
switch (format) {
|
||||
case MALI_RGBA4_UNORM:
|
||||
return MALI_RGBA4;
|
||||
case MALI_RGBA8_UNORM:
|
||||
case MALI_RGB8_UNORM:
|
||||
return MALI_RGBA8_2;
|
||||
case MALI_RGB10_A2_UNORM:
|
||||
return MALI_RGB10_A2_2;
|
||||
/* Formats requiring blend shaders are stored raw in the tilebuffer */
|
||||
if (!fmt.internal)
|
||||
return desc->format;
|
||||
|
||||
/* Else, pick the pixel format matching the tilebuffer format */
|
||||
switch (fmt.internal) {
|
||||
case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A8:
|
||||
return MALI_RGBA8_TB;
|
||||
|
||||
case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R10G10B10A2:
|
||||
return MALI_RGB10_A2_TB;
|
||||
|
||||
case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A2:
|
||||
return dither ? MALI_RGB8_A2_AU : MALI_RGB8_A2_PU;
|
||||
|
||||
case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R4G4B4A4:
|
||||
return dither ? MALI_RGBA4_AU : MALI_RGBA4_PU;
|
||||
|
||||
case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R5G6B5A0:
|
||||
return dither ? MALI_R5G6B5_AU : MALI_R5G6B5_PU;
|
||||
|
||||
case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R5G5B5A1:
|
||||
return dither ? MALI_RGB5_A1_AU : MALI_RGB5_A1_PU;
|
||||
default:
|
||||
return format;
|
||||
unreachable("invalid internal blendable");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ panfrost_bifrost_swizzle(unsigned components)
|
||||
}
|
||||
|
||||
enum mali_format
|
||||
panfrost_format_to_bifrost_blend(const struct util_format_description *desc);
|
||||
panfrost_format_to_bifrost_blend(const struct util_format_description *desc, bool dither);
|
||||
|
||||
struct pan_pool;
|
||||
struct pan_scoreboard;
|
||||
|
||||
Reference in New Issue
Block a user