mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-24 12:48:13 +02:00
vulkan/wsi: Add common wrappers for most entrypoints
For a long time, our Vulkan WSI code has acted as something of a layer. The WSI code calls into various Vulkan entrypoints inside the driver to create images, allocate memory, etc. It then implements the API-facing interface almost entirely. The only thing the driver has to provide is little wrappers that wrap around the WSI calls to expose them through the API. However, now that we have a common dispatch framework, we can implement entrypoints directly in the WSI code. As long as the driver uses vk_instance, vk_physical_device, and vk_device, we can provide common wrappers for the vast majority of entrypoints. The only exceptions are vkAcquireNextImage, vkQueuePresent, vkRegisterDeviceEventEXT, and vkRegisterDisplayEventEXT because those may have to manually poke at synchronization primitives. We provide wrappers for vkAcquireNextImage and vkQueuePresent because some drivers can use the default versions. For now, we're intentionally avoiding any link-time dependencies between WSI and the common code. We only use VK_FROM_HANDLE and associated inline helpers and vk_physical_device has a pointer to a wsi_device. Eventually, we may tie the two together closer, but this lets us get 95% of the way there without reworking the universe. Acked-by: Chia-I Wu <olvaffe@gmail.com> Acked-by: Iago Toral Quiroga <itoral@igalia.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13234>
This commit is contained in:
parent
020fbb9ea1
commit
75955c6685
6 changed files with 626 additions and 0 deletions
|
|
@ -31,6 +31,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct wsi_device;
|
||||
|
||||
struct vk_physical_device {
|
||||
struct vk_object_base base;
|
||||
struct vk_instance *instance;
|
||||
|
|
@ -38,6 +40,8 @@ struct vk_physical_device {
|
|||
struct vk_device_extension_table supported_extensions;
|
||||
|
||||
struct vk_physical_device_dispatch_table dispatch_table;
|
||||
|
||||
struct wsi_device *wsi_device;
|
||||
};
|
||||
|
||||
VK_DEFINE_HANDLE_CASTS(vk_physical_device, base, VkPhysicalDevice,
|
||||
|
|
|
|||
|
|
@ -22,10 +22,15 @@
|
|||
*/
|
||||
|
||||
#include "wsi_common_private.h"
|
||||
#include "wsi_common_entrypoints.h"
|
||||
#include "util/macros.h"
|
||||
#include "util/os_file.h"
|
||||
#include "util/os_time.h"
|
||||
#include "util/xmlconfig.h"
|
||||
#include "vk_device.h"
|
||||
#include "vk_instance.h"
|
||||
#include "vk_physical_device.h"
|
||||
#include "vk_queue.h"
|
||||
#include "vk_util.h"
|
||||
|
||||
#include <time.h>
|
||||
|
|
@ -184,6 +189,20 @@ wsi_device_finish(struct wsi_device *wsi,
|
|||
#endif
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
wsi_DestroySurfaceKHR(VkInstance _instance,
|
||||
VkSurfaceKHR _surface,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_instance, instance, _instance);
|
||||
ICD_FROM_HANDLE(VkIcdSurfaceBase, surface, _surface);
|
||||
|
||||
if (!surface)
|
||||
return;
|
||||
|
||||
vk_free2(&instance->alloc, pAllocator, surface);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_swapchain_init(const struct wsi_device *wsi,
|
||||
struct wsi_swapchain *chain,
|
||||
|
|
@ -333,6 +352,20 @@ wsi_common_get_surface_support(struct wsi_device *wsi_device,
|
|||
queueFamilyIndex, pSupported);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
VkSurfaceKHR surface,
|
||||
VkBool32 *pSupported)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_common_get_surface_support(device->wsi_device,
|
||||
queueFamilyIndex,
|
||||
surface,
|
||||
pSupported);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_common_get_surface_capabilities(struct wsi_device *wsi_device,
|
||||
VkSurfaceKHR _surface,
|
||||
|
|
@ -353,6 +386,19 @@ wsi_common_get_surface_capabilities(struct wsi_device *wsi_device,
|
|||
return result;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetPhysicalDeviceSurfaceCapabilitiesKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkSurfaceKHR surface,
|
||||
VkSurfaceCapabilitiesKHR *pSurfaceCapabilities)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_common_get_surface_capabilities(device->wsi_device,
|
||||
surface,
|
||||
pSurfaceCapabilities);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_common_get_surface_capabilities2(struct wsi_device *wsi_device,
|
||||
const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
|
||||
|
|
@ -365,6 +411,19 @@ wsi_common_get_surface_capabilities2(struct wsi_device *wsi_device,
|
|||
pSurfaceCapabilities);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetPhysicalDeviceSurfaceCapabilities2KHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
|
||||
VkSurfaceCapabilities2KHR *pSurfaceCapabilities)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_common_get_surface_capabilities2(device->wsi_device,
|
||||
pSurfaceInfo,
|
||||
pSurfaceCapabilities);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_common_get_surface_capabilities2ext(
|
||||
struct wsi_device *wsi_device,
|
||||
|
|
@ -410,6 +469,19 @@ wsi_common_get_surface_capabilities2ext(
|
|||
return result;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetPhysicalDeviceSurfaceCapabilities2EXT(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkSurfaceKHR surface,
|
||||
VkSurfaceCapabilities2EXT *pSurfaceCapabilities)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_common_get_surface_capabilities2ext(device->wsi_device,
|
||||
surface,
|
||||
pSurfaceCapabilities);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_common_get_surface_formats(struct wsi_device *wsi_device,
|
||||
VkSurfaceKHR _surface,
|
||||
|
|
@ -423,6 +495,18 @@ wsi_common_get_surface_formats(struct wsi_device *wsi_device,
|
|||
pSurfaceFormatCount, pSurfaceFormats);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice,
|
||||
VkSurfaceKHR surface,
|
||||
uint32_t *pSurfaceFormatCount,
|
||||
VkSurfaceFormatKHR *pSurfaceFormats)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_common_get_surface_formats(device->wsi_device, surface,
|
||||
pSurfaceFormatCount, pSurfaceFormats);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_common_get_surface_formats2(struct wsi_device *wsi_device,
|
||||
const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
|
||||
|
|
@ -436,6 +520,18 @@ wsi_common_get_surface_formats2(struct wsi_device *wsi_device,
|
|||
pSurfaceFormatCount, pSurfaceFormats);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceSurfaceInfo2KHR * pSurfaceInfo,
|
||||
uint32_t *pSurfaceFormatCount,
|
||||
VkSurfaceFormat2KHR *pSurfaceFormats)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_common_get_surface_formats2(device->wsi_device, pSurfaceInfo,
|
||||
pSurfaceFormatCount, pSurfaceFormats);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_common_get_surface_present_modes(struct wsi_device *wsi_device,
|
||||
VkSurfaceKHR _surface,
|
||||
|
|
@ -449,6 +545,19 @@ wsi_common_get_surface_present_modes(struct wsi_device *wsi_device,
|
|||
pPresentModes);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice,
|
||||
VkSurfaceKHR surface,
|
||||
uint32_t *pPresentModeCount,
|
||||
VkPresentModeKHR *pPresentModes)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_common_get_surface_present_modes(device->wsi_device, surface,
|
||||
pPresentModeCount,
|
||||
pPresentModes);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_common_get_present_rectangles(struct wsi_device *wsi_device,
|
||||
VkSurfaceKHR _surface,
|
||||
|
|
@ -462,6 +571,19 @@ wsi_common_get_present_rectangles(struct wsi_device *wsi_device,
|
|||
pRectCount, pRects);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice,
|
||||
VkSurfaceKHR surface,
|
||||
uint32_t *pRectCount,
|
||||
VkRect2D *pRects)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_common_get_present_rectangles(device->wsi_device,
|
||||
surface,
|
||||
pRectCount, pRects);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_common_create_swapchain(struct wsi_device *wsi,
|
||||
VkDevice device,
|
||||
|
|
@ -493,6 +615,25 @@ wsi_common_create_swapchain(struct wsi_device *wsi,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_CreateSwapchainKHR(VkDevice _device,
|
||||
const VkSwapchainCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSwapchainKHR *pSwapchain)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_device, device, _device);
|
||||
struct wsi_device *wsi_device = device->physical->wsi_device;
|
||||
const VkAllocationCallbacks *alloc;
|
||||
|
||||
if (pAllocator)
|
||||
alloc = pAllocator;
|
||||
else
|
||||
alloc = &device->alloc;
|
||||
|
||||
return wsi_common_create_swapchain(wsi_device, _device,
|
||||
pCreateInfo, alloc, pSwapchain);
|
||||
}
|
||||
|
||||
void
|
||||
wsi_common_destroy_swapchain(VkDevice device,
|
||||
VkSwapchainKHR _swapchain,
|
||||
|
|
@ -505,6 +646,22 @@ wsi_common_destroy_swapchain(VkDevice device,
|
|||
swapchain->destroy(swapchain, pAllocator);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
wsi_DestroySwapchainKHR(VkDevice _device,
|
||||
VkSwapchainKHR swapchain,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_device, device, _device);
|
||||
const VkAllocationCallbacks *alloc;
|
||||
|
||||
if (pAllocator)
|
||||
alloc = pAllocator;
|
||||
else
|
||||
alloc = &device->alloc;
|
||||
|
||||
wsi_common_destroy_swapchain(_device, swapchain, alloc);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_common_get_images(VkSwapchainKHR _swapchain,
|
||||
uint32_t *pSwapchainImageCount,
|
||||
|
|
@ -522,6 +679,40 @@ wsi_common_get_images(VkSwapchainKHR _swapchain,
|
|||
return vk_outarray_status(&images);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetSwapchainImagesKHR(VkDevice device,
|
||||
VkSwapchainKHR swapchain,
|
||||
uint32_t *pSwapchainImageCount,
|
||||
VkImage *pSwapchainImages)
|
||||
{
|
||||
return wsi_common_get_images(swapchain,
|
||||
pSwapchainImageCount,
|
||||
pSwapchainImages);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_AcquireNextImageKHR(VkDevice _device,
|
||||
VkSwapchainKHR swapchain,
|
||||
uint64_t timeout,
|
||||
VkSemaphore semaphore,
|
||||
VkFence fence,
|
||||
uint32_t *pImageIndex)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_device, device, _device);
|
||||
|
||||
const VkAcquireNextImageInfoKHR acquire_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR,
|
||||
.swapchain = swapchain,
|
||||
.timeout = timeout,
|
||||
.semaphore = semaphore,
|
||||
.fence = fence,
|
||||
.deviceMask = 0,
|
||||
};
|
||||
|
||||
return device->dispatch_table.AcquireNextImage2KHR(_device, &acquire_info,
|
||||
pImageIndex);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_common_acquire_next_image2(const struct wsi_device *wsi,
|
||||
VkDevice device,
|
||||
|
|
@ -559,6 +750,17 @@ wsi_common_acquire_next_image2(const struct wsi_device *wsi,
|
|||
return result;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_AcquireNextImage2KHR(VkDevice _device,
|
||||
const VkAcquireNextImageInfoKHR *pAcquireInfo,
|
||||
uint32_t *pImageIndex)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_device, device, _device);
|
||||
|
||||
return wsi_common_acquire_next_image2(device->physical->wsi_device,
|
||||
_device, pAcquireInfo, pImageIndex);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_common_queue_present(const struct wsi_device *wsi,
|
||||
VkDevice device,
|
||||
|
|
@ -682,8 +884,42 @@ wsi_common_queue_present(const struct wsi_device *wsi,
|
|||
return final_result;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_QueuePresentKHR(VkQueue _queue, const VkPresentInfoKHR *pPresentInfo)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_queue, queue, _queue);
|
||||
|
||||
return wsi_common_queue_present(queue->base.device->physical->wsi_device,
|
||||
vk_device_to_handle(queue->base.device),
|
||||
_queue,
|
||||
queue->queue_family_index,
|
||||
pPresentInfo);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
wsi_common_get_current_time(void)
|
||||
{
|
||||
return os_time_get_nano();
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetDeviceGroupPresentCapabilitiesKHR(VkDevice device,
|
||||
VkDeviceGroupPresentCapabilitiesKHR *pCapabilities)
|
||||
{
|
||||
memset(pCapabilities->presentMask, 0,
|
||||
sizeof(pCapabilities->presentMask));
|
||||
pCapabilities->presentMask[0] = 0x1;
|
||||
pCapabilities->modes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetDeviceGroupSurfacePresentModesKHR(VkDevice device,
|
||||
VkSurfaceKHR surface,
|
||||
VkDeviceGroupPresentModeFlagsKHR *pModes)
|
||||
{
|
||||
*pModes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,11 @@
|
|||
#include "util/hash_table.h"
|
||||
#include "util/list.h"
|
||||
|
||||
#include "vk_device.h"
|
||||
#include "vk_instance.h"
|
||||
#include "vk_physical_device.h"
|
||||
#include "vk_util.h"
|
||||
#include "wsi_common_entrypoints.h"
|
||||
#include "wsi_common_private.h"
|
||||
#include "wsi_common_display.h"
|
||||
#include "wsi_common_queue.h"
|
||||
|
|
@ -457,6 +461,19 @@ wsi_display_get_physical_device_display_properties(
|
|||
}
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice,
|
||||
uint32_t *pPropertyCount,
|
||||
VkDisplayPropertiesKHR *pProperties)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_display_get_physical_device_display_properties(physicalDevice,
|
||||
device->wsi_device,
|
||||
pPropertyCount,
|
||||
pProperties);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_display_get_physical_device_display_properties2(
|
||||
VkPhysicalDevice physical_device,
|
||||
|
|
@ -507,6 +524,19 @@ bail:
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetPhysicalDeviceDisplayProperties2KHR(VkPhysicalDevice physicalDevice,
|
||||
uint32_t *pPropertyCount,
|
||||
VkDisplayProperties2KHR *pProperties)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_display_get_physical_device_display_properties2(physicalDevice,
|
||||
device->wsi_device,
|
||||
pPropertyCount,
|
||||
pProperties);
|
||||
}
|
||||
|
||||
/*
|
||||
* Implement vkGetPhysicalDeviceDisplayPlanePropertiesKHR (VK_KHR_display
|
||||
*/
|
||||
|
|
@ -553,6 +583,17 @@ wsi_display_get_physical_device_display_plane_properties(
|
|||
return vk_outarray_status(&conn);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice,
|
||||
uint32_t *pPropertyCount,
|
||||
VkDisplayPlanePropertiesKHR *pProperties)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_display_get_physical_device_display_plane_properties(
|
||||
physicalDevice, device->wsi_device, pPropertyCount, pProperties);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_display_get_physical_device_display_plane_properties2(
|
||||
VkPhysicalDevice physical_device,
|
||||
|
|
@ -574,6 +615,17 @@ wsi_display_get_physical_device_display_plane_properties2(
|
|||
return vk_outarray_status(&conn);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetPhysicalDeviceDisplayPlaneProperties2KHR(VkPhysicalDevice physicalDevice,
|
||||
uint32_t *pPropertyCount,
|
||||
VkDisplayPlaneProperties2KHR *pProperties)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_display_get_physical_device_display_plane_properties2(
|
||||
physicalDevice, device->wsi_device, pPropertyCount, pProperties);
|
||||
}
|
||||
|
||||
/*
|
||||
* Implement vkGetDisplayPlaneSupportedDisplaysKHR (VK_KHR_display)
|
||||
*/
|
||||
|
|
@ -604,6 +656,18 @@ wsi_display_get_display_plane_supported_displays(
|
|||
return vk_outarray_status(&conn);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice,
|
||||
uint32_t planeIndex,
|
||||
uint32_t *pDisplayCount,
|
||||
VkDisplayKHR *pDisplays)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_display_get_display_plane_supported_displays(
|
||||
physicalDevice, device->wsi_device, planeIndex, pDisplayCount, pDisplays);
|
||||
}
|
||||
|
||||
/*
|
||||
* Implement vkGetDisplayModePropertiesKHR (VK_KHR_display)
|
||||
*/
|
||||
|
|
@ -652,6 +716,21 @@ wsi_display_get_display_mode_properties(VkPhysicalDevice physical_device,
|
|||
return vk_outarray_status(&conn);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice,
|
||||
VkDisplayKHR display,
|
||||
uint32_t *pPropertyCount,
|
||||
VkDisplayModePropertiesKHR *pProperties)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_display_get_display_mode_properties(physicalDevice,
|
||||
device->wsi_device,
|
||||
display,
|
||||
pPropertyCount,
|
||||
pProperties);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_display_get_display_mode_properties2(VkPhysicalDevice physical_device,
|
||||
struct wsi_device *wsi_device,
|
||||
|
|
@ -676,6 +755,21 @@ wsi_display_get_display_mode_properties2(VkPhysicalDevice physical_device,
|
|||
return vk_outarray_status(&conn);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetDisplayModeProperties2KHR(VkPhysicalDevice physicalDevice,
|
||||
VkDisplayKHR display,
|
||||
uint32_t *pPropertyCount,
|
||||
VkDisplayModeProperties2KHR *pProperties)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_display_get_display_mode_properties2(physicalDevice,
|
||||
device->wsi_device,
|
||||
display,
|
||||
pPropertyCount,
|
||||
pProperties);
|
||||
}
|
||||
|
||||
static bool
|
||||
wsi_display_mode_matches_vk(wsi_display_mode *wsi,
|
||||
const VkDisplayModeParametersKHR *vk)
|
||||
|
|
@ -718,6 +812,23 @@ wsi_display_create_display_mode(VkPhysicalDevice physical_device,
|
|||
return VK_ERROR_INITIALIZATION_FAILED;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_CreateDisplayModeKHR(VkPhysicalDevice physicalDevice,
|
||||
VkDisplayKHR display,
|
||||
const VkDisplayModeCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDisplayModeKHR *pMode)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_display_create_display_mode(physicalDevice,
|
||||
device->wsi_device,
|
||||
display,
|
||||
pCreateInfo,
|
||||
pAllocator,
|
||||
pMode);
|
||||
}
|
||||
|
||||
/*
|
||||
* Implement vkGetDisplayPlaneCapabilities
|
||||
*/
|
||||
|
|
@ -751,6 +862,21 @@ wsi_get_display_plane_capabilities(VkPhysicalDevice physical_device,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice,
|
||||
VkDisplayModeKHR mode,
|
||||
uint32_t planeIndex,
|
||||
VkDisplayPlaneCapabilitiesKHR *pCapabilities)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_get_display_plane_capabilities(physicalDevice,
|
||||
device->wsi_device,
|
||||
mode,
|
||||
planeIndex,
|
||||
pCapabilities);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_get_display_plane_capabilities2(
|
||||
VkPhysicalDevice physical_device,
|
||||
|
|
@ -784,6 +910,19 @@ wsi_get_display_plane_capabilities2(
|
|||
return result;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetDisplayPlaneCapabilities2KHR(VkPhysicalDevice physicalDevice,
|
||||
const VkDisplayPlaneInfo2KHR *pDisplayPlaneInfo,
|
||||
VkDisplayPlaneCapabilities2KHR *pCapabilities)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_get_display_plane_capabilities2(physicalDevice,
|
||||
device->wsi_device,
|
||||
pDisplayPlaneInfo,
|
||||
pCapabilities);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_create_display_surface(VkInstance instance,
|
||||
const VkAllocationCallbacks *allocator,
|
||||
|
|
@ -810,6 +949,22 @@ wsi_create_display_surface(VkInstance instance,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_CreateDisplayPlaneSurfaceKHR(VkInstance _instance,
|
||||
const VkDisplaySurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_instance, instance, _instance);
|
||||
const VkAllocationCallbacks *alloc;
|
||||
|
||||
if (pAllocator)
|
||||
alloc = pAllocator;
|
||||
else
|
||||
alloc = &instance->alloc;
|
||||
|
||||
return wsi_create_display_surface(_instance, alloc, pCreateInfo, pSurface);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
wsi_display_surface_get_support(VkIcdSurfaceBase *surface,
|
||||
|
|
@ -2004,6 +2159,17 @@ wsi_release_display(VkPhysicalDevice physical_device,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_ReleaseDisplayEXT(VkPhysicalDevice physicalDevice,
|
||||
VkDisplayKHR display)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_release_display(physicalDevice,
|
||||
device->wsi_device,
|
||||
display);
|
||||
}
|
||||
|
||||
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
|
||||
|
||||
static struct wsi_display_connector *
|
||||
|
|
@ -2463,6 +2629,18 @@ wsi_acquire_xlib_display(VkPhysicalDevice physical_device,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice,
|
||||
Display *dpy,
|
||||
VkDisplayKHR display)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_acquire_xlib_display(physicalDevice,
|
||||
device->wsi_device,
|
||||
dpy, display);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_get_randr_output_display(VkPhysicalDevice physical_device,
|
||||
struct wsi_device *wsi_device,
|
||||
|
|
@ -2481,6 +2659,19 @@ wsi_get_randr_output_display(VkPhysicalDevice physical_device,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetRandROutputDisplayEXT(VkPhysicalDevice physicalDevice,
|
||||
Display *dpy,
|
||||
RROutput rrOutput,
|
||||
VkDisplayKHR *pDisplay)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_get_randr_output_display(physicalDevice,
|
||||
device->wsi_device,
|
||||
dpy, rrOutput, pDisplay);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* VK_EXT_display_control */
|
||||
|
|
@ -2517,6 +2708,17 @@ wsi_display_power_control(VkDevice device,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_DisplayPowerControlEXT(VkDevice _device,
|
||||
VkDisplayKHR display,
|
||||
const VkDisplayPowerInfoEXT *pDisplayPowerInfo)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_device, device, _device);
|
||||
|
||||
return wsi_display_power_control(_device, device->physical->wsi_device,
|
||||
display, pDisplayPowerInfo);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_register_device_event(VkDevice device,
|
||||
struct wsi_device *wsi_device,
|
||||
|
|
@ -2528,6 +2730,15 @@ wsi_register_device_event(VkDevice device,
|
|||
return VK_ERROR_FEATURE_NOT_PRESENT;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_RegisterDeviceEventEXT(VkDevice device,
|
||||
const VkDeviceEventInfoEXT *pDeviceEventInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkFence *pFence)
|
||||
{
|
||||
unreachable("Not enough common infrastructure to implement this yet");
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_register_display_event(VkDevice device,
|
||||
struct wsi_device *wsi_device,
|
||||
|
|
@ -2573,6 +2784,15 @@ wsi_register_display_event(VkDevice device,
|
|||
return ret;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_RegisterDisplayEventEXT(VkDevice device,
|
||||
VkDisplayKHR display,
|
||||
const VkDisplayEventInfoEXT *pDisplayEventInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkFence *pFence)
|
||||
{
|
||||
unreachable("Not enough common infrastructure to implement this yet");
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_get_swapchain_counter(VkDevice device,
|
||||
|
|
@ -2603,6 +2823,18 @@ wsi_get_swapchain_counter(VkDevice device,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetSwapchainCounterEXT(VkDevice _device,
|
||||
VkSwapchainKHR swapchain,
|
||||
VkSurfaceCounterFlagBitsEXT counter,
|
||||
uint64_t *pCounterValue)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_device, device, _device);
|
||||
|
||||
return wsi_get_swapchain_counter(_device, device->physical->wsi_device,
|
||||
swapchain, counter, pCounterValue);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_acquire_drm_display(VkPhysicalDevice pDevice,
|
||||
struct wsi_device *wsi_device,
|
||||
|
|
@ -2634,6 +2866,17 @@ wsi_acquire_drm_display(VkPhysicalDevice pDevice,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_AcquireDrmDisplayEXT(VkPhysicalDevice physicalDevice,
|
||||
int32_t drmFd,
|
||||
VkDisplayKHR display)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_acquire_drm_display(physicalDevice, device->wsi_device,
|
||||
drmFd, display);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_get_drm_display(VkPhysicalDevice pDevice,
|
||||
struct wsi_device *wsi_device,
|
||||
|
|
@ -2656,3 +2899,14 @@ wsi_get_drm_display(VkPhysicalDevice pDevice,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_GetDrmDisplayEXT(VkPhysicalDevice physicalDevice,
|
||||
int32_t drmFd,
|
||||
uint32_t connectorId,
|
||||
VkDisplayKHR *display)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_get_drm_display(physicalDevice, device->wsi_device,
|
||||
drmFd, connectorId, display);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,10 @@
|
|||
|
||||
#include "drm-uapi/drm_fourcc.h"
|
||||
|
||||
#include "vk_instance.h"
|
||||
#include "vk_physical_device.h"
|
||||
#include "vk_util.h"
|
||||
#include "wsi_common_entrypoints.h"
|
||||
#include "wsi_common_private.h"
|
||||
#include "wsi_common_wayland.h"
|
||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||
|
|
@ -589,6 +592,16 @@ wsi_wl_get_presentation_support(struct wsi_device *wsi_device,
|
|||
return ret == VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL
|
||||
wsi_GetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
struct wl_display *display)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_wl_get_presentation_support(device->wsi_device, display);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
wsi_wl_surface_get_support(VkIcdSurfaceBase *surface,
|
||||
struct wsi_device *wsi_device,
|
||||
|
|
@ -793,6 +806,25 @@ VkResult wsi_create_wl_surface(const VkAllocationCallbacks *pAllocator,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_CreateWaylandSurfaceKHR(VkInstance _instance,
|
||||
const VkWaylandSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_instance, instance, _instance);
|
||||
const VkAllocationCallbacks *alloc;
|
||||
|
||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR);
|
||||
|
||||
if (pAllocator)
|
||||
alloc = pAllocator;
|
||||
else
|
||||
alloc = &instance->alloc;
|
||||
|
||||
return wsi_create_wl_surface(alloc, pCreateInfo, pSurface);
|
||||
}
|
||||
|
||||
struct wsi_wl_image {
|
||||
struct wsi_image base;
|
||||
struct wl_buffer * buffer;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,10 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "vk_instance.h"
|
||||
#include "vk_physical_device.h"
|
||||
#include "vk_util.h"
|
||||
#include "wsi_common_entrypoints.h"
|
||||
#include "wsi_common_private.h"
|
||||
#include "wsi_common_win32.h"
|
||||
|
||||
|
|
@ -73,6 +76,15 @@ wsi_win32_get_presentation_support(struct wsi_device *wsi_device)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL
|
||||
wsi_GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_win32_get_presentation_support(device->wsi_device);
|
||||
}
|
||||
|
||||
VkResult
|
||||
wsi_create_win32_surface(VkInstance instance,
|
||||
const VkAllocationCallbacks *allocator,
|
||||
|
|
@ -94,6 +106,25 @@ wsi_create_win32_surface(VkInstance instance,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_CreateWin32SurfaceKHR(VkInstance _instance,
|
||||
const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_instance, instance, _instance);
|
||||
const VkAllocationCallbacks *alloc;
|
||||
|
||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR);
|
||||
|
||||
if (pAllocator)
|
||||
alloc = pAllocator;
|
||||
else
|
||||
alloc = &instance->alloc;
|
||||
|
||||
return wsi_create_win32_surface(_instance, alloc, pCreateInfo, pSurface);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
wsi_win32_surface_get_support(VkIcdSurfaceBase *surface,
|
||||
struct wsi_device *wsi_device,
|
||||
|
|
|
|||
|
|
@ -43,8 +43,11 @@
|
|||
#include "util/u_thread.h"
|
||||
#include "util/xmlconfig.h"
|
||||
|
||||
#include "vk_instance.h"
|
||||
#include "vk_physical_device.h"
|
||||
#include "vk_util.h"
|
||||
#include "vk_enum_to_str.h"
|
||||
#include "wsi_common_entrypoints.h"
|
||||
#include "wsi_common_private.h"
|
||||
#include "wsi_common_x11.h"
|
||||
#include "wsi_common_queue.h"
|
||||
|
|
@ -495,6 +498,34 @@ VkBool32 wsi_get_physical_device_xcb_presentation_support(
|
|||
return true;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL
|
||||
wsi_GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
xcb_connection_t *connection,
|
||||
xcb_visualid_t visual_id)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_get_physical_device_xcb_presentation_support(device->wsi_device,
|
||||
queueFamilyIndex,
|
||||
connection,
|
||||
visual_id);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL
|
||||
wsi_GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
Display *dpy,
|
||||
VisualID visualID)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
|
||||
|
||||
return wsi_get_physical_device_xcb_presentation_support(device->wsi_device,
|
||||
queueFamilyIndex,
|
||||
XGetXCBConnection(dpy),
|
||||
visualID);
|
||||
}
|
||||
|
||||
static xcb_connection_t*
|
||||
x11_surface_get_connection(VkIcdSurfaceBase *icd_surface)
|
||||
{
|
||||
|
|
@ -794,6 +825,25 @@ VkResult wsi_create_xcb_surface(const VkAllocationCallbacks *pAllocator,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_CreateXcbSurfaceKHR(VkInstance _instance,
|
||||
const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_instance, instance, _instance);
|
||||
const VkAllocationCallbacks *alloc;
|
||||
|
||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR);
|
||||
|
||||
if (pAllocator)
|
||||
alloc = pAllocator;
|
||||
else
|
||||
alloc = &instance->alloc;
|
||||
|
||||
return wsi_create_xcb_surface(alloc, pCreateInfo, pSurface);
|
||||
}
|
||||
|
||||
VkResult wsi_create_xlib_surface(const VkAllocationCallbacks *pAllocator,
|
||||
const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
|
||||
VkSurfaceKHR *pSurface)
|
||||
|
|
@ -813,6 +863,25 @@ VkResult wsi_create_xlib_surface(const VkAllocationCallbacks *pAllocator,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
wsi_CreateXlibSurfaceKHR(VkInstance _instance,
|
||||
const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_instance, instance, _instance);
|
||||
const VkAllocationCallbacks *alloc;
|
||||
|
||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR);
|
||||
|
||||
if (pAllocator)
|
||||
alloc = pAllocator;
|
||||
else
|
||||
alloc = &instance->alloc;
|
||||
|
||||
return wsi_create_xlib_surface(alloc, pCreateInfo, pSurface);
|
||||
}
|
||||
|
||||
struct x11_image {
|
||||
struct wsi_image base;
|
||||
xcb_pixmap_t pixmap;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue