tu: implement wsi hook to decide if we can present directly on device
This will prevent the driver to take the prime blit path for presentation in scenarios where it can avoid it. Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com> Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11091>
This commit is contained in:
committed by
Marge Bot
parent
fa75b2a027
commit
3e7f6c9aeb
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "vk_util.h"
|
||||
#include "wsi_common.h"
|
||||
#include "wsi_common_drm.h"
|
||||
#include "drm-uapi/drm_fourcc.h"
|
||||
|
||||
static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
|
||||
@@ -36,6 +37,14 @@ tu_wsi_proc_addr(VkPhysicalDevice physicalDevice, const char *pName)
|
||||
return vk_instance_get_proc_addr_unchecked(&pdevice->instance->vk, pName);
|
||||
}
|
||||
|
||||
static bool
|
||||
tu_wsi_can_present_on_device(VkPhysicalDevice physicalDevice, int fd)
|
||||
{
|
||||
TU_FROM_HANDLE(tu_physical_device, pdevice, physicalDevice);
|
||||
|
||||
return wsi_common_drm_devices_equal(fd, pdevice->local_fd);
|
||||
}
|
||||
|
||||
VkResult
|
||||
tu_wsi_init(struct tu_physical_device *physical_device)
|
||||
{
|
||||
@@ -52,6 +61,9 @@ tu_wsi_init(struct tu_physical_device *physical_device)
|
||||
return result;
|
||||
|
||||
physical_device->wsi_device.supports_modifiers = true;
|
||||
physical_device->wsi_device.can_present_on_device =
|
||||
tu_wsi_can_present_on_device;
|
||||
|
||||
physical_device->vk.wsi_device = &physical_device->wsi_device;
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user