anv: Only include the pack headers where needed
authorJason Ekstrand <jason.ekstrand@intel.com>
Mon, 16 Nov 2015 20:29:07 +0000 (12:29 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 16 Nov 2015 20:29:09 +0000 (12:29 -0800)
Previously, we were including gen7_pack.h, gen75_pack.h, and gen8_pack.h
in anv_private.h.  As we add more gens, this is going to become untenable.
This commit moves things around so that we only use the pack headers when
and if we need them.

12 files changed:
src/vulkan/anv_batch_chain.c
src/vulkan/anv_device.c
src/vulkan/anv_formats.c
src/vulkan/anv_image.c
src/vulkan/anv_pipeline.c
src/vulkan/anv_private.h
src/vulkan/gen7_cmd_buffer.c
src/vulkan/gen7_pipeline.c
src/vulkan/gen7_state.c
src/vulkan/gen8_cmd_buffer.c
src/vulkan/gen8_pipeline.c
src/vulkan/gen8_state.c

index 239149709df74e3fe4504188a9bafcca67b74bf6..9d35da8024b2713027b05efeb57661753abd36d1 100644 (file)
@@ -29,6 +29,9 @@
 
 #include "anv_private.h"
 
+#include "gen7_pack.h"
+#include "gen8_pack.h"
+
 /** \file anv_batch_chain.c
  *
  * This file contains functions related to anv_cmd_buffer as a data
index fb608592c1fed223c9ece92e773a9f05e320f29d..6cdfd4e5c46bb3d705ff0749327e6fc14f4d34b8 100644 (file)
@@ -31,6 +31,8 @@
 #include "mesa/main/git_sha1.h"
 #include "util/strtod.h"
 
+#include "gen7_pack.h"
+
 struct anv_dispatch_table dtable;
 
 static void
index 942e7cfb484dea26e3cf1b47bb3946b9ec2a1479..a231967a865906578e9469eadc24ead3f4b74f73 100644 (file)
@@ -24,6 +24,8 @@
 #include "anv_private.h"
 #include "brw_surface_formats.h"
 
+#include "gen7_pack.h"
+
 #define fmt(__vk_fmt, __hw_fmt, ...) \
    [__vk_fmt] = { \
       .vk_format = __vk_fmt, \
index e90257e8faaf216dc7c4cfdddeaf9ab6aa592fbd..7808454262e8c1633eec1f7bf04b2eb8b572fa16 100644 (file)
 
 #include "anv_private.h"
 
+/* FIXME: We shouldn't be using the actual hardware enum values here.  They
+ * change across gens.  Once we get that fixed, this include needs to go.
+ */
+#include "gen8_pack.h"
+
 static const uint8_t anv_halign[] = {
     [4] = HALIGN4,
     [8] = HALIGN8,
index a9cf16f79c21856c1a517f985f8a7a9d731ac7fd..6c9deaddda7a785c9b624f77b29bb97743b043c4 100644 (file)
@@ -260,7 +260,7 @@ static const uint32_t vk_to_gen_primitive_type[] = {
    [VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_ADJ]       = _3DPRIM_LINESTRIP_ADJ,
    [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_ADJ]    = _3DPRIM_TRILIST_ADJ,
    [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_ADJ]   = _3DPRIM_TRISTRIP_ADJ,
-   [VK_PRIMITIVE_TOPOLOGY_PATCH]                = _3DPRIM_PATCHLIST_1
+/*   [VK_PRIMITIVE_TOPOLOGY_PATCH]                = _3DPRIM_PATCHLIST_1 */
 };
 
 static void
index 5afd42b4d131d841c95066db032f8b715d4a6365..a8ed5e8a7e266e18d3f3962b390a697204529ff1 100644 (file)
@@ -627,11 +627,6 @@ __gen_combine_address(struct anv_batch *batch, void *location,
    }
 }
 
-#include "gen7_pack.h"
-#include "gen75_pack.h"
-#undef GEN8_3DSTATE_MULTISAMPLE
-#include "gen8_pack.h"
-
 #define anv_batch_emit(batch, cmd, ...) do {                            \
       void *__dst = anv_batch_emit_dwords(batch, cmd ## _length);       \
       struct cmd __template = {                                         \
@@ -664,11 +659,11 @@ __gen_combine_address(struct anv_batch *batch, void *location,
       VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, ARRAY_SIZE(dwords0) * 4));\
    } while (0)
 
-static const struct GEN7_MEMORY_OBJECT_CONTROL_STATE GEN7_MOCS = {
-   .GraphicsDataTypeGFDT                        = 0,
-   .LLCCacheabilityControlLLCCC                 = 0,
-   .L3CacheabilityControlL3CC                   = 1
-};
+#define GEN7_MOCS (struct GEN7_MEMORY_OBJECT_CONTROL_STATE) {  \
+   .GraphicsDataTypeGFDT                        = 0,           \
+   .LLCCacheabilityControlLLCCC                 = 0,           \
+   .L3CacheabilityControlL3CC                   = 1,           \
+}
 
 #define GEN8_MOCS {                                     \
       .MemoryTypeLLCeLLCCacheabilityControl = WB,       \
