vk: Add basic MOCS settings

This matches what we do for GL.
This commit is contained in:
Kristian Høgsberg
2015-05-21 14:35:34 -07:00
parent c03314bdd3
commit 0997a7b2e3
3 changed files with 15 additions and 5 deletions

View File

@@ -1509,7 +1509,7 @@ VkResult anv_CreateBufferView(
.VerticalLineStrideOffset = 0, .VerticalLineStrideOffset = 0,
.SamplerL2BypassModeDisable = true, .SamplerL2BypassModeDisable = true,
.RenderCacheReadWriteMode = WriteOnlyCache, .RenderCacheReadWriteMode = WriteOnlyCache,
.MemoryObjectControlState = 0, /* FIXME: MOCS */ .MemoryObjectControlState = GEN8_MOCS,
.BaseMipLevel = 0, .BaseMipLevel = 0,
.SurfaceQPitch = 0, .SurfaceQPitch = 0,
.Height = (num_elements >> 7) & 0x3fff, .Height = (num_elements >> 7) & 0x3fff,
@@ -2211,25 +2211,29 @@ VkResult anv_BeginCommandBuffer(
anv_batch_emit(&cmd_buffer->batch, GEN8_STATE_BASE_ADDRESS, anv_batch_emit(&cmd_buffer->batch, GEN8_STATE_BASE_ADDRESS,
.GeneralStateBaseAddress = { NULL, 0 }, .GeneralStateBaseAddress = { NULL, 0 },
.GeneralStateMemoryObjectControlState = GEN8_MOCS,
.GeneralStateBaseAddressModifyEnable = true, .GeneralStateBaseAddressModifyEnable = true,
.GeneralStateBufferSize = 0xfffff, .GeneralStateBufferSize = 0xfffff,
.GeneralStateBufferSizeModifyEnable = true, .GeneralStateBufferSizeModifyEnable = true,
.SurfaceStateBaseAddress = { &cmd_buffer->surface_bo, 0 }, .SurfaceStateBaseAddress = { &cmd_buffer->surface_bo, 0 },
.SurfaceStateMemoryObjectControlState = 0, /* FIXME: MOCS */ .SurfaceStateMemoryObjectControlState = GEN8_MOCS,
.SurfaceStateBaseAddressModifyEnable = true, .SurfaceStateBaseAddressModifyEnable = true,
.DynamicStateBaseAddress = { &device->dynamic_state_block_pool.bo, 0 }, .DynamicStateBaseAddress = { &device->dynamic_state_block_pool.bo, 0 },
.DynamicStateMemoryObjectControlState = GEN8_MOCS,
.DynamicStateBaseAddressModifyEnable = true, .DynamicStateBaseAddressModifyEnable = true,
.DynamicStateBufferSize = 0xfffff, .DynamicStateBufferSize = 0xfffff,
.DynamicStateBufferSizeModifyEnable = true, .DynamicStateBufferSizeModifyEnable = true,
.IndirectObjectBaseAddress = { NULL, 0 }, .IndirectObjectBaseAddress = { NULL, 0 },
.IndirectObjectMemoryObjectControlState = GEN8_MOCS,
.IndirectObjectBaseAddressModifyEnable = true, .IndirectObjectBaseAddressModifyEnable = true,
.IndirectObjectBufferSize = 0xfffff, .IndirectObjectBufferSize = 0xfffff,
.IndirectObjectBufferSizeModifyEnable = true, .IndirectObjectBufferSizeModifyEnable = true,
.InstructionBaseAddress = { &device->instruction_block_pool.bo, 0 }, .InstructionBaseAddress = { &device->instruction_block_pool.bo, 0 },
.InstructionMemoryObjectControlState = GEN8_MOCS,
.InstructionBaseAddressModifyEnable = true, .InstructionBaseAddressModifyEnable = true,
.InstructionBufferSize = 0xfffff, .InstructionBufferSize = 0xfffff,
.InstructionBuffersizeModifyEnable = true); .InstructionBuffersizeModifyEnable = true);
@@ -2546,7 +2550,7 @@ void anv_CmdBindIndexBuffer(
anv_batch_emit(&cmd_buffer->batch, GEN8_3DSTATE_INDEX_BUFFER, anv_batch_emit(&cmd_buffer->batch, GEN8_3DSTATE_INDEX_BUFFER,
.IndexFormat = vk_to_gen_index_type[indexType], .IndexFormat = vk_to_gen_index_type[indexType],
.MemoryObjectControlState = 0, .MemoryObjectControlState = GEN8_MOCS,
.BufferStartingAddress = { buffer->bo, buffer->offset + offset }, .BufferStartingAddress = { buffer->bo, buffer->offset + offset },
.BufferSize = buffer->size - 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 = { struct GEN8_VERTEX_BUFFER_STATE state = {
.VertexBufferIndex = vb, .VertexBufferIndex = vb,
.MemoryObjectControlState = 0, .MemoryObjectControlState = GEN8_MOCS,
.AddressModifyEnable = true, .AddressModifyEnable = true,
.BufferPitch = pipeline->binding_stride[vb], .BufferPitch = pipeline->binding_stride[vb],
.BufferStartingAddress = { buffer->bo, buffer->offset + offset }, .BufferStartingAddress = { buffer->bo, buffer->offset + offset },

View File

@@ -149,7 +149,7 @@ create_surface_state(struct anv_device *device,
.VerticalLineStrideOffset = 0, .VerticalLineStrideOffset = 0,
.SamplerL2BypassModeDisable = true, .SamplerL2BypassModeDisable = true,
.RenderCacheReadWriteMode = WriteOnlyCache, .RenderCacheReadWriteMode = WriteOnlyCache,
.MemoryObjectControlState = 0, /* FIXME: MOCS */ .MemoryObjectControlState = GEN8_MOCS,
.BaseMipLevel = 0, .BaseMipLevel = 0,
.SurfaceQPitch = 0, .SurfaceQPitch = 0,
.Height = image->extent.height - 1, .Height = image->extent.height - 1,

View File

@@ -447,6 +447,12 @@ __gen_combine_address(struct anv_batch *batch, void *location,
dw[i] = (dwords0)[i] | (dwords1)[i]; \ dw[i] = (dwords0)[i] | (dwords1)[i]; \
} while (0) } while (0)
#define GEN8_MOCS { \
.MemoryTypeLLCeLLCCacheabilityControl = WB, \
.TargetCache = L3DefertoPATforLLCeLLCselection, \
.AgeforQUADLRU = 0 \
}
struct anv_device_memory { struct anv_device_memory {
struct anv_bo bo; struct anv_bo bo;
VkDeviceSize map_size; VkDeviceSize map_size;