anv: store the workaround address
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 21 Feb 2020 15:36:36 +0000 (17:36 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 20 May 2020 15:58:22 +0000 (15:58 +0000)
This will allow to select a different address later, leaving the
beginning of the buffer to some other use.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3203>

src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_private.h
src/intel/vulkan/genX_blorp_exec.c
src/intel/vulkan/genX_cmd_buffer.c
src/intel/vulkan/genX_pipeline.c

index 5b4c952a33816b3d8edba07d6a0c6420ba2b344e..ec30e2d0251830d2d318e9642a126619a10368d6 100644 (file)
@@ -2932,6 +2932,10 @@ VkResult anv_CreateDevice(
    if (result != VK_SUCCESS)
       goto fail_surface_aux_map_pool;
 
+   device->workaround_address = (struct anv_address) {
+      .bo = device->workaround_bo,
+   };
+
    result = anv_device_init_trivial_batch(device);
    if (result != VK_SUCCESS)
       goto fail_workaround_bo;
index fa44307457b8ded615df824f2518a5c41bfc31a0..7e9270d62f323414e13e54bfe0a7d65d4922c8c0 100644 (file)
@@ -1297,6 +1297,11 @@ anv_device_upload_nir(struct anv_device *device,
                       const struct nir_shader *nir,
                       unsigned char sha1_key[20]);
 
+struct anv_address {
+   struct anv_bo *bo;
+   uint32_t offset;
+};
+
 struct anv_device {
     struct vk_device                            vk;
 
@@ -1340,6 +1345,8 @@ struct anv_device {
      * For that, we use the high bytes (>= 1024) of the workaround BO.
      */
     struct anv_bo *                             workaround_bo;
+    struct anv_address                          workaround_address;
+
     struct anv_bo *                             trivial_batch_bo;
     struct anv_bo *                             hiz_clear_bo;
     struct anv_state                            null_surface_state;
@@ -1602,11 +1609,6 @@ struct anv_batch_bo {
    struct anv_reloc_list                        relocs;
 };
 
-struct anv_address {
-   struct anv_bo *bo;
-   uint32_t offset;
-};
-
 struct anv_batch {
    const VkAllocationCallbacks *                alloc;
 
index 56a3c8868ebf1b5c4f4a17092e71a94669d375dc..15ecf7805af5b8782658c89e3296595e2ecfaf81 100644 (file)
@@ -184,7 +184,8 @@ blorp_get_workaround_address(struct blorp_batch *batch)
    struct anv_cmd_buffer *cmd_buffer = batch->driver_batch;
 
    return (struct blorp_address) {
-      .buffer = cmd_buffer->device->workaround_bo,
+      .buffer = cmd_buffer->device->workaround_address.bo,
+      .offset = cmd_buffer->device->workaround_address.offset,
    };
 }
 
index e1389699750bbd1a1560f051196af9fb70587707..9c67e6796dbf4c5597ca81b048d49be3ccdd32c5 100644 (file)
@@ -2251,8 +2251,7 @@ genX(cmd_buffer_apply_pipe_flushes)(struct anv_cmd_buffer *cmd_buffer)
           */
          if (GEN_GEN == 9 && pipe.VFCacheInvalidationEnable) {
             pipe.PostSyncOperation = WriteImmediateData;
-            pipe.Address =
-               (struct anv_address) { cmd_buffer->device->workaround_bo, 0 };
+            pipe.Address = cmd_buffer->device->workaround_address;
          }
       }
 
@@ -3404,8 +3403,7 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer)
       anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) {
          pc.DepthStallEnable  = true;
          pc.PostSyncOperation = WriteImmediateData;
-         pc.Address           =
-            (struct anv_address) { cmd_buffer->device->workaround_bo, 0 };
+         pc.Address           = cmd_buffer->device->workaround_address;
       }
    }
 #endif
@@ -4950,8 +4948,7 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
        */
       anv_batch_emit(&cmd_buffer->batch, GENX(PIPE_CONTROL), pc) {
          pc.PostSyncOperation = WriteImmediateData;
-         pc.Address =
-            (struct anv_address) { cmd_buffer->device->workaround_bo, 0 };
+         pc.Address = cmd_buffer->device->workaround_address;
       }
    }
    cmd_buffer->state.hiz_enabled = isl_aux_usage_has_hiz(info.hiz_usage);
index e17ba6750d4d2c01d6ad011da41ef1de04f91de8..43078ce2b84f4495e1aef5d375bf78bc159f8373 100644 (file)
@@ -290,7 +290,7 @@ genX(emit_urb_setup)(struct anv_device *device, struct anv_batch *batch,
    anv_batch_emit(batch, GEN7_PIPE_CONTROL, pc) {
       pc.DepthStallEnable  = true;
       pc.PostSyncOperation = WriteImmediateData;
-      pc.Address           = (struct anv_address) { device->workaround_bo, 0 };
+      pc.Address           = device->workaround_address;
    }
 #endif