@@ -923,7 +918,7 @@ struct anv_cmd_state {
    struct anv_framebuffer *                     framebuffer;
    struct anv_render_pass *                     pass;
    struct anv_subpass *                         subpass;
-   uint32_t                                     state_vf[GEN8_3DSTATE_VF_length];
+   uint32_t                                     state_vf[2];
    struct anv_vertex_binding                    vertex_bindings[MAX_VBS];
    struct anv_descriptor_set *                  descriptors[MAX_SETS];
    struct anv_push_constants *                  push_constants[VK_SHADER_STAGE_NUM];
@@ -1150,15 +1145,15 @@ struct anv_pipeline {
    uint32_t                                     cs_right_mask;
 
    struct {
-      uint32_t                                  sf[GEN7_3DSTATE_SF_length];
-      uint32_t                                  depth_stencil_state[GEN7_DEPTH_STENCIL_STATE_length];
+      uint32_t                                  sf[7];
+      uint32_t                                  depth_stencil_state[3];
    } gen7;
 
    struct {
-      uint32_t                                  sf[GEN8_3DSTATE_SF_length];
-      uint32_t                                  vf[GEN8_3DSTATE_VF_length];
-      uint32_t                                  raster[GEN8_3DSTATE_RASTER_length];
-      uint32_t                                  wm_depth_stencil[GEN8_3DSTATE_WM_DEPTH_STENCIL_length];
+      uint32_t                                  sf[4];
+      uint32_t                                  vf[2];
+      uint32_t                                  raster[5];
+      uint32_t                                  wm_depth_stencil[3];
    } gen8;
 };
 
index ee40a0de09cfaef9434798c704a79b4b7ac37169..4f5d50fe167b827c1999effe20f59b2cd6ecf0d4 100644 (file)
@@ -29,6 +29,8 @@
 
 #include "anv_private.h"
 
+#include "gen7_pack.h"
+
 static void
 gen7_cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer)
 {
@@ -283,7 +285,7 @@ emit_scissor_state(struct anv_cmd_buffer *cmd_buffer,
       }
    }
 
-   anv_batch_emit(&cmd_buffer->batch, GEN8_3DSTATE_SCISSOR_STATE_POINTERS,
+   anv_batch_emit(&cmd_buffer->batch, GEN7_3DSTATE_SCISSOR_STATE_POINTERS,
                   .ScissorRectPointer = scissor_state.offset);
 }
 
index 1fed33a53d1e2b7576d8ae3e5d734d1483250679..d53489c2db1a91a149eb62361b34e38d8e89510d 100644 (file)
@@ -29,6 +29,8 @@
 
 #include "anv_private.h"
 
+#include "gen7_pack.h"
+
 static void
 gen7_emit_vertex_input(struct anv_pipeline *pipeline,
                        const VkPipelineVertexInputStateCreateInfo *info)
@@ -92,8 +94,8 @@ static const uint32_t vk_to_gen_fillmode[] = {
 };
 
 static const uint32_t vk_to_gen_front_face[] = {
-   [VK_FRONT_FACE_CCW]                          = CounterClockwise,
-   [VK_FRONT_FACE_CW]                           = Clockwise
+   [VK_FRONT_FACE_CCW]                          = 1,
+   [VK_FRONT_FACE_CW]                           = 0
 };
 
 static void
