broadcom/vc5: Introduce enums for internal depth/type, with V3D prefixes.
authorEric Anholt <eric@anholt.net>
Thu, 28 Dec 2017 21:01:37 +0000 (13:01 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 3 Jan 2018 22:25:23 +0000 (14:25 -0800)
src/broadcom/cle/v3d_packet_v33.xml
src/gallium/drivers/vc5/vc5_draw.c
src/gallium/drivers/vc5/vc5_formats.c
src/gallium/drivers/vc5/vc5_rcl.c
src/gallium/drivers/vc5/vc5_resource.c
src/gallium/drivers/vc5/vc5_state.c

index 6049d7359b3e248417914c5571ec4a45dc097f04..094ee00cf127b4276a5172c23aa126dd33ebc643 100644 (file)
     <value name="all samples" value="3"/>
   </enum>
 
+  <enum name="Internal Type" prefix="V3D_INTERNAL_TYPE">
+    <value name="8i" value="0"/>
+    <value name="8ui" value="1"/>
+    <value name="8" value="2"/>
+    <value name="16i" value="4"/>
+    <value name="16ui" value="5"/>
+    <value name="16f" value="6"/>
+    <value name="32i" value="8"/>
+    <value name="32ui" value="9"/>
+    <value name="32f" value="10"/>
+  </enum>
+
+  <enum name="Internal BPP" prefix="V3D_INTERNAL_BPP">
+    <value name="32" value="0"/>
+    <value name="64" value="1"/>
+    <value name="128" value="2"/>
+  </enum>
+
+  <enum name="Internal Depth Type" prefix="V3D_INTERNAL_TYPE">
+    <value name="depth_32f" value="0"/>
+    <value name="depth_24" value="1"/>
+    <value name="depth_16" value="2"/>
+  </enum>
+
   <enum name="Output Image Format" prefix="V3D_OUTPUT_IMAGE_FORMAT">
     <!--
        Formats appear with their channels named from the low bits to
     <field name="Double-buffer in non-ms mode" size="1" start="63" type="bool"/>
     <field name="Multisample Mode (4x)" size="1" start="62" type="bool"/>
 
-    <field name="Maximum BPP of all render targets" size="2" start="60" type="uint">
-      <value name="Render target maximum 32bpp" value="0"/>
-      <value name="Render target maximum 64bpp" value="1"/>
-      <value name="Render target maximum 128bpp" value="2"/>
-    </field>
+    <field name="Maximum BPP of all render targets" size="2" start="60" type="Internal BPP"/>
 
     <field name="Number of Render Targets" size="4" start="56" type="uint"/>
     <field name="Height (in tiles)" size="12" start="44" type="uint"/>
 
     <field name="Decimate mode" size="2" start="14" type="Decimate Mode"/>
 
-    <field name="Internal Type" size="4" start="10" type="uint" prefix="Internal Type">
-      <value name="8i" value="0"/>
-      <value name="8ui" value="1"/>
-      <value name="8" value="2"/>
-      <value name="16i" value="4"/>
-      <value name="16ui" value="5"/>
-      <value name="16f" value="6"/>
-      <value name="32i" value="8"/>
-      <value name="32ui" value="9"/>
-      <value name="32f" value="10"/>
-    </field>
-
-    <field name="Internal BPP" size="2" start="8" type="uint" prefix="Internal Bpp">
-      <value name="32" value="0"/>
-      <value name="64" value="1"/>
-      <value name="128" value="2"/>
-    </field>
+    <field name="Internal Type" size="4" start="10" type="Internal Type"/>
+    <field name="Internal BPP" size="2" start="8" type="Internal BPP"/>
     <field name="Render Target Number" size="4" start="4" type="uint"/>
     <field name="sub-id" size="4" start="0" type="uint" default="2"/>
   </packet>
 
     <field name="Decimate mode" size="2" start="14" type="uint"/>
 
-    <field name="Internal Type" size="4" start="10" type="uint" prefix="Internal Type">
-      <value name="depth_32f" value="0"/>
-      <value name="depth_24" value="1"/>
-      <value name="depth_16" value="2"/>
-    </field>
+    <field name="Internal Type" size="4" start="10" type="Internal Depth Type"/>
 
     <field name="Internal BPP (ignored)" size="2" start="8" type="uint"/>
     <!-- selects between Z/Stencil config packet and Separate Stencil packet. -->
index e07fbd8e810fdc51f77a4e0cfaf0a80eadb940a9..d157531a178e4338806a769f4f8bf5bff350f856 100644 (file)
@@ -524,7 +524,7 @@ vc5_clear(struct pipe_context *pctx, unsigned buffers,
                 }
 
                 switch (surf->internal_type) {
-                case INTERNAL_TYPE_8:
+                case V3D_INTERNAL_TYPE_8:
                         if (surf->format == PIPE_FORMAT_B4G4R4A4_UNORM ||
                             surf->format == PIPE_FORMAT_B4G4R4A4_UNORM) {
                                 /* Our actual hardware layout is ABGR4444, but
@@ -539,28 +539,28 @@ vc5_clear(struct pipe_context *pctx, unsigned buffers,
                         }
                         memcpy(job->clear_color[i], uc.ui, internal_size);
                         break;
-                case INTERNAL_TYPE_8I:
-                case INTERNAL_TYPE_8UI:
+                case V3D_INTERNAL_TYPE_8I:
+                case V3D_INTERNAL_TYPE_8UI:
                         job->clear_color[i][0] = ((uc.ui[0] & 0xff) |
                                                   (uc.ui[1] & 0xff) << 8 |
                                                   (uc.ui[2] & 0xff) << 16 |
                                                   (uc.ui[3] & 0xff) << 24);
                         break;
-                case INTERNAL_TYPE_16F:
+                case V3D_INTERNAL_TYPE_16F:
                         util_pack_color(color->f, PIPE_FORMAT_R16G16B16A16_FLOAT,
                                         &uc);
                         memcpy(job->clear_color[i], uc.ui, internal_size);
                         break;
-                case INTERNAL_TYPE_16I:
-                case INTERNAL_TYPE_16UI:
+                case V3D_INTERNAL_TYPE_16I:
+                case V3D_INTERNAL_TYPE_16UI:
                         job->clear_color[i][0] = ((uc.ui[0] & 0xffff) |
                                                   uc.ui[1] << 16);
                         job->clear_color[i][1] = ((uc.ui[2] & 0xffff) |
                                                   uc.ui[3] << 16);
                         break;
-                case INTERNAL_TYPE_32F:
-                case INTERNAL_TYPE_32I:
-                case INTERNAL_TYPE_32UI:
+                case V3D_INTERNAL_TYPE_32F:
+                case V3D_INTERNAL_TYPE_32I:
+                case V3D_INTERNAL_TYPE_32UI:
                         memcpy(job->clear_color[i], color->ui, internal_size);
                         break;
                 }
index b16ac1db3f8a6bd95773ed0e49c82eb210f1fc20..432db913b42547533ff767460ef9a3319209baa1 100644 (file)
@@ -309,22 +309,22 @@ vc5_get_internal_type_bpp_for_output_format(uint32_t format,
         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;
+                *type = V3D_INTERNAL_TYPE_8;
+                *bpp = V3D_INTERNAL_BPP_32;
                 break;
 
         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;
+                *type = V3D_INTERNAL_TYPE_8I;
+                *bpp = V3D_INTERNAL_BPP_32;
                 break;
 
         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;
+                *type = V3D_INTERNAL_TYPE_8UI;
+                *bpp = V3D_INTERNAL_BPP_32;
                 break;
 
         case V3D_OUTPUT_IMAGE_FORMAT_SRGB8_ALPHA8:
@@ -337,76 +337,76 @@ vc5_get_internal_type_bpp_for_output_format(uint32_t format,
                  * and the conversion to sRGB happens at tilebuffer
                  * load/store.
                  */
-                *type = INTERNAL_TYPE_16F;
-                *bpp = INTERNAL_BPP_64;
+                *type = V3D_INTERNAL_TYPE_16F;
+                *bpp = V3D_INTERNAL_BPP_64;
                 break;
 
         case V3D_OUTPUT_IMAGE_FORMAT_RG16F:
         case V3D_OUTPUT_IMAGE_FORMAT_R16F:
-                *type = INTERNAL_TYPE_16F;
+                *type = V3D_INTERNAL_TYPE_16F;
                 /* Use 64bpp to make sure the TLB doesn't throw away the alpha
                  * channel before alpha test happens.
                  */
-                *bpp = INTERNAL_BPP_64;
+                *bpp = V3D_INTERNAL_BPP_64;
                 break;
 
         case V3D_OUTPUT_IMAGE_FORMAT_RGBA16I:
-                *type = INTERNAL_TYPE_16I;
-                *bpp = INTERNAL_BPP_64;
+                *type = V3D_INTERNAL_TYPE_16I;
+                *bpp = V3D_INTERNAL_BPP_64;
                 break;
         case V3D_OUTPUT_IMAGE_FORMAT_RG16I:
         case V3D_OUTPUT_IMAGE_FORMAT_R16I:
-                *type = INTERNAL_TYPE_16I;
-                *bpp = INTERNAL_BPP_32;
+                *type = V3D_INTERNAL_TYPE_16I;
+                *bpp = V3D_INTERNAL_BPP_32;
                 break;
 
         case V3D_OUTPUT_IMAGE_FORMAT_RGBA16UI:
-                *type = INTERNAL_TYPE_16UI;
-                *bpp = INTERNAL_BPP_64;
+                *type = V3D_INTERNAL_TYPE_16UI;
+                *bpp = V3D_INTERNAL_BPP_64;
                 break;
         case V3D_OUTPUT_IMAGE_FORMAT_RG16UI:
         case V3D_OUTPUT_IMAGE_FORMAT_R16UI:
-                *type = INTERNAL_TYPE_16UI;
-                *bpp = INTERNAL_BPP_32;
+                *type = V3D_INTERNAL_TYPE_16UI;
+                *bpp = V3D_INTERNAL_BPP_32;
                 break;
 
         case V3D_OUTPUT_IMAGE_FORMAT_RGBA32I:
-                *type = INTERNAL_TYPE_32I;
-                *bpp = INTERNAL_BPP_128;
+                *type = V3D_INTERNAL_TYPE_32I;
+                *bpp = V3D_INTERNAL_BPP_128;
                 break;
         case V3D_OUTPUT_IMAGE_FORMAT_RG32I:
-                *type = INTERNAL_TYPE_32I;
-                *bpp = INTERNAL_BPP_64;
+                *type = V3D_INTERNAL_TYPE_32I;
+                *bpp = V3D_INTERNAL_BPP_64;
                 break;
         case V3D_OUTPUT_IMAGE_FORMAT_R32I:
-                *type = INTERNAL_TYPE_32I;
-                *bpp = INTERNAL_BPP_32;
+                *type = V3D_INTERNAL_TYPE_32I;
+                *bpp = V3D_INTERNAL_BPP_32;
                 break;
 
         case V3D_OUTPUT_IMAGE_FORMAT_RGBA32UI:
-                *type = INTERNAL_TYPE_32UI;
-                *bpp = INTERNAL_BPP_128;
+                *type = V3D_INTERNAL_TYPE_32UI;
+                *bpp = V3D_INTERNAL_BPP_128;
                 break;
         case V3D_OUTPUT_IMAGE_FORMAT_RG32UI:
-                *type = INTERNAL_TYPE_32UI;
-                *bpp = INTERNAL_BPP_64;
+                *type = V3D_INTERNAL_TYPE_32UI;
+                *bpp = V3D_INTERNAL_BPP_64;
                 break;
         case V3D_OUTPUT_IMAGE_FORMAT_R32UI:
-                *type = INTERNAL_TYPE_32UI;
-                *bpp = INTERNAL_BPP_32;
+                *type = V3D_INTERNAL_TYPE_32UI;
+                *bpp = V3D_INTERNAL_BPP_32;
                 break;
 
         case V3D_OUTPUT_IMAGE_FORMAT_RGBA32F:
-                *type = INTERNAL_TYPE_32F;
-                *bpp = INTERNAL_BPP_128;
+                *type = V3D_INTERNAL_TYPE_32F;
+                *bpp = V3D_INTERNAL_BPP_128;
                 break;
         case V3D_OUTPUT_IMAGE_FORMAT_RG32F:
-                *type = INTERNAL_TYPE_32F;
-                *bpp = INTERNAL_BPP_64;
+                *type = V3D_INTERNAL_TYPE_32F;
+                *bpp = V3D_INTERNAL_BPP_64;
                 break;
         case V3D_OUTPUT_IMAGE_FORMAT_R32F:
-                *type = INTERNAL_TYPE_32F;
-                *bpp = INTERNAL_BPP_32;
+                *type = V3D_INTERNAL_TYPE_32F;
+                *bpp = V3D_INTERNAL_BPP_32;
                 break;
 
         default:
@@ -414,8 +414,8 @@ vc5_get_internal_type_bpp_for_output_format(uint32_t format,
                  * creation time, even if an RB with this format isn't
                  * supported.
                  */
-                *type = INTERNAL_TYPE_8;
-                *bpp = INTERNAL_BPP_32;
+                *type = V3D_INTERNAL_TYPE_8;
+                *bpp = V3D_INTERNAL_BPP_32;
                 break;
         }
 }
index 600a8469668f3b3b08faf26a4eb9183d90efc9b5..f113d27961b7a345be96578c32c74cf509ccaf7f 100644 (file)
@@ -334,7 +334,7 @@ vc5_emit_rcl(struct vc5_job *job)
                         clear.render_target_number = i;
                 };
 
-                if (surf->internal_bpp >= INTERNAL_BPP_64) {
+                if (surf->internal_bpp >= V3D_INTERNAL_BPP_64) {
                         cl_emit(&job->rcl, TILE_RENDERING_MODE_CONFIGURATION_CLEAR_COLORS_PART2,
                                 clear) {
                                 clear.clear_color_mid_low_32_bits =
@@ -347,7 +347,7 @@ vc5_emit_rcl(struct vc5_job *job)
                         };
                 }
 
-                if (surf->internal_bpp >= INTERNAL_BPP_128 || clear_pad) {
+                if (surf->internal_bpp >= V3D_INTERNAL_BPP_128 || clear_pad) {
                         cl_emit(&job->rcl, TILE_RENDERING_MODE_CONFIGURATION_CLEAR_COLORS_PART3,
                                 clear) {
                                 clear.uif_padded_height_in_uif_blocks = clear_pad;
index dc768379ca44efba02f02191960e8d61fbbb565a..ddf4d5d377abe6cf9de6eeeeff7a25c0680cdaa1 100644 (file)
@@ -443,13 +443,13 @@ vc5_resource_setup(struct pipe_screen *pscreen,
                                                             &internal_type,
                                                             &internal_bpp);
                 switch (internal_bpp) {
-                case INTERNAL_BPP_32:
+                case V3D_INTERNAL_BPP_32:
                         rsc->cpp = 4;
                         break;
-                case INTERNAL_BPP_64:
+                case V3D_INTERNAL_BPP_64:
                         rsc->cpp = 8;
                         break;
-                case INTERNAL_BPP_128:
+                case V3D_INTERNAL_BPP_128:
                         rsc->cpp = 16;
                         break;
                 }
@@ -667,14 +667,14 @@ vc5_create_surface(struct pipe_context *pctx,
         if (util_format_is_depth_or_stencil(psurf->format)) {
                 switch (psurf->format) {
                 case PIPE_FORMAT_Z16_UNORM:
-                        surface->internal_type = INTERNAL_TYPE_DEPTH_16;
+                        surface->internal_type = V3D_INTERNAL_TYPE_DEPTH_16;
                         break;
                 case PIPE_FORMAT_Z32_FLOAT:
                 case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
-                        surface->internal_type = INTERNAL_TYPE_DEPTH_32F;
+                        surface->internal_type = V3D_INTERNAL_TYPE_DEPTH_32F;
                         break;
                 default:
-                        surface->internal_type = INTERNAL_TYPE_DEPTH_24;
+                        surface->internal_type = V3D_INTERNAL_TYPE_DEPTH_24;
                 }
         } else {
                 uint32_t bpp, type;
index a3ae2b3f539f23a7606f46bb5c7d0bd6bbf36313..35d5e1df509f26d7cc4819d3276b9cb7327835f8 100644 (file)
@@ -617,10 +617,10 @@ vc5_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,
                                                                     &internal_bpp);
 
                         switch (internal_type) {
-                        case INTERNAL_TYPE_8:
+                        case V3D_INTERNAL_TYPE_8:
                                 tex.texture_type = TEXTURE_DATA_FORMAT_RGBA8;
                                 break;
-                        case INTERNAL_TYPE_16F:
+                        case V3D_INTERNAL_TYPE_16F:
                                 tex.texture_type = TEXTURE_DATA_FORMAT_RGBA16F;
                                 break;
                         default: