mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
panfrost: Get rid of the Pixel Format descriptor
We use opaque uint to encode formats everywhere else, so let's make things consistent and convert the only user to an opaque int too. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7530>
This commit is contained in:
parent
6e069d1c3f
commit
0dd093a89f
6 changed files with 30 additions and 42 deletions
|
|
@ -260,10 +260,7 @@ bifrost_get_blend_desc(const struct panfrost_device *dev,
|
|||
unreachable("Invalid format");
|
||||
}
|
||||
|
||||
cfg.fixed_function.conversion.memory_format.srgb =
|
||||
desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB;
|
||||
|
||||
cfg.fixed_function.conversion.memory_format.format =
|
||||
cfg.fixed_function.conversion.memory_format =
|
||||
panfrost_format_to_bifrost_blend(dev, desc, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -300,12 +300,8 @@ panfrost_emit_bifrost_blend(struct panfrost_batch *batch,
|
|||
* num_comps must be set to 4
|
||||
*/
|
||||
cfg.bifrost.internal.fixed_function.num_comps = 4;
|
||||
cfg.bifrost.internal.fixed_function.conversion.memory_format.format =
|
||||
cfg.bifrost.internal.fixed_function.conversion.memory_format =
|
||||
panfrost_format_to_bifrost_blend(dev, format_desc, true);
|
||||
if (dev->quirks & HAS_SWIZZLES) {
|
||||
cfg.bifrost.internal.fixed_function.conversion.memory_format.swizzle =
|
||||
panfrost_get_default_swizzle(4);
|
||||
}
|
||||
cfg.bifrost.internal.fixed_function.conversion.register_format =
|
||||
fs->blend_types[i];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -357,17 +357,6 @@
|
|||
<value name="Force Late" value="3"/>
|
||||
</enum>
|
||||
|
||||
<struct name="Pixel Format" no-direct-packing="true">
|
||||
<field name="RGB Component Order" size="8" start="0" type="RGB Component Order"/>
|
||||
<field name="YUV Component Order" size="3" start="0" type="YUV Swizzle"/>
|
||||
<field name="YUV Component Swap" size="1" start="3" type="bool"/>
|
||||
<field name="YUV Cr Siting" size="3" start="0" type="YUV Cr Siting"/>
|
||||
<field name="Swizzle" size="12" start="0" type="uint"/>
|
||||
<field name="Format" size="8" start="12" type="Format"/>
|
||||
<field name="sRGB" size="1" start="20" type="bool"/>
|
||||
<field name="Big Endian" size="1" start="21" type="bool"/>
|
||||
</struct>
|
||||
|
||||
<enum name="Block Format">
|
||||
<!--- 16x16 block u-interleaved -->
|
||||
<value name="Tiled U-Interleaved" value="0"/>
|
||||
|
|
@ -551,7 +540,7 @@
|
|||
</struct>
|
||||
|
||||
<struct name="Bifrost Internal Conversion" size="1">
|
||||
<field name="Memory Format" size="22" start="0" type="Pixel Format"/>
|
||||
<field name="Memory Format" size="22" start="0" type="uint"/>
|
||||
<field name="Raw" size="1" start="22" type="bool"/>
|
||||
<field name="Register Format" size="3" start="24" type="Bifrost Register File Format"/>
|
||||
</struct>
|
||||
|
|
|
|||
|
|
@ -569,16 +569,12 @@ bifrost_load_emit_blend_rt(struct pan_pool *pool, void *out,
|
|||
cfg.bifrost.equation.alpha.c = MALI_BLEND_OPERAND_C_ZERO;
|
||||
cfg.bifrost.equation.color_mask = 0xf;
|
||||
cfg.bifrost.internal.fixed_function.num_comps = 4;
|
||||
cfg.bifrost.internal.fixed_function.conversion.memory_format.format =
|
||||
cfg.bifrost.internal.fixed_function.conversion.memory_format =
|
||||
panfrost_format_to_bifrost_blend(pool->dev, format_desc, true);
|
||||
cfg.bifrost.internal.fixed_function.conversion.register_format =
|
||||
blit_type_to_reg_fmt(T);
|
||||
|
||||
cfg.bifrost.internal.fixed_function.rt = rt;
|
||||
if (pool->dev->quirks & HAS_SWIZZLES) {
|
||||
cfg.bifrost.internal.fixed_function.conversion.memory_format.swizzle =
|
||||
panfrost_get_default_swizzle(4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <stdio.h>
|
||||
#include "midgard_pack.h"
|
||||
#include "pan_texture.h"
|
||||
#include "panfrost-quirks.h"
|
||||
|
||||
/* Convenience */
|
||||
|
||||
|
|
@ -672,7 +673,7 @@ panfrost_invert_swizzle(const unsigned char *in, unsigned char *out)
|
|||
}
|
||||
}
|
||||
|
||||
enum mali_format
|
||||
unsigned
|
||||
panfrost_format_to_bifrost_blend(const struct panfrost_device *dev,
|
||||
const struct util_format_description *desc, bool dither)
|
||||
{
|
||||
|
|
@ -680,27 +681,36 @@ panfrost_format_to_bifrost_blend(const struct panfrost_device *dev,
|
|||
|
||||
/* Formats requiring blend shaders are stored raw in the tilebuffer */
|
||||
if (!fmt.internal)
|
||||
return MALI_EXTRACT_INDEX(dev->formats[desc->format].hw);
|
||||
return dev->formats[desc->format].hw;
|
||||
|
||||
unsigned extra = 0;
|
||||
|
||||
if (dev->quirks & HAS_SWIZZLES)
|
||||
extra |= panfrost_get_default_swizzle(4);
|
||||
|
||||
if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
|
||||
extra |= 1 << 20;
|
||||
|
||||
/* Else, pick the pixel format matching the tilebuffer format */
|
||||
switch (fmt.internal) {
|
||||
case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A8:
|
||||
return MALI_RGBA8_TB;
|
||||
#define TB_FORMAT(in, out) \
|
||||
case MALI_COLOR_BUFFER_INTERNAL_FORMAT_ ## in: \
|
||||
return (MALI_ ## out << 12) | extra
|
||||
|
||||
case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R10G10B10A2:
|
||||
return MALI_RGB10_A2_TB;
|
||||
#define TB_FORMAT_DITHER(in, out) \
|
||||
case MALI_COLOR_BUFFER_INTERNAL_FORMAT_ ## in: \
|
||||
return ((dither ? MALI_ ## out ## _AU : MALI_ ## out ## _PU) << 12) | extra
|
||||
|
||||
case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R8G8B8A2:
|
||||
return dither ? MALI_RGB8_A2_AU : MALI_RGB8_A2_PU;
|
||||
TB_FORMAT(R8G8B8A8, RGBA8_TB);
|
||||
TB_FORMAT(R10G10B10A2, RGB10_A2_TB);
|
||||
TB_FORMAT_DITHER(R8G8B8A2, RGB8_A2);
|
||||
TB_FORMAT_DITHER(R4G4B4A4, RGBA4);
|
||||
TB_FORMAT_DITHER(R5G6B5A0, R5G6B5);
|
||||
TB_FORMAT_DITHER(R5G5B5A1, RGB5_A1);
|
||||
|
||||
case MALI_COLOR_BUFFER_INTERNAL_FORMAT_R4G4B4A4:
|
||||
return dither ? MALI_RGBA4_AU : MALI_RGBA4_PU;
|
||||
#undef TB_FORMAT_DITHER
|
||||
#undef TB_FORMAT
|
||||
|
||||
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:
|
||||
unreachable("invalid internal blendable");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ panfrost_bifrost_swizzle(unsigned components)
|
|||
return components < 4 ? 0x10 : 0x00;
|
||||
}
|
||||
|
||||
enum mali_format
|
||||
unsigned
|
||||
panfrost_format_to_bifrost_blend(const struct panfrost_device *dev,
|
||||
const struct util_format_description *desc,
|
||||
bool dither);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue