summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2017-12-27 16:36:09 -0800
committerEric Anholt <[email protected]>2018-01-03 14:25:23 -0800
commit17cb634b1c712f8a926a684d96d5c49d3a9dccb9 (patch)
tree43ef165479e8363767e3bc8631501c47b40d6bc4
parent883a9b02c9644b7bff434ecc574ebee7aba04523 (diff)
broadcom/vc5: Turn the output image format into an enum.
-rw-r--r--src/broadcom/cle/v3d_packet_v33.xml106
-rw-r--r--src/gallium/drivers/vc5/vc5_formats.c90
2 files changed, 100 insertions, 96 deletions
diff --git a/src/broadcom/cle/v3d_packet_v33.xml b/src/broadcom/cle/v3d_packet_v33.xml
index 4c701db5fb1..e3c35de68b4 100644
--- a/src/broadcom/cle/v3d_packet_v33.xml
+++ b/src/broadcom/cle/v3d_packet_v33.xml
@@ -107,6 +107,59 @@
<value name="UIF (XOR)" value="5"/>
</enum>
+ <enum name="Output Image Format" prefix="V3D_OUTPUT_IMAGE_FORMAT">
+ <!--
+ Formats appear with their channels named from the low bits to
+ the high bits.
+ -->
+ <value name="srgb8_alpha8" value="0"/>
+ <value name="srgb" value="1"/>
+ <value name="rgb10_a2ui" value="2"/>
+ <value name="rgb10_a2" value="3"/>
+ <value name="abgr1555" value="4"/>
+ <value name="alpha-masked abgr1555" value="5"/>
+ <value name="abgr4444" value="6"/>
+ <value name="bgr565" value="7"/>
+ <value name="r11f_g11f_b10f" value="8"/>
+ <value name="rgba32f" value="9"/>
+ <value name="rg32f" value="10"/>
+ <value name="r32f" value="11"/>
+ <value name="rgba32i" value="12"/>
+ <value name="rg32i" value="13"/>
+ <value name="r32i" value="14"/>
+ <value name="rgba32ui" value="15"/>
+ <value name="rg32ui" value="16"/>
+ <value name="r32ui" value="17"/>
+ <value name="rgba16f" value="18"/>
+ <value name="rg16f" value="19"/>
+ <value name="r16f" value="20"/>
+ <value name="rgba16i" value="21"/>
+ <value name="rg16i" value="22"/>
+ <value name="r16i" value="23"/>
+ <value name="rgba16ui" value="24"/>
+ <value name="rg16ui" value="25"/>
+ <value name="r16ui" value="26"/>
+ <value name="rgba8" value="27"/>
+ <value name="rgb8" value="28"/>
+ <value name="rg8" value="29"/>
+ <value name="r8" value="30"/>
+ <value name="rgba8i" value="31"/>
+ <value name="rg8i" value="32"/>
+ <value name="r8i" value="33"/>
+ <value name="rgba8ui" value="34"/>
+ <value name="rg8ui" value="35"/>
+ <value name="r8ui" value="36"/>
+ <value name="srgbx8" value="37"/>
+ <value name="rgbx8" value="38"/>
+ </enum>
+
+ <enum name="Z/S Output Image Format" prefix="V3D_OUTPUT_IMAGE_FORMAT_ZS">
+ <value name="depth_component32f" value="0"/>
+ <value name="depth_component24" value="1"/> <!-- depth low, pad high -->
+ <value name="depth_component16" value="2"/>
+ <value name="depth24_stencil8" value="3"/> <!-- stencil low, depth high -->
+ </enum>
+
<packet code="0" name="Halt"/>
<packet code="1" name="NOP"/>
<packet code="4" name="Flush"/>
@@ -496,51 +549,7 @@
<field name="A dithered" size="1" start="23" type="bool"/>
<field name="BGR dithered" size="1" start="22" type="bool"/>
- <field name="Output image format" size="6" start="16" type="uint" prefix="Output Image Format">
- <!--
- Formats appear with their channels named from the low bits to
- the high bits.
- -->
- <value name="srgb8_alpha8" value="0"/>
- <value name="srgb" value="1"/>
- <value name="rgb10_a2ui" value="2"/>
- <value name="rgb10_a2" value="3"/>
- <value name="abgr1555" value="4"/>
- <value name="alpha-masked abgr1555" value="5"/>
- <value name="abgr4444" value="6"/>
- <value name="bgr565" value="7"/>
- <value name="r11f_g11f_b10f" value="8"/>
- <value name="rgba32f" value="9"/>
- <value name="rg32f" value="10"/>
- <value name="r32f" value="11"/>
- <value name="rgba32i" value="12"/>
- <value name="rg32i" value="13"/>
- <value name="r32i" value="14"/>
- <value name="rgba32ui" value="15"/>
- <value name="rg32ui" value="16"/>
- <value name="r32ui" value="17"/>
- <value name="rgba16f" value="18"/>
- <value name="rg16f" value="19"/>
- <value name="r16f" value="20"/>
- <value name="rgba16i" value="21"/>
- <value name="rg16i" value="22"/>
- <value name="r16i" value="23"/>
- <value name="rgba16ui" value="24"/>
- <value name="rg16ui" value="25"/>
- <value name="r16ui" value="26"/>
- <value name="rgba8" value="27"/>
- <value name="rgb8" value="28"/>
- <value name="rg8" value="29"/>
- <value name="r8" value="30"/>
- <value name="rgba8i" value="31"/>
- <value name="rg8i" value="32"/>
- <value name="r8i" value="33"/>
- <value name="rgba8ui" value="34"/>
- <value name="rg8ui" value="35"/>
- <value name="r8ui" value="36"/>
- <value name="srgbx8" value="37"/>
- <value name="rgbx8" value="38"/>
- </field>
+ <field name="Output image format" size="6" start="16" type="Output Image Format"/>
<field name="Decimate mode" size="2" start="14" type="uint"/>
@@ -572,12 +581,7 @@
<field name="Memory Format" size="3" start="22" type="Memory Format"/>
- <field name="Output image format" size="6" start="16" type="uint" prefix="Output Image Format">
- <value name="depth_component32f" value="0"/>
- <value name="depth_component24" value="1"/> <!-- depth low, pad high -->
- <value name="depth_component16" value="2"/>
- <value name="depth24_stencil8" value="3"/> <!-- stencil low, depth high -->
- </field>
+ <field name="Output image format" size="6" start="16" type="Z/S Output Image Format"/>
<field name="Decimate mode" size="2" start="14" type="uint"/>
diff --git a/src/gallium/drivers/vc5/vc5_formats.c b/src/gallium/drivers/vc5/vc5_formats.c
index 6c541ea47ea..b16ac1db3f8 100644
--- a/src/gallium/drivers/vc5/vc5_formats.c
+++ b/src/gallium/drivers/vc5/vc5_formats.c
@@ -38,7 +38,7 @@
#include "vc5_context.h"
#include "broadcom/cle/v3d_packet_v33_pack.h"
-#define OUTPUT_IMAGE_FORMAT_NO 255
+#define V3D_OUTPUT_IMAGE_FORMAT_NO 255
struct vc5_format {
/** Set if the pipe format is defined in the table. */
@@ -77,7 +77,7 @@ struct vc5_format {
#define FORMAT(pipe, rt, tex, swiz, return_size, return_channels) \
[PIPE_FORMAT_##pipe] = { \
true, \
- OUTPUT_IMAGE_FORMAT_##rt, \
+ V3D_OUTPUT_IMAGE_FORMAT_##rt, \
TEXTURE_DATA_FORMAT_##tex, \
swiz, \
return_size, \
@@ -182,14 +182,14 @@ static const struct vc5_format vc5_format_table[] = {
FORMAT(R11G11B10_FLOAT, R11F_G11F_B10F, R11F_G11F_B10F, SWIZ_XYZW, 16, 0),
FORMAT(R9G9B9E5_FLOAT, NO, RGB9_E5, SWIZ_XYZW, 16, 0),
- FORMAT(S8_UINT_Z24_UNORM, DEPTH24_STENCIL8, DEPTH24_X8, SWIZ_XXXX, 32, 1),
- FORMAT(X8Z24_UNORM, DEPTH24_STENCIL8, DEPTH24_X8, SWIZ_XXXX, 32, 1),
+ FORMAT(S8_UINT_Z24_UNORM, ZS_DEPTH24_STENCIL8, DEPTH24_X8, SWIZ_XXXX, 32, 1),
+ FORMAT(X8Z24_UNORM, ZS_DEPTH24_STENCIL8, DEPTH24_X8, SWIZ_XXXX, 32, 1),
FORMAT(S8X24_UINT, NO, R32F, SWIZ_XXXX, 32, 1),
- FORMAT(Z32_FLOAT, DEPTH_COMPONENT32F, R32F, SWIZ_XXXX, 32, 1),
- FORMAT(Z16_UNORM, DEPTH_COMPONENT16, DEPTH_COMP16, SWIZ_XXXX, 32, 1),
+ FORMAT(Z32_FLOAT, ZS_DEPTH_COMPONENT32F, R32F, SWIZ_XXXX, 32, 1),
+ FORMAT(Z16_UNORM, ZS_DEPTH_COMPONENT16, DEPTH_COMP16, SWIZ_XXXX, 32, 1),
/* Pretend we support this, but it'll be separate Z32F depth and S8. */
- FORMAT(Z32_FLOAT_S8X24_UINT, DEPTH_COMPONENT32F, R32F, SWIZ_XXXX, 32, 1),
+ FORMAT(Z32_FLOAT_S8X24_UINT, ZS_DEPTH_COMPONENT32F, R32F, SWIZ_XXXX, 32, 1),
FORMAT(ETC2_RGB8, NO, RGB8_ETC2, SWIZ_XYZ1, 16, 0),
FORMAT(ETC2_SRGB8, NO, RGB8_ETC2, SWIZ_XYZ1, 16, 0),
@@ -225,7 +225,7 @@ vc5_rt_format_supported(enum pipe_format f)
if (!vf)
return false;
- return vf->rt_type != OUTPUT_IMAGE_FORMAT_NO;
+ return vf->rt_type != V3D_OUTPUT_IMAGE_FORMAT_NO;
}
uint8_t
@@ -301,38 +301,38 @@ vc5_get_internal_type_bpp_for_output_format(uint32_t format,
uint32_t *bpp)
{
switch (format) {
- case OUTPUT_IMAGE_FORMAT_RGBA8:
- case OUTPUT_IMAGE_FORMAT_RGBX8:
- case OUTPUT_IMAGE_FORMAT_RGB8:
- case OUTPUT_IMAGE_FORMAT_RG8:
- case OUTPUT_IMAGE_FORMAT_R8:
- case OUTPUT_IMAGE_FORMAT_ABGR4444:
- case OUTPUT_IMAGE_FORMAT_BGR565:
- case OUTPUT_IMAGE_FORMAT_ABGR1555:
+ case V3D_OUTPUT_IMAGE_FORMAT_RGBA8:
+ case V3D_OUTPUT_IMAGE_FORMAT_RGBX8:
+ case V3D_OUTPUT_IMAGE_FORMAT_RGB8:
+ case V3D_OUTPUT_IMAGE_FORMAT_RG8:
+ case V3D_OUTPUT_IMAGE_FORMAT_R8:
+ case V3D_OUTPUT_IMAGE_FORMAT_ABGR4444:
+ case V3D_OUTPUT_IMAGE_FORMAT_BGR565:
+ case V3D_OUTPUT_IMAGE_FORMAT_ABGR1555:
*type = INTERNAL_TYPE_8;
*bpp = INTERNAL_BPP_32;
break;
- case OUTPUT_IMAGE_FORMAT_RGBA8I:
- case OUTPUT_IMAGE_FORMAT_RG8I:
- case OUTPUT_IMAGE_FORMAT_R8I:
+ case V3D_OUTPUT_IMAGE_FORMAT_RGBA8I:
+ case V3D_OUTPUT_IMAGE_FORMAT_RG8I:
+ case V3D_OUTPUT_IMAGE_FORMAT_R8I:
*type = INTERNAL_TYPE_8I;
*bpp = INTERNAL_BPP_32;
break;
- case OUTPUT_IMAGE_FORMAT_RGBA8UI:
- case OUTPUT_IMAGE_FORMAT_RG8UI:
- case OUTPUT_IMAGE_FORMAT_R8UI:
+ case V3D_OUTPUT_IMAGE_FORMAT_RGBA8UI:
+ case V3D_OUTPUT_IMAGE_FORMAT_RG8UI:
+ case V3D_OUTPUT_IMAGE_FORMAT_R8UI:
*type = INTERNAL_TYPE_8UI;
*bpp = INTERNAL_BPP_32;
break;
- case OUTPUT_IMAGE_FORMAT_SRGB8_ALPHA8:
- case OUTPUT_IMAGE_FORMAT_SRGB:
- case OUTPUT_IMAGE_FORMAT_RGB10_A2:
- case OUTPUT_IMAGE_FORMAT_R11F_G11F_B10F:
- case OUTPUT_IMAGE_FORMAT_SRGBX8:
- case OUTPUT_IMAGE_FORMAT_RGBA16F:
+ case V3D_OUTPUT_IMAGE_FORMAT_SRGB8_ALPHA8:
+ case V3D_OUTPUT_IMAGE_FORMAT_SRGB:
+ case V3D_OUTPUT_IMAGE_FORMAT_RGB10_A2:
+ case V3D_OUTPUT_IMAGE_FORMAT_R11F_G11F_B10F:
+ case V3D_OUTPUT_IMAGE_FORMAT_SRGBX8:
+ case V3D_OUTPUT_IMAGE_FORMAT_RGBA16F:
/* Note that sRGB RTs are stored in the tile buffer at 16F,
* and the conversion to sRGB happens at tilebuffer
* load/store.
@@ -341,8 +341,8 @@ vc5_get_internal_type_bpp_for_output_format(uint32_t format,
*bpp = INTERNAL_BPP_64;
break;
- case OUTPUT_IMAGE_FORMAT_RG16F:
- case OUTPUT_IMAGE_FORMAT_R16F:
+ case V3D_OUTPUT_IMAGE_FORMAT_RG16F:
+ case V3D_OUTPUT_IMAGE_FORMAT_R16F:
*type = INTERNAL_TYPE_16F;
/* Use 64bpp to make sure the TLB doesn't throw away the alpha
* channel before alpha test happens.
@@ -350,61 +350,61 @@ vc5_get_internal_type_bpp_for_output_format(uint32_t format,
*bpp = INTERNAL_BPP_64;
break;
- case OUTPUT_IMAGE_FORMAT_RGBA16I:
+ case V3D_OUTPUT_IMAGE_FORMAT_RGBA16I:
*type = INTERNAL_TYPE_16I;
*bpp = INTERNAL_BPP_64;
break;
- case OUTPUT_IMAGE_FORMAT_RG16I:
- case OUTPUT_IMAGE_FORMAT_R16I:
+ case V3D_OUTPUT_IMAGE_FORMAT_RG16I:
+ case V3D_OUTPUT_IMAGE_FORMAT_R16I:
*type = INTERNAL_TYPE_16I;
*bpp = INTERNAL_BPP_32;
break;
- case OUTPUT_IMAGE_FORMAT_RGBA16UI:
+ case V3D_OUTPUT_IMAGE_FORMAT_RGBA16UI:
*type = INTERNAL_TYPE_16UI;
*bpp = INTERNAL_BPP_64;
break;
- case OUTPUT_IMAGE_FORMAT_RG16UI:
- case OUTPUT_IMAGE_FORMAT_R16UI:
+ case V3D_OUTPUT_IMAGE_FORMAT_RG16UI:
+ case V3D_OUTPUT_IMAGE_FORMAT_R16UI:
*type = INTERNAL_TYPE_16UI;
*bpp = INTERNAL_BPP_32;
break;
- case OUTPUT_IMAGE_FORMAT_RGBA32I:
+ case V3D_OUTPUT_IMAGE_FORMAT_RGBA32I:
*type = INTERNAL_TYPE_32I;
*bpp = INTERNAL_BPP_128;
break;
- case OUTPUT_IMAGE_FORMAT_RG32I:
+ case V3D_OUTPUT_IMAGE_FORMAT_RG32I:
*type = INTERNAL_TYPE_32I;
*bpp = INTERNAL_BPP_64;
break;
- case OUTPUT_IMAGE_FORMAT_R32I:
+ case V3D_OUTPUT_IMAGE_FORMAT_R32I:
*type = INTERNAL_TYPE_32I;
*bpp = INTERNAL_BPP_32;
break;
- case OUTPUT_IMAGE_FORMAT_RGBA32UI:
+ case V3D_OUTPUT_IMAGE_FORMAT_RGBA32UI:
*type = INTERNAL_TYPE_32UI;
*bpp = INTERNAL_BPP_128;
break;
- case OUTPUT_IMAGE_FORMAT_RG32UI:
+ case V3D_OUTPUT_IMAGE_FORMAT_RG32UI:
*type = INTERNAL_TYPE_32UI;
*bpp = INTERNAL_BPP_64;
break;
- case OUTPUT_IMAGE_FORMAT_R32UI:
+ case V3D_OUTPUT_IMAGE_FORMAT_R32UI:
*type = INTERNAL_TYPE_32UI;
*bpp = INTERNAL_BPP_32;
break;
- case OUTPUT_IMAGE_FORMAT_RGBA32F:
+ case V3D_OUTPUT_IMAGE_FORMAT_RGBA32F:
*type = INTERNAL_TYPE_32F;
*bpp = INTERNAL_BPP_128;
break;
- case OUTPUT_IMAGE_FORMAT_RG32F:
+ case V3D_OUTPUT_IMAGE_FORMAT_RG32F:
*type = INTERNAL_TYPE_32F;
*bpp = INTERNAL_BPP_64;
break;
- case OUTPUT_IMAGE_FORMAT_R32F:
+ case V3D_OUTPUT_IMAGE_FORMAT_R32F:
*type = INTERNAL_TYPE_32F;
*bpp = INTERNAL_BPP_32;
break;