@@ -575,9 +577,9 @@ gen7_graphics_pipeline_create(
    anv_batch_emit(&pipeline->batch, GEN7_3DSTATE_WM,
       .StatisticsEnable                         = true,
       .ThreadDispatchEnable                     = true,
-      .LineEndCapAntialiasingRegionWidth        = _05pixels,
-      .LineAntialiasingRegionWidth              = _10pixels,
-      .EarlyDepthStencilControl                 = NORMAL,
+      .LineEndCapAntialiasingRegionWidth        = 0, /* 0.5 pixels */
+      .LineAntialiasingRegionWidth              = 1, /* 1.0 pixels */
+      .EarlyDepthStencilControl                 = EDSC_NORMAL,
       .PointRasterizationRule                   = RASTRULE_UPPER_RIGHT,
       .PixelShaderComputedDepthMode             = wm_prog_data->computed_depth_mode,
       .BarycentricInterpolationMode             = wm_prog_data->barycentric_interp_modes);
index a53b6e3faf355887eabd52eb19a390895c1ae49b..596e232ab6fb878e6e10d7b99cfcc24d50bb993f 100644 (file)
@@ -29,6 +29,8 @@
 
 #include "anv_private.h"
 
+#include "gen7_pack.h"
+
 void
 gen7_fill_buffer_surface_state(void *state, const struct anv_format *format,
                                uint32_t offset, uint32_t range, uint32_t stride)
@@ -272,7 +274,7 @@ gen7_image_view_init(struct anv_image_view *iview,
       iview->color_rt_surface_state =
          gen7_alloc_surface_state(device, cmd_buffer);
 
-      surface_state.RenderCacheReadWriteMode = WriteOnlyCache;
+      surface_state.RenderCacheReadWriteMode = 0; /* Write only */
 
       /* For render target surfaces, the hardware interprets field MIPCount/LOD as
        * LOD. The Broadwell PRM says:
index 2c76e31936f2693bc2abbd89d8a395be2f8cc5d1..2e4a618bad1c48114fea12d8e82bbed70be50210 100644 (file)
@@ -29,6 +29,8 @@
 
 #include "anv_private.h"
 
+#include "gen8_pack.h"
+
 static void
 gen8_cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer)
 {
@@ -94,14 +96,14 @@ emit_viewport_state(struct anv_cmd_buffer *cmd_buffer,
          .YMaxViewPort = vp->originY + vp->height - 1,
       };
 
-      struct GEN7_CC_VIEWPORT cc_viewport = {
+      struct GEN8_CC_VIEWPORT cc_viewport = {
          .MinimumDepth = vp->minDepth,
          .MaximumDepth = vp->maxDepth
       };
 
       GEN8_SF_CLIP_VIEWPORT_pack(NULL, sf_clip_state.map + i * 64,
                                  &sf_clip_viewport);
-      GEN7_CC_VIEWPORT_pack(NULL, cc_state.map + i * 32, &cc_viewport);
+      GEN8_CC_VIEWPORT_pack(NULL, cc_state.map + i * 32, &cc_viewport);
    }
 
    anv_batch_emit(&cmd_buffer->batch,
index e98045248a4a5e1a0366d9aa055c026750885c16..81bc254b3f7246235907745e8b48e1c4edff6d67 100644 (file)
@@ -29,6 +29,8 @@
 
 #include "anv_private.h"
 
+#include "gen8_pack.h"
+
 static void
 emit_vertex_input(struct anv_pipeline *pipeline,
                   const VkPipelineVertexInputStateCreateInfo *info)
index 6eb65e6ec4ec16421a73a48bd5c6ff7701ccd34d..94972d2049019e35b764e3b2dced9018a2cde549 100644 (file)
@@ -29,6 +29,8 @@
 
 #include "anv_private.h"
 
+#include "gen8_pack.h"
+
 void
 gen8_fill_buffer_surface_state(void *state, const struct anv_format *format,
                                uint32_t offset, uint32_t range, uint32_t stride)