summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-04-19 22:49:56 +0200
committerMichel Dänzer <michel@daenzer.net>2021-05-18 15:19:55 +0000
commitf3eb1684fa5008ad7c881f798a5efb7441b23035 (patch)
tree946662867fa5cbe19d14d04562bb78a72aabebca
parent3d33d885fcd1215a74c1819278cf6f9557c9860b (diff)
xwayland: enable MIT-SHM shared pixmaps
Allow X11 clients to create shared pixmaps via the MIT-SHM extension under Xwayland. Tested with a wlroots patch [1]. Also add a few assertions to make sure we have wl_buffers where we need them. [1]: https://github.com/swaywm/wlroots/pull/2875 Signed-off-by: Simon Ser <contact@emersion.fr> Acked-by: Michel Dänzer <mdaenzer@redhat.com>
-rw-r--r--hw/xwayland/xwayland-present.c3
-rw-r--r--hw/xwayland/xwayland-screen.c8
2 files changed, 11 insertions, 0 deletions
diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 83d67517a..c0f128833 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -404,6 +404,9 @@ xwl_present_check_flip2(RRCrtcPtr crtc,
if (!xwl_window)
return FALSE;
+ if (!xwl_glamor_pixmap_get_wl_buffer(pixmap))
+ return FALSE;
+
if (!xwl_glamor_check_flip(pixmap))
return FALSE;
diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c
index c18e2fbb5..bb18e5c94 100644
--- a/hw/xwayland/xwayland-screen.c
+++ b/hw/xwayland/xwayland-screen.c
@@ -52,6 +52,10 @@
#include "xwayland-present.h"
#include "xwayland-shm.h"
+#ifdef MITSHM
+#include "shmint.h"
+#endif
+
#include "xdg-output-unstable-v1-client-protocol.h"
#include "viewporter-client-protocol.h"
#include "xdg-shell-client-protocol.h"
@@ -662,6 +666,10 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
fbPictureInit(pScreen, 0, 0);
+#ifdef MITSHM
+ ShmRegisterFbFuncs(pScreen);
+#endif
+
#ifdef HAVE_XSHMFENCE
if (!miSyncShmScreenInit(pScreen))
return FALSE;