vk: Downgrade state packet to gen7 where they're common
authorKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Tue, 18 Aug 2015 18:04:19 +0000 (11:04 -0700)
committerKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Mon, 24 Aug 2015 20:45:40 +0000 (13:45 -0700)
Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
src/vulkan/anv_batch_chain.c
src/vulkan/anv_cmd_buffer.c
src/vulkan/anv_device.c

index c34f58b253445cc66d094034e756cba1dc3e9c7b..0faf7877af13969603e79d03bfff60b4fd532a93 100644 (file)
@@ -629,11 +629,11 @@ anv_cmd_buffer_end_batch_buffer(struct anv_cmd_buffer *cmd_buffer)
       anv_cmd_buffer_current_surface_bbo(cmd_buffer);
 
    if (cmd_buffer->level == VK_CMD_BUFFER_LEVEL_PRIMARY) {
-      anv_batch_emit(&cmd_buffer->batch, GEN8_MI_BATCH_BUFFER_END);
+      anv_batch_emit(&cmd_buffer->batch, GEN7_MI_BATCH_BUFFER_END);
 
       /* Round batch up to an even number of dwords. */
       if ((cmd_buffer->batch.next - cmd_buffer->batch.start) & 4)
-         anv_batch_emit(&cmd_buffer->batch, GEN8_MI_NOOP);
+         anv_batch_emit(&cmd_buffer->batch, GEN7_MI_NOOP);
 
       cmd_buffer->exec_mode = ANV_CMD_BUFFER_EXEC_MODE_PRIMARY;
    }
index 84e690321475ecf0b420fbcab1167d56f38b70d4..920d9f74ef77ce91db91b7bb4a2f9d2fd89f6586 100644 (file)
@@ -518,14 +518,14 @@ flush_descriptor_set(struct anv_cmd_buffer *cmd_buffer, uint32_t stage)
 
    if (samplers.alloc_size > 0) {
       anv_batch_emit(&cmd_buffer->batch,
-                     GEN8_3DSTATE_SAMPLER_STATE_POINTERS_VS,
+                     GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS,
                      ._3DCommandSubOpcode  = sampler_state_opcodes[stage],
                      .PointertoVSSamplerState = samplers.offset);
    }
 
    if (surfaces.alloc_size > 0) {
       anv_batch_emit(&cmd_buffer->batch,
-                     GEN8_3DSTATE_BINDING_TABLE_POINTERS_VS,
+                     GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS,
                      ._3DCommandSubOpcode  = binding_table_opcodes[stage],
                      .PointertoVSBindingTable = surfaces.offset);
    }
index 1ab9d1a3c4375b07189c21f84e246c66c830f614..a33981d7350fd459b93a799f43ad3e0542ca8b2f 100644 (file)
@@ -1108,8 +1108,8 @@ VkResult anv_CreateFence(
       anv_gem_mmap(device, fence->bo.gem_handle, 0, fence->bo.size);
    batch.next = batch.start = fence->bo.map;
    batch.end = fence->bo.map + fence->bo.size;
-   anv_batch_emit(&batch, GEN8_MI_BATCH_BUFFER_END);
-   anv_batch_emit(&batch, GEN8_MI_NOOP);
+   anv_batch_emit(&batch, GEN7_MI_BATCH_BUFFER_END);
+   anv_batch_emit(&batch, GEN7_MI_NOOP);
 
    fence->exec2_objects[0].handle = fence->bo.gem_handle;
    fence->exec2_objects[0].relocation_count = 0;
@@ -1777,6 +1777,8 @@ VkResult anv_CreateDynamicViewportState(
       const VkViewport *vp = &pCreateInfo->pViewports[i];
       const VkRect2D *s = &pCreateInfo->pScissors[i];
 
+      /* The gen7 state struct has just the matrix and guardband fields, the
+       * gen8 struct adds the min/max viewport fields. */
       struct GEN8_SF_CLIP_VIEWPORT sf_clip_viewport = {
          .ViewportMatrixElementm00 = vp->width / 2,
          .ViewportMatrixElementm11 = vp->height / 2,
@@ -1794,7 +1796,7 @@ VkResult anv_CreateDynamicViewportState(
          .YMaxViewPort = vp->originY + vp->height - 1,
       };
 
-      struct GEN8_CC_VIEWPORT cc_viewport = {
+      struct GEN7_CC_VIEWPORT cc_viewport = {
          .MinimumDepth = vp->minDepth,
          .MaximumDepth = vp->maxDepth
       };
@@ -1804,7 +1806,7 @@ VkResult anv_CreateDynamicViewportState(
        * 0, the clamps below produce 0 for xmin, ymin, xmax, ymax, which isn't
        * what we want. Just special case empty clips and produce a canonical
        * empty clip. */
-      static const struct GEN8_SCISSOR_RECT empty_scissor = {
+      static const struct GEN7_SCISSOR_RECT empty_scissor = {
          .ScissorRectangleYMin = 1,
          .ScissorRectangleXMin = 1,
          .ScissorRectangleYMax = 0,
@@ -1812,7 +1814,7 @@ VkResult anv_CreateDynamicViewportState(
       };
 
       const int max = 0xffff;
-      struct GEN8_SCISSOR_RECT scissor = {
+      struct GEN7_SCISSOR_RECT scissor = {
          /* Do this math using int64_t so overflow gets clamped correctly. */
          .ScissorRectangleYMin = clamp_int64(s->offset.y, 0, max),
          .ScissorRectangleXMin = clamp_int64(s->offset.x, 0, max),
@@ -1821,12 +1823,12 @@ VkResult anv_CreateDynamicViewportState(
       };
 
       GEN8_SF_CLIP_VIEWPORT_pack(NULL, state->sf_clip_vp.map + i * 64, &sf_clip_viewport);
-      GEN8_CC_VIEWPORT_pack(NULL, state->cc_vp.map + i * 32, &cc_viewport);
+      GEN7_CC_VIEWPORT_pack(NULL, state->cc_vp.map + i * 32, &cc_viewport);
 
       if (s->extent.width <= 0 || s->extent.height <= 0) {
-         GEN8_SCISSOR_RECT_pack(NULL, state->scissor.map + i * 32, &empty_scissor);
+         GEN7_SCISSOR_RECT_pack(NULL, state->scissor.map + i * 32, &empty_scissor);
       } else {
-         GEN8_SCISSOR_RECT_pack(NULL, state->scissor.map + i * 32, &scissor);
+         GEN7_SCISSOR_RECT_pack(NULL, state->scissor.map + i * 32, &scissor);
       }
    }
 
@@ -1886,14 +1888,14 @@ VkResult anv_CreateDynamicColorBlendState(
    if (state == NULL)
       return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
 
-   struct GEN8_COLOR_CALC_STATE color_calc_state = {
+   struct GEN7_COLOR_CALC_STATE color_calc_state = {
       .BlendConstantColorRed = pCreateInfo->blendConst[0],
       .BlendConstantColorGreen = pCreateInfo->blendConst[1],
       .BlendConstantColorBlue = pCreateInfo->blendConst[2],
       .BlendConstantColorAlpha = pCreateInfo->blendConst[3]
    };
 
-   GEN8_COLOR_CALC_STATE_pack(NULL, state->state_color_calc, &color_calc_state);
+   GEN7_COLOR_CALC_STATE_pack(NULL, state->state_color_calc, &color_calc_state);
 
    *pState = anv_dynamic_cb_state_to_handle(state);