From d4f628235ee03e3681906e52bd7af10349d4013c Mon Sep 17 00:00:00 2001 From: Rafael Antognolli Date: Tue, 5 Nov 2019 11:12:36 -0800 Subject: [PATCH] anv: Use mocs settings from isl_dev. v2: Remove device->default_mocs and external_mocs (Jason). Reviewed-by: Jordan Justen Acked-by: Lionel Landwerlin --- src/intel/vulkan/anv_blorp.c | 2 +- src/intel/vulkan/anv_device.c | 2 +- src/intel/vulkan/anv_private.h | 57 ++---------------------------- src/intel/vulkan/genX_blorp_exec.c | 2 +- src/intel/vulkan/genX_cmd_buffer.c | 19 +++++----- src/intel/vulkan/genX_state.c | 7 ---- 6 files changed, 15 insertions(+), 74 deletions(-) diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index af22fc08bb7..59ad344d911 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -795,7 +795,7 @@ void anv_CmdUpdateBuffer( struct blorp_address src = { .buffer = cmd_buffer->device->dynamic_state_pool.block_pool.bo, .offset = tmp_data.offset, - .mocs = cmd_buffer->device->default_mocs, + .mocs = cmd_buffer->device->isl_dev.mocs.internal, }; struct blorp_address dst = { .buffer = dst_buffer->address.bo, diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 74cefbffbf1..28a652867d9 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -3944,7 +3944,7 @@ anv_fill_buffer_surface_state(struct anv_device *device, struct anv_state state, { isl_buffer_fill_state(&device->isl_dev, state.map, .address = anv_address_physical(address), - .mocs = device->default_mocs, + .mocs = device->isl_dev.mocs.internal, .size_B = range, .format = format, .swizzle = ISL_SWIZZLE_IDENTITY, diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index b1586f4c32b..0b1e97c64b6 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1243,9 +1243,6 @@ struct anv_device { struct anv_scratch_pool scratch_pool; - uint32_t default_mocs; - uint32_t external_mocs; - pthread_mutex_t mutex; pthread_cond_t queue_submit; int _lost; @@ -1290,9 +1287,9 @@ static inline uint32_t anv_mocs_for_bo(const struct anv_device *device, const struct anv_bo *bo) { if (bo->is_external) - return device->external_mocs; + return device->isl_dev.mocs.external; else - return device->default_mocs; + return device->isl_dev.mocs.internal; } void anv_device_init_blorp(struct anv_device *device); @@ -1634,56 +1631,6 @@ _anv_combine_address(struct anv_batch *batch, void *location, _dst = NULL; \ })) -/* MEMORY_OBJECT_CONTROL_STATE: - * .GraphicsDataTypeGFDT = 0, - * .LLCCacheabilityControlLLCCC = 0, - * .L3CacheabilityControlL3CC = 1, - */ -#define GEN7_MOCS 1 - -/* MEMORY_OBJECT_CONTROL_STATE: - * .LLCeLLCCacheabilityControlLLCCC = 0, - * .L3CacheabilityControlL3CC = 1, - */ -#define GEN75_MOCS 1 - -/* MEMORY_OBJECT_CONTROL_STATE: - * .MemoryTypeLLCeLLCCacheabilityControl = WB, - * .TargetCache = L3DefertoPATforLLCeLLCselection, - * .AgeforQUADLRU = 0 - */ -#define GEN8_MOCS 0x78 - -/* MEMORY_OBJECT_CONTROL_STATE: - * .MemoryTypeLLCeLLCCacheabilityControl = UCwithFenceifcoherentcycle, - * .TargetCache = L3DefertoPATforLLCeLLCselection, - * .AgeforQUADLRU = 0 - */ -#define GEN8_EXTERNAL_MOCS 0x18 - -/* Skylake: MOCS is now an index into an array of 62 different caching - * configurations programmed by the kernel. - */ - -/* TC=LLC/eLLC, LeCC=WB, LRUM=3, L3CC=WB */ -#define GEN9_MOCS (2 << 1) - -/* TC=LLC/eLLC, LeCC=WB, LRUM=3, L3CC=WB */ -#define GEN9_EXTERNAL_MOCS (1 << 1) - -/* Cannonlake MOCS defines are duplicates of Skylake MOCS defines. */ -#define GEN10_MOCS GEN9_MOCS -#define GEN10_EXTERNAL_MOCS GEN9_EXTERNAL_MOCS - -/* Ice Lake MOCS defines are duplicates of Skylake MOCS defines. */ -#define GEN11_MOCS GEN9_MOCS -#define GEN11_EXTERNAL_MOCS GEN9_EXTERNAL_MOCS - -/* TigerLake MOCS */ -#define GEN12_MOCS GEN9_MOCS -/* TC=1/LLC Only, LeCC=1/Uncacheable, LRUM=0, L3CC=1/Uncacheable */ -#define GEN12_EXTERNAL_MOCS (3 << 1) - struct anv_device_memory { struct list_head link; diff --git a/src/intel/vulkan/genX_blorp_exec.c b/src/intel/vulkan/genX_blorp_exec.c index 9aa4bbf0a08..c68607b9526 100644 --- a/src/intel/vulkan/genX_blorp_exec.c +++ b/src/intel/vulkan/genX_blorp_exec.c @@ -158,7 +158,7 @@ blorp_alloc_vertex_buffer(struct blorp_batch *batch, uint32_t size, *addr = (struct blorp_address) { .buffer = cmd_buffer->device->dynamic_state_pool.block_pool.bo, .offset = vb_state.offset, - .mocs = cmd_buffer->device->default_mocs, + .mocs = cmd_buffer->device->isl_dev.mocs.internal, }; return vb_state.map; diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index a020fa200d4..5342cd7860f 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -53,6 +53,7 @@ void genX(cmd_buffer_emit_state_base_address)(struct anv_cmd_buffer *cmd_buffer) { struct anv_device *device = cmd_buffer->device; + uint32_t mocs = device->isl_dev.mocs.internal; /* If we are emitting a new state base address we probably need to re-emit * binding tables. @@ -77,28 +78,28 @@ genX(cmd_buffer_emit_state_base_address)(struct anv_cmd_buffer *cmd_buffer) anv_batch_emit(&cmd_buffer->batch, GENX(STATE_BASE_ADDRESS), sba) { sba.GeneralStateBaseAddress = (struct anv_address) { NULL, 0 }; - sba.GeneralStateMOCS = GENX(MOCS); + sba.GeneralStateMOCS = mocs; sba.GeneralStateBaseAddressModifyEnable = true; - sba.StatelessDataPortAccessMOCS = GENX(MOCS); + sba.StatelessDataPortAccessMOCS = mocs; sba.SurfaceStateBaseAddress = anv_cmd_buffer_surface_base_address(cmd_buffer); - sba.SurfaceStateMOCS = GENX(MOCS); + sba.SurfaceStateMOCS = mocs; sba.SurfaceStateBaseAddressModifyEnable = true; sba.DynamicStateBaseAddress = (struct anv_address) { device->dynamic_state_pool.block_pool.bo, 0 }; - sba.DynamicStateMOCS = GENX(MOCS); + sba.DynamicStateMOCS = mocs; sba.DynamicStateBaseAddressModifyEnable = true; sba.IndirectObjectBaseAddress = (struct anv_address) { NULL, 0 }; - sba.IndirectObjectMOCS = GENX(MOCS); + sba.IndirectObjectMOCS = mocs; sba.IndirectObjectBaseAddressModifyEnable = true; sba.InstructionBaseAddress = (struct anv_address) { device->instruction_state_pool.block_pool.bo, 0 }; - sba.InstructionMOCS = GENX(MOCS); + sba.InstructionMOCS = mocs; sba.InstructionBaseAddressModifyEnable = true; # if (GEN_GEN >= 8) @@ -143,12 +144,12 @@ genX(cmd_buffer_emit_state_base_address)(struct anv_cmd_buffer *cmd_buffer) sba.BindlessSurfaceStateBaseAddress = ANV_NULL_ADDRESS; sba.BindlessSurfaceStateSize = 0; } - sba.BindlessSurfaceStateMOCS = GENX(MOCS); + sba.BindlessSurfaceStateMOCS = mocs; sba.BindlessSurfaceStateBaseAddressModifyEnable = true; # endif # if (GEN_GEN >= 10) sba.BindlessSamplerStateBaseAddress = (struct anv_address) { NULL, 0 }; - sba.BindlessSamplerStateMOCS = GENX(MOCS); + sba.BindlessSamplerStateMOCS = mocs; sba.BindlessSamplerStateBaseAddressModifyEnable = true; sba.BindlessSamplerStateBufferSize = 0; # endif @@ -2788,7 +2789,7 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer) if (cmd_buffer->state.xfb_enabled && xfb->buffer && xfb->size != 0) { sob.SOBufferEnable = true; - sob.MOCS = cmd_buffer->device->default_mocs, + sob.MOCS = cmd_buffer->device->isl_dev.mocs.internal, sob.StreamOffsetWriteEnable = false; sob.SurfaceBaseAddress = anv_address_add(xfb->buffer->address, xfb->offset); diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c index cd0ced4d163..81739acf065 100644 --- a/src/intel/vulkan/genX_state.c +++ b/src/intel/vulkan/genX_state.c @@ -164,13 +164,6 @@ genX(emit_slice_hashing_state)(struct anv_device *device, VkResult genX(init_device_state)(struct anv_device *device) { - device->default_mocs = GENX(MOCS); -#if GEN_GEN >= 8 - device->external_mocs = GENX(EXTERNAL_MOCS); -#else - device->external_mocs = device->default_mocs; -#endif - struct anv_batch batch; uint32_t cmds[64]; -- 2.30.2