mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 10:00:14 +01:00
anv: optimize the implicit fencing support of external memory
Previously we apply implicit sync to all external memory, which is a bit redundant since we only need it for the dedicated image scenario (media image imported into Vulkan). This change optimizes just like that while also excluding wsi which has its own way of synchronizing with the compositor. Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27398>
This commit is contained in:
parent
55ac9a08b5
commit
be3af5acf6
1 changed files with 15 additions and 6 deletions
|
|
@ -4099,12 +4099,21 @@ VkResult anv_AllocateMemory(
|
|||
if (wsi_info)
|
||||
alloc_flags |= ANV_BO_ALLOC_SCANOUT;
|
||||
|
||||
/* Anything imported or exported is EXTERNAL. Apply implicit sync to be
|
||||
* compatible with clients relying on implicit fencing. This matches the
|
||||
* behavior in iris i915_batch_submit. An example client is VA-API.
|
||||
*/
|
||||
if (mem->vk.export_handle_types || mem->vk.import_handle_type)
|
||||
alloc_flags |= (ANV_BO_ALLOC_EXTERNAL | ANV_BO_ALLOC_IMPLICIT_SYNC);
|
||||
/* Anything imported or exported is EXTERNAL */
|
||||
if (mem->vk.export_handle_types || mem->vk.import_handle_type) {
|
||||
alloc_flags |= ANV_BO_ALLOC_EXTERNAL;
|
||||
|
||||
/* wsi has its own way of synchronizing with the compositor */
|
||||
if (!wsi_info && dedicated_info &&
|
||||
dedicated_info->image != VK_NULL_HANDLE) {
|
||||
/* Apply implicit sync to be compatible with clients relying on
|
||||
* implicit fencing. This matches the behavior in iris i915_batch
|
||||
* submit. An example client is VA-API (iHD), so only dedicated
|
||||
* image scenario has to be covered.
|
||||
*/
|
||||
alloc_flags |= ANV_BO_ALLOC_IMPLICIT_SYNC;
|
||||
}
|
||||
}
|
||||
|
||||
if (mem->vk.ahardware_buffer) {
|
||||
result = anv_import_ahw_memory(_device, mem);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue