mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 20:38:06 +02:00
anv: Properly alloc buffers that will be promoted to framebuffer in Xe KMD
Xe KMD does a special caching handling for buffers that will be scanout to display, so that is why it needs a flag set during allocation. Checking if VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA is available in AllocateMemory() and marking the buffer as scanout. All WSI code paths but one sets VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA. The only one that doesn't requires that WSI is initialize with wsi_device_options.sw_device = true to be executed, what is not the case for ANV. Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21885>
This commit is contained in:
parent
a311c031f6
commit
b2d82c25fb
3 changed files with 16 additions and 3 deletions
|
|
@ -3959,11 +3959,20 @@ VkResult anv_AllocateMemory(
|
|||
}
|
||||
|
||||
default:
|
||||
if (ext->sType != VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA)
|
||||
/* this isn't a real enum value,
|
||||
* so use conditional to avoid compiler warn
|
||||
/* VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA isn't a real
|
||||
* enum value, so use conditional to avoid compiler warn
|
||||
*/
|
||||
if (ext->sType == VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA) {
|
||||
/* TODO: Android, ChromeOS and other applications may need another
|
||||
* way to allocate buffers that can be scanout to display but it
|
||||
* should pretty easy to catch those as Xe KMD driver will print
|
||||
* warnings in dmesg when scanning buffers allocated without
|
||||
* proper flag set.
|
||||
*/
|
||||
alloc_flags |= ANV_BO_ALLOC_SCANOUT;
|
||||
} else {
|
||||
anv_debug_ignored_stype(ext->sType);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -460,6 +460,9 @@ enum anv_bo_alloc_flags {
|
|||
* Should be faster for bo pools, which write but do not read
|
||||
*/
|
||||
ANV_BO_ALLOC_WRITE_COMBINE = (1 << 12),
|
||||
|
||||
/** This buffer will be scanout to display */
|
||||
ANV_BO_ALLOC_SCANOUT = (1 << 13),
|
||||
};
|
||||
|
||||
struct anv_bo {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ xe_gem_create(struct anv_device *device,
|
|||
struct drm_xe_gem_create gem_create = {
|
||||
.vm_id = device->vm_id,
|
||||
.size = size,
|
||||
.flags = alloc_flags & ANV_BO_ALLOC_SCANOUT ? XE_GEM_CREATE_FLAG_SCANOUT : 0,
|
||||
};
|
||||
for (uint16_t i = 0; i < regions_count; i++)
|
||||
gem_create.flags |= BITFIELD_BIT(regions[i]->instance);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue