From bc17f9c9d76dbf2cdc657cfb6861b887dbca3046 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 22 Sep 2015 10:58:34 -0700 Subject: anv/cmd_buffer: Add a helper for getting the surface state base address --- src/vulkan/anv_batch_chain.c | 9 +++++++++ src/vulkan/anv_private.h | 2 ++ src/vulkan/gen7_cmd_buffer.c | 2 +- src/vulkan/gen8_cmd_buffer.c | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/vulkan') diff --git a/src/vulkan/anv_batch_chain.c b/src/vulkan/anv_batch_chain.c index b8f08b9cd8a..6c37ce0aca3 100644 --- a/src/vulkan/anv_batch_chain.c +++ b/src/vulkan/anv_batch_chain.c @@ -395,6 +395,15 @@ anv_cmd_buffer_current_surface_relocs(struct anv_cmd_buffer *cmd_buffer) return &anv_cmd_buffer_current_surface_bbo(cmd_buffer)->relocs; } +struct anv_address +anv_cmd_buffer_surface_base_address(struct anv_cmd_buffer *cmd_buffer) +{ + return (struct anv_address) { + .bo = anv_cmd_buffer_current_surface_bo(cmd_buffer), + .offset = 0, + }; +} + static void emit_batch_buffer_start(struct anv_batch *batch, struct anv_bo *bo, uint32_t offset) { diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index fa910064945..2e8bfa2c1d6 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -897,6 +897,8 @@ struct anv_bo * anv_cmd_buffer_current_surface_bo(struct anv_cmd_buffer *cmd_buffer); struct anv_reloc_list * anv_cmd_buffer_current_surface_relocs(struct anv_cmd_buffer *cmd_buffer); +struct anv_address +anv_cmd_buffer_surface_base_address(struct anv_cmd_buffer *cmd_buffer); struct anv_state anv_cmd_buffer_alloc_surface_state(struct anv_cmd_buffer *cmd_buffer, uint32_t size, uint32_t alignment); diff --git a/src/vulkan/gen7_cmd_buffer.c b/src/vulkan/gen7_cmd_buffer.c index b149673f405..95d1e28698f 100644 --- a/src/vulkan/gen7_cmd_buffer.c +++ b/src/vulkan/gen7_cmd_buffer.c @@ -48,7 +48,7 @@ gen7_cmd_buffer_emit_state_base_address(struct anv_cmd_buffer *cmd_buffer) .GeneralStateAccessUpperBound = { scratch_bo, scratch_bo->size }, .GeneralStateAccessUpperBoundModifyEnable = true, - .SurfaceStateBaseAddress = { anv_cmd_buffer_current_surface_bo(cmd_buffer), 0 }, + .SurfaceStateBaseAddress = anv_cmd_buffer_surface_base_address(cmd_buffer), .SurfaceStateMemoryObjectControlState = GEN7_MOCS, .SurfaceStateBaseAddressModifyEnable = true, diff --git a/src/vulkan/gen8_cmd_buffer.c b/src/vulkan/gen8_cmd_buffer.c index 5737879ffe7..5018b6775d9 100644 --- a/src/vulkan/gen8_cmd_buffer.c +++ b/src/vulkan/gen8_cmd_buffer.c @@ -824,7 +824,7 @@ gen8_cmd_buffer_emit_state_base_address(struct anv_cmd_buffer *cmd_buffer) .GeneralStateBufferSize = 0xfffff, .GeneralStateBufferSizeModifyEnable = true, - .SurfaceStateBaseAddress = { anv_cmd_buffer_current_surface_bo(cmd_buffer), 0 }, + .SurfaceStateBaseAddress = anv_cmd_buffer_surface_base_address(cmd_buffer), .SurfaceStateMemoryObjectControlState = GEN8_MOCS, .SurfaceStateBaseAddressModifyEnable = true, -- cgit v1.2.3