From: Kristian Høgsberg Date: Thu, 21 May 2015 21:35:34 +0000 (-0700) Subject: vk: Add basic MOCS settings X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0997a7b2e3c0c1cef9c59feb706243c0bfec4e65;p=mesa.git vk: Add basic MOCS settings This matches what we do for GL. --- diff --git a/src/vulkan/device.c b/src/vulkan/device.c index 5d37ce8b3be..4301739022d 100644 --- a/src/vulkan/device.c +++ b/src/vulkan/device.c @@ -1509,7 +1509,7 @@ VkResult anv_CreateBufferView( .VerticalLineStrideOffset = 0, .SamplerL2BypassModeDisable = true, .RenderCacheReadWriteMode = WriteOnlyCache, - .MemoryObjectControlState = 0, /* FIXME: MOCS */ + .MemoryObjectControlState = GEN8_MOCS, .BaseMipLevel = 0, .SurfaceQPitch = 0, .Height = (num_elements >> 7) & 0x3fff, @@ -2211,25 +2211,29 @@ VkResult anv_BeginCommandBuffer( anv_batch_emit(&cmd_buffer->batch, GEN8_STATE_BASE_ADDRESS, .GeneralStateBaseAddress = { NULL, 0 }, + .GeneralStateMemoryObjectControlState = GEN8_MOCS, .GeneralStateBaseAddressModifyEnable = true, .GeneralStateBufferSize = 0xfffff, .GeneralStateBufferSizeModifyEnable = true, .SurfaceStateBaseAddress = { &cmd_buffer->surface_bo, 0 }, - .SurfaceStateMemoryObjectControlState = 0, /* FIXME: MOCS */ + .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); @@ -2546,7 +2550,7 @@ void anv_CmdBindIndexBuffer( anv_batch_emit(&cmd_buffer->batch, GEN8_3DSTATE_INDEX_BUFFER, .IndexFormat = vk_to_gen_index_type[indexType], - .MemoryObjectControlState = 0, + .MemoryObjectControlState = GEN8_MOCS, .BufferStartingAddress = { buffer->bo, buffer->offset + offset }, .BufferSize = buffer->size - offset); } @@ -2663,7 +2667,7 @@ anv_cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer) struct GEN8_VERTEX_BUFFER_STATE state = { .VertexBufferIndex = vb, - .MemoryObjectControlState = 0, + .MemoryObjectControlState = GEN8_MOCS, .AddressModifyEnable = true, .BufferPitch = pipeline->binding_stride[vb], .BufferStartingAddress = { buffer->bo, buffer->offset + offset }, diff --git a/src/vulkan/image.c b/src/vulkan/image.c index a7dc243b2a2..109a248b9a0 100644 --- a/src/vulkan/image.c +++ b/src/vulkan/image.c @@ -149,7 +149,7 @@ create_surface_state(struct anv_device *device, .VerticalLineStrideOffset = 0, .SamplerL2BypassModeDisable = true, .RenderCacheReadWriteMode = WriteOnlyCache, - .MemoryObjectControlState = 0, /* FIXME: MOCS */ + .MemoryObjectControlState = GEN8_MOCS, .BaseMipLevel = 0, .SurfaceQPitch = 0, .Height = image->extent.height - 1, diff --git a/src/vulkan/private.h b/src/vulkan/private.h index b957151cdbc..e3e5bd52a64 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -447,6 +447,12 @@ __gen_combine_address(struct anv_batch *batch, void *location, dw[i] = (dwords0)[i] | (dwords1)[i]; \ } while (0) +#define GEN8_MOCS { \ + .MemoryTypeLLCeLLCCacheabilityControl = WB, \ + .TargetCache = L3DefertoPATforLLCeLLCselection, \ + .AgeforQUADLRU = 0 \ + } + struct anv_device_memory { struct anv_bo bo; VkDeviceSize map_size;