vulkan/wsi/x11: Only use MIT_SHM if the device supports EXT_external_memory_host
Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17388>
This commit is contained in:
parent
5abc05f1df
commit
54fa5ff406
|
@ -104,6 +104,11 @@ wsi_device_init(struct wsi_device *wsi,
|
|||
wsi->semaphore_export_handle_types |= handle_type;
|
||||
}
|
||||
|
||||
const struct vk_device_extension_table *supported_extensions =
|
||||
&vk_physical_device_from_handle(pdevice)->supported_extensions;
|
||||
wsi->has_import_memory_host =
|
||||
supported_extensions->EXT_external_memory_host;
|
||||
|
||||
list_inithead(&wsi->hotplug_fences);
|
||||
|
||||
#define WSI_GET_CB(func) \
|
||||
|
|
|
@ -104,6 +104,8 @@ struct wsi_device {
|
|||
|
||||
VkExternalSemaphoreHandleTypeFlags semaphore_export_handle_types;
|
||||
|
||||
bool has_import_memory_host;
|
||||
|
||||
bool supports_modifiers;
|
||||
uint32_t maxImageDimension2D;
|
||||
uint32_t optimalBufferCopyRowPitchAlignment;
|
||||
|
|
|
@ -196,6 +196,7 @@ wsi_x11_connection_create(struct wsi_device *wsi_dev,
|
|||
xcb_query_extension_reply_t *dri3_reply, *pres_reply, *randr_reply,
|
||||
*amd_reply, *nv_reply, *shm_reply = NULL,
|
||||
*xfixes_reply;
|
||||
bool wants_shm = wsi_dev->sw && wsi_dev->has_import_memory_host;
|
||||
bool has_dri3_v1_2 = false;
|
||||
bool has_present_v1_2 = false;
|
||||
|
||||
|
@ -211,7 +212,7 @@ wsi_x11_connection_create(struct wsi_device *wsi_dev,
|
|||
randr_cookie = xcb_query_extension(conn, 5, "RANDR");
|
||||
xfixes_cookie = xcb_query_extension(conn, 6, "XFIXES");
|
||||
|
||||
if (wsi_dev->sw)
|
||||
if (wants_shm)
|
||||
shm_cookie = xcb_query_extension(conn, 7, "MIT-SHM");
|
||||
|
||||
/* We try to be nice to users and emit a warning if they try to use a
|
||||
|
@ -233,7 +234,7 @@ wsi_x11_connection_create(struct wsi_device *wsi_dev,
|
|||
amd_reply = xcb_query_extension_reply(conn, amd_cookie, NULL);
|
||||
nv_reply = xcb_query_extension_reply(conn, nv_cookie, NULL);
|
||||
xfixes_reply = xcb_query_extension_reply(conn, xfixes_cookie, NULL);
|
||||
if (wsi_dev->sw)
|
||||
if (wants_shm)
|
||||
shm_reply = xcb_query_extension_reply(conn, shm_cookie, NULL);
|
||||
if (!dri3_reply || !pres_reply || !xfixes_reply) {
|
||||
free(dri3_reply);
|
||||
|
@ -242,7 +243,7 @@ wsi_x11_connection_create(struct wsi_device *wsi_dev,
|
|||
free(randr_reply);
|
||||
free(amd_reply);
|
||||
free(nv_reply);
|
||||
if (wsi_dev->sw)
|
||||
if (wants_shm)
|
||||
free(shm_reply);
|
||||
vk_free(&wsi_dev->instance_alloc, wsi_conn);
|
||||
return NULL;
|
||||
|
@ -300,7 +301,7 @@ wsi_x11_connection_create(struct wsi_device *wsi_dev,
|
|||
wsi_conn->is_proprietary_x11 = true;
|
||||
|
||||
wsi_conn->has_mit_shm = false;
|
||||
if (wsi_conn->has_dri3 && wsi_conn->has_present && wsi_dev->sw) {
|
||||
if (wsi_conn->has_dri3 && wsi_conn->has_present && wants_shm) {
|
||||
bool has_mit_shm = shm_reply->present != 0;
|
||||
|
||||
xcb_shm_query_version_cookie_t ver_cookie;
|
||||
|
@ -329,7 +330,7 @@ wsi_x11_connection_create(struct wsi_device *wsi_dev,
|
|||
free(randr_reply);
|
||||
free(amd_reply);
|
||||
free(nv_reply);
|
||||
if (wsi_dev->sw)
|
||||
if (wants_shm)
|
||||
free(shm_reply);
|
||||
|
||||
return wsi_conn;
|
||||
|
|
Loading…
Reference in New Issue