vk: Add basic MOCS settings
authorKristian Høgsberg <kristian.h.kristensen@intel.com>
Thu, 21 May 2015 21:35:34 +0000 (14:35 -0700)
committerKristian Høgsberg <kristian.h.kristensen@intel.com>
Tue, 26 May 2015 03:20:31 +0000 (20:20 -0700)
This matches what we do for GL.

src/vulkan/device.c
src/vulkan/image.c
src/vulkan/private.h

index 5d37ce8b3be47bad775903e58dc69bc99851dbe0..4301739022dfc14727a4cd85f93a96d792c8534d 100644 (file)
@@ -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 },
index a7dc243b2a2c3419a61cc273fed585d1c1c56b67..109a248b9a03f7cba186d4ee66ca30d83339ec54 100644 (file)
@@ -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,
index b957151cdbc0358946d7b6d8c4f97c3a8314d6c2..e3e5bd52a64b65e754d2df578f43ae76789ea37c 100644 (file)
@@ -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;