mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 07:08:04 +02:00
egl/dri: Check that xshm can be attached
Cc: mesa-stable
Co-authored-by: Carlos Lopez <clopez@igalia.com>
(cherry picked from commit 5f481dd89d)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40359>
This commit is contained in:
parent
23b88ba221
commit
2c4c7fbfa9
2 changed files with 4 additions and 33 deletions
|
|
@ -2414,7 +2414,7 @@
|
|||
"description": "egl/dri: Check that xshm can be attached",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -51,7 +51,9 @@
|
|||
#include "util/log.h"
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include "x11_dri3.h"
|
||||
#include "x11_display.h"
|
||||
#include "kopper_interface.h"
|
||||
#include "loader.h"
|
||||
#include "platform_x11.h"
|
||||
|
|
@ -1123,37 +1125,6 @@ dri2_x11_setup_swap_interval(_EGLDisplay *disp)
|
|||
dri2_setup_swap_interval(disp, arbitrary_max_interval);
|
||||
}
|
||||
|
||||
static bool
|
||||
check_xshm(struct dri2_egl_display *dri2_dpy)
|
||||
{
|
||||
xcb_void_cookie_t cookie;
|
||||
xcb_generic_error_t *error;
|
||||
int ret = true;
|
||||
xcb_query_extension_cookie_t shm_cookie;
|
||||
xcb_query_extension_reply_t *shm_reply;
|
||||
bool has_mit_shm;
|
||||
|
||||
shm_cookie = xcb_query_extension(dri2_dpy->conn, 7, "MIT-SHM");
|
||||
shm_reply = xcb_query_extension_reply(dri2_dpy->conn, shm_cookie, NULL);
|
||||
|
||||
has_mit_shm = shm_reply && shm_reply->present;
|
||||
free(shm_reply);
|
||||
if (!has_mit_shm)
|
||||
return false;
|
||||
|
||||
cookie = xcb_shm_detach_checked(dri2_dpy->conn, 0);
|
||||
if ((error = xcb_request_check(dri2_dpy->conn, cookie))) {
|
||||
/* BadRequest means we're a remote client. If we were local we'd
|
||||
* expect BadValue since 'info' has an invalid segment name.
|
||||
*/
|
||||
if (error->error_code == BadRequest)
|
||||
ret = false;
|
||||
free(error);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool
|
||||
platform_x11_finalize(_EGLDisplay *disp, bool force_zink)
|
||||
{
|
||||
|
|
@ -1220,7 +1191,7 @@ dri2_initialize_x11_swrast(_EGLDisplay *disp)
|
|||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
|
||||
if (check_xshm(dri2_dpy)) {
|
||||
if (x11_xcb_display_supports_xshm(dri2_dpy->conn)) {
|
||||
dri2_dpy->loader_extensions = swrast_loader_shm_extensions;
|
||||
} else {
|
||||
dri2_dpy->loader_extensions = swrast_loader_extensions;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue