Path: blob/21.2-virgl/src/broadcom/vulkan/v3dv_wsi_display.c
4560 views
/*1* Copyright © 2020 Raspberry Pi2* based on KHR_display extension code:3* Copyright © 2017 Keith Packard4*5* Permission to use, copy, modify, distribute, and sell this software and its6* documentation for any purpose is hereby granted without fee, provided that7* the above copyright notice appear in all copies and that both that copyright8* notice and this permission notice appear in supporting documentation, and9* that the name of the copyright holders not be used in advertising or10* publicity pertaining to distribution of the software without specific,11* written prior permission. The copyright holders make no representations12* about the suitability of this software for any purpose. It is provided "as13* is" without express or implied warranty.14*15* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,16* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO17* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR18* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,19* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER20* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE21* OF THIS SOFTWARE.22*/23#include "v3dv_private.h"24#include "wsi_common_display.h"2526VKAPI_ATTR VkResult VKAPI_CALL27v3dv_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physical_device,28uint32_t *property_count,29VkDisplayPropertiesKHR *properties)30{31V3DV_FROM_HANDLE(v3dv_physical_device, pdevice, physical_device);3233return wsi_display_get_physical_device_display_properties(34physical_device,35&pdevice->wsi_device,36property_count,37properties);38}3940VkResult41v3dv_GetPhysicalDeviceDisplayProperties2KHR(42VkPhysicalDevice physical_device,43uint32_t *pPropertyCount,44VkDisplayProperties2KHR *pProperties)45{46V3DV_FROM_HANDLE(v3dv_physical_device, pdevice, physical_device);4748return wsi_display_get_physical_device_display_properties2(49physical_device,50&pdevice->wsi_device,51pPropertyCount,52pProperties);53}5455VKAPI_ATTR VkResult VKAPI_CALL56v3dv_GetPhysicalDeviceDisplayPlanePropertiesKHR(57VkPhysicalDevice physical_device,58uint32_t *property_count,59VkDisplayPlanePropertiesKHR *properties)60{61V3DV_FROM_HANDLE(v3dv_physical_device, pdevice, physical_device);6263return wsi_display_get_physical_device_display_plane_properties(64physical_device,65&pdevice->wsi_device,66property_count,67properties);68}6970VkResult71v3dv_GetPhysicalDeviceDisplayPlaneProperties2KHR(72VkPhysicalDevice physical_device,73uint32_t *pPropertyCount,74VkDisplayPlaneProperties2KHR *pProperties)75{76V3DV_FROM_HANDLE(v3dv_physical_device, pdevice, physical_device);7778return wsi_display_get_physical_device_display_plane_properties2(79physical_device,80&pdevice->wsi_device,81pPropertyCount,82pProperties);83}8485VKAPI_ATTR VkResult VKAPI_CALL86v3dv_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physical_device,87uint32_t plane_index,88uint32_t *display_count,89VkDisplayKHR *displays)90{91V3DV_FROM_HANDLE(v3dv_physical_device, pdevice, physical_device);9293return wsi_display_get_display_plane_supported_displays(94physical_device,95&pdevice->wsi_device,96plane_index,97display_count,98displays);99}100101VKAPI_ATTR VkResult VKAPI_CALL102v3dv_GetDisplayModePropertiesKHR(VkPhysicalDevice physical_device,103VkDisplayKHR display,104uint32_t *property_count,105VkDisplayModePropertiesKHR *properties)106{107V3DV_FROM_HANDLE(v3dv_physical_device, pdevice, physical_device);108109return wsi_display_get_display_mode_properties(physical_device,110&pdevice->wsi_device,111display,112property_count,113properties);114}115116VkResult117v3dv_GetDisplayModeProperties2KHR(VkPhysicalDevice physical_device,118VkDisplayKHR display,119uint32_t *pPropertyCount,120VkDisplayModeProperties2KHR *pProperties)121{122V3DV_FROM_HANDLE(v3dv_physical_device, pdevice, physical_device);123124return wsi_display_get_display_mode_properties2(physical_device,125&pdevice->wsi_device,126display,127pPropertyCount,128pProperties);129}130131VKAPI_ATTR VkResult VKAPI_CALL132v3dv_CreateDisplayModeKHR(VkPhysicalDevice physical_device,133VkDisplayKHR display,134const VkDisplayModeCreateInfoKHR *create_info,135const VkAllocationCallbacks *allocator,136VkDisplayModeKHR *mode)137{138V3DV_FROM_HANDLE(v3dv_physical_device, pdevice, physical_device);139140return wsi_display_create_display_mode(physical_device,141&pdevice->wsi_device,142display,143create_info,144allocator,145mode);146}147148VKAPI_ATTR VkResult VKAPI_CALL149v3dv_GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physical_device,150VkDisplayModeKHR mode_khr,151uint32_t plane_index,152VkDisplayPlaneCapabilitiesKHR *capabilities)153{154V3DV_FROM_HANDLE(v3dv_physical_device, pdevice, physical_device);155156return wsi_get_display_plane_capabilities(physical_device,157&pdevice->wsi_device,158mode_khr,159plane_index,160capabilities);161}162163VkResult164v3dv_GetDisplayPlaneCapabilities2KHR(165VkPhysicalDevice physical_device,166const VkDisplayPlaneInfo2KHR *pDisplayPlaneInfo,167VkDisplayPlaneCapabilities2KHR *pCapabilities)168{169V3DV_FROM_HANDLE(v3dv_physical_device, pdevice, physical_device);170171return wsi_get_display_plane_capabilities2(physical_device,172&pdevice->wsi_device,173pDisplayPlaneInfo,174pCapabilities);175}176177VKAPI_ATTR VkResult VKAPI_CALL178v3dv_CreateDisplayPlaneSurfaceKHR(179VkInstance _instance,180const VkDisplaySurfaceCreateInfoKHR *create_info,181const VkAllocationCallbacks *allocator,182VkSurfaceKHR *surface)183{184V3DV_FROM_HANDLE(v3dv_instance, instance, _instance);185const VkAllocationCallbacks *alloc;186187if (allocator)188alloc = allocator;189else190alloc = &instance->vk.alloc;191192return wsi_create_display_surface(_instance, alloc,193create_info, surface);194}195196197