<div dir="ltr">Looks good to me. <br></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Oct 10, 2018 at 10:52 AM Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 10/10/2018 16:34, Juan A. Suarez Romero wrote:<br>
> On Tue, 2018-10-02 at 16:11 -0500, Jason Ekstrand wrote:<br>
>> On Broadwell and above, we have to use different MOCS settings to allow<br>
>> the kernel to take over and disable caching when needed for external<br>
>> buffers. On Broadwell, this is especially important because the kernel<br>
>> can't disable eLLC so we have to do it in userspace. We very badly<br>
>> don't want to do that on everything so we need separate MOCS for<br>
>> external and internal BOs.<br>
>><br>
>> In order to do this, we add an anv-specific BO flag for "external" and<br>
>> use that to distinguish between buffers which may be shared with other<br>
>> processes and/or display and those which are entirely internal. That,<br>
>> together with an anv_mocs_for_bo helper lets us choose the right MOCS<br>
>> settings for each BO use.<br>
>><br>
>> Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=99507" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=99507</a><br>
>> Cc: <a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank">mesa-stable@lists.freedesktop.org</a><br>
><br>
> Unfortunately this didn't apply cleanly on 18.2 branch. I've resolved the<br>
> trivial conflicts, but it would be good if you can check if everything is<br>
> correct.<br>
><br>
> The fixed commit in 18.2 is<br>
><br>
><br>
> <a href="https://gitlab.freedesktop.org/mesa/mesa/commit/8927cf03bbb64d0be1fbb68f1a505b81d3e8ba26" rel="noreferrer" target="_blank">https://gitlab.freedesktop.org/mesa/mesa/commit/8927cf03bbb64d0be1fbb68f1a505b81d3e8ba26</a><br>
><br>
><br>
> Thanks in advance!<br>
<br>
Hi Juan,<br>
<br>
This backport looks good to me.<br>
<br>
Thanks!<br>
<br>
-<br>
Lionel<br>
<br>
<br>
><br>
><br>
> J.A.<br>
><br>
>> ---<br>
>> src/intel/vulkan/anv_allocator.c | 12 ++++++++--<br>
>> src/intel/vulkan/anv_batch_chain.c | 2 +-<br>
>> src/intel/vulkan/anv_blorp.c | 15 ++++++------<br>
>> src/intel/vulkan/anv_device.c | 9 +++++--<br>
>> src/intel/vulkan/anv_image.c | 5 ++--<br>
>> src/intel/vulkan/anv_intel.c | 2 +-<br>
>> src/intel/vulkan/anv_private.h | 38 +++++++++++++++++++++++-------<br>
>> src/intel/vulkan/gen7_cmd_buffer.c | 3 ++-<br>
>> src/intel/vulkan/gen8_cmd_buffer.c | 3 ++-<br>
>> src/intel/vulkan/genX_cmd_buffer.c | 18 +++++++-------<br>
>> src/intel/vulkan/genX_gpu_memcpy.c | 5 ++--<br>
>> src/intel/vulkan/genX_state.c | 6 +++++<br>
>> 12 files changed, 80 insertions(+), 38 deletions(-)<br>
>><br>
>> diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c<br>
>> index ab01d46cbeb..f62d48ae3fe 100644<br>
>> --- a/src/intel/vulkan/anv_allocator.c<br>
>> +++ b/src/intel/vulkan/anv_allocator.c<br>
>> @@ -1253,7 +1253,8 @@ anv_bo_cache_lookup(struct anv_bo_cache *cache, uint32_t gem_handle)<br>
>> (EXEC_OBJECT_WRITE | \<br>
>> EXEC_OBJECT_ASYNC | \<br>
>> EXEC_OBJECT_SUPPORTS_48B_ADDRESS | \<br>
>> - EXEC_OBJECT_PINNED)<br>
>> + EXEC_OBJECT_PINNED | \<br>
>> + ANV_BO_EXTERNAL)<br>
>> <br>
>> VkResult<br>
>> anv_bo_cache_alloc(struct anv_device *device,<br>
>> @@ -1311,6 +1312,7 @@ anv_bo_cache_import(struct anv_device *device,<br>
>> struct anv_bo **bo_out)<br>
>> {<br>
>> assert(bo_flags == (bo_flags & ANV_BO_CACHE_SUPPORTED_FLAGS));<br>
>> + assert(bo_flags & ANV_BO_EXTERNAL);<br>
>> <br>
>> pthread_mutex_lock(&cache->mutex);<br>
>> <br>
>> @@ -1327,7 +1329,7 @@ anv_bo_cache_import(struct anv_device *device,<br>
>> * client has imported a BO twice in different ways and they get what<br>
>> * they have coming.<br>
>> */<br>
>> - uint64_t new_flags = 0;<br>
>> + uint64_t new_flags = ANV_BO_EXTERNAL;<br>
>> new_flags |= (bo->bo.flags | bo_flags) & EXEC_OBJECT_WRITE;<br>
>> new_flags |= (bo->bo.flags & bo_flags) & EXEC_OBJECT_ASYNC;<br>
>> new_flags |= (bo->bo.flags & bo_flags) & EXEC_OBJECT_SUPPORTS_48B_ADDRESS;<br>
>> @@ -1411,6 +1413,12 @@ anv_bo_cache_export(struct anv_device *device,<br>
>> assert(anv_bo_cache_lookup(cache, bo_in->gem_handle) == bo_in);<br>
>> struct anv_cached_bo *bo = (struct anv_cached_bo *)bo_in;<br>
>> <br>
>> + /* This BO must have been flagged external in order for us to be able<br>
>> + * to export it. This is done based on external options passed into<br>
>> + * anv_AllocateMemory.<br>
>> + */<br>
>> + assert(bo->bo.flags & ANV_BO_EXTERNAL);<br>
>> +<br>
>> int fd = anv_gem_handle_to_fd(device, bo->bo.gem_handle);<br>
>> if (fd < 0)<br>
>> return vk_error(VK_ERROR_TOO_MANY_OBJECTS);<br>
>> diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c<br>
>> index 0f7c8325ea4..3e13553ac18 100644<br>
>> --- a/src/intel/vulkan/anv_batch_chain.c<br>
>> +++ b/src/intel/vulkan/anv_batch_chain.c<br>
>> @@ -1088,7 +1088,7 @@ anv_execbuf_add_bo(struct anv_execbuf *exec,<br>
>> obj->relocs_ptr = 0;<br>
>> obj->alignment = 0;<br>
>> obj->offset = bo->offset;<br>
>> - obj->flags = bo->flags | extra_flags;<br>
>> + obj->flags = (bo->flags & ~ANV_BO_FLAG_MASK) | extra_flags;<br>
>> obj->rsvd1 = 0;<br>
>> obj->rsvd2 = 0;<br>
>> }<br>
>> diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c<br>
>> index fa7936d0981..29ed6b2ee35 100644<br>
>> --- a/src/intel/vulkan/anv_blorp.c<br>
>> +++ b/src/intel/vulkan/anv_blorp.c<br>
>> @@ -156,7 +156,7 @@ get_blorp_surf_for_anv_buffer(struct anv_device *device,<br>
>> .addr = {<br>
>> .buffer = buffer-><a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>,<br>
>> .offset = buffer->address.offset + offset,<br>
>> - .mocs = device->default_mocs,<br>
>> + .mocs = anv_mocs_for_bo(device, buffer-><a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>),<br>
>> },<br>
>> };<br>
>> <br>
>> @@ -209,7 +209,7 @@ get_blorp_surf_for_anv_image(const struct anv_device *device,<br>
>> .addr = {<br>
>> .buffer = image->planes[plane].<a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>,<br>
>> .offset = image->planes[plane].address.offset + surface->offset,<br>
>> - .mocs = device->default_mocs,<br>
>> + .mocs = anv_mocs_for_bo(device, image->planes[plane].<a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>),<br>
>> },<br>
>> };<br>
>> <br>
>> @@ -219,7 +219,7 @@ get_blorp_surf_for_anv_image(const struct anv_device *device,<br>
>> blorp_surf->aux_addr = (struct blorp_address) {<br>
>> .buffer = image->planes[plane].<a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>,<br>
>> .offset = image->planes[plane].address.offset + aux_surface->offset,<br>
>> - .mocs = device->default_mocs,<br>
>> + .mocs = anv_mocs_for_bo(device, image->planes[plane].<a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>),<br>
>> };<br>
>> blorp_surf->aux_usage = aux_usage;<br>
>> <br>
>> @@ -669,12 +669,12 @@ void anv_CmdCopyBuffer(<br>
>> struct blorp_address src = {<br>
>> .buffer = src_buffer-><a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>,<br>
>> .offset = src_buffer->address.offset + pRegions[r].srcOffset,<br>
>> - .mocs = cmd_buffer->device->default_mocs,<br>
>> + .mocs = anv_mocs_for_bo(cmd_buffer->device, src_buffer-><a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>),<br>
>> };<br>
>> struct blorp_address dst = {<br>
>> .buffer = dst_buffer-><a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>,<br>
>> .offset = dst_buffer->address.offset + pRegions[r].dstOffset,<br>
>> - .mocs = cmd_buffer->device->default_mocs,<br>
>> + .mocs = anv_mocs_for_bo(cmd_buffer->device, dst_buffer-><a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>),<br>
>> };<br>
>> <br>
>> blorp_buffer_copy(&batch, src, dst, pRegions[r].size);<br>
>> @@ -727,7 +727,7 @@ void anv_CmdUpdateBuffer(<br>
>> struct blorp_address dst = {<br>
>> .buffer = dst_buffer-><a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>,<br>
>> .offset = dst_buffer->address.offset + dstOffset,<br>
>> - .mocs = cmd_buffer->device->default_mocs,<br>
>> + .mocs = anv_mocs_for_bo(cmd_buffer->device, dst_buffer-><a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>),<br>
>> };<br>
>> <br>
>> blorp_buffer_copy(&batch, src, dst, copy_size);<br>
>> @@ -1437,7 +1437,8 @@ anv_image_copy_to_shadow(struct anv_cmd_buffer *cmd_buffer,<br>
>> .buffer = image->planes[0].<a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>,<br>
>> .offset = image->planes[0].address.offset +<br>
>> image->planes[0].shadow_surface.offset,<br>
>> - .mocs = cmd_buffer->device->default_mocs,<br>
>> + .mocs = anv_mocs_for_bo(cmd_buffer->device,<br>
>> + image->planes[0].<a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>),<br>
>> },<br>
>> };<br>
>> <br>
>> diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c<br>
>> index eae93587349..d9d9553aec2 100644<br>
>> --- a/src/intel/vulkan/anv_device.c<br>
>> +++ b/src/intel/vulkan/anv_device.c<br>
>> @@ -2278,8 +2278,8 @@ VkResult anv_AllocateMemory(<br>
>> fd_info->handleType ==<br>
>> VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT);<br>
>> <br>
>> - result = anv_bo_cache_import(device, &device->bo_cache,<br>
>> - fd_info->fd, bo_flags, &mem->bo);<br>
>> + result = anv_bo_cache_import(device, &device->bo_cache, fd_info->fd,<br>
>> + bo_flags | ANV_BO_EXTERNAL, &mem->bo);<br>
>> if (result != VK_SUCCESS)<br>
>> goto fail;<br>
>> <br>
>> @@ -2316,6 +2316,11 @@ VkResult anv_AllocateMemory(<br>
>> */<br>
>> close(fd_info->fd);<br>
>> } else {<br>
>> + const VkExportMemoryAllocateInfoKHR *fd_info =<br>
>> + vk_find_struct_const(pAllocateInfo->pNext, EXPORT_MEMORY_ALLOCATE_INFO_KHR);<br>
>> + if (fd_info && fd_info->handleTypes)<br>
>> + bo_flags |= ANV_BO_EXTERNAL;<br>
>> +<br>
>> result = anv_bo_cache_alloc(device, &device->bo_cache,<br>
>> pAllocateInfo->allocationSize, bo_flags,<br>
>> &mem->bo);<br>
>> diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c<br>
>> index b0d8c560adb..ad820917f23 100644<br>
>> --- a/src/intel/vulkan/anv_image.c<br>
>> +++ b/src/intel/vulkan/anv_image.c<br>
>> @@ -1097,7 +1097,7 @@ anv_image_fill_surface_state(struct anv_device *device,<br>
>> .size_B = surface->isl.size_B,<br>
>> .format = ISL_FORMAT_RAW,<br>
>> .stride_B = 1,<br>
>> - .mocs = device->default_mocs);<br>
>> + .mocs = anv_mocs_for_bo(device, <a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>));<br>
>> state_inout->address = address,<br>
>> state_inout->aux_address = ANV_NULL_ADDRESS;<br>
>> state_inout->clear_address = ANV_NULL_ADDRESS;<br>
>> @@ -1198,7 +1198,8 @@ anv_image_fill_surface_state(struct anv_device *device,<br>
>> .aux_address = anv_address_physical(aux_address),<br>
>> .clear_address = anv_address_physical(clear_address),<br>
>> .use_clear_address = !anv_address_is_null(clear_address),<br>
>> - .mocs = device->default_mocs,<br>
>> + .mocs = anv_mocs_for_bo(device,<br>
>> + state_inout-><a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>),<br>
>> .x_offset_sa = tile_x_sa,<br>
>> .y_offset_sa = tile_y_sa);<br>
>> <br>
>> diff --git a/src/intel/vulkan/anv_intel.c b/src/intel/vulkan/anv_intel.c<br>
>> index 06db5787a9c..ed1bc096c66 100644<br>
>> --- a/src/intel/vulkan/anv_intel.c<br>
>> +++ b/src/intel/vulkan/anv_intel.c<br>
>> @@ -73,7 +73,7 @@ VkResult anv_CreateDmaBufImageINTEL(<br>
>> <br>
>> image = anv_image_from_handle(image_h);<br>
>> <br>
>> - uint64_t bo_flags = 0;<br>
>> + uint64_t bo_flags = ANV_BO_EXTERNAL;<br>
>> if (device->instance->physicalDevice.supports_48bit_addresses)<br>
>> bo_flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;<br>
>> if (device->instance->physicalDevice.use_softpin)<br>
>> diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h<br>
>> index 0b78d59e567..926f353aa4b 100644<br>
>> --- a/src/intel/vulkan/anv_private.h<br>
>> +++ b/src/intel/vulkan/anv_private.h<br>
>> @@ -558,6 +558,10 @@ anv_multialloc_alloc2(struct anv_multialloc *ma,<br>
>> return anv_multialloc_alloc(ma, alloc ? alloc : parent_alloc, scope);<br>
>> }<br>
>> <br>
>> +/* Extra ANV-defined BO flags which won't be passed to the kernel */<br>
>> +#define ANV_BO_EXTERNAL (1ull << 31)<br>
>> +#define ANV_BO_FLAG_MASK (1ull << 31)<br>
>> +<br>
>> struct anv_bo {<br>
>> uint32_t gem_handle;<br>
>> <br>
>> @@ -1018,6 +1022,7 @@ struct anv_device {<br>
>> struct anv_scratch_pool scratch_pool;<br>
>> <br>
>> uint32_t default_mocs;<br>
>> + uint32_t external_mocs;<br>
>> <br>
>> pthread_mutex_t mutex;<br>
>> pthread_cond_t queue_submit;<br>
>> @@ -1047,6 +1052,15 @@ anv_binding_table_pool_free(struct anv_device *device, struct anv_state state) {<br>
>> anv_state_pool_free(anv_binding_table_pool(device), state);<br>
>> }<br>
>> <br>
>> +static inline uint32_t<br>
>> +anv_mocs_for_bo(const struct anv_device *device, const struct anv_bo *bo)<br>
>> +{<br>
>> + if (bo->flags & ANV_BO_EXTERNAL)<br>
>> + return device->external_mocs;<br>
>> + else<br>
>> + return device->default_mocs;<br>
>> +}<br>
>> +<br>
>> static void inline<br>
>> anv_state_flush(struct anv_device *device, struct anv_state state)<br>
>> {<br>
>> @@ -1328,6 +1342,12 @@ _anv_combine_address(struct anv_batch *batch, void *location,<br>
>> .AgeforQUADLRU = 0 \<br>
>> }<br>
>> <br>
>> +#define GEN8_EXTERNAL_MOCS (struct GEN8_MEMORY_OBJECT_CONTROL_STATE) { \<br>
>> + .MemoryTypeLLCeLLCCacheabilityControl = UCwithFenceifcoherentcycle, \<br>
>> + .TargetCache = L3DefertoPATforLLCeLLCselection, \<br>
>> + .AgeforQUADLRU = 0 \<br>
>> + }<br>
>> +<br>
>> /* Skylake: MOCS is now an index into an array of 62 different caching<br>
>> * configurations programmed by the kernel.<br>
>> */<br>
>> @@ -1337,9 +1357,9 @@ _anv_combine_address(struct anv_batch *batch, void *location,<br>
>> .IndextoMOCSTables = 2 \<br>
>> }<br>
>> <br>
>> -#define GEN9_MOCS_PTE { \<br>
>> - /* TC=LLC/eLLC, LeCC=WB, LRUM=3, L3CC=WB */ \<br>
>> - .IndextoMOCSTables = 1 \<br>
>> +#define GEN9_EXTERNAL_MOCS (struct GEN9_MEMORY_OBJECT_CONTROL_STATE) { \<br>
>> + /* TC=LLC/eLLC, LeCC=WB, LRUM=3, L3CC=WB */ \<br>
>> + .IndextoMOCSTables = 1 \<br>
>> }<br>
>> <br>
>> /* Cannonlake MOCS defines are duplicates of Skylake MOCS defines. */<br>
>> @@ -1348,9 +1368,9 @@ _anv_combine_address(struct anv_batch *batch, void *location,<br>
>> .IndextoMOCSTables = 2 \<br>
>> }<br>
>> <br>
>> -#define GEN10_MOCS_PTE { \<br>
>> - /* TC=LLC/eLLC, LeCC=WB, LRUM=3, L3CC=WB */ \<br>
>> - .IndextoMOCSTables = 1 \<br>
>> +#define GEN10_EXTERNAL_MOCS (struct GEN10_MEMORY_OBJECT_CONTROL_STATE) { \<br>
>> + /* TC=LLC/eLLC, LeCC=WB, LRUM=3, L3CC=WB */ \<br>
>> + .IndextoMOCSTables = 1 \<br>
>> }<br>
>> <br>
>> /* Ice Lake MOCS defines are duplicates of Skylake MOCS defines. */<br>
>> @@ -1359,9 +1379,9 @@ _anv_combine_address(struct anv_batch *batch, void *location,<br>
>> .IndextoMOCSTables = 2 \<br>
>> }<br>
>> <br>
>> -#define GEN11_MOCS_PTE { \<br>
>> - /* TC=LLC/eLLC, LeCC=WB, LRUM=3, L3CC=WB */ \<br>
>> - .IndextoMOCSTables = 1 \<br>
>> +#define GEN11_EXTERNAL_MOCS (struct GEN11_MEMORY_OBJECT_CONTROL_STATE) { \<br>
>> + /* TC=LLC/eLLC, LeCC=WB, LRUM=3, L3CC=WB */ \<br>
>> + .IndextoMOCSTables = 1 \<br>
>> }<br>
>> <br>
>> struct anv_device_memory {<br>
>> diff --git a/src/intel/vulkan/gen7_cmd_buffer.c b/src/intel/vulkan/gen7_cmd_buffer.c<br>
>> index cf1f8ee2829..da51cb9781c 100644<br>
>> --- a/src/intel/vulkan/gen7_cmd_buffer.c<br>
>> +++ b/src/intel/vulkan/gen7_cmd_buffer.c<br>
>> @@ -246,7 +246,8 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)<br>
>> ib.CutIndexEnable = pipeline->primitive_restart;<br>
>> #endif<br>
>> ib.IndexFormat = cmd_buffer->state.gfx.gen7.index_type;<br>
>> - ib.MemoryObjectControlState = GENX(MOCS);<br>
>> + ib.IndexBufferMOCS = anv_mocs_for_bo(cmd_buffer->device,<br>
>> + buffer-><a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>);<br>
>> <br>
>> ib.BufferStartingAddress = anv_address_add(buffer->address,<br>
>> offset);<br>
>> diff --git a/src/intel/vulkan/gen8_cmd_buffer.c b/src/intel/vulkan/gen8_cmd_buffer.c<br>
>> index ca2baf84a19..752d04f3013 100644<br>
>> --- a/src/intel/vulkan/gen8_cmd_buffer.c<br>
>> +++ b/src/intel/vulkan/gen8_cmd_buffer.c<br>
>> @@ -565,7 +565,8 @@ void genX(CmdBindIndexBuffer)(<br>
>> <br>
>> anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_INDEX_BUFFER), ib) {<br>
>> ib.IndexFormat = vk_to_gen_index_type[indexType];<br>
>> - ib.MemoryObjectControlState = GENX(MOCS);<br>
>> + ib.IndexBufferMOCS = anv_mocs_for_bo(cmd_buffer->device,<br>
>> + buffer-><a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>);<br>
>> ib.BufferStartingAddress = anv_address_add(buffer->address, offset);<br>
>> ib.BufferSize = buffer->size - offset;<br>
>> }<br>
>> diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c<br>
>> index a543860b976..c112a4afa10 100644<br>
>> --- a/src/intel/vulkan/genX_cmd_buffer.c<br>
>> +++ b/src/intel/vulkan/genX_cmd_buffer.c<br>
>> @@ -2547,12 +2547,11 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer)<br>
>> struct GENX(VERTEX_BUFFER_STATE) state = {<br>
>> .VertexBufferIndex = vb,<br>
>> <br>
>> -#if GEN_GEN >= 8<br>
>> - .MemoryObjectControlState = GENX(MOCS),<br>
>> -#else<br>
>> + .VertexBufferMOCS = anv_mocs_for_bo(cmd_buffer->device,<br>
>> + buffer-><a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>),<br>
>> +#if GEN_GEN <= 7<br>
>> .BufferAccessType = pipeline->vb[vb].instanced ? INSTANCEDATA : VERTEXDATA,<br>
>> .InstanceDataStepRate = pipeline->vb[vb].instance_divisor,<br>
>> - .VertexBufferMemoryObjectControlState = GENX(MOCS),<br>
>> #endif<br>
>> <br>
>> .AddressModifyEnable = true,<br>
>> @@ -2691,12 +2690,11 @@ emit_vertex_bo(struct anv_cmd_buffer *cmd_buffer,<br>
>> .VertexBufferIndex = index,<br>
>> .AddressModifyEnable = true,<br>
>> .BufferPitch = 0,<br>
>> + .VertexBufferMOCS = anv_mocs_for_bo(cmd_buffer->device, <a href="http://addr.bo" rel="noreferrer" target="_blank">addr.bo</a>),<br>
>> #if (GEN_GEN >= 8)<br>
>> - .MemoryObjectControlState = GENX(MOCS),<br>
>> .BufferStartingAddress = addr,<br>
>> .BufferSize = size<br>
>> #else<br>
>> - .VertexBufferMemoryObjectControlState = GENX(MOCS),<br>
>> .BufferStartingAddress = addr,<br>
>> .EndAddress = anv_address_add(addr, size),<br>
>> #endif<br>
>> @@ -3681,9 +3679,7 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)<br>
>> if (dw == NULL)<br>
>> return;<br>
>> <br>
>> - struct isl_depth_stencil_hiz_emit_info info = {<br>
>> - .mocs = device->default_mocs,<br>
>> - };<br>
>> + struct isl_depth_stencil_hiz_emit_info info = { };<br>
>> <br>
>> if (iview)<br>
>> info.view = &iview->planes[0].isl;<br>
>> @@ -3701,6 +3697,8 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)<br>
>> image->planes[depth_plane].<a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>,<br>
>> image->planes[depth_plane].address.offset +<br>
>> surface->offset);<br>
>> + info.mocs =<br>
>> + anv_mocs_for_bo(device, image->planes[depth_plane].<a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>);<br>
>> <br>
>> const uint32_t ds =<br>
>> cmd_buffer->state.subpass->depth_stencil_attachment->attachment;<br>
>> @@ -3732,6 +3730,8 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)<br>
>> image->planes[stencil_plane].<a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>,<br>
>> image->planes[stencil_plane].address.offset +<br>
>> surface->offset);<br>
>> + info.mocs =<br>
>> + anv_mocs_for_bo(device, image->planes[stencil_plane].<a href="http://address.bo" rel="noreferrer" target="_blank">address.bo</a>);<br>
>> }<br>
>> <br>
>> isl_emit_depth_stencil_hiz_s(&device->isl_dev, dw, &info);<br>
>> diff --git a/src/intel/vulkan/genX_gpu_memcpy.c b/src/intel/vulkan/genX_gpu_memcpy.c<br>
>> index fd78f4d125b..81522986550 100644<br>
>> --- a/src/intel/vulkan/genX_gpu_memcpy.c<br>
>> +++ b/src/intel/vulkan/genX_gpu_memcpy.c<br>
>> @@ -167,11 +167,10 @@ genX(cmd_buffer_so_memcpy)(struct anv_cmd_buffer *cmd_buffer,<br>
>> .AddressModifyEnable = true,<br>
>> .BufferStartingAddress = src,<br>
>> .BufferPitch = bs,<br>
>> + .VertexBufferMOCS = anv_mocs_for_bo(cmd_buffer->device, <a href="http://src.bo" rel="noreferrer" target="_blank">src.bo</a>),<br>
>> #if (GEN_GEN >= 8)<br>
>> - .MemoryObjectControlState = GENX(MOCS),<br>
>> .BufferSize = size,<br>
>> #else<br>
>> - .VertexBufferMemoryObjectControlState = GENX(MOCS),<br>
>> .EndAddress = anv_address_add(src, size - 1),<br>
>> #endif<br>
>> });<br>
>> @@ -228,7 +227,7 @@ genX(cmd_buffer_so_memcpy)(struct anv_cmd_buffer *cmd_buffer,<br>
>> <br>
>> anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_SO_BUFFER), sob) {<br>
>> sob.SOBufferIndex = 0;<br>
>> - sob.SOBufferObjectControlState = GENX(MOCS);<br>
>> + sob.SOBufferMOCS = anv_mocs_for_bo(cmd_buffer->device, <a href="http://dst.bo" rel="noreferrer" target="_blank">dst.bo</a>),<br>
>> sob.SurfaceBaseAddress = dst;<br>
>> <br>
>> #if GEN_GEN >= 8<br>
>> diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c<br>
>> index aa5bce5a801..75bcd96d78a 100644<br>
>> --- a/src/intel/vulkan/genX_state.c<br>
>> +++ b/src/intel/vulkan/genX_state.c<br>
>> @@ -93,6 +93,12 @@ genX(init_device_state)(struct anv_device *device)<br>
>> {<br>
>> GENX(MEMORY_OBJECT_CONTROL_STATE_pack)(NULL, &device->default_mocs,<br>
>> &GENX(MOCS));<br>
>> +#if GEN_GEN >= 8<br>
>> + GENX(MEMORY_OBJECT_CONTROL_STATE_pack)(NULL, &device->external_mocs,<br>
>> + &GENX(EXTERNAL_MOCS));<br>
>> +#else<br>
>> + device->external_mocs = device->default_mocs;<br>
>> +#endif<br>
>> <br>
>> struct anv_batch batch;<br>
>> <br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
<br>
<br>
</blockquote></div>