Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package xwayland for openSUSE:Factory checked in at 2024-07-14 08:49:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/xwayland (Old) and /work/SRC/openSUSE:Factory/.xwayland.new.17339 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xwayland" Sun Jul 14 08:49:11 2024 rev:34 rq:1187080 version:24.1.1 Changes: -------- --- /work/SRC/openSUSE:Factory/xwayland/xwayland.changes 2024-06-06 12:30:47.384471569 +0200 +++ /work/SRC/openSUSE:Factory/.xwayland.new.17339/xwayland.changes 2024-07-14 08:49:56.735223001 +0200 @@ -1,0 +2,46 @@ +Thu Jul 11 13:46:12 UTC 2024 - Stefan Dirsch <[email protected]> + +- added version specific requirements for dri3proto, presentproto + and wayland-protocols + +------------------------------------------------------------------- +Thu Jul 11 13:17:54 UTC 2024 - Stefan Dirsch <[email protected]> + +- This supersedes the following patches + * U_CVE-2024-31080-Xi-ProcXIGetSelectedEvents-needs-to-use-unswapped-le.patch + * U_CVE-2024-31081-Xi-ProcXIPassiveGrabDevice-needs-to-use-unswapped-le.patch + * U_CVE-2024-31083-render-fix-refcounting-of-glyphs-during-ProcRenderAd.patch + * U_render-Avoid-possible-double-free-in-ProcRenderAddGl.patch + which fixed security issues + * CVE-2024-31080 (bsc#1222309) + * CVE-2024-31081 (bsc#1222310) + * CVE-2024-31083 (bsc#1222312) + and a regression due to a security fix for CVE-2024-31083 (bsc#1222312, + boo#1222442, gitlab xserver issue #1659) + +------------------------------------------------------------------- +Thu Jul 11 11:43:22 UTC 2024 - Stefan Dirsch <[email protected]> + +- Update to bugfix release 24.1.1 for the current stable 24.1 + branch of Xwayland + * xwayland: fix segment fault in `xwl_glamor_gbm_init_main_dev` + * os: Explicitly include X11/Xmd.h for CARD32 definition to fix + building on i686 + * present: On *BSD, epoll-shim is needed to emulate eventfd() + * xwayland: Stop on first unmapped child + * xwayland/window-buffers: Promote xwl_window_buffer + * xwayland/window-buffers: Add xwl_window_buffer_release() + * xwayland/glamor/gbm: Copy explicit sync code to GLAMOR/GBM + * xwayland/window-buffers: Use synchronization from GLAMOR/GBM + * xwayland/window-buffers: Do not always set syncpnts + * xwayland/window-buffers: Move code to submit pixmaps + * xwayland/window-buffers: Set syncpnts for all pixmaps + * xwayland: Move xwl_window disposal to its own function + * xwayland: Make sure we do not leak xwl_window on destroy + * wayland/window-buffers: Move buffer disposal to its own function + * xwayland/window-buffers: optionally force disposal + * wayland: Force disposal of windows buffers for root on destroy + * xwayland: Check for pointer in xwl_seat_leave_ptr() + * xwayland: remove includedir from pkgconfig + +------------------------------------------------------------------- Old: ---- xwayland-24.1.0.tar.xz xwayland-24.1.0.tar.xz.sig New: ---- xwayland-24.1.1.tar.xz xwayland-24.1.1.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ xwayland.spec ++++++ --- /var/tmp/diff_new_pack.3ZAnGE/_old 2024-07-14 08:49:57.579253837 +0200 +++ /var/tmp/diff_new_pack.3ZAnGE/_new 2024-07-14 08:49:57.579253837 +0200 @@ -22,7 +22,7 @@ %endif Name: xwayland -Version: 24.1.0 +Version: 24.1.1 Release: 0 URL: http://xorg.freedesktop.org Summary: Xwayland Xserver @@ -39,7 +39,7 @@ BuildRequires: pkgconfig(compositeproto) BuildRequires: pkgconfig(damageproto) BuildRequires: pkgconfig(dri) -BuildRequires: pkgconfig(dri3proto) +BuildRequires: pkgconfig(dri3proto) >= 1.4 BuildRequires: pkgconfig(epoxy) BuildRequires: pkgconfig(fixesproto) BuildRequires: pkgconfig(fontsproto) @@ -61,7 +61,7 @@ BuildRequires: pkgconfig(libxcvt) BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(pixman-1) -BuildRequires: pkgconfig(presentproto) +BuildRequires: pkgconfig(presentproto) >= 1.4 BuildRequires: pkgconfig(randrproto) BuildRequires: pkgconfig(recordproto) BuildRequires: pkgconfig(renderproto) @@ -69,7 +69,7 @@ BuildRequires: pkgconfig(scrnsaverproto) BuildRequires: pkgconfig(videoproto) BuildRequires: pkgconfig(wayland-client) >= 1.21.0 -BuildRequires: pkgconfig(wayland-protocols) +BuildRequires: pkgconfig(wayland-protocols) >= 1.34 BuildRequires: pkgconfig(xau) BuildRequires: pkgconfig(xcb) BuildRequires: pkgconfig(xcb-damage) ++++++ xwayland-24.1.0.tar.xz -> xwayland-24.1.1.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-24.1.0/hw/xwayland/meson.build new/xwayland-24.1.1/hw/xwayland/meson.build --- old/xwayland-24.1.0/hw/xwayland/meson.build 2024-05-15 08:21:39.000000000 +0200 +++ new/xwayland-24.1.1/hw/xwayland/meson.build 2024-07-10 13:40:59.000000000 +0200 @@ -189,6 +189,8 @@ filebase: 'xwayland', name: 'Xwayland', description: 'X Server for Wayland', + dataonly: true, + install_dir: join_paths(get_option('libdir'), 'pkgconfig'), variables: [ 'exec_prefix=${prefix}', 'xwayland=' + xwayland_path + '/Xwayland', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-24.1.0/hw/xwayland/xwayland-dmabuf.c new/xwayland-24.1.1/hw/xwayland/xwayland-dmabuf.c --- old/xwayland-24.1.0/hw/xwayland/xwayland-dmabuf.c 2024-05-15 08:21:39.000000000 +0200 +++ new/xwayland-24.1.1/hw/xwayland/xwayland-dmabuf.c 2024-07-10 13:40:59.000000000 +0200 @@ -752,7 +752,7 @@ /* If the linux-dmabuf v4 per-surface feedback changed, make sure the * window buffers get re-created with appropriate parameters. */ - xwl_window_buffers_dispose(xwl_window); + xwl_window_buffers_dispose(xwl_window, FALSE); xwl_window_realloc_pixmap(xwl_window); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-24.1.0/hw/xwayland/xwayland-glamor-gbm.c new/xwayland-24.1.1/hw/xwayland/xwayland-glamor-gbm.c --- old/xwayland-24.1.0/hw/xwayland/xwayland-glamor-gbm.c 2024-05-15 08:21:39.000000000 +0200 +++ new/xwayland-24.1.1/hw/xwayland/xwayland-glamor-gbm.c 2024-07-10 13:40:59.000000000 +0200 @@ -32,6 +32,8 @@ #include <fcntl.h> #include <errno.h> +#include <poll.h> +#include <sys/eventfd.h> #include <sys/stat.h> #include <xf86drm.h> #include <drm_fourcc.h> @@ -55,6 +57,7 @@ #include "xwayland-glamor-gbm.h" #include "xwayland-pixmap.h" #include "xwayland-screen.h" +#include "xwayland-window-buffers.h" #include "linux-dmabuf-unstable-v1-client-protocol.h" #include "linux-drm-syncobj-v1-client-protocol.h" @@ -82,6 +85,12 @@ unsigned int texture; struct gbm_bo *bo; Bool implicit_modifier; +#ifdef DRI3 + struct dri3_syncobj *syncobj; + uint64_t timeline_point; + int efd; + struct xwl_window_buffer *xwl_window_buffer; +#endif /* DRI3 */ }; static DevPrivateKeyRec xwl_gbm_private_key; @@ -225,6 +234,9 @@ xwl_pixmap->bo = bo; xwl_pixmap->buffer = NULL; xwl_pixmap->implicit_modifier = implicit_modifier; +#ifdef XWL_HAS_GLAMOR + xwl_pixmap->efd = -1; +#endif /* XWL_HAS_GLAMOR */ #ifdef GBM_BO_FD_FOR_PLANE if (xwl_gbm->dmabuf_capable) { @@ -445,6 +457,7 @@ eglDestroyImageKHR(xwl_screen->egl_display, xwl_pixmap->image); if (xwl_pixmap->bo) gbm_bo_destroy(xwl_pixmap->bo); + xwl_glamor_gbm_dispose_syncpts(pixmap); free(xwl_pixmap); } @@ -1388,6 +1401,21 @@ epoxy_has_egl_extension(NULL, "EGL_KHR_platform_gbm")); } +#ifdef DRI3 +static void +xwl_glamor_gbm_release_fence_avail(int fd, int xevents, void *data) +{ + struct xwl_pixmap *xwl_pixmap = data; + struct xwl_window_buffer *xwl_window_buffer = xwl_pixmap->xwl_window_buffer; + + SetNotifyFd(fd, NULL, 0, NULL); + close(fd); + xwl_pixmap->efd = -1; + + xwl_window_buffer_release(xwl_window_buffer); +} +#endif /* DRI3 */ + Bool xwl_glamor_supports_implicit_sync(struct xwl_screen *xwl_screen) { @@ -1403,6 +1431,122 @@ xwl_gbm_get(xwl_screen)->supports_syncobjs; } +Bool +xwl_glamor_gbm_set_syncpts(struct xwl_window *xwl_window, PixmapPtr pixmap) +{ +#ifdef DRI3 + struct xwl_screen *xwl_screen = xwl_window->xwl_screen; + struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); + uint64_t acquire_point; + uint64_t release_point; + int fence_fd; + + if (!xwl_screen->glamor) + return FALSE; + + if (!xwl_pixmap) { + ErrorF("XWAYLAND: Failed to set synchronization point, no backing xwl_pixmap!\n"); + return FALSE; + } + + acquire_point = ++xwl_pixmap->timeline_point; + release_point = ++xwl_pixmap->timeline_point; + + if (!xwl_pixmap->syncobj) { + struct dri3_syncobj *syncobj = xwl_glamor_dri3_syncobj_create(xwl_screen); + if (!syncobj) + goto fail; + xwl_pixmap->syncobj = syncobj; + } + + fence_fd = xwl_glamor_get_fence(xwl_screen); + if (fence_fd >= 0) + xwl_pixmap->syncobj->import_fence(xwl_pixmap->syncobj, acquire_point, fence_fd); + else + goto fail; + + xwl_glamor_dri3_syncobj_passthrough(xwl_window, + xwl_pixmap->syncobj, + xwl_pixmap->syncobj, + acquire_point, + release_point); + return TRUE; + +fail: + /* can't use explicit sync, we will do a glFinish() before presenting */ + if (xwl_pixmap->syncobj) { + xwl_pixmap->syncobj->free(xwl_pixmap->syncobj); + xwl_pixmap->syncobj = NULL; + } +#endif /* DRI3 */ + return FALSE; +} + +void +xwl_glamor_gbm_dispose_syncpts(PixmapPtr pixmap) +{ +#ifdef DRI3 + struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); + struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen); + + if (!xwl_screen->glamor || !xwl_pixmap) + return; + + if (xwl_pixmap->syncobj) { + xwl_pixmap->syncobj->free(xwl_pixmap->syncobj); + xwl_pixmap->syncobj = NULL; + } + + if (xwl_pixmap->efd >= 0) { + SetNotifyFd(xwl_pixmap->efd, NULL, 0, NULL); + close(xwl_pixmap->efd); + } +#endif /* DRI3 */ +} + +void +xwl_glamor_gbm_wait_syncpts(PixmapPtr pixmap) +{ +#ifdef DRI3 + struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen); + struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); + int fence_fd; + + if (!xwl_screen->glamor || !xwl_pixmap) + return; + + if (xwl_pixmap->syncobj) { + fence_fd = xwl_pixmap->syncobj->export_fence(xwl_pixmap->syncobj, + xwl_pixmap->timeline_point); + xwl_glamor_wait_fence(xwl_screen, fence_fd); + close(fence_fd); + } +#endif /* DRI3 */ +} + +void +xwl_glamor_gbm_wait_release_fence(struct xwl_window *xwl_window, + PixmapPtr pixmap, + struct xwl_window_buffer *xwl_window_buffer) +{ +#ifdef DRI3 + struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap); + struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen); + + if (!xwl_screen->glamor || !xwl_pixmap || !xwl_window_buffer) + return; + + xwl_pixmap->xwl_window_buffer = xwl_window_buffer; + /* wait until the release fence is available before re-using this buffer */ + xwl_pixmap->efd = eventfd(0, EFD_CLOEXEC); + SetNotifyFd(xwl_pixmap->efd, xwl_glamor_gbm_release_fence_avail, X_NOTIFY_READ, + xwl_pixmap); + xwl_pixmap->syncobj->submitted_eventfd(xwl_pixmap->syncobj, + xwl_pixmap->timeline_point, + xwl_pixmap->efd); +#endif /* DRI3 */ +} + static Bool xwl_glamor_try_to_make_context_current(struct xwl_screen *xwl_screen) { @@ -1514,6 +1658,11 @@ } main_dev = xwl_screen->default_feedback.main_dev; + if (!main_dev) { + ErrorF("No main linux-dmabuf device advertised by compositor\n"); + return FALSE; + } + if (!(main_dev->available_nodes & (1 << DRM_NODE_RENDER))) { ErrorF("Main linux-dmabuf device has no render node\n"); return FALSE; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-24.1.0/hw/xwayland/xwayland-glamor-gbm.h new/xwayland-24.1.1/hw/xwayland/xwayland-glamor-gbm.h --- old/xwayland-24.1.0/hw/xwayland/xwayland-glamor-gbm.h 2024-05-15 08:21:39.000000000 +0200 +++ new/xwayland-24.1.1/hw/xwayland/xwayland-glamor-gbm.h 2024-07-10 13:40:59.000000000 +0200 @@ -42,4 +42,12 @@ Bool xwl_glamor_gbm_init_screen(struct xwl_screen *xwl_screen); drmDevice *xwl_gbm_get_main_device(struct xwl_screen *xwl_screen); +/* Explicit buffer synchronization points */ +Bool xwl_glamor_gbm_set_syncpts(struct xwl_window *xwl_window, PixmapPtr pixmap); +void xwl_glamor_gbm_dispose_syncpts(PixmapPtr pixmap); +void xwl_glamor_gbm_wait_syncpts(PixmapPtr pixmap); +void xwl_glamor_gbm_wait_release_fence(struct xwl_window *xwl_window, + PixmapPtr pixmap, + struct xwl_window_buffer *xwl_window_buffer); + #endif /* XWAYLAND_GLAMOR_GBM_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-24.1.0/hw/xwayland/xwayland-input.c new/xwayland-24.1.1/hw/xwayland/xwayland-input.c --- old/xwayland-24.1.0/hw/xwayland/xwayland-input.c 2024-05-15 08:21:39.000000000 +0200 +++ new/xwayland-24.1.1/hw/xwayland/xwayland-input.c 2024-07-10 13:40:59.000000000 +0200 @@ -595,6 +595,9 @@ { DeviceIntPtr dev = get_pointer_device(xwl_seat); + if (!dev) + return; + if (focus_lost) CheckMotion(NULL, GetMaster(dev, POINTER_OR_FLOAT)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-24.1.0/hw/xwayland/xwayland-types.h new/xwayland-24.1.1/hw/xwayland/xwayland-types.h --- old/xwayland-24.1.0/hw/xwayland/xwayland-types.h 2024-05-15 08:21:39.000000000 +0200 +++ new/xwayland-24.1.1/hw/xwayland/xwayland-types.h 2024-07-10 13:40:59.000000000 +0200 @@ -31,5 +31,6 @@ struct xwl_screen; struct xwl_drm_lease; struct xwl_output; +struct xwl_window_buffer; #endif /* XWAYLAND_TYPES_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-24.1.0/hw/xwayland/xwayland-window-buffers.c new/xwayland-24.1.1/hw/xwayland/xwayland-window-buffers.c --- old/xwayland-24.1.0/hw/xwayland/xwayland-window-buffers.c 2024-05-15 08:21:39.000000000 +0200 +++ new/xwayland-24.1.1/hw/xwayland/xwayland-window-buffers.c 2024-07-10 13:40:59.000000000 +0200 @@ -31,6 +31,7 @@ #include "xwayland-window.h" #include "xwayland-pixmap.h" #include "xwayland-screen.h" +#include "xwayland-glamor-gbm.h" #include "xwayland-window-buffers.h" #ifdef XWL_HAS_GLAMOR #include "glamor.h" @@ -47,11 +48,6 @@ struct xwl_window *xwl_window; PixmapPtr pixmap; RegionPtr damage_region; -#ifdef XWL_HAS_GLAMOR - struct dri3_syncobj *syncobj; - uint64_t timeline_point; - int efd; -#endif /* XWL_HAS_GLAMOR */ int refcnt; uint32_t time; struct xorg_list link_buffer; @@ -90,9 +86,6 @@ xwl_window_buffer->damage_region = RegionCreate(NullBox, 1); xwl_window_buffer->pixmap = NullPixmap; xwl_window_buffer->refcnt = 1; -#ifdef XWL_HAS_GLAMOR - xwl_window_buffer->efd = -1; -#endif /* XWL_HAS_GLAMOR */ xorg_list_init(&xwl_window_buffer->link_buffer); @@ -109,31 +102,31 @@ xwl_window_buffer->pixmap = NullPixmap; } -static Bool -xwl_window_buffer_maybe_dispose(struct xwl_window_buffer *xwl_window_buffer) +static void +xwl_window_buffer_dispose(struct xwl_window_buffer *xwl_window_buffer) { - assert(xwl_window_buffer->refcnt > 0); - - if (--xwl_window_buffer->refcnt) - return FALSE; - RegionDestroy(xwl_window_buffer->damage_region); - if (xwl_window_buffer->pixmap) - xwl_window_buffer_destroy_pixmap (xwl_window_buffer); - + if (xwl_window_buffer->pixmap) { #ifdef XWL_HAS_GLAMOR - if (xwl_window_buffer->syncobj) - xwl_window_buffer->syncobj->free(xwl_window_buffer->syncobj); - - if (xwl_window_buffer->efd >= 0) { - SetNotifyFd(xwl_window_buffer->efd, NULL, 0, NULL); - close(xwl_window_buffer->efd); - } + xwl_glamor_gbm_dispose_syncpts(xwl_window_buffer->pixmap); #endif /* XWL_HAS_GLAMOR */ + xwl_window_buffer_destroy_pixmap (xwl_window_buffer); + } xorg_list_del(&xwl_window_buffer->link_buffer); free(xwl_window_buffer); +} + +static Bool +xwl_window_buffer_maybe_dispose(struct xwl_window_buffer *xwl_window_buffer) +{ + assert(xwl_window_buffer->refcnt > 0); + + if (--xwl_window_buffer->refcnt) + return FALSE; + + xwl_window_buffer_dispose(xwl_window_buffer); return TRUE; } @@ -238,19 +231,11 @@ xwl_window); } -#ifdef XWL_HAS_GLAMOR -static void -xwl_window_buffers_release_fence_avail(int fd, int xevents, void *data) +void +xwl_window_buffer_release(struct xwl_window_buffer *xwl_window_buffer) { - struct xwl_window_buffer *xwl_window_buffer = data; - - SetNotifyFd(fd, NULL, 0, NULL); - close(fd); - xwl_window_buffer->efd = -1; - - xwl_window_buffer_release_callback(data); + xwl_window_buffer_release_callback(xwl_window_buffer); } -#endif /* XWL_HAS_GLAMOR */ void xwl_window_buffers_init(struct xwl_window *xwl_window) @@ -259,8 +244,17 @@ xorg_list_init(&xwl_window->window_buffers_unavailable); } +static void +xwl_window_buffer_disposal(struct xwl_window_buffer *xwl_window_buffer, Bool force) +{ + if (force) + xwl_window_buffer_dispose(xwl_window_buffer); + else + xwl_window_buffer_maybe_dispose(xwl_window_buffer); +} + void -xwl_window_buffers_dispose(struct xwl_window *xwl_window) +xwl_window_buffers_dispose(struct xwl_window *xwl_window, Bool force) { struct xwl_window_buffer *xwl_window_buffer, *tmp; @@ -272,14 +266,14 @@ &xwl_window->window_buffers_available, link_buffer) { xorg_list_del(&xwl_window_buffer->link_buffer); - xwl_window_buffer_maybe_dispose(xwl_window_buffer); + xwl_window_buffer_disposal(xwl_window_buffer, force); } xorg_list_for_each_entry_safe(xwl_window_buffer, tmp, &xwl_window->window_buffers_unavailable, link_buffer) { xorg_list_del(&xwl_window_buffer->link_buffer); - xwl_window_buffer_maybe_dispose(xwl_window_buffer); + xwl_window_buffer_disposal(xwl_window_buffer, force); } if (xwl_window->window_buffers_timer) @@ -370,54 +364,39 @@ screen->DestroyPixmap(window_pixmap); } -#ifdef XWL_HAS_GLAMOR static Bool -xwl_window_buffers_set_syncpts(struct xwl_window_buffer *xwl_window_buffer) +xwl_window_handle_pixmap_sync(struct xwl_window *xwl_window, + PixmapPtr pixmap, + struct xwl_window_buffer *xwl_window_buffer) { - struct xwl_window *xwl_window = xwl_window_buffer->xwl_window; + Bool implicit_sync = TRUE; +#ifdef XWL_HAS_GLAMOR struct xwl_screen *xwl_screen = xwl_window->xwl_screen; - uint64_t acquire_point = ++xwl_window_buffer->timeline_point; - uint64_t release_point = ++xwl_window_buffer->timeline_point; - - if (!xwl_window_buffer->syncobj) { - struct dri3_syncobj *syncobj = xwl_glamor_dri3_syncobj_create(xwl_screen); - if (!syncobj) - goto fail; - xwl_window_buffer->syncobj = syncobj; - } - - int fence_fd = xwl_glamor_get_fence(xwl_screen); - if (fence_fd >= 0) - xwl_window_buffer->syncobj->import_fence(xwl_window_buffer->syncobj, - acquire_point, fence_fd); - else - goto fail; - xwl_glamor_dri3_syncobj_passthrough(xwl_window, - xwl_window_buffer->syncobj, - xwl_window_buffer->syncobj, - acquire_point, - release_point); - return TRUE; - -fail: - /* can't use explicit sync, we will do a glFinish() before presenting */ - if (xwl_window_buffer->syncobj) { - xwl_window_buffer->syncobj->free(xwl_window_buffer->syncobj); - xwl_window_buffer->syncobj = NULL; + if (!xwl_glamor_supports_implicit_sync(xwl_screen)) { + if (xwl_screen->explicit_sync && xwl_glamor_gbm_set_syncpts(xwl_window, pixmap)) { + implicit_sync = FALSE; + /* wait until the release fence is available before re-using this buffer */ + xwl_glamor_gbm_wait_release_fence(xwl_window, pixmap, xwl_window_buffer); + } else { + /* If glamor does not support implicit sync and we can't use + * explicit sync, wait for the GPU to be idle before presenting. + * Note that buffer re-use will still be unsynchronized :( + */ + glamor_finish(xwl_screen->screen); + } } - return FALSE; -} #endif /* XWL_HAS_GLAMOR */ + return implicit_sync; +} PixmapPtr -xwl_window_swap_pixmap(struct xwl_window *xwl_window) +xwl_window_swap_pixmap(struct xwl_window *xwl_window, Bool handle_sync) { struct xwl_screen *xwl_screen = xwl_window->xwl_screen; WindowPtr surface_window = xwl_window->surface_window; struct xwl_window_buffer *xwl_window_buffer; PixmapPtr window_pixmap; - Bool implicit_sync = TRUE; window_pixmap = (*xwl_screen->screen->GetWindowPixmap) (surface_window); @@ -428,17 +407,9 @@ RegionPtr full_damage = xwl_window_buffer->damage_region; BoxPtr pBox = RegionRects(full_damage); int nBox = RegionNumRects(full_damage); - #ifdef XWL_HAS_GLAMOR - if (xwl_window_buffer->syncobj) { - int fence_fd = - xwl_window_buffer->syncobj->export_fence(xwl_window_buffer->syncobj, - xwl_window_buffer->timeline_point); - xwl_glamor_wait_fence(xwl_screen, fence_fd); - close(fence_fd); - } + xwl_glamor_gbm_wait_syncpts(xwl_window_buffer->pixmap); #endif /* XWL_HAS_GLAMOR */ - while (nBox--) { copy_pixmap_area(window_pixmap, xwl_window_buffer->pixmap, @@ -458,6 +429,8 @@ if (xwl_is_client_pixmap(window_pixmap)) { xwl_window_buffer->pixmap = NULL; xwl_window_buffer_maybe_dispose(xwl_window_buffer); + if (handle_sync) + xwl_window_handle_pixmap_sync(xwl_window, window_pixmap, NULL); return window_pixmap; } } else { @@ -468,8 +441,11 @@ window_pixmap->refcnt++; xwl_window_realloc_pixmap(xwl_window); - if (!xwl_window_buffer) + if (!xwl_window_buffer) { + if (handle_sync) + xwl_window_handle_pixmap_sync(xwl_window, window_pixmap, NULL); return window_pixmap; + } } xwl_window_buffer->pixmap = window_pixmap; @@ -477,27 +453,8 @@ /* Hold a reference on the buffer until it's released by the compositor */ xwl_window_buffer->refcnt++; -#ifdef XWL_HAS_GLAMOR - if (!xwl_glamor_supports_implicit_sync(xwl_screen)) { - if (xwl_screen->explicit_sync && xwl_window_buffers_set_syncpts(xwl_window_buffer)) { - implicit_sync = FALSE; - /* wait until the release fence is available before re-using this buffer */ - xwl_window_buffer->efd = eventfd(0, EFD_CLOEXEC); - SetNotifyFd(xwl_window_buffer->efd, xwl_window_buffers_release_fence_avail, - X_NOTIFY_READ, xwl_window_buffer); - xwl_window_buffer->syncobj->submitted_eventfd(xwl_window_buffer->syncobj, - xwl_window_buffer->timeline_point, - xwl_window_buffer->efd); - } else - /* If glamor does not support implicit sync and we can't use - * explicit sync, wait for the GPU to be idle before presenting. - * Note that buffer re-use will still be unsynchronized :( - */ - glamor_finish(xwl_screen->screen); - } -#endif /* XWL_HAS_GLAMOR */ - - if (implicit_sync) { + if (handle_sync && + xwl_window_handle_pixmap_sync(xwl_window, window_pixmap, xwl_window_buffer)) { xwl_pixmap_set_buffer_release_cb(xwl_window_buffer->pixmap, xwl_window_buffer_release_callback, xwl_window_buffer); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-24.1.0/hw/xwayland/xwayland-window-buffers.h new/xwayland-24.1.1/hw/xwayland/xwayland-window-buffers.h --- old/xwayland-24.1.0/hw/xwayland/xwayland-window-buffers.h 2024-05-15 08:21:39.000000000 +0200 +++ new/xwayland-24.1.1/hw/xwayland/xwayland-window-buffers.h 2024-07-10 13:40:59.000000000 +0200 @@ -31,12 +31,11 @@ #include "xwayland-types.h" -struct xwl_window_buffer; - void xwl_window_buffer_add_damage_region(struct xwl_window *xwl_window); +void xwl_window_buffer_release(struct xwl_window_buffer *xwl_window_buffer); void xwl_window_buffers_init(struct xwl_window *xwl_window); -void xwl_window_buffers_dispose(struct xwl_window *xwl_window); +void xwl_window_buffers_dispose(struct xwl_window *xwl_window, Bool force); void xwl_window_realloc_pixmap(struct xwl_window *xwl_window); -PixmapPtr xwl_window_swap_pixmap(struct xwl_window *xwl_window); +PixmapPtr xwl_window_swap_pixmap(struct xwl_window *xwl_window, Bool handle_sync); #endif /* XWAYLAND_WINDOW_BUFFERS_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-24.1.0/hw/xwayland/xwayland-window.c new/xwayland-24.1.1/hw/xwayland/xwayland-window.c --- old/xwayland-24.1.0/hw/xwayland/xwayland-window.c 2024-05-15 08:21:39.000000000 +0200 +++ new/xwayland-24.1.1/hw/xwayland/xwayland-window.c 2024-07-10 13:40:59.000000000 +0200 @@ -316,7 +316,7 @@ window_pixmap = xwl_screen->screen->GetWindowPixmap(xwl_window->surface_window); if (xwl_is_client_pixmap(window_pixmap)) - xwl_screen->screen->DestroyPixmap(xwl_window_swap_pixmap(xwl_window)); + xwl_screen->screen->DestroyPixmap(xwl_window_swap_pixmap(xwl_window, FALSE)); } static void @@ -1351,6 +1351,9 @@ if (!RegionEqual(&window->winSize, &surface_window->winSize)) break; + if (!window->mapped) + break; + /* The surface window must be top-level for its window pixmap */ window_pixmap = screen->GetWindowPixmap(window); if (window_pixmap == surface_pixmap) @@ -1365,6 +1368,9 @@ if (window->drawable.depth == 32) continue; + if (window->redirectDraw == RedirectDrawManual) + break; + surface_window = window; } @@ -1398,7 +1404,7 @@ } if (surface_window->drawable.depth != xwl_window->surface_window->drawable.depth) - xwl_window_buffers_dispose(xwl_window); + xwl_window_buffers_dispose(xwl_window, FALSE); xwl_window->surface_window = surface_window; register_damage(xwl_window); @@ -1634,28 +1640,15 @@ release_wl_surface_for_window_legacy_delay(xwl_window); } -Bool -xwl_unrealize_window(WindowPtr window) +static void +xwl_window_dispose(struct xwl_window *xwl_window) { - ScreenPtr screen = window->drawable.pScreen; - struct xwl_screen *xwl_screen; - struct xwl_window *xwl_window; + struct xwl_screen *xwl_screen = xwl_window->xwl_screen; struct xwl_seat *xwl_seat; - Bool ret; - - xwl_screen = xwl_screen_get(screen); + WindowPtr window = xwl_window->toplevel; + ScreenPtr screen = xwl_screen->screen; - xwl_window = xwl_window_get(window); - if (xwl_window) - compUnredirectWindow(serverClient, window, CompositeRedirectManual); - - screen->UnrealizeWindow = xwl_screen->UnrealizeWindow; - ret = (*screen->UnrealizeWindow) (window); - xwl_screen->UnrealizeWindow = screen->UnrealizeWindow; - screen->UnrealizeWindow = xwl_unrealize_window; - - if (!xwl_window) - return ret; + compUnredirectWindow(serverClient, window, CompositeRedirectManual); xorg_list_for_each_entry(xwl_seat, &xwl_screen->seat_list, link) { if (xwl_seat->focus_window == xwl_window) @@ -1695,9 +1688,10 @@ release_wl_surface_for_window(xwl_window); xorg_list_del(&xwl_window->link_damage); xorg_list_del(&xwl_window->link_window); - unregister_damage(xwl_window); - xwl_window_buffers_dispose(xwl_window); + /* Special case for the root window in rootful mode */ + xwl_window_buffers_dispose(xwl_window, + (!xwl_screen->rootless && window == screen->root)); if (xwl_window->window_buffers_timer) TimerFree(xwl_window->window_buffers_timer); @@ -1709,6 +1703,25 @@ free(xwl_window); dixSetPrivate(&window->devPrivates, &xwl_window_private_key, NULL); +} + +Bool +xwl_unrealize_window(WindowPtr window) +{ + ScreenPtr screen = window->drawable.pScreen; + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + struct xwl_window *xwl_window = xwl_window_get(window); + Bool ret; + + if (xwl_window) { + unregister_damage(xwl_window); + xwl_window_dispose(xwl_window); + } + + screen->UnrealizeWindow = xwl_screen->UnrealizeWindow; + ret = (*screen->UnrealizeWindow) (window); + xwl_screen->UnrealizeWindow = screen->UnrealizeWindow; + screen->UnrealizeWindow = xwl_unrealize_window; return ret; } @@ -1740,7 +1753,7 @@ old_pixmap->drawable.height == pixmap->drawable.height)) return; - xwl_window_buffers_dispose(xwl_window); + xwl_window_buffers_dispose(xwl_window, FALSE); } Bool @@ -1917,11 +1930,15 @@ { ScreenPtr screen = window->drawable.pScreen; struct xwl_screen *xwl_screen = xwl_screen_get(screen); + struct xwl_window *xwl_window = xwl_window_get(window); Bool ret; if (xwl_screen->present) xwl_present_cleanup(window); + if (xwl_window) + xwl_window_dispose(xwl_window); + screen->DestroyWindow = xwl_screen->DestroyWindow; if (screen->DestroyWindow) @@ -1946,7 +1963,7 @@ PixmapPtr pixmap; int i; - pixmap = xwl_window_swap_pixmap(xwl_window); + pixmap = xwl_window_swap_pixmap(xwl_window, TRUE); buffer = xwl_pixmap_get_wl_buffer(pixmap); if (!buffer) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-24.1.0/meson.build new/xwayland-24.1.1/meson.build --- old/xwayland-24.1.0/meson.build 2024-05-15 08:21:39.000000000 +0200 +++ new/xwayland-24.1.1/meson.build 2024-07-10 13:40:59.000000000 +0200 @@ -3,10 +3,10 @@ 'buildtype=debugoptimized', 'c_std=gnu99', ], - version: '24.1.0', + version: '24.1.1', meson_version: '>= 0.56.0', ) -release_date = '2024-05-15' +release_date = '2024-07-10' add_project_arguments('-DHAVE_DIX_CONFIG_H', language: ['c', 'objc']) cc = meson.get_compiler('c') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-24.1.0/os/osdep.h new/xwayland-24.1.1/os/osdep.h --- old/xwayland-24.1.0/os/osdep.h 2024-05-15 08:21:39.000000000 +0200 +++ new/xwayland-24.1.1/os/osdep.h 2024-07-10 13:40:59.000000000 +0200 @@ -60,6 +60,7 @@ #include <limits.h> #include <stddef.h> #include <X11/Xos.h> +#include <X11/Xmd.h> /* If EAGAIN and EWOULDBLOCK are distinct errno values, then we check errno * for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-24.1.0/present/meson.build new/xwayland-24.1.1/present/meson.build --- old/xwayland-24.1.0/present/meson.build 2024-05-15 08:21:39.000000000 +0200 +++ new/xwayland-24.1.1/present/meson.build 2024-07-10 13:40:59.000000000 +0200 @@ -16,11 +16,18 @@ 'presentext.h', ] +if host_machine.system() in ['freebsd', 'openbsd'] + epoll_dep = dependency('epoll-shim') +else + epoll_dep = [] +endif + libxserver_present = static_library('libxserver_present', srcs_present, include_directories: inc, dependencies: [ common_dep, + epoll_dep, dependency('presentproto', version: '>= 1.2') ], )
