Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/virtio/vulkan/vn_wsi_x11.c
4560 views
1
/*
2
* Copyright 2019 Google LLC
3
* SPDX-License-Identifier: MIT
4
*
5
* based in part on anv and radv which are:
6
* Copyright © 2015 Intel Corporation
7
* Copyright © 2016 Red Hat.
8
* Copyright © 2016 Bas Nieuwenhuizen
9
*/
10
11
#include <X11/Xlib-xcb.h>
12
13
#include "wsi_common_x11.h"
14
15
#include "vn_device.h"
16
#include "vn_wsi.h"
17
18
/* XCB surface commands */
19
20
VkResult
21
vn_CreateXcbSurfaceKHR(VkInstance _instance,
22
const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
23
const VkAllocationCallbacks *pAllocator,
24
VkSurfaceKHR *pSurface)
25
{
26
struct vn_instance *instance = vn_instance_from_handle(_instance);
27
const VkAllocationCallbacks *alloc =
28
pAllocator ? pAllocator : &instance->base.base.alloc;
29
30
VkResult result = wsi_create_xcb_surface(alloc, pCreateInfo, pSurface);
31
32
return vn_result(instance, result);
33
}
34
35
VkBool32
36
vn_GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice,
37
uint32_t queueFamilyIndex,
38
xcb_connection_t *connection,
39
xcb_visualid_t visual_id)
40
{
41
struct vn_physical_device *physical_dev =
42
vn_physical_device_from_handle(physicalDevice);
43
44
return wsi_get_physical_device_xcb_presentation_support(
45
&physical_dev->wsi_device, queueFamilyIndex, connection, visual_id);
46
}
47
48
/* Xlib surface commands */
49
50
VkResult
51
vn_CreateXlibSurfaceKHR(VkInstance _instance,
52
const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
53
const VkAllocationCallbacks *pAllocator,
54
VkSurfaceKHR *pSurface)
55
{
56
struct vn_instance *instance = vn_instance_from_handle(_instance);
57
const VkAllocationCallbacks *alloc =
58
pAllocator ? pAllocator : &instance->base.base.alloc;
59
60
VkResult result = wsi_create_xlib_surface(alloc, pCreateInfo, pSurface);
61
62
return vn_result(instance, result);
63
}
64
65
VkBool32
66
vn_GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice,
67
uint32_t queueFamilyIndex,
68
Display *dpy,
69
VisualID visualID)
70
{
71
struct vn_physical_device *physical_dev =
72
vn_physical_device_from_handle(physicalDevice);
73
74
return wsi_get_physical_device_xcb_presentation_support(
75
&physical_dev->wsi_device, queueFamilyIndex, XGetXCBConnection(dpy),
76
visualID);
77
}
78
79