Path: blob/21.2-virgl/src/virtio/vulkan/vn_wsi_x11.c
4560 views
/*1* Copyright 2019 Google LLC2* SPDX-License-Identifier: MIT3*4* based in part on anv and radv which are:5* Copyright © 2015 Intel Corporation6* Copyright © 2016 Red Hat.7* Copyright © 2016 Bas Nieuwenhuizen8*/910#include <X11/Xlib-xcb.h>1112#include "wsi_common_x11.h"1314#include "vn_device.h"15#include "vn_wsi.h"1617/* XCB surface commands */1819VkResult20vn_CreateXcbSurfaceKHR(VkInstance _instance,21const VkXcbSurfaceCreateInfoKHR *pCreateInfo,22const VkAllocationCallbacks *pAllocator,23VkSurfaceKHR *pSurface)24{25struct vn_instance *instance = vn_instance_from_handle(_instance);26const VkAllocationCallbacks *alloc =27pAllocator ? pAllocator : &instance->base.base.alloc;2829VkResult result = wsi_create_xcb_surface(alloc, pCreateInfo, pSurface);3031return vn_result(instance, result);32}3334VkBool3235vn_GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice,36uint32_t queueFamilyIndex,37xcb_connection_t *connection,38xcb_visualid_t visual_id)39{40struct vn_physical_device *physical_dev =41vn_physical_device_from_handle(physicalDevice);4243return wsi_get_physical_device_xcb_presentation_support(44&physical_dev->wsi_device, queueFamilyIndex, connection, visual_id);45}4647/* Xlib surface commands */4849VkResult50vn_CreateXlibSurfaceKHR(VkInstance _instance,51const VkXlibSurfaceCreateInfoKHR *pCreateInfo,52const VkAllocationCallbacks *pAllocator,53VkSurfaceKHR *pSurface)54{55struct vn_instance *instance = vn_instance_from_handle(_instance);56const VkAllocationCallbacks *alloc =57pAllocator ? pAllocator : &instance->base.base.alloc;5859VkResult result = wsi_create_xlib_surface(alloc, pCreateInfo, pSurface);6061return vn_result(instance, result);62}6364VkBool3265vn_GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice,66uint32_t queueFamilyIndex,67Display *dpy,68VisualID visualID)69{70struct vn_physical_device *physical_dev =71vn_physical_device_from_handle(physicalDevice);7273return wsi_get_physical_device_xcb_presentation_support(74&physical_dev->wsi_device, queueFamilyIndex, XGetXCBConnection(dpy),75visualID);76}777879