Path: blob/21.2-virgl/src/panfrost/vulkan/panvk_wsi_display.c
4560 views
/*1* Copyright © 2021 Collabora Ltd.2*3* Derived from v3dv driver:4* Copyright © 2020 Raspberry Pi5* Copyright © 2017 Keith Packard6*7* Permission to use, copy, modify, distribute, and sell this software and its8* documentation for any purpose is hereby granted without fee, provided that9* the above copyright notice appear in all copies and that both that copyright10* notice and this permission notice appear in supporting documentation, and11* that the name of the copyright holders not be used in advertising or12* publicity pertaining to distribution of the software without specific,13* written prior permission. The copyright holders make no representations14* about the suitability of this software for any purpose. It is provided "as15* is" without express or implied warranty.16*17* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,18* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO19* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR20* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,21* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER22* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE23* OF THIS SOFTWARE.24*/25#include "panvk_private.h"26#include "wsi_common_display.h"2728VkResult29panvk_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physical_device,30uint32_t *property_count,31VkDisplayPropertiesKHR *properties)32{33VK_FROM_HANDLE(panvk_physical_device, pdevice, physical_device);3435return wsi_display_get_physical_device_display_properties(36physical_device,37&pdevice->wsi_device,38property_count,39properties);40}4142VkResult43panvk_GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physical_device,44uint32_t *property_count,45VkDisplayPlanePropertiesKHR *properties)46{47VK_FROM_HANDLE(panvk_physical_device, pdevice, physical_device);4849return wsi_display_get_physical_device_display_plane_properties(50physical_device,51&pdevice->wsi_device,52property_count,53properties);54}5556VkResult57panvk_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physical_device,58uint32_t plane_index,59uint32_t *display_count,60VkDisplayKHR *displays)61{62VK_FROM_HANDLE(panvk_physical_device, pdevice, physical_device);6364return wsi_display_get_display_plane_supported_displays(65physical_device,66&pdevice->wsi_device,67plane_index,68display_count,69displays);70}7172VkResult73panvk_GetDisplayModePropertiesKHR(VkPhysicalDevice physical_device,74VkDisplayKHR display,75uint32_t *property_count,76VkDisplayModePropertiesKHR *properties)77{78VK_FROM_HANDLE(panvk_physical_device, pdevice, physical_device);7980return wsi_display_get_display_mode_properties(physical_device,81&pdevice->wsi_device,82display,83property_count,84properties);85}8687VkResult88panvk_CreateDisplayModeKHR(VkPhysicalDevice physical_device,89VkDisplayKHR display,90const VkDisplayModeCreateInfoKHR *create_info,91const VkAllocationCallbacks *allocator,92VkDisplayModeKHR *mode)93{94VK_FROM_HANDLE(panvk_physical_device, pdevice, physical_device);9596return wsi_display_create_display_mode(physical_device,97&pdevice->wsi_device,98display,99create_info,100allocator,101mode);102}103104VkResult105panvk_GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physical_device,106VkDisplayModeKHR mode_khr,107uint32_t plane_index,108VkDisplayPlaneCapabilitiesKHR *capabilities)109{110VK_FROM_HANDLE(panvk_physical_device, pdevice, physical_device);111112return wsi_get_display_plane_capabilities(physical_device,113&pdevice->wsi_device,114mode_khr,115plane_index,116capabilities);117}118119VkResult120panvk_CreateDisplayPlaneSurfaceKHR(VkInstance _instance,121const VkDisplaySurfaceCreateInfoKHR *create_info,122const VkAllocationCallbacks *allocator,123VkSurfaceKHR *surface)124{125VK_FROM_HANDLE(panvk_instance, instance, _instance);126const VkAllocationCallbacks *alloc;127128if (allocator)129alloc = allocator;130else131alloc = &instance->vk.alloc;132133return wsi_create_display_surface(_instance, alloc,134create_info, surface);135}136137138