From 0f19381f4906e3100cd43544f1cad82d2a933c63 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Tue, 9 Jul 2019 11:08:27 +0200 Subject: [PATCH] xwayland: Don't create wl_buffer backing pixmap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In non-rootless mode, not all pixmaps need a wl_buffer backing. Suggested-by: Twaik Yont (@twaik) in #834 Signed-off-by: Olivier Fourdan Reviewed-by: Michel Dänzer --- hw/xwayland/xwayland-cursor.c | 3 ++- hw/xwayland/xwayland-glamor-gbm.c | 6 +++--- hw/xwayland/xwayland-shm.c | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c index 66720bcc0..ec0029438 100644 --- a/hw/xwayland/xwayland-cursor.c +++ b/hw/xwayland/xwayland-cursor.c @@ -66,7 +66,8 @@ xwl_realize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor) PixmapPtr pixmap; pixmap = xwl_shm_create_pixmap(screen, cursor->bits->width, - cursor->bits->height, 32, 0); + cursor->bits->height, 32, + CREATE_PIXMAP_USAGE_BACKING_PIXMAP); dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, pixmap); return TRUE; diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c index e2a240c23..354695060 100644 --- a/hw/xwayland/xwayland-glamor-gbm.c +++ b/hw/xwayland/xwayland-glamor-gbm.c @@ -212,9 +212,9 @@ xwl_glamor_gbm_create_pixmap(ScreenPtr screen, PixmapPtr pixmap = NULL; if (width > 0 && height > 0 && depth >= 15 && - (hint == 0 || - hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP || - hint == CREATE_PIXMAP_USAGE_SHARED)) { + (hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP || + hint == CREATE_PIXMAP_USAGE_SHARED || + (xwl_screen->rootless && hint == 0))) { uint32_t format = gbm_format_for_depth(depth); #ifdef GBM_BO_WITH_MODIFIERS diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c index 29732eaca..d1127efc0 100644 --- a/hw/xwayland/xwayland-shm.c +++ b/hw/xwayland/xwayland-shm.c @@ -202,6 +202,7 @@ xwl_shm_create_pixmap(ScreenPtr screen, int fd; if (hint == CREATE_PIXMAP_USAGE_GLYPH_PICTURE || + (!xwl_screen->rootless && hint != CREATE_PIXMAP_USAGE_BACKING_PIXMAP) || (width == 0 && height == 0) || depth < 15) return fbCreatePixmap(screen, width, height, depth, hint);