summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_wsi.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-11-13 16:44:07 -0800
committerDaniel Stone <[email protected]>2018-02-21 22:37:10 +0000
commitc757fd2852849a5c8db92032ff66b6bbe5073f1c (patch)
tree8594c24ed51d12120c089317e19696d1a957a8f7 /src/intel/vulkan/anv_wsi.c
parentadca1e4a92a53a403b7620c3356dcf038f0bcecc (diff)
anv/image: Add support for modifiers for WSI
This adds support for the modifiers portion of the WSI "extension". Reviewed-by: Daniel Stone <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_wsi.c')
-rw-r--r--src/intel/vulkan/anv_wsi.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
index 6082c3dd093..8913a8022c4 100644
--- a/src/intel/vulkan/anv_wsi.c
+++ b/src/intel/vulkan/anv_wsi.c
@@ -33,13 +33,29 @@ anv_wsi_proc_addr(VkPhysicalDevice physicalDevice, const char *pName)
return anv_lookup_entrypoint(&physical_device->info, pName);
}
+static uint64_t
+anv_wsi_image_get_modifier(VkImage _image)
+{
+ ANV_FROM_HANDLE(anv_image, image, _image);
+ return image->drm_format_mod;
+}
+
VkResult
anv_init_wsi(struct anv_physical_device *physical_device)
{
- return wsi_device_init(&physical_device->wsi_device,
- anv_physical_device_to_handle(physical_device),
- anv_wsi_proc_addr,
- &physical_device->instance->alloc);
+ VkResult result;
+
+ result = wsi_device_init(&physical_device->wsi_device,
+ anv_physical_device_to_handle(physical_device),
+ anv_wsi_proc_addr,
+ &physical_device->instance->alloc);
+ if (result != VK_SUCCESS)
+ return result;
+
+ physical_device->wsi_device.supports_modifiers = true;
+ physical_device->wsi_device.image_get_modifier = anv_wsi_image_get_modifier;
+
+ return VK_SUCCESS;
}
void