summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/amd/vulkan/radv_extensions.py1
-rw-r--r--src/amd/vulkan/radv_wsi_display.c57
-rw-r--r--src/intel/vulkan/anv_extensions.py1
-rw-r--r--src/intel/vulkan/anv_wsi_display.c56
-rw-r--r--src/vulkan/wsi/wsi_common_display.c175
-rw-r--r--src/vulkan/wsi/wsi_common_display.h27
6 files changed, 301 insertions, 16 deletions
diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py
index a0f1038110b..c36559f48ef 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -66,6 +66,7 @@ EXTENSIONS = [
Extension('VK_KHR_external_semaphore', 1, 'device->rad_info.has_syncobj'),
Extension('VK_KHR_external_semaphore_capabilities', 1, True),
Extension('VK_KHR_external_semaphore_fd', 1, 'device->rad_info.has_syncobj'),
+ Extension('VK_KHR_get_display_properties2', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
Extension('VK_KHR_get_memory_requirements2', 1, True),
Extension('VK_KHR_get_physical_device_properties2', 1, True),
Extension('VK_KHR_get_surface_capabilities2', 1, 'RADV_HAS_SURFACE'),
diff --git a/src/amd/vulkan/radv_wsi_display.c b/src/amd/vulkan/radv_wsi_display.c
index 3a4774e2f56..d8743a06e3b 100644
--- a/src/amd/vulkan/radv_wsi_display.c
+++ b/src/amd/vulkan/radv_wsi_display.c
@@ -57,6 +57,20 @@ radv_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physical_device,
}
VkResult
+radv_GetPhysicalDeviceDisplayProperties2KHR(VkPhysicalDevice physical_device,
+ uint32_t *property_count,
+ VkDisplayProperties2KHR *properties)
+{
+ RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
+
+ return wsi_display_get_physical_device_display_properties2(
+ physical_device,
+ &pdevice->wsi_device,
+ property_count,
+ properties);
+}
+
+VkResult
radv_GetPhysicalDeviceDisplayPlanePropertiesKHR(
VkPhysicalDevice physical_device,
uint32_t *property_count,
@@ -72,6 +86,21 @@ radv_GetPhysicalDeviceDisplayPlanePropertiesKHR(
}
VkResult
+radv_GetPhysicalDeviceDisplayPlaneProperties2KHR(
+ VkPhysicalDevice physical_device,
+ uint32_t *property_count,
+ VkDisplayPlaneProperties2KHR *properties)
+{
+ RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
+
+ return wsi_display_get_physical_device_display_plane_properties2(
+ physical_device,
+ &pdevice->wsi_device,
+ property_count,
+ properties);
+}
+
+VkResult
radv_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physical_device,
uint32_t plane_index,
uint32_t *display_count,
@@ -104,6 +133,21 @@ radv_GetDisplayModePropertiesKHR(VkPhysicalDevice physical_device,
}
VkResult
+radv_GetDisplayModeProperties2KHR(VkPhysicalDevice physical_device,
+ VkDisplayKHR display,
+ uint32_t *property_count,
+ VkDisplayModeProperties2KHR *properties)
+{
+ RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
+
+ return wsi_display_get_display_mode_properties2(physical_device,
+ &pdevice->wsi_device,
+ display,
+ property_count,
+ properties);
+}
+
+VkResult
radv_CreateDisplayModeKHR(VkPhysicalDevice physical_device,
VkDisplayKHR display,
const VkDisplayModeCreateInfoKHR *create_info,
@@ -136,6 +180,19 @@ radv_GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physical_device,
}
VkResult
+radv_GetDisplayPlaneCapabilities2KHR(VkPhysicalDevice physical_device,
+ const VkDisplayPlaneInfo2KHR *pDisplayPlaneInfo,
+ VkDisplayPlaneCapabilities2KHR *capabilities)
+{
+ RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
+
+ return wsi_get_display_plane_capabilities2(physical_device,
+ &pdevice->wsi_device,
+ pDisplayPlaneInfo,
+ capabilities);
+}
+
+VkResult
radv_CreateDisplayPlaneSurfaceKHR(
VkInstance _instance,
const VkDisplaySurfaceCreateInfoKHR *create_info,
diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py
index 418618d2021..adc1d758982 100644
--- a/src/intel/vulkan/anv_extensions.py
+++ b/src/intel/vulkan/anv_extensions.py
@@ -90,6 +90,7 @@ EXTENSIONS = [
Extension('VK_KHR_external_semaphore', 1, True),
Extension('VK_KHR_external_semaphore_capabilities', 1, True),
Extension('VK_KHR_external_semaphore_fd', 1, True),
+ Extension('VK_KHR_get_display_properties2', 1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
Extension('VK_KHR_get_memory_requirements2', 1, True),
Extension('VK_KHR_get_physical_device_properties2', 1, True),
Extension('VK_KHR_get_surface_capabilities2', 1, 'ANV_HAS_SURFACE'),
diff --git a/src/intel/vulkan/anv_wsi_display.c b/src/intel/vulkan/anv_wsi_display.c
index 94e16010463..3212c235bab 100644
--- a/src/intel/vulkan/anv_wsi_display.c
+++ b/src/intel/vulkan/anv_wsi_display.c
@@ -41,6 +41,19 @@ anv_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physical_device,
}
VkResult
+anv_GetPhysicalDeviceDisplayProperties2KHR(
+ VkPhysicalDevice physicalDevice,
+ uint32_t* pPropertyCount,
+ VkDisplayProperties2KHR* pProperties)
+{
+ ANV_FROM_HANDLE(anv_physical_device, pdevice, physicalDevice);
+
+ return wsi_display_get_physical_device_display_properties2(
+ physicalDevice, &pdevice->wsi_device,
+ pPropertyCount, pProperties);
+}
+
+VkResult
anv_GetPhysicalDeviceDisplayPlanePropertiesKHR(
VkPhysicalDevice physical_device,
uint32_t *property_count,
@@ -54,6 +67,19 @@ anv_GetPhysicalDeviceDisplayPlanePropertiesKHR(
}
VkResult
+anv_GetPhysicalDeviceDisplayPlaneProperties2KHR(
+ VkPhysicalDevice physicalDevice,
+ uint32_t* pPropertyCount,
+ VkDisplayPlaneProperties2KHR* pProperties)
+{
+ ANV_FROM_HANDLE(anv_physical_device, pdevice, physicalDevice);
+
+ return wsi_display_get_physical_device_display_plane_properties2(
+ physicalDevice, &pdevice->wsi_device,
+ pPropertyCount, pProperties);
+}
+
+VkResult
anv_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physical_device,
uint32_t plane_index,
uint32_t *display_count,
@@ -85,6 +111,22 @@ anv_GetDisplayModePropertiesKHR(VkPhysicalDevice physical_device,
}
VkResult
+anv_GetDisplayModeProperties2KHR(
+ VkPhysicalDevice physicalDevice,
+ VkDisplayKHR display,
+ uint32_t* pPropertyCount,
+ VkDisplayModeProperties2KHR* pProperties)
+{
+ ANV_FROM_HANDLE(anv_physical_device, pdevice, physicalDevice);
+
+ return wsi_display_get_display_mode_properties2(physicalDevice,
+ &pdevice->wsi_device,
+ display,
+ pPropertyCount,
+ pProperties);
+}
+
+VkResult
anv_CreateDisplayModeKHR(VkPhysicalDevice physical_device,
VkDisplayKHR display,
const VkDisplayModeCreateInfoKHR *create_info,
@@ -117,6 +159,20 @@ anv_GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physical_device,
}
VkResult
+anv_GetDisplayPlaneCapabilities2KHR(
+ VkPhysicalDevice physicalDevice,
+ const VkDisplayPlaneInfo2KHR* pDisplayPlaneInfo,
+ VkDisplayPlaneCapabilities2KHR* pCapabilities)
+{
+ ANV_FROM_HANDLE(anv_physical_device, pdevice, physicalDevice);
+
+ return wsi_get_display_plane_capabilities2(physicalDevice,
+ &pdevice->wsi_device,
+ pDisplayPlaneInfo,
+ pCapabilities);
+}
+
+VkResult
anv_CreateDisplayPlaneSurfaceKHR(
VkInstance _instance,
const VkDisplaySurfaceCreateInfoKHR *create_info,
diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c
index 4a2d88ff77e..ac932d4368a 100644
--- a/src/vulkan/wsi/wsi_common_display.c
+++ b/src/vulkan/wsi/wsi_common_display.c
@@ -366,8 +366,11 @@ mode_size(struct wsi_display_mode *mode)
static void
wsi_display_fill_in_display_properties(struct wsi_device *wsi_device,
struct wsi_display_connector *connector,
- VkDisplayPropertiesKHR *properties)
+ VkDisplayProperties2KHR *properties2)
{
+ assert(properties2->sType == VK_STRUCTURE_TYPE_DISPLAY_PROPERTIES_2_KHR);
+ VkDisplayPropertiesKHR *properties = &properties2->displayProperties;
+
properties->display = wsi_display_connector_to_handle(connector);
properties->displayName = connector->name;
@@ -426,6 +429,50 @@ wsi_display_get_physical_device_display_properties(
struct wsi_display *wsi =
(struct wsi_display *) wsi_device->wsi[VK_ICD_WSI_PLATFORM_DISPLAY];
+ if (properties == NULL) {
+ return wsi_display_get_physical_device_display_properties2(
+ physical_device, wsi_device, property_count, NULL);
+ } else {
+ /* If we're actually returning properties, allocate a temporary array of
+ * VkDisplayProperties2KHR structs, call properties2 to fill them out,
+ * and then copy them to the client. This seems a bit expensive but
+ * wsi_display_get_physical_device_display_properties2() calls
+ * drmModeGetResources() which does an ioctl and then a bunch of
+ * allocations so this should get lost in the noise.
+ */
+ VkDisplayProperties2KHR *props2 =
+ vk_zalloc(wsi->alloc, sizeof(*props2) * *property_count, 8,
+ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+ if (props2 == NULL)
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
+
+ for (uint32_t i = 0; i < *property_count; i++)
+ props2[i].sType = VK_STRUCTURE_TYPE_DISPLAY_PROPERTIES_2_KHR;
+
+ VkResult result = wsi_display_get_physical_device_display_properties2(
+ physical_device, wsi_device, property_count, props2);
+
+ if (result == VK_SUCCESS || result == VK_INCOMPLETE) {
+ for (uint32_t i = 0; i < *property_count; i++)
+ properties[i] = props2[i].displayProperties;
+ }
+
+ vk_free(wsi->alloc, props2);
+
+ return result;
+ }
+}
+
+VkResult
+wsi_display_get_physical_device_display_properties2(
+ VkPhysicalDevice physical_device,
+ struct wsi_device *wsi_device,
+ uint32_t *property_count,
+ VkDisplayProperties2KHR *properties)
+{
+ struct wsi_display *wsi =
+ (struct wsi_display *) wsi_device->wsi[VK_ICD_WSI_PLATFORM_DISPLAY];
+
if (wsi->fd < 0)
goto bail;
@@ -468,6 +515,24 @@ bail:
/*
* Implement vkGetPhysicalDeviceDisplayPlanePropertiesKHR (VK_KHR_display
*/
+static void
+wsi_display_fill_in_display_plane_properties(
+ struct wsi_device *wsi_device,
+ struct wsi_display_connector *connector,
+ VkDisplayPlaneProperties2KHR *properties)
+{
+ assert(properties->sType == VK_STRUCTURE_TYPE_DISPLAY_PLANE_PROPERTIES_2_KHR);
+ VkDisplayPlanePropertiesKHR *prop = &properties->displayPlaneProperties;
+
+ if (connector && connector->active) {
+ prop->currentDisplay = wsi_display_connector_to_handle(connector);
+ prop->currentStackIndex = 0;
+ } else {
+ prop->currentDisplay = VK_NULL_HANDLE;
+ prop->currentStackIndex = 0;
+ }
+}
+
VkResult
wsi_display_get_physical_device_display_plane_properties(
VkPhysicalDevice physical_device,
@@ -482,13 +547,33 @@ wsi_display_get_physical_device_display_plane_properties(
wsi_for_each_connector(connector, wsi) {
vk_outarray_append(&conn, prop) {
- if (connector && connector->active) {
- prop->currentDisplay = wsi_display_connector_to_handle(connector);
- prop->currentStackIndex = 0;
- } else {
- prop->currentDisplay = VK_NULL_HANDLE;
- prop->currentStackIndex = 0;
- }
+ VkDisplayPlaneProperties2KHR prop2 = {
+ .sType = VK_STRUCTURE_TYPE_DISPLAY_PLANE_PROPERTIES_2_KHR,
+ };
+ wsi_display_fill_in_display_plane_properties(wsi_device, connector,
+ &prop2);
+ *prop = prop2.displayPlaneProperties;
+ }
+ }
+ return vk_outarray_status(&conn);
+}
+
+VkResult
+wsi_display_get_physical_device_display_plane_properties2(
+ VkPhysicalDevice physical_device,
+ struct wsi_device *wsi_device,
+ uint32_t *property_count,
+ VkDisplayPlaneProperties2KHR *properties)
+{
+ struct wsi_display *wsi =
+ (struct wsi_display *) wsi_device->wsi[VK_ICD_WSI_PLATFORM_DISPLAY];
+
+ VK_OUTARRAY_MAKE(conn, properties, property_count);
+
+ wsi_for_each_connector(connector, wsi) {
+ vk_outarray_append(&conn, prop) {
+ wsi_display_fill_in_display_plane_properties(wsi_device, connector,
+ prop);
}
}
return vk_outarray_status(&conn);
@@ -528,6 +613,22 @@ wsi_display_get_display_plane_supported_displays(
* Implement vkGetDisplayModePropertiesKHR (VK_KHR_display)
*/
+static void
+wsi_display_fill_in_display_mode_properties(
+ struct wsi_device *wsi_device,
+ struct wsi_display_mode *display_mode,
+ VkDisplayModeProperties2KHR *properties)
+{
+ assert(properties->sType = VK_STRUCTURE_TYPE_DISPLAY_MODE_PROPERTIES_2_KHR);
+ VkDisplayModePropertiesKHR *prop = &properties->displayModeProperties;
+
+ prop->displayMode = wsi_display_mode_to_handle(display_mode);
+ prop->parameters.visibleRegion.width = display_mode->hdisplay;
+ prop->parameters.visibleRegion.height = display_mode->vdisplay;
+ prop->parameters.refreshRate =
+ (uint32_t) (wsi_display_mode_refresh(display_mode) * 1000 + 0.5);
+}
+
VkResult
wsi_display_get_display_mode_properties(VkPhysicalDevice physical_device,
struct wsi_device *wsi_device,
@@ -541,14 +642,40 @@ wsi_display_get_display_mode_properties(VkPhysicalDevice physical_device,
VK_OUTARRAY_MAKE(conn, properties, property_count);
wsi_for_each_display_mode(display_mode, connector) {
- if (display_mode->valid) {
- vk_outarray_append(&conn, prop) {
- prop->displayMode = wsi_display_mode_to_handle(display_mode);
- prop->parameters.visibleRegion.width = display_mode->hdisplay;
- prop->parameters.visibleRegion.height = display_mode->vdisplay;
- prop->parameters.refreshRate =
- (uint32_t) (wsi_display_mode_refresh(display_mode) * 1000 + 0.5);
- }
+ if (!display_mode->valid)
+ continue;
+
+ vk_outarray_append(&conn, prop) {
+ VkDisplayModeProperties2KHR prop2 = {
+ .sType = VK_STRUCTURE_TYPE_DISPLAY_MODE_PROPERTIES_2_KHR,
+ };
+ wsi_display_fill_in_display_mode_properties(wsi_device,
+ display_mode, &prop2);
+ *prop = prop2.displayModeProperties;
+ }
+ }
+ return vk_outarray_status(&conn);
+}
+
+VkResult
+wsi_display_get_display_mode_properties2(VkPhysicalDevice physical_device,
+ struct wsi_device *wsi_device,
+ VkDisplayKHR display,
+ uint32_t *property_count,
+ VkDisplayModeProperties2KHR *properties)
+{
+ struct wsi_display_connector *connector =
+ wsi_display_connector_from_handle(display);
+
+ VK_OUTARRAY_MAKE(conn, properties, property_count);
+
+ wsi_for_each_display_mode(display_mode, connector) {
+ if (!display_mode->valid)
+ continue;
+
+ vk_outarray_append(&conn, prop) {
+ wsi_display_fill_in_display_mode_properties(wsi_device,
+ display_mode, prop);
}
}
return vk_outarray_status(&conn);
@@ -630,6 +757,22 @@ wsi_get_display_plane_capabilities(VkPhysicalDevice physical_device,
}
VkResult
+wsi_get_display_plane_capabilities2(
+ VkPhysicalDevice physical_device,
+ struct wsi_device *wsi_device,
+ const VkDisplayPlaneInfo2KHR *pDisplayPlaneInfo,
+ VkDisplayPlaneCapabilities2KHR *capabilities)
+{
+ assert(capabilities->sType =
+ VK_STRUCTURE_TYPE_DISPLAY_PLANE_CAPABILITIES_2_KHR);
+
+ return wsi_get_display_plane_capabilities(physical_device, wsi_device,
+ pDisplayPlaneInfo->mode,
+ pDisplayPlaneInfo->planeIndex,
+ &capabilities->capabilities);
+}
+
+VkResult
wsi_create_display_surface(VkInstance instance,
const VkAllocationCallbacks *allocator,
const VkDisplaySurfaceCreateInfoKHR *create_info,
diff --git a/src/vulkan/wsi/wsi_common_display.h b/src/vulkan/wsi/wsi_common_display.h
index 941ce8d5d66..50d7f836a75 100644
--- a/src/vulkan/wsi/wsi_common_display.h
+++ b/src/vulkan/wsi/wsi_common_display.h
@@ -40,6 +40,13 @@ wsi_display_get_physical_device_display_properties(
VkDisplayPropertiesKHR *properties);
VkResult
+wsi_display_get_physical_device_display_properties2(
+ VkPhysicalDevice physical_device,
+ struct wsi_device *wsi_device,
+ uint32_t *pPropertyCount,
+ VkDisplayProperties2KHR *pProperties);
+
+VkResult
wsi_display_get_physical_device_display_plane_properties(
VkPhysicalDevice physical_device,
struct wsi_device *wsi_device,
@@ -47,6 +54,13 @@ wsi_display_get_physical_device_display_plane_properties(
VkDisplayPlanePropertiesKHR *properties);
VkResult
+wsi_display_get_physical_device_display_plane_properties2(
+ VkPhysicalDevice physical_device,
+ struct wsi_device *wsi_device,
+ uint32_t *property_count,
+ VkDisplayPlaneProperties2KHR *properties);
+
+VkResult
wsi_display_get_display_plane_supported_displays(
VkPhysicalDevice physical_device,
struct wsi_device *wsi_device,
@@ -62,6 +76,13 @@ wsi_display_get_display_mode_properties(VkPhysicalDevice physical_device,
VkDisplayModePropertiesKHR *properties);
VkResult
+wsi_display_get_display_mode_properties2(VkPhysicalDevice physical_device,
+ struct wsi_device *wsi_device,
+ VkDisplayKHR display,
+ uint32_t *property_count,
+ VkDisplayModeProperties2KHR *properties);
+
+VkResult
wsi_display_create_display_mode(VkPhysicalDevice physical_device,
struct wsi_device *wsi_device,
VkDisplayKHR display,
@@ -77,6 +98,12 @@ wsi_get_display_plane_capabilities(VkPhysicalDevice physical_device,
VkDisplayPlaneCapabilitiesKHR *capabilities);
VkResult
+wsi_get_display_plane_capabilities2(VkPhysicalDevice physical_device,
+ struct wsi_device *wsi_device,
+ const VkDisplayPlaneInfo2KHR *pDisplayPlaneInfo,
+ VkDisplayPlaneCapabilities2KHR *capabilities);
+
+VkResult
wsi_create_display_surface(VkInstance instance,
const VkAllocationCallbacks *pAllocator,
const VkDisplaySurfaceCreateInfoKHR *pCreateInfo,