summaryrefslogtreecommitdiff
path: root/src/intel/vulkan/anv_wsi_x11.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-10-13 05:07:27 +0100
committerDave Airlie <airlied@redhat.com>2016-10-19 10:15:42 +1000
commitbe61fff6da32267cb5d463197df22be8d8875ff8 (patch)
tree5bbd5704c96b660246735411d34ca956c022f190 /src/intel/vulkan/anv_wsi_x11.c
parente9cf7c4460588eec68074c477bf3c7add6d21da7 (diff)
anv/wsi/x11: push device out of x11 connection fns.
just pass the allocator/wsi_interface instead. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Diffstat (limited to 'src/intel/vulkan/anv_wsi_x11.c')
-rw-r--r--src/intel/vulkan/anv_wsi_x11.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/intel/vulkan/anv_wsi_x11.c b/src/intel/vulkan/anv_wsi_x11.c
index fce3451481d..3c9d4bd1f0d 100644
--- a/src/intel/vulkan/anv_wsi_x11.c
+++ b/src/intel/vulkan/anv_wsi_x11.c
@@ -46,14 +46,14 @@ struct wsi_x11 {
};
static struct wsi_x11_connection *
-wsi_x11_connection_create(struct anv_physical_device *device,
+wsi_x11_connection_create(const VkAllocationCallbacks *alloc,
xcb_connection_t *conn)
{
xcb_query_extension_cookie_t dri3_cookie, pres_cookie;
xcb_query_extension_reply_t *dri3_reply, *pres_reply;
struct wsi_x11_connection *wsi_conn =
- vk_alloc(&device->instance->alloc, sizeof(*wsi_conn), 8,
+ vk_alloc(alloc, sizeof(*wsi_conn), 8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (!wsi_conn)
return NULL;
@@ -66,7 +66,7 @@ wsi_x11_connection_create(struct anv_physical_device *device,
if (dri3_reply == NULL || pres_reply == NULL) {
free(dri3_reply);
free(pres_reply);
- vk_free(&device->instance->alloc, wsi_conn);
+ vk_free(alloc, wsi_conn);
return NULL;
}
@@ -80,18 +80,19 @@ wsi_x11_connection_create(struct anv_physical_device *device,
}
static void
-wsi_x11_connection_destroy(struct anv_physical_device *device,
+wsi_x11_connection_destroy(const VkAllocationCallbacks *alloc,
struct wsi_x11_connection *conn)
{
- vk_free(&device->instance->alloc, conn);
+ vk_free(alloc, conn);
}
static struct wsi_x11_connection *
-wsi_x11_get_connection(struct anv_physical_device *device,
+wsi_x11_get_connection(struct anv_wsi_interface **wsi_dev,
+ const VkAllocationCallbacks *alloc,
xcb_connection_t *conn)
{
struct wsi_x11 *wsi =
- (struct wsi_x11 *)device->wsi[VK_ICD_WSI_PLATFORM_XCB];
+ (struct wsi_x11 *)wsi_dev[VK_ICD_WSI_PLATFORM_XCB];
pthread_mutex_lock(&wsi->mutex);
@@ -103,14 +104,14 @@ wsi_x11_get_connection(struct anv_physical_device *device,
pthread_mutex_unlock(&wsi->mutex);
struct wsi_x11_connection *wsi_conn =
- wsi_x11_connection_create(device, conn);
+ wsi_x11_connection_create(alloc, conn);
pthread_mutex_lock(&wsi->mutex);
entry = _mesa_hash_table_search(wsi->connections, conn);
if (entry) {
/* Oops, someone raced us to it */
- wsi_x11_connection_destroy(device, wsi_conn);
+ wsi_x11_connection_destroy(alloc, wsi_conn);
} else {
entry = _mesa_hash_table_insert(wsi->connections, conn, wsi_conn);
}
@@ -241,7 +242,7 @@ VkBool32 anv_GetPhysicalDeviceXcbPresentationSupportKHR(
ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);
struct wsi_x11_connection *wsi_conn =
- wsi_x11_get_connection(device, connection);
+ wsi_x11_get_connection(device->wsi, &device->instance->alloc, connection);
if (!wsi_conn->has_dri3) {
fprintf(stderr, "vulkan: No DRI3 support\n");
@@ -298,7 +299,7 @@ x11_surface_get_support(VkIcdSurfaceBase *icd_surface,
xcb_window_t window = x11_surface_get_window(icd_surface);
struct wsi_x11_connection *wsi_conn =
- wsi_x11_get_connection(device, conn);
+ wsi_x11_get_connection(device->wsi, &device->instance->alloc, conn);
if (!wsi_conn)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);