Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package xwayland for openSUSE:Factory checked in at 2023-06-12 15:25:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/xwayland (Old) and /work/SRC/openSUSE:Factory/.xwayland.new.15902 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xwayland" Mon Jun 12 15:25:05 2023 rev:22 rq:1091980 version:23.1.2 Changes: -------- --- /work/SRC/openSUSE:Factory/xwayland/xwayland.changes 2023-04-02 19:16:59.944409956 +0200 +++ /work/SRC/openSUSE:Factory/.xwayland.new.15902/xwayland.changes 2023-06-12 15:25:41.270780950 +0200 @@ -1,0 +2,8 @@ +Sat Jun 10 11:23:26 UTC 2023 - Stefan Dirsch <sndir...@suse.com> + +- Update to version 23.1.2 + * This release includes improved DMA-BUF v4 feedback support for + direct scanout, relaxed CVT modes for non-standard modes, fixes + for the CHERI/Morello platform and other various fixes. + +------------------------------------------------------------------- Old: ---- xwayland-23.1.1.tar.xz xwayland-23.1.1.tar.xz.sig New: ---- xwayland-23.1.2.tar.xz xwayland-23.1.2.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ xwayland.spec ++++++ --- /var/tmp/diff_new_pack.vv6LYy/_old 2023-06-12 15:25:42.062785636 +0200 +++ /var/tmp/diff_new_pack.vv6LYy/_new 2023-06-12 15:25:42.066785660 +0200 @@ -24,7 +24,7 @@ %endif Name: xwayland -Version: 23.1.1 +Version: 23.1.2 Release: 0 URL: http://xorg.freedesktop.org Summary: Xwayland Xserver ++++++ xwayland-23.1.1.tar.xz -> xwayland-23.1.2.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-23.1.1/glamor/glamor.c new/xwayland-23.1.2/glamor/glamor.c --- old/xwayland-23.1.1/glamor/glamor.c 2023-03-29 14:26:36.000000000 +0200 +++ new/xwayland-23.1.2/glamor/glamor.c 2023-06-06 11:20:05.000000000 +0200 @@ -1003,6 +1003,7 @@ uint32_t *strides, uint32_t *offsets, CARD32 *size, uint64_t *modifier) { +#ifdef GLAMOR_HAS_GBM glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); glamor_screen_private *glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen); @@ -1030,6 +1031,7 @@ default: break; } +#endif /* GLAMOR_HAS_GBM */ return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-23.1.1/hw/xwayland/meson.build new/xwayland-23.1.2/hw/xwayland/meson.build --- old/xwayland-23.1.1/hw/xwayland/meson.build 2023-03-29 14:26:36.000000000 +0200 +++ new/xwayland-23.1.2/hw/xwayland/meson.build 2023-06-06 11:20:05.000000000 +0200 @@ -97,7 +97,10 @@ srcs += 'xwayland-glx.c' endif if gbm_dep.found() - srcs += 'xwayland-glamor-gbm.c' + srcs += [ + 'xwayland-glamor-gbm.c', + 'xwayland-present.c' + ] endif if build_eglstream eglstream_protodir = eglstream_dep.get_pkgconfig_variable('pkgdatadir') @@ -111,7 +114,6 @@ srcs += 'xwayland-glamor-eglstream.c' endif - srcs += 'xwayland-present.c' if build_xv srcs += 'xwayland-glamor-xv.c' endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-23.1.1/hw/xwayland/xwayland-cvt.c new/xwayland-23.1.2/hw/xwayland/xwayland-cvt.c --- old/xwayland-23.1.1/hw/xwayland/xwayland-cvt.c 2023-03-29 14:26:36.000000000 +0200 +++ new/xwayland-23.1.2/hw/xwayland/xwayland-cvt.c 2023-06-06 11:20:05.000000000 +0200 @@ -29,30 +29,48 @@ #include "xwayland-cvt.h" -RRModePtr -xwayland_cvt(int hdisplay, int vdisplay, float vrefresh, Bool reduced, - Bool interlaced) +static void +xwayland_modeinfo_from_cvt(xRRModeInfo *modeinfo, + int hdisplay, int vdisplay, float vrefresh, + Bool reduced, Bool interlaced) { struct libxcvt_mode_info *libxcvt_mode_info; - char name[128]; - xRRModeInfo modeinfo; libxcvt_mode_info = libxcvt_gen_mode_info(hdisplay, vdisplay, vrefresh, reduced, interlaced); - memset(&modeinfo, 0, sizeof modeinfo); - modeinfo.width = libxcvt_mode_info->hdisplay; - modeinfo.height = libxcvt_mode_info->vdisplay; - modeinfo.dotClock = libxcvt_mode_info->dot_clock * 1000.0; - modeinfo.hSyncStart = libxcvt_mode_info->hsync_start; - modeinfo.hSyncEnd = libxcvt_mode_info->hsync_end; - modeinfo.hTotal = libxcvt_mode_info->htotal; - modeinfo.vSyncStart = libxcvt_mode_info->vsync_start; - modeinfo.vSyncEnd = libxcvt_mode_info->vsync_end; - modeinfo.vTotal = libxcvt_mode_info->vtotal; - modeinfo.modeFlags = libxcvt_mode_info->mode_flags; + modeinfo->width = libxcvt_mode_info->hdisplay; + modeinfo->height = libxcvt_mode_info->vdisplay; + modeinfo->dotClock = libxcvt_mode_info->dot_clock * 1000.0; + modeinfo->hSyncStart = libxcvt_mode_info->hsync_start; + modeinfo->hSyncEnd = libxcvt_mode_info->hsync_end; + modeinfo->hTotal = libxcvt_mode_info->htotal; + modeinfo->vSyncStart = libxcvt_mode_info->vsync_start; + modeinfo->vSyncEnd = libxcvt_mode_info->vsync_end; + modeinfo->vTotal = libxcvt_mode_info->vtotal; + modeinfo->modeFlags = libxcvt_mode_info->mode_flags; free(libxcvt_mode_info); +} + +RRModePtr +xwayland_cvt(int hdisplay, int vdisplay, float vrefresh, Bool reduced, + Bool interlaced) +{ + char name[128]; + xRRModeInfo modeinfo = { 0, }; + + xwayland_modeinfo_from_cvt(&modeinfo, + hdisplay, vdisplay, vrefresh, reduced, interlaced); + + /* Horizontal granularity in libxcvt is 8, so if our horizontal size is not + * divisible by 8, libxcvt will round it up, and we will advertise a wrong + * size to our XRandR clients. + * Force the width/height (i.e. simply increase blanking which should not + * hurt anything), keeping the rest of the CVT mode timings unchanged. + */ + modeinfo.width = hdisplay; + modeinfo.height = vdisplay; snprintf(name, sizeof name, "%dx%d", modeinfo.width, modeinfo.height); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-23.1.1/hw/xwayland/xwayland-glamor-gbm.c new/xwayland-23.1.2/hw/xwayland/xwayland-glamor-gbm.c --- old/xwayland-23.1.1/hw/xwayland/xwayland-glamor-gbm.c 2023-03-29 14:26:36.000000000 +0200 +++ new/xwayland-23.1.2/hw/xwayland/xwayland-glamor-gbm.c 2023-06-06 11:20:05.000000000 +0200 @@ -275,11 +275,12 @@ } static PixmapPtr -xwl_glamor_gbm_create_pixmap(ScreenPtr screen, - int width, int height, int depth, - unsigned int hint) +xwl_glamor_gbm_create_pixmap_internal(struct xwl_screen *xwl_screen, + DrawablePtr drawable, + int width, int height, int depth, + unsigned int hint, + Bool implicit_scanout) { - struct xwl_screen *xwl_screen = xwl_screen_get(screen); struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); struct gbm_bo *bo = NULL; PixmapPtr pixmap = NULL; @@ -293,25 +294,49 @@ #ifdef GBM_BO_WITH_MODIFIERS if (xwl_gbm->dmabuf_capable) { - uint32_t num_modifiers; + uint32_t num_modifiers = 0; uint64_t *modifiers = NULL; + Bool supports_scanout = FALSE; - xwl_glamor_get_modifiers(screen, format, &num_modifiers, &modifiers); + if (drawable) { + xwl_glamor_get_drawable_modifiers_and_scanout(drawable, + format, + &num_modifiers, + &modifiers, + &supports_scanout); + } - if (num_modifiers > 0) + if (num_modifiers == 0) { + xwl_glamor_get_modifiers(xwl_screen->screen, format, + &num_modifiers, &modifiers); + } + + if (num_modifiers > 0) { +#ifdef GBM_BO_WITH_MODIFIERS2 + uint32_t usage = GBM_BO_USE_RENDERING; + if (supports_scanout) + usage |= GBM_BO_USE_SCANOUT; + bo = gbm_bo_create_with_modifiers2(xwl_gbm->gbm, width, height, + format, modifiers, num_modifiers, + usage); +#else bo = gbm_bo_create_with_modifiers(xwl_gbm->gbm, width, height, format, modifiers, num_modifiers); +#endif + } free(modifiers); } #endif if (bo == NULL) { + uint32_t usage = GBM_BO_USE_RENDERING; implicit = TRUE; - bo = gbm_bo_create(xwl_gbm->gbm, width, height, format, - GBM_BO_USE_RENDERING); + if (implicit_scanout) + usage |= GBM_BO_USE_SCANOUT; + bo = gbm_bo_create(xwl_gbm->gbm, width, height, format, usage); } if (bo) { - pixmap = xwl_glamor_gbm_create_pixmap_for_bo(screen, bo, depth, implicit); + pixmap = xwl_glamor_gbm_create_pixmap_for_bo(xwl_screen->screen, bo, depth, implicit); if (!pixmap) { gbm_bo_destroy(bo); @@ -323,11 +348,32 @@ } if (!pixmap) - pixmap = glamor_create_pixmap(screen, width, height, depth, hint); + pixmap = glamor_create_pixmap(xwl_screen->screen, width, height, depth, hint); return pixmap; } +static PixmapPtr +xwl_glamor_gbm_create_pixmap(ScreenPtr screen, + int width, int height, int depth, + unsigned int hint) +{ + return xwl_glamor_gbm_create_pixmap_internal(xwl_screen_get(screen), NULL, + width, height, depth, hint, FALSE); +} + +static PixmapPtr +xwl_glamor_gbm_create_pixmap_for_window(struct xwl_window *xwl_window) +{ + return xwl_glamor_gbm_create_pixmap_internal(xwl_window->xwl_screen, + &xwl_window->window->drawable, + xwl_window->window->drawable.width, + xwl_window->window->drawable.height, + xwl_window->window->drawable.depth, + CREATE_PIXMAP_USAGE_BACKING_PIXMAP, + xwl_window->has_implicit_scanout_support); +} + static Bool xwl_glamor_gbm_destroy_pixmap(PixmapPtr pixmap) { @@ -1205,4 +1251,5 @@ xwl_screen->gbm_backend.is_available = TRUE; xwl_screen->gbm_backend.backend_flags = XWL_EGL_BACKEND_NEEDS_BUFFER_FLUSH | XWL_EGL_BACKEND_NEEDS_N_BUFFERING; + xwl_screen->gbm_backend.create_pixmap_for_window = xwl_glamor_gbm_create_pixmap_for_window; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-23.1.1/hw/xwayland/xwayland-glamor.c new/xwayland-23.1.2/hw/xwayland/xwayland-glamor.c --- old/xwayland-23.1.1/hw/xwayland/xwayland-glamor.c 2023-03-29 14:26:36.000000000 +0200 +++ new/xwayland-23.1.2/hw/xwayland/xwayland-glamor.c 2023-06-06 11:20:05.000000000 +0200 @@ -43,6 +43,7 @@ #include "xwayland-glx.h" #include "xwayland-screen.h" #include "xwayland-window.h" +#include "xwayland-window-buffers.h" #include <sys/mman.h> @@ -124,11 +125,15 @@ static Bool xwl_feedback_is_modifier_supported(struct xwl_dmabuf_feedback *xwl_feedback, - uint32_t format, uint64_t modifier) + uint32_t format, uint64_t modifier, + int supports_scanout) { for (int i = 0; i < xwl_feedback->dev_formats_len; i++) { struct xwl_device_formats *dev_formats = &xwl_feedback->dev_formats[i]; + if (supports_scanout && !dev_formats->supports_scanout) + continue; + if (xwl_glamor_is_modifier_supported_in_formats(dev_formats->formats, dev_formats->num_formats, format, modifier)) @@ -157,11 +162,11 @@ format, modifier); } - if (xwl_feedback_is_modifier_supported(&xwl_screen->default_feedback, format, modifier)) + if (xwl_feedback_is_modifier_supported(&xwl_screen->default_feedback, format, modifier, FALSE)) return TRUE; xorg_list_for_each_entry(xwl_window, &xwl_screen->window_list, link_window) { - if (xwl_feedback_is_modifier_supported(&xwl_window->feedback, format, modifier)) + if (xwl_feedback_is_modifier_supported(&xwl_window->feedback, format, modifier, FALSE)) return TRUE; } @@ -322,7 +327,8 @@ static Bool xwl_get_modifiers_for_device(struct xwl_dmabuf_feedback *feedback, drmDevice *device, uint32_t format, uint32_t *num_modifiers, - uint64_t **modifiers) + uint64_t **modifiers, + Bool *supports_scanout) { /* Now try to find a matching set of tranches for the window's device */ for (int i = 0; i < feedback->dev_formats_len; i++) { @@ -330,8 +336,11 @@ if (drmDevicesEqual(dev_formats->drm_dev, device) && xwl_get_modifiers_for_format(dev_formats->formats, dev_formats->num_formats, - format, num_modifiers, modifiers)) + format, num_modifiers, modifiers)) { + if (supports_scanout) + *supports_scanout = !!dev_formats->supports_scanout; return TRUE; + } } return FALSE; @@ -355,7 +364,8 @@ main_dev = xwl_screen_get_main_dev(xwl_screen); return xwl_get_modifiers_for_device(&xwl_screen->default_feedback, main_dev, - format, num_modifiers, modifiers); + format, num_modifiers, modifiers, + NULL); } else { return xwl_get_modifiers_for_format(xwl_screen->formats, xwl_screen->num_formats, format, num_modifiers, modifiers); @@ -363,8 +373,11 @@ } Bool -xwl_glamor_get_drawable_modifiers(DrawablePtr drawable, uint32_t format, - uint32_t *num_modifiers, uint64_t **modifiers) +xwl_glamor_get_drawable_modifiers_and_scanout(DrawablePtr drawable, + uint32_t format, + uint32_t *num_modifiers, + uint64_t **modifiers, + Bool *supports_scanout) { struct xwl_screen *xwl_screen = xwl_screen_get(drawable->pScreen); struct xwl_window *xwl_window; @@ -372,6 +385,8 @@ *num_modifiers = 0; *modifiers = NULL; + if (supports_scanout) + *supports_scanout = FALSE; /* We can only return per-drawable modifiers if the compositor supports feedback */ if (xwl_screen->dmabuf_protocol_version < 4) @@ -389,7 +404,18 @@ main_dev = xwl_screen_get_main_dev(xwl_screen); return xwl_get_modifiers_for_device(&xwl_window->feedback, main_dev, - format, num_modifiers, modifiers); + format, num_modifiers, modifiers, + supports_scanout); + +} + +Bool +xwl_glamor_get_drawable_modifiers(DrawablePtr drawable, uint32_t format, + uint32_t *num_modifiers, uint64_t **modifiers) +{ + return xwl_glamor_get_drawable_modifiers_and_scanout(drawable, + format, num_modifiers, + modifiers, NULL); } @@ -660,24 +686,6 @@ }; Bool -xwl_dmabuf_setup_feedback_for_window(struct xwl_window *xwl_window) -{ - struct xwl_screen *xwl_screen = xwl_window->xwl_screen; - - xwl_window->feedback.dmabuf_feedback = - zwp_linux_dmabuf_v1_get_surface_feedback(xwl_screen->dmabuf, xwl_window->surface); - - if (!xwl_window->feedback.dmabuf_feedback) - return FALSE; - - zwp_linux_dmabuf_feedback_v1_add_listener(xwl_window->feedback.dmabuf_feedback, - &xwl_dmabuf_feedback_listener, - &xwl_window->feedback); - - return TRUE; -} - -Bool xwl_screen_set_dmabuf_interface(struct xwl_screen *xwl_screen, uint32_t id, uint32_t version) { @@ -707,6 +715,115 @@ return TRUE; } +static void +xwl_window_dmabuf_feedback_main_device(void *data, + struct zwp_linux_dmabuf_feedback_v1 *dmabuf_feedback, + struct wl_array *dev) +{ + struct xwl_window *xwl_window = data; + + xwl_dmabuf_feedback_main_device(&xwl_window->feedback, dmabuf_feedback, dev); +} + +static void +xwl_window_dmabuf_feedback_tranche_target_device(void *data, + struct zwp_linux_dmabuf_feedback_v1 *dmabuf_feedback, + struct wl_array *dev) +{ + struct xwl_window *xwl_window = data; + + xwl_dmabuf_feedback_tranche_target_device(&xwl_window->feedback, dmabuf_feedback, dev); +} + +static void +xwl_window_dmabuf_feedback_tranche_flags(void *data, + struct zwp_linux_dmabuf_feedback_v1 *dmabuf_feedback, + uint32_t flags) +{ + struct xwl_window *xwl_window = data; + + xwl_dmabuf_feedback_tranche_flags(&xwl_window->feedback, dmabuf_feedback, flags); +} + +static void +xwl_window_dmabuf_feedback_tranche_formats(void *data, + struct zwp_linux_dmabuf_feedback_v1 *dmabuf_feedback, + struct wl_array *indices) +{ + struct xwl_window *xwl_window = data; + + xwl_dmabuf_feedback_tranche_formats(&xwl_window->feedback, dmabuf_feedback, indices); +} + +static void +xwl_window_dmabuf_feedback_tranche_done(void *data, + struct zwp_linux_dmabuf_feedback_v1 *dmabuf_feedback) +{ + struct xwl_window *xwl_window = data; + + xwl_dmabuf_feedback_tranche_done(&xwl_window->feedback, dmabuf_feedback); +} + +static void +xwl_window_dmabuf_feedback_done(void *data, + struct zwp_linux_dmabuf_feedback_v1 *dmabuf_feedback) +{ + struct xwl_window *xwl_window = data; + uint32_t format = wl_drm_format_for_depth(xwl_window->window->drawable.depth); + + xwl_dmabuf_feedback_done(&xwl_window->feedback, dmabuf_feedback); + + xwl_window->has_implicit_scanout_support = + xwl_feedback_is_modifier_supported(&xwl_window->feedback, format, + DRM_FORMAT_MOD_INVALID, TRUE); + DebugF("XWAYLAND: Window 0x%x can%s get implicit scanout support\n", + xwl_window->window->drawable.id, + xwl_window->has_implicit_scanout_support ? "" : "not"); + + /* If the linux-dmabuf v4 per-surface feedback changed, recycle the + * window buffers so that they get re-created with appropriate parameters. + */ + xwl_window_buffers_recycle(xwl_window); +} + +static void +xwl_window_dmabuf_feedback_format_table(void *data, + struct zwp_linux_dmabuf_feedback_v1 *dmabuf_feedback, + int32_t fd, uint32_t size) +{ + struct xwl_window *xwl_window = data; + + xwl_dmabuf_feedback_format_table(&xwl_window->feedback, dmabuf_feedback, fd, size); +} + +static const struct zwp_linux_dmabuf_feedback_v1_listener xwl_window_dmabuf_feedback_listener = { + .done = xwl_window_dmabuf_feedback_done, + .format_table = xwl_window_dmabuf_feedback_format_table, + .main_device = xwl_window_dmabuf_feedback_main_device, + .tranche_done = xwl_window_dmabuf_feedback_tranche_done, + .tranche_target_device = xwl_window_dmabuf_feedback_tranche_target_device, + .tranche_formats = xwl_window_dmabuf_feedback_tranche_formats, + .tranche_flags = xwl_window_dmabuf_feedback_tranche_flags, +}; + +Bool +xwl_dmabuf_setup_feedback_for_window(struct xwl_window *xwl_window) +{ + struct xwl_screen *xwl_screen = xwl_window->xwl_screen; + + xwl_window->feedback.dmabuf_feedback = + zwp_linux_dmabuf_v1_get_surface_feedback(xwl_screen->dmabuf, xwl_window->surface); + + if (!xwl_window->feedback.dmabuf_feedback) + return FALSE; + + zwp_linux_dmabuf_feedback_v1_add_listener(xwl_window->feedback.dmabuf_feedback, + &xwl_window_dmabuf_feedback_listener, + xwl_window); + + return TRUE; +} + void xwl_glamor_init_wl_registry(struct xwl_screen *xwl_screen, struct wl_registry *registry, @@ -829,6 +946,20 @@ XWL_EGL_BACKEND_NEEDS_N_BUFFERING); } +PixmapPtr +xwl_glamor_create_pixmap_for_window(struct xwl_window *xwl_window) +{ + struct xwl_screen *xwl_screen = xwl_window->xwl_screen; + + if (!xwl_screen->glamor || !xwl_screen->egl_backend) + return NullPixmap; + + if (xwl_screen->egl_backend->create_pixmap_for_window) + return xwl_screen->egl_backend->create_pixmap_for_window(xwl_window); + else + return NullPixmap; +} + void xwl_glamor_init_backends(struct xwl_screen *xwl_screen, Bool use_eglstream) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-23.1.1/hw/xwayland/xwayland-glamor.h new/xwayland-23.1.2/hw/xwayland/xwayland-glamor.h --- old/xwayland-23.1.1/hw/xwayland/xwayland-glamor.h 2023-03-29 14:26:36.000000000 +0200 +++ new/xwayland-23.1.2/hw/xwayland/xwayland-glamor.h 2023-06-06 11:20:05.000000000 +0200 @@ -104,6 +104,9 @@ * is set up on. */ drmDevice *(*get_main_device)(struct xwl_screen *xwl_screen); + + /* Direct hook to create the backing pixmap for a window */ + PixmapPtr (*create_pixmap_for_window)(struct xwl_window *xwl_window); }; #ifdef XWL_HAS_GLAMOR @@ -139,9 +142,15 @@ CARD32 *num_formats, CARD32 **formats); Bool xwl_glamor_get_modifiers(ScreenPtr screen, uint32_t format, uint32_t *num_modifiers, uint64_t **modifiers); +Bool xwl_glamor_get_drawable_modifiers_and_scanout(DrawablePtr drawable, + uint32_t format, + uint32_t *num_modifiers, + uint64_t **modifiers, + Bool *supports_scanout); Bool xwl_glamor_get_drawable_modifiers(DrawablePtr drawable, uint32_t format, uint32_t *num_modifiers, uint64_t **modifiers); Bool xwl_glamor_check_flip(PixmapPtr pixmap); +PixmapPtr xwl_glamor_create_pixmap_for_window (struct xwl_window *xwl_window); #ifdef XV /* glamor Xv Adaptor */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-23.1.1/hw/xwayland/xwayland-output.c new/xwayland-23.1.2/hw/xwayland/xwayland-output.c --- old/xwayland-23.1.1/hw/xwayland/xwayland-output.c 2023-03-29 14:26:36.000000000 +0200 +++ new/xwayland-23.1.2/hw/xwayland/xwayland-output.c 2023-06-06 11:20:05.000000000 +0200 @@ -1086,11 +1086,8 @@ { RRModePtr *modes = NULL; RRModePtr mode; - xRRModeInfo mode_info = { 0, }; - char mode_name[128]; int i, nmodes, current; - modes = xallocarray(ARRAY_SIZE(xwl_output_fake_modes) + 1, sizeof(RRModePtr)); if (!modes) { ErrorF("Failed to allocated RandR modes\n"); @@ -1115,21 +1112,11 @@ } if (!current) { - /* Add the current mode as it's not part of the fake modes. - * Not using libcvt as the size is set from the command line and - * may not be a valid CVT mode. - */ - mode_info.width = current_width; - mode_info.height = current_height; - mode_info.hTotal = current_width; - mode_info.vTotal = current_height; - mode_info.dotClock = 60 * 1000 * 1000; - - snprintf(mode_name, sizeof(mode_name), "%dx%d", - current_width, current_height); - mode_info.nameLength = strlen(mode_name); + /* Add the current mode as it's not part of the fake modes. */ + mode = xwayland_cvt(current_width, current_height, 60, 0, 0); - modes[nmodes++] = RRModeGet(&mode_info, mode_name); + if (mode) + modes[nmodes++] = mode; } qsort(modes, nmodes, sizeof(RRModePtr), mode_sort); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-23.1.1/hw/xwayland/xwayland-present.c new/xwayland-23.1.2/hw/xwayland/xwayland-present.c --- old/xwayland-23.1.1/hw/xwayland/xwayland-present.c 2023-03-29 14:26:36.000000000 +0200 +++ new/xwayland-23.1.2/hw/xwayland/xwayland-present.c 2023-06-06 11:20:05.000000000 +0200 @@ -84,9 +84,22 @@ } static struct xwl_present_event * -xwl_present_event_from_id(uint64_t event_id) +xwl_present_event_from_id(WindowPtr present_window, uint64_t event_id) { - return (struct xwl_present_event*)(uintptr_t)event_id; + present_window_priv_ptr window_priv = present_get_window_priv(present_window, TRUE); + struct xwl_present_event *event; + + xorg_list_for_each_entry(event, &window_priv->vblank, vblank.window_list) { + if (event->vblank.event_id == event_id) + return event; + } + return NULL; +} + +static struct xwl_present_event * +xwl_present_event_from_vblank(present_vblank_ptr vblank) +{ + return container_of(vblank, struct xwl_present_event, vblank); } static Bool entered_for_each_frame_callback; @@ -268,7 +281,7 @@ xwl_present_free_idle_vblank(present_vblank_ptr vblank) { present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence); - xwl_present_free_event(xwl_present_event_from_id((uintptr_t)vblank)); + xwl_present_free_event(xwl_present_event_from_vblank(vblank)); } static WindowPtr @@ -306,7 +319,7 @@ struct xwl_present_event *event; vblank = xwl_present_window->flip_active; - event = xwl_present_event_from_id((uintptr_t)vblank); + event = xwl_present_event_from_vblank(vblank); if (event->pixmap) xwl_present_free_idle_vblank(vblank); else @@ -336,7 +349,7 @@ if (xwl_present_window->flip_active) { struct xwl_present_event *event = - xwl_present_event_from_id((uintptr_t)xwl_present_window->flip_active); + xwl_present_event_from_vblank(xwl_present_window->flip_active); if (!event->pixmap) xwl_present_free_event(event); @@ -540,7 +553,12 @@ { struct xwl_present_window *xwl_present_window = xwl_present_window_get_priv(present_window); struct xwl_window *xwl_window = xwl_window_from_window(present_window); - struct xwl_present_event *event = xwl_present_event_from_id(event_id); + struct xwl_present_event *event = xwl_present_event_from_id(present_window, event_id); + + if (!event) { + ErrorF("present: Error getting event\n"); + return BadImplementation; + } event->vblank.exec_msc = msc; @@ -732,18 +750,15 @@ } static Bool -xwl_present_flip(WindowPtr present_window, - RRCrtcPtr crtc, - uint64_t event_id, - PixmapPtr pixmap, - Bool sync_flip, - RegionPtr damage) +xwl_present_flip(present_vblank_ptr vblank, RegionPtr damage) { + WindowPtr present_window = vblank->window; + PixmapPtr pixmap = vblank->pixmap; struct xwl_window *xwl_window = xwl_window_from_window(present_window); struct xwl_present_window *xwl_present_window = xwl_present_window_priv(present_window); BoxPtr damage_box; struct wl_buffer *buffer; - struct xwl_present_event *event = xwl_present_event_from_id(event_id); + struct xwl_present_event *event = xwl_present_event_from_vblank(vblank); if (!xwl_window) return FALSE; @@ -781,7 +796,7 @@ wl_surface_commit(xwl_window->surface); - if (!sync_flip) { + if (!vblank->sync_flip) { xwl_present_window->sync_callback = wl_display_sync(xwl_window->xwl_screen->display); wl_callback_add_listener(xwl_present_window->sync_callback, @@ -845,8 +860,7 @@ } else damage = RegionDuplicate(&window->clipList); - if (xwl_present_flip(vblank->window, vblank->crtc, vblank->event_id, - vblank->pixmap, vblank->sync_flip, damage)) { + if (xwl_present_flip(vblank, damage)) { WindowPtr toplvl_window = xwl_present_toplvl_pixmap_window(vblank->window); PixmapPtr old_pixmap = screen->GetWindowPixmap(window); @@ -916,6 +930,7 @@ present_notify_ptr notifies, int num_notifies) { + static uint64_t xwl_present_event_id; uint64_t ust = 0; uint64_t target_msc; uint64_t crtc_msc = 0; @@ -981,7 +996,7 @@ return BadAlloc; } - vblank->event_id = (uintptr_t)event; + vblank->event_id = ++xwl_present_event_id; /* Xwayland presentations always complete (at least) one frame after they * are executed diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-23.1.1/hw/xwayland/xwayland-screen.c new/xwayland-23.1.2/hw/xwayland/xwayland-screen.c --- old/xwayland-23.1.1/hw/xwayland/xwayland-screen.c 2023-03-29 14:26:36.000000000 +0200 +++ new/xwayland-23.1.2/hw/xwayland/xwayland-screen.c 2023-06-06 11:20:05.000000000 +0200 @@ -943,10 +943,11 @@ xwl_screen->glamor = 0; } } - +#ifdef GLAMOR_HAS_GBM if (xwl_screen->glamor && xwl_screen->rootless) xwl_screen->present = xwl_present_init(pScreen); -#endif +#endif /* GLAMOR_HAS_GBM */ +#endif /* XWL_HAS_GLAMOR */ if (!xwl_screen->glamor) { xwl_screen->CreateScreenResources = pScreen->CreateScreenResources; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-23.1.1/hw/xwayland/xwayland-window-buffers.c new/xwayland-23.1.2/hw/xwayland/xwayland-window-buffers.c --- old/xwayland-23.1.1/hw/xwayland/xwayland-window-buffers.c 2023-03-29 14:26:36.000000000 +0200 +++ new/xwayland-23.1.2/hw/xwayland/xwayland-window-buffers.c 2023-06-06 11:20:05.000000000 +0200 @@ -328,12 +328,19 @@ pBox++; } } else { +#ifdef XWL_HAS_GLAMOR + /* Try the xwayland/glamor direct hook first */ xwl_window_buffer->pixmap = - (*xwl_screen->screen->CreatePixmap) (window_pixmap->drawable.pScreen, - window_pixmap->drawable.width, - window_pixmap->drawable.height, - window_pixmap->drawable.depth, - CREATE_PIXMAP_USAGE_BACKING_PIXMAP); + xwl_glamor_create_pixmap_for_window(xwl_window); +#endif /* XWL_HAS_GLAMOR */ + if (!xwl_window_buffer->pixmap) { + xwl_window_buffer->pixmap = + (*xwl_screen->screen->CreatePixmap) (window_pixmap->drawable.pScreen, + window_pixmap->drawable.width, + window_pixmap->drawable.height, + window_pixmap->drawable.depth, + CREATE_PIXMAP_USAGE_BACKING_PIXMAP); + } if (!xwl_window_buffer->pixmap) return window_pixmap; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-23.1.1/hw/xwayland/xwayland-window.c new/xwayland-23.1.2/hw/xwayland/xwayland-window.c --- old/xwayland-23.1.1/hw/xwayland/xwayland-window.c 2023-03-29 14:26:36.000000000 +0200 +++ new/xwayland-23.1.2/hw/xwayland/xwayland-window.c 2023-06-06 11:20:05.000000000 +0200 @@ -56,41 +56,6 @@ static DevPrivateKeyRec xwl_damage_private_key; static const char *xwl_surface_tag = "xwl-surface"; -static void -xwl_window_set_allow_commits(struct xwl_window *xwl_window, Bool allow, - const char *debug_msg) -{ - xwl_window->allow_commits = allow; - DebugF("XWAYLAND: win %d allow_commits = %d (%s)\n", - xwl_window->window->drawable.id, allow, debug_msg); -} - -static void -xwl_window_set_allow_commits_from_property(struct xwl_window *xwl_window, - PropertyPtr prop) -{ - static Bool warned = FALSE; - CARD32 *propdata; - - if (prop->propertyName != xwl_window->xwl_screen->allow_commits_prop) - FatalError("Xwayland internal error: prop mismatch in %s.\n", __func__); - - if (prop->type != XA_CARDINAL || prop->format != 32 || prop->size != 1) { - /* Not properly set, so fall back to safe and glitchy */ - xwl_window_set_allow_commits(xwl_window, TRUE, "WM fault"); - - if (!warned) { - LogMessageVerb(X_WARNING, 0, "Window manager is misusing property %s.\n", - NameForAtom(prop->propertyName)); - warned = TRUE; - } - return; - } - - propdata = prop->data; - xwl_window_set_allow_commits(xwl_window, !!propdata[0], "from property"); -} - struct xwl_window * xwl_window_get(WindowPtr window) { @@ -137,6 +102,53 @@ return wl_proxy_get_tag((struct wl_proxy *) surface) == &xwl_surface_tag; } +static void +xwl_window_set_allow_commits(struct xwl_window *xwl_window, Bool allow, + const char *debug_msg) +{ + struct xwl_screen *xwl_screen = xwl_window->xwl_screen; + DamagePtr damage; + + xwl_window->allow_commits = allow; + DebugF("XWAYLAND: win %d allow_commits = %d (%s)\n", + xwl_window->window->drawable.id, allow, debug_msg); + + damage = window_get_damage(xwl_window->window); + if (allow && + xorg_list_is_empty(&xwl_window->link_damage) && + damage && + RegionNotEmpty(DamageRegion(damage))) { + xorg_list_add(&xwl_window->link_damage, + &xwl_screen->damage_window_list); + } +} + +static void +xwl_window_set_allow_commits_from_property(struct xwl_window *xwl_window, + PropertyPtr prop) +{ + static Bool warned = FALSE; + CARD32 *propdata; + + if (prop->propertyName != xwl_window->xwl_screen->allow_commits_prop) + FatalError("Xwayland internal error: prop mismatch in %s.\n", __func__); + + if (prop->type != XA_CARDINAL || prop->format != 32 || prop->size != 1) { + /* Not properly set, so fall back to safe and glitchy */ + xwl_window_set_allow_commits(xwl_window, TRUE, "WM fault"); + + if (!warned) { + LogMessageVerb(X_WARNING, 0, "Window manager is misusing property %s.\n", + NameForAtom(prop->propertyName)); + warned = TRUE; + } + return; + } + + propdata = prop->data; + xwl_window_set_allow_commits(xwl_window, !!propdata[0], "from property"); +} + void xwl_window_update_property(struct xwl_window *xwl_window, PropertyStateRec *propstate) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-23.1.1/hw/xwayland/xwayland-window.h new/xwayland-23.1.2/hw/xwayland/xwayland-window.h --- old/xwayland-23.1.1/hw/xwayland/xwayland-window.h 2023-03-29 14:26:36.000000000 +0200 +++ new/xwayland-23.1.2/hw/xwayland/xwayland-window.h 2023-06-06 11:20:05.000000000 +0200 @@ -119,6 +119,8 @@ #endif struct xwayland_surface_v1 *xwayland_surface; struct xwl_dmabuf_feedback feedback; + /* If TRUE, the window buffer format supports scanout with implicit modifier */ + Bool has_implicit_scanout_support; }; struct xwl_window *xwl_window_get(WindowPtr window); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-23.1.1/hw/xwayland/xwayland.c new/xwayland-23.1.2/hw/xwayland/xwayland.c --- old/xwayland-23.1.1/hw/xwayland/xwayland.c 2023-03-29 14:26:36.000000000 +0200 +++ new/xwayland-23.1.2/hw/xwayland/xwayland.c 2023-06-06 11:20:05.000000000 +0200 @@ -289,14 +289,13 @@ DeleteCallback(&SelectionCallback, wm_selection_callback, xwl_screen); } -_X_NORETURN static void _X_ATTRIBUTE_PRINTF(1, 0) xwl_log_handler(const char *format, va_list args) { char msg[256]; vsnprintf(msg, sizeof msg, format, args); - FatalError("%s", msg); + ErrorF("XWAYLAND: %s", msg); } #ifdef XWL_HAS_XWAYLAND_EXTENSION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-23.1.1/include/meson.build new/xwayland-23.1.2/include/meson.build --- old/xwayland-23.1.1/include/meson.build 2023-03-29 14:26:36.000000000 +0200 +++ new/xwayland-23.1.2/include/meson.build 2023-06-06 11:20:05.000000000 +0200 @@ -107,6 +107,8 @@ build_glamor and gbm_dep.found() and gbm_dep.version().version_compare('>= 17.1') ? '1' : false) conf_data.set('GBM_BO_FD_FOR_PLANE', build_glamor and gbm_dep.found() and gbm_dep.version().version_compare('>= 21.1') ? '1' : false) +conf_data.set('GBM_BO_WITH_MODIFIERS2', + build_glamor and gbm_dep.found() and gbm_dep.version().version_compare('>= 21.3') ? '1' : false) conf_data.set_quoted('SERVER_MISC_CONFIG_PATH', serverconfigdir) conf_data.set_quoted('PROJECTROOT', get_option('prefix')) @@ -178,7 +180,7 @@ endif if conf_data.get('HAVE_GETPEEREID').to_int() == 0 and conf_data.get('HAVE_GETPEERUCRED').to_int() == 0 - if not cc.has_header_symbol('sys/socket.h', 'SO_PEERCRED') + if not cc.has_header_symbol('sys/socket.h', 'SO_PEERCRED', args: '-D_GNU_SOURCE') conf_data.set('NO_LOCAL_CLIENT_CRED', 1) endif endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xwayland-23.1.1/meson.build new/xwayland-23.1.2/meson.build --- old/xwayland-23.1.1/meson.build 2023-03-29 14:26:36.000000000 +0200 +++ new/xwayland-23.1.2/meson.build 2023-06-06 11:20:05.000000000 +0200 @@ -3,10 +3,10 @@ 'buildtype=debugoptimized', 'c_std=gnu99', ], - version: '23.1.1', + version: '23.1.2', meson_version: '>= 0.52.0', ) -release_date = '2023-03-29' +release_date = '2023-06-06' add_project_arguments('-DHAVE_DIX_CONFIG_H', language: ['c', 'objc']) cc = meson.get_compiler('c')