Path: blob/21.2-virgl/src/intel/vulkan/anv_wsi_x11.c
4547 views
/*1* Copyright © 2015 Intel Corporation2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#include <X11/Xlib-xcb.h>24#include <X11/xshmfence.h>25#include <xcb/xcb.h>26#include <xcb/dri3.h>27#include <xcb/present.h>2829#include "wsi_common_x11.h"30#include "anv_private.h"3132VkBool32 anv_GetPhysicalDeviceXcbPresentationSupportKHR(33VkPhysicalDevice physicalDevice,34uint32_t queueFamilyIndex,35xcb_connection_t* connection,36xcb_visualid_t visual_id)37{38ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);3940return wsi_get_physical_device_xcb_presentation_support(41&device->wsi_device,42queueFamilyIndex,43connection, visual_id);44}4546VkBool32 anv_GetPhysicalDeviceXlibPresentationSupportKHR(47VkPhysicalDevice physicalDevice,48uint32_t queueFamilyIndex,49Display* dpy,50VisualID visualID)51{52ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);5354return wsi_get_physical_device_xcb_presentation_support(55&device->wsi_device,56queueFamilyIndex,57XGetXCBConnection(dpy), visualID);58}5960VkResult anv_CreateXcbSurfaceKHR(61VkInstance _instance,62const VkXcbSurfaceCreateInfoKHR* pCreateInfo,63const VkAllocationCallbacks* pAllocator,64VkSurfaceKHR* pSurface)65{66ANV_FROM_HANDLE(anv_instance, instance, _instance);67const VkAllocationCallbacks *alloc;68assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR);6970if (pAllocator)71alloc = pAllocator;72else73alloc = &instance->vk.alloc;7475return wsi_create_xcb_surface(alloc, pCreateInfo, pSurface);76}7778VkResult anv_CreateXlibSurfaceKHR(79VkInstance _instance,80const VkXlibSurfaceCreateInfoKHR* pCreateInfo,81const VkAllocationCallbacks* pAllocator,82VkSurfaceKHR* pSurface)83{84ANV_FROM_HANDLE(anv_instance, instance, _instance);85const VkAllocationCallbacks *alloc;8687assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR);8889if (pAllocator)90alloc = pAllocator;91else92alloc = &instance->vk.alloc;9394return wsi_create_xlib_surface(alloc, pCreateInfo, pSurface);95}969798