diff options
author | Jason Ekstrand <[email protected]> | 2018-07-09 14:21:33 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-10-03 09:03:03 -0500 |
commit | 7a89a0d9edae638e68e4b4ee8e0cbb34baa9c080 (patch) | |
tree | 2772d7f0a493ea3b543dddfa642a4b4dece2d8cb /src/intel/vulkan/anv_device.c | |
parent | 08bff097e136042aa5e5a0c99b1b67871525e5fe (diff) |
anv: Use separate MOCS settings for external BOs
On Broadwell and above, we have to use different MOCS settings to allow
the kernel to take over and disable caching when needed for external
buffers. On Broadwell, this is especially important because the kernel
can't disable eLLC so we have to do it in userspace. We very badly
don't want to do that on everything so we need separate MOCS for
external and internal BOs.
In order to do this, we add an anv-specific BO flag for "external" and
use that to distinguish between buffers which may be shared with other
processes and/or display and those which are entirely internal. That,
together with an anv_mocs_for_bo helper lets us choose the right MOCS
settings for each BO use.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99507
Cc: [email protected]
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_device.c')
-rw-r--r-- | src/intel/vulkan/anv_device.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 8f0cbad305f..6a24d1086d8 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -2255,8 +2255,8 @@ VkResult anv_AllocateMemory( fd_info->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT); - result = anv_bo_cache_import(device, &device->bo_cache, - fd_info->fd, bo_flags, &mem->bo); + result = anv_bo_cache_import(device, &device->bo_cache, fd_info->fd, + bo_flags | ANV_BO_EXTERNAL, &mem->bo); if (result != VK_SUCCESS) goto fail; @@ -2293,6 +2293,11 @@ VkResult anv_AllocateMemory( */ close(fd_info->fd); } else { + const VkExportMemoryAllocateInfoKHR *fd_info = + vk_find_struct_const(pAllocateInfo->pNext, EXPORT_MEMORY_ALLOCATE_INFO_KHR); + if (fd_info && fd_info->handleTypes) + bo_flags |= ANV_BO_EXTERNAL; + result = anv_bo_cache_alloc(device, &device->bo_cache, pAllocateInfo->allocationSize, bo_flags, &mem->bo); |