vk: Move gen8_cmd_buffer_emit_state_base_address() to anv_gen8.c
Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
This commit is contained in:
@@ -140,82 +140,12 @@ VkResult anv_ResetCommandBuffer(
|
|||||||
void
|
void
|
||||||
anv_cmd_buffer_emit_state_base_address(struct anv_cmd_buffer *cmd_buffer)
|
anv_cmd_buffer_emit_state_base_address(struct anv_cmd_buffer *cmd_buffer)
|
||||||
{
|
{
|
||||||
struct anv_device *device = cmd_buffer->device;
|
switch (cmd_buffer->device->info.gen) {
|
||||||
struct anv_bo *scratch_bo = NULL;
|
case 8:
|
||||||
|
return gen8_cmd_buffer_emit_state_base_address(cmd_buffer);
|
||||||
cmd_buffer->state.scratch_size =
|
default:
|
||||||
anv_block_pool_size(&device->scratch_block_pool);
|
unreachable("unsupported gen\n");
|
||||||
if (cmd_buffer->state.scratch_size > 0)
|
}
|
||||||
scratch_bo = &device->scratch_block_pool.bo;
|
|
||||||
|
|
||||||
anv_batch_emit(&cmd_buffer->batch, GEN8_STATE_BASE_ADDRESS,
|
|
||||||
.GeneralStateBaseAddress = { scratch_bo, 0 },
|
|
||||||
.GeneralStateMemoryObjectControlState = GEN8_MOCS,
|
|
||||||
.GeneralStateBaseAddressModifyEnable = true,
|
|
||||||
.GeneralStateBufferSize = 0xfffff,
|
|
||||||
.GeneralStateBufferSizeModifyEnable = true,
|
|
||||||
|
|
||||||
.SurfaceStateBaseAddress = { anv_cmd_buffer_current_surface_bo(cmd_buffer), 0 },
|
|
||||||
.SurfaceStateMemoryObjectControlState = GEN8_MOCS,
|
|
||||||
.SurfaceStateBaseAddressModifyEnable = true,
|
|
||||||
|
|
||||||
.DynamicStateBaseAddress = { &device->dynamic_state_block_pool.bo, 0 },
|
|
||||||
.DynamicStateMemoryObjectControlState = GEN8_MOCS,
|
|
||||||
.DynamicStateBaseAddressModifyEnable = true,
|
|
||||||
.DynamicStateBufferSize = 0xfffff,
|
|
||||||
.DynamicStateBufferSizeModifyEnable = true,
|
|
||||||
|
|
||||||
.IndirectObjectBaseAddress = { NULL, 0 },
|
|
||||||
.IndirectObjectMemoryObjectControlState = GEN8_MOCS,
|
|
||||||
.IndirectObjectBaseAddressModifyEnable = true,
|
|
||||||
.IndirectObjectBufferSize = 0xfffff,
|
|
||||||
.IndirectObjectBufferSizeModifyEnable = true,
|
|
||||||
|
|
||||||
.InstructionBaseAddress = { &device->instruction_block_pool.bo, 0 },
|
|
||||||
.InstructionMemoryObjectControlState = GEN8_MOCS,
|
|
||||||
.InstructionBaseAddressModifyEnable = true,
|
|
||||||
.InstructionBufferSize = 0xfffff,
|
|
||||||
.InstructionBuffersizeModifyEnable = true);
|
|
||||||
|
|
||||||
/* After re-setting the surface state base address, we have to do some
|
|
||||||
* cache flusing so that the sampler engine will pick up the new
|
|
||||||
* SURFACE_STATE objects and binding tables. From the Broadwell PRM,
|
|
||||||
* Shared Function > 3D Sampler > State > State Caching (page 96):
|
|
||||||
*
|
|
||||||
* Coherency with system memory in the state cache, like the texture
|
|
||||||
* cache is handled partially by software. It is expected that the
|
|
||||||
* command stream or shader will issue Cache Flush operation or
|
|
||||||
* Cache_Flush sampler message to ensure that the L1 cache remains
|
|
||||||
* coherent with system memory.
|
|
||||||
*
|
|
||||||
* [...]
|
|
||||||
*
|
|
||||||
* Whenever the value of the Dynamic_State_Base_Addr,
|
|
||||||
* Surface_State_Base_Addr are altered, the L1 state cache must be
|
|
||||||
* invalidated to ensure the new surface or sampler state is fetched
|
|
||||||
* from system memory.
|
|
||||||
*
|
|
||||||
* The PIPE_CONTROL command has a "State Cache Invalidation Enable" bit
|
|
||||||
* which, according the PIPE_CONTROL instruction documentation in the
|
|
||||||
* Broadwell PRM:
|
|
||||||
*
|
|
||||||
* Setting this bit is independent of any other bit in this packet.
|
|
||||||
* This bit controls the invalidation of the L1 and L2 state caches
|
|
||||||
* at the top of the pipe i.e. at the parsing time.
|
|
||||||
*
|
|
||||||
* Unfortunately, experimentation seems to indicate that state cache
|
|
||||||
* invalidation through a PIPE_CONTROL does nothing whatsoever in
|
|
||||||
* regards to surface state and binding tables. In stead, it seems that
|
|
||||||
* invalidating the texture cache is what is actually needed.
|
|
||||||
*
|
|
||||||
* XXX: As far as we have been able to determine through
|
|
||||||
* experimentation, shows that flush the texture cache appears to be
|
|
||||||
* sufficient. The theory here is that all of the sampling/rendering
|
|
||||||
* units cache the binding table in the texture cache. However, we have
|
|
||||||
* yet to be able to actually confirm this.
|
|
||||||
*/
|
|
||||||
anv_batch_emit(&cmd_buffer->batch, GEN8_PIPE_CONTROL,
|
|
||||||
.TextureCacheInvalidationEnable = true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult anv_BeginCommandBuffer(
|
VkResult anv_BeginCommandBuffer(
|
||||||
|
@@ -1141,3 +1141,85 @@ void gen8_CmdCopyQueryPoolResults(
|
|||||||
dst_offset += destStride;
|
dst_offset += destStride;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gen8_cmd_buffer_emit_state_base_address(struct anv_cmd_buffer *cmd_buffer)
|
||||||
|
{
|
||||||
|
struct anv_device *device = cmd_buffer->device;
|
||||||
|
struct anv_bo *scratch_bo = NULL;
|
||||||
|
|
||||||
|
cmd_buffer->state.scratch_size =
|
||||||
|
anv_block_pool_size(&device->scratch_block_pool);
|
||||||
|
if (cmd_buffer->state.scratch_size > 0)
|
||||||
|
scratch_bo = &device->scratch_block_pool.bo;
|
||||||
|
|
||||||
|
anv_batch_emit(&cmd_buffer->batch, GEN8_STATE_BASE_ADDRESS,
|
||||||
|
.GeneralStateBaseAddress = { scratch_bo, 0 },
|
||||||
|
.GeneralStateMemoryObjectControlState = GEN8_MOCS,
|
||||||
|
.GeneralStateBaseAddressModifyEnable = true,
|
||||||
|
.GeneralStateBufferSize = 0xfffff,
|
||||||
|
.GeneralStateBufferSizeModifyEnable = true,
|
||||||
|
|
||||||
|
.SurfaceStateBaseAddress = { anv_cmd_buffer_current_surface_bo(cmd_buffer), 0 },
|
||||||
|
.SurfaceStateMemoryObjectControlState = GEN8_MOCS,
|
||||||
|
.SurfaceStateBaseAddressModifyEnable = true,
|
||||||
|
|
||||||
|
.DynamicStateBaseAddress = { &device->dynamic_state_block_pool.bo, 0 },
|
||||||
|
.DynamicStateMemoryObjectControlState = GEN8_MOCS,
|
||||||
|
.DynamicStateBaseAddressModifyEnable = true,
|
||||||
|
.DynamicStateBufferSize = 0xfffff,
|
||||||
|
.DynamicStateBufferSizeModifyEnable = true,
|
||||||
|
|
||||||
|
.IndirectObjectBaseAddress = { NULL, 0 },
|
||||||
|
.IndirectObjectMemoryObjectControlState = GEN8_MOCS,
|
||||||
|
.IndirectObjectBaseAddressModifyEnable = true,
|
||||||
|
.IndirectObjectBufferSize = 0xfffff,
|
||||||
|
.IndirectObjectBufferSizeModifyEnable = true,
|
||||||
|
|
||||||
|
.InstructionBaseAddress = { &device->instruction_block_pool.bo, 0 },
|
||||||
|
.InstructionMemoryObjectControlState = GEN8_MOCS,
|
||||||
|
.InstructionBaseAddressModifyEnable = true,
|
||||||
|
.InstructionBufferSize = 0xfffff,
|
||||||
|
.InstructionBuffersizeModifyEnable = true);
|
||||||
|
|
||||||
|
/* After re-setting the surface state base address, we have to do some
|
||||||
|
* cache flusing so that the sampler engine will pick up the new
|
||||||
|
* SURFACE_STATE objects and binding tables. From the Broadwell PRM,
|
||||||
|
* Shared Function > 3D Sampler > State > State Caching (page 96):
|
||||||
|
*
|
||||||
|
* Coherency with system memory in the state cache, like the texture
|
||||||
|
* cache is handled partially by software. It is expected that the
|
||||||
|
* command stream or shader will issue Cache Flush operation or
|
||||||
|
* Cache_Flush sampler message to ensure that the L1 cache remains
|
||||||
|
* coherent with system memory.
|
||||||
|
*
|
||||||
|
* [...]
|
||||||
|
*
|
||||||
|
* Whenever the value of the Dynamic_State_Base_Addr,
|
||||||
|
* Surface_State_Base_Addr are altered, the L1 state cache must be
|
||||||
|
* invalidated to ensure the new surface or sampler state is fetched
|
||||||
|
* from system memory.
|
||||||
|
*
|
||||||
|
* The PIPE_CONTROL command has a "State Cache Invalidation Enable" bit
|
||||||
|
* which, according the PIPE_CONTROL instruction documentation in the
|
||||||
|
* Broadwell PRM:
|
||||||
|
*
|
||||||
|
* Setting this bit is independent of any other bit in this packet.
|
||||||
|
* This bit controls the invalidation of the L1 and L2 state caches
|
||||||
|
* at the top of the pipe i.e. at the parsing time.
|
||||||
|
*
|
||||||
|
* Unfortunately, experimentation seems to indicate that state cache
|
||||||
|
* invalidation through a PIPE_CONTROL does nothing whatsoever in
|
||||||
|
* regards to surface state and binding tables. In stead, it seems that
|
||||||
|
* invalidating the texture cache is what is actually needed.
|
||||||
|
*
|
||||||
|
* XXX: As far as we have been able to determine through
|
||||||
|
* experimentation, shows that flush the texture cache appears to be
|
||||||
|
* sufficient. The theory here is that all of the sampling/rendering
|
||||||
|
* units cache the binding table in the texture cache. However, we have
|
||||||
|
* yet to be able to actually confirm this.
|
||||||
|
*/
|
||||||
|
anv_batch_emit(&cmd_buffer->batch, GEN8_PIPE_CONTROL,
|
||||||
|
.TextureCacheInvalidationEnable = true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -776,6 +776,8 @@ VkResult anv_cmd_buffer_new_surface_state_bo(struct anv_cmd_buffer *cmd_buffer);
|
|||||||
|
|
||||||
void anv_cmd_buffer_emit_state_base_address(struct anv_cmd_buffer *cmd_buffer);
|
void anv_cmd_buffer_emit_state_base_address(struct anv_cmd_buffer *cmd_buffer);
|
||||||
|
|
||||||
|
void gen8_cmd_buffer_emit_state_base_address(struct anv_cmd_buffer *cmd_buffer);
|
||||||
|
|
||||||
void anv_cmd_buffer_begin_subpass(struct anv_cmd_buffer *cmd_buffer,
|
void anv_cmd_buffer_begin_subpass(struct anv_cmd_buffer *cmd_buffer,
|
||||||
struct anv_subpass *subpass);
|
struct anv_subpass *subpass);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user