diff --git a/xserver/ChangeLog b/xserver/ChangeLog index 57a978eb2..f23837692 100644 --- a/xserver/ChangeLog +++ b/xserver/ChangeLog @@ -1,3 +1,414 @@ +commit f84ad082557f9cde6b8faa373eca6a0a89ba7d56 +Author: Matt Turner +Date: Sun Mar 29 13:02:03 2020 -0700 + + xserver 1.20.8 + + Signed-off-by: Matt Turner + +commit 8837279869309317c110afb6f2f3c24484c77657 +Author: Jon Turney +Date: Wed Apr 17 11:37:11 2019 +0100 + + Fix old-style definition warning for xf86OSInputThreadInit() + + ../hw/xfree86/os-support/stub/stub_init.c: In function ‘xf86OSInputThreadInit’: + ../hw/xfree86/os-support/stub/stub_init.c:29:1: warning: old-style function definition [-Wold-style-definition] + + (cherry picked from commit 7c266cafed14b38c039091651069ae9888c3a8ae) + +commit 0c012f968b4e02a2bc892ce71f7bea9bd3f7fb22 +Author: Jon Turney +Date: Wed Mar 13 14:57:14 2019 +0000 + + Add xf86OSInputThreadInit to stub os-support as well + + stub os support also needs to provide xf86OSInputThreadInit, omitted in + ea1527a8 + + (cherry picked from commit c020769dbfb965740c8441d8242b738ef572a7c9) + +commit b259485975078087fe6bde2b9e1eccf4ae14120c +Author: Michel Dänzer +Date: Tue Mar 17 11:45:22 2020 +0100 + + xwayland: Delete all frame_callback_list nodes in xwl_unrealize_window + + We were only calling xwl_present_unrealize_window for the toplevel + window, but the list can contain entries from child windows as well, + in which case we were leaving dangling pointers to freed memory. + + Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/1000 + Fixes: c5067feaeea1 "xwayland: Use single frame callback for Present + flips and normal updates" + Reviewed-by: Olivier Fourdan + Tested-by: Olivier Fourdan + (cherry picked from commit 5e91587302e85fd6f0e8d5ffbe30182e18c6913f) + +commit a033571644d277dc49a489f7ae32c4ad92856543 +Author: Jonas Ådahl +Date: Fri Sep 13 17:11:27 2019 +0200 + + xwayland/glamor-gbm: Handle DRM_FORMAT_MOD_INVALID gracefully + + The compositor may send DRM_FORMAT_MOD_INVALID instead of a list of + modifiers for various reasons. Handle this gracefully by ignoring it. + + Without this, if a compositor would send DRM_FORMAT_MOD_INVALID, it'd + result in empty windows provided by Xwayland. + + Signed-off-by: Jonas Ådahl + Reviewed-by: Olivier Fourdan + Reviewed-by: Michel Dänzer + (cherry picked from commit edf964434eac10ffbe27cc883e3ab95505669aee) + +commit 3c48bd50ad33f2a533ac76afa38d6e3906ebc28a +Author: Arthur Williams +Date: Sun Oct 6 18:55:35 2019 +0000 + + dix: Check for NULL spriteInfo in GetPairedDevice + + There is a race when reseting the XServer that causes spriteInfo to be + NULL in GetPairedDevice resulting a segfault and subsequent crash. The + problem was noticed when opening a connection, creating master devices, + destroying master devices and closing the connection during testing. + + Signed-off-by: Arthur Williams + + + (cherry picked from commit e693c9657f98c334e9921ca2f8ebf710497c0c6a) + +commit 1610ef1d6b5ba99da9d1a639f3b65b2e61514a7d +Author: David Seifert +Date: Fri Jan 24 12:49:44 2020 +0100 + + Fix building with `-fno-common` + + * GCC 10 will switch the default to `-fno-common`. + https://gcc.gnu.org/PR85678 + + Bug: https://bugs.gentoo.org/705880 + Signed-off-by: Matt Turner + +commit 2a185dd22ddb5b0d7d2ef5948591028766bb9530 +Author: Michel Dänzer +Date: Mon Mar 2 18:09:31 2020 +0100 + + xwayland: Use frame callbacks for Present vblank events + + Instead of only the fallback timer. + + Fixes https://gitlab.freedesktop.org/xorg/xserver/issues/854 + + v2: + * Drop unused frame_callback member of struct xwl_present_window + (Olivier Fourdan) + + Reviewed-by: Olivier Fourdan + (cherry picked from commit 9b31358c52e951883bf7c01c953a9da080542244) + +commit 99a6d6b15e0757a4652a569a1b2070c76a00b567 +Author: Michel Dänzer +Date: Wed Nov 27 18:04:06 2019 +0100 + + xwayland: Use single frame callback for Present flips and normal updates + + Using a list of Present windows that need to be called back. + + This prepares for the following change, there should be no change in + observed behaviour. + + v2: + * Use xwl_window_create_frame_callback instead of making the + frame_listener struct non-static (Olivier Fourdan) + + Reviewed-by: Olivier Fourdan + (cherry picked from commit c5067feaeea115761f0a72f37407c6e5e943d1a1) + +commit 915cc107767624bd7914c962347bab9c2e21cdff +Author: Michel Dänzer +Date: Fri Dec 13 18:26:35 2019 +0100 + + xwayland: Add xwl_window_create_frame_callback helper + + This will be used by the following changes. No functional change + intended. + + Reviewed-by: Olivier Fourdan + (cherry picked from commit f80eea0529b2cfb805a9c7d4994a4235451131e3) + +commit 94dad4f05133171805ee94095bbcd20ece754eba +Author: Dor Askayo +Date: Wed Feb 19 17:22:11 2020 +0100 + + xwayland: clear pixmaps after creation in rootless mode + + When a pixmap is created with a backing FBO, the FBO should be cleared + to avoid rendering uninitialized memory. This could happen when the + pixmap is rendered without being filled in its entirety. + + One example is when a top-level window without a background is + resized. The pixmap would be reallocated to prepare for more pixels, + but uninitialized memory would be rendered in the resize offset until + the client sends a frame that fills these additional pixels. + + Another example is when a new top-level window is created without a + background. Uninitialized memory would be rendered after the pixmap is + allocated and before the client sends its first frame. + + This issue is only apparent in OpenGL implementations that don't zero + the VRAM of allocated buffers by default, such as RadeonSI. + + Signed-off-by: Dor Askayo + Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/636 + Reviewed-by: Michel Dänzer + (cherry picked from commit 0e9a0c203c2ae4eae12bdbb95428f398211c7bee) + + [ Michel Dänzer: + * Squashed in commit ebf549db2d9341d99e0d0847b948dd798d98f7dc + * Dropped code related to glamor_format, which only exists on master ] + +commit 0238359bced17f9db0e266111897d154ab117d68 +Author: Michel Dänzer +Date: Fri Feb 7 12:15:07 2020 +0100 + + xwayland: Call glamor_block_handler from xwl_screen_post_damage + + In between the two phases introduced by the previous change. This makes + sure all pending drawing to the new buffers is flushed before they're + committed to the Wayland server. + (cherry picked from commit a542224ea28e2e8ccaf5e0df85bf6c603e97599a) + +commit a93bce6bfc6c610676a7fbc76639854c5553cb2c +Author: Michel Dänzer +Date: Fri Feb 7 12:06:39 2020 +0100 + + xwayland: Split up xwl_screen_post_damage into two phases + + The first phase sets the new surface properties for all damaged + windows, then the second phase commits all surface updates. + + This is preparatory for the next change, there should be no observable + change in behaviour (other than the order of Wayland protocol + requests). + + Reviewed-by: Adam Jackson + (cherry picked from commit f88d9b1f779835302e02e255fcd45989db7f488d) + +commit 1ba5e528d52ed9d7d67eb45c5d3e04b6f5d22b05 +Author: Maarten Lankhorst +Date: Thu Apr 25 11:46:41 2019 +0200 + + modesetting: Disable atomic support by default + + The atomic driver has issues with modesetting when stealing + connectors from a different crtc, a black screen when doing rotation + on a different crtc, and in general is just a mapping of the legacy + helpers to atomic. This is already done in the kernel, so just + fallback to legacy by default until this is fixed. + + Please backport to 1.20, as we don't want to enable it for everyone + there. It breaks for existing users. + + The fixes to make the xserver more atomic have been pending on the + mailing list for ages. + + Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110375 + Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110030 + References: https://gitlab.freedesktop.org/xorg/xserver/merge_requests/36/commits + Signed-off-by: Maarten Lankhorst + (cherry picked from commit f0d78b47ac49977a6007f5fe081f00c6eb19a12e) + +commit d44bbb4710961651dcf10701bc562f1f01509010 +Author: Eric Anholt +Date: Mon Feb 10 10:22:34 2020 +0100 + + glamor: Fix a compiler warning since the recent OOM fixes. + + Signed-off-by: Eric Anholt + (cherry picked from commit 3b26b90cb787a14fa5f8bb2033eab8ab6562a9a5) + +commit d2a6c8708ca4f27c8d9aade6db2c4e7f2d8c624f +Author: Paul Kocialkowski +Date: Mon Feb 10 10:21:02 2020 +0100 + + glamor: Fallback to system memory for RW PBO buffer allocation + + We currently support two modes of operation for RW PBO buffers: one + that allocates a pack buffer with GL memory and one that uses system + memory when the former is not supported. + + Since allocation with system memory is less likely to fail, add a + fallback to system memory when GL memory failed instead of bailing + out. + + Signed-off-by: Paul Kocialkowski + (cherry picked from commit 8c4e8d9eff03cefc987f13c900b0a47403946127) + +commit ca034c2f2cfff8e49b816b8ecbaa96215b796e36 +Author: Paul Kocialkowski +Date: Mon Feb 10 10:20:30 2020 +0100 + + glamor: Propagate glamor_prepare_access failures in copy helpers + + glamor_prepare_access can fail for a few reasons, especially when + failing to allocate a PBO buffer. Take this in account and bail in + the copy helpers that call the helper when a failure happens. + + Signed-off-by: Paul Kocialkowski + (cherry picked from commit de6b3fac1f26075ce915006c914c4a4755617715) + +commit a7b165d994d74131778a5a9bcffec957f1d1cacb +Author: Paul Kocialkowski +Date: Mon Feb 10 10:20:04 2020 +0100 + + glamor: Error out on out-of-memory when allocating PBO for FBO access + + Packed buffer allocation (which happens at glBufferData time with the + buffer bound) can fail when there is no GL memory left. + + Pick up the error when it happens, print a proper error message, do + some cleanup and bail. + + Signed-off-by: Paul Kocialkowski + (cherry picked from commit bc2e12239f86e5a4acd220744f42eb83ba55d328) + +commit 428b5ce4da99a43bfa0c1933ec447f7feb3639a1 +Author: Paul Kocialkowski +Date: Mon Feb 10 10:19:18 2020 +0100 + + glamor: Propagate FBO allocation failure for picture to texture upload + + When uploading a picture to a texture, glamor_upload_picture_to_texture + calls glamor_pixmap_ensure_fbo to ensure that there is backing FBO. + The FBO will be allocated if the picture's drawable pixmap does not have + one already, which can fail when there is no GL memory left. + + glamor_upload_picture_to_texture checks that the call succeeded and will + enter the failure path if it did not. However, unlike many other + functions in glamor, this one has ret set to TRUE initially, so it needs + to be set to FALSE when a failure happens. + + Otherwise, the error is not propagated and the failure path return TRUE. + This leads to a fault when trying to access the FBO pointer later on. + + Signed-off-by: Paul Kocialkowski + (cherry picked from commit c98c7709c67d8ed6b7455ec700a49b58c396ec2c) + +commit 948afd768398955f043fef8e14d7d154cea25f85 +Author: Dave Airlie +Date: Thu Feb 6 17:59:08 2020 +0100 + + modesetting: remove unnecessary error message, fix zaphod leases + + I introduced this error with the MST hotplug code, but it can trigger + on zaphod setups, and is perfectly fine. There is no support for + MST/hotplug on zaphod setups currently, so we can just skip over + the dynamic connector handling here. However we shouldn't skip + over the lease handling so move it into the codepath. + + Fixes: 9257b1252da9 ("modesetting: add dynamic connector hotplug support (MST) (v3)") + Reviewed-by: Michel Dänzer + Signed-off-by: Dave Airlie + (cherry picked from commit 1cfdd1a96580733df3625bcea3384ffee3dc92df) + +commit 1c3e51dabadbf65e7fdedbebbdcd19a85fb03e34 +Author: Michel Dänzer +Date: Thu Feb 6 17:57:16 2020 +0100 + + xfree86/modes: Bail from xf86RotateRedisplay if pScreen->root is NULL + + Avoids a crash in xf86RotatePrepare -> DamageRegister during + CreateScreenResources if rotation or another transform is configured for + any connected RandR output in xorg.conf. The generic rotation/transform + code generally can't work without the root window currently. + + Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/969 + Fixes: 094f42cdfe5d "xfree86/modes: Call xf86RotateRedisplay from + xf86CrtcRotate" + Acked-by: Olivier Fourdan + Reviewed-by: Adam Jackson + (cherry picked from commit 6a5e47c57d16de8b6a6a2636f3cbad1aebec32e2) + +commit af2fd88b1019f63fe3ce871f9e99b3e1e4608b25 +Author: Daniel Llewellyn +Date: Thu Feb 6 17:56:12 2020 +0100 + + os: Ignore dying client in ResetCurrentRequest + + You might as well, it's harmless. Better, some cleanup code (like DRI2 + swap wait) needs to run both normally and at client exit, so it + simplifies the callers to not need to check first. See 4308f5d3 for a + similar example. + + Props: @ajax (Adam Jackson) + + Fixes: xorg/xserver#211 + + Signed-off-by: Daniel Llewellyn + (cherry picked from commit 578371616e09364318c9fb2371a693d438b31b29) + +commit e5293f1c5d7b20d98ed4975dc29a6f88c8bc6a0d +Author: Adam Jackson +Date: Thu Feb 6 17:55:25 2020 +0100 + + Revert "dri2: Don't make reference to noClientException" + + It's true that the value would always be -1, if it's not zero, but it's + usually zero is the problem. As a result we return failure from + otherwise successful indirect GLX paths, which isn't very nice of us. + + This reverts commit 7d33ab0f8c7958b205076f71e4b47c24aace77fd. + + Fixes: https://gitlab.freedesktop.org/xorg/xserver/issues/211 + (cherry picked from commit e1fa3beb2fe2519e69f859f0acdc68e5a770de27) + +commit d845ceae53bb425695e6a185b51ae1b432dd4672 +Author: George Matsumura +Date: Thu Feb 6 17:54:36 2020 +0100 + + Restrict 1x1 pixmap filling optimization to GXcopy + + This restricts an optimization whereby the filling of 1x1 pixmaps + went around the driver-provided function to cases where the + source color is meant to be directly copied to the destination, + as opposed to other operations which should produce different + destination values than just the foreground color. + + Signed-off-by: George Matsumura + Reviewed-by: Michel Dänzer + (cherry picked from commit 83826075e59c0393c16d2a2482dc5c9f2fdf4564) + +commit c2ef88c4d3a551ff7646bfb86550cae32b02a510 +Author: Michel Dänzer +Date: Tue Jan 14 09:23:34 2020 +0100 + + modesetting: Explicitly #include "mi.h" + + For the miClearDrawable prototype. Apparently it doesn't get pulled in + for some build configurations, breaking the build. + + Reviewed-by: Kenneth Graunke + (cherry picked from commit a24a786fc8490fda08b15c3dab6fa6750f008ecb) + +commit ad7364d8d7f936b9b08195e47d2f6ee9329ff687 +Author: Kenneth Graunke +Date: Mon Jan 13 23:34:49 2020 -0800 + + configure: Define GLAMOR_HAS_EGL_QUERY_DRIVER when available + + Commit 195c2ef8f9f07b9bdabc0f554a9033b7857b99c7 added this to the Meson + build but neglected to add it to autotools. + + v2: Also update dix-config.h.in + + Fixes: 195c2ef8f ("glamor: Add a function to get the driver name via EGL_MESA_query_driver") + + Reviewed-by: Michel Dänzer [v1] + Reviewed-by: Eric Engestrom [v1] + Reviewed-by: Matt Turner + (cherry picked from commit 25ca99df38a2c28c25ab20a917e68442285f2353) + commit 489f4191f3c881c6c8acce97ec612167a4ae0f33 Author: Matt Turner Date: Mon Jan 13 14:47:48 2020 -0800 diff --git a/xserver/configure b/xserver/configure index 5c1814afe..bdd5c2a7c 100644 --- a/xserver/configure +++ b/xserver/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for xorg-server 1.20.7. +# Generated by GNU Autoconf 2.69 for xorg-server 1.20.8. # # Report bugs to . # @@ -651,8 +651,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='xorg-server' PACKAGE_TARNAME='xorg-server' -PACKAGE_VERSION='1.20.7' -PACKAGE_STRING='xorg-server 1.20.7' +PACKAGE_VERSION='1.20.8' +PACKAGE_STRING='xorg-server 1.20.8' PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/xserver/issues' PACKAGE_URL='' @@ -2045,7 +2045,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures xorg-server 1.20.7 to adapt to many kinds of systems. +\`configure' configures xorg-server 1.20.8 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -2115,7 +2115,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xorg-server 1.20.7:";; + short | recursive ) echo "Configuration of xorg-server 1.20.8:";; esac cat <<\_ACEOF @@ -2310,10 +2310,10 @@ Optional Packages: org.x) --with-bundle-version=VERSION Version to use for X11.app's CFBundleVersion - (default: 1.20.7) + (default: 1.20.8) --with-bundle-version-string=VERSION Version to use for X11.app's - CFBundleShortVersionString (default: 1.20.7) + CFBundleShortVersionString (default: 1.20.8) --with-sparkle-feed-url=URL URL for the Sparkle feed (default: https://www.xquartz.org/releases/sparkle/release.xml) @@ -2568,7 +2568,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -xorg-server configure 1.20.7 +xorg-server configure 1.20.8 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -3277,7 +3277,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by xorg-server $as_me 1.20.7, which was +It was created by xorg-server $as_me 1.20.8, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3625,8 +3625,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -RELEASE_DATE="2020-01-13" -RELEASE_NAME="Stuffed French Toast" +RELEASE_DATE="2020-03-29" +RELEASE_NAME="Chicken Parmigiana" am__api_version='1.12' @@ -4105,7 +4105,7 @@ fi # Define the identity of the package. PACKAGE='xorg-server' - VERSION='1.20.7' + VERSION='1.20.8' cat >>confdefs.h <<_ACEOF @@ -23034,7 +23034,7 @@ _ACEOF if test "${with_bundle_version+set}" = set; then : withval=$with_bundle_version; BUNDLE_VERSION="${withval}" else - BUNDLE_VERSION="1.20.7" + BUNDLE_VERSION="1.20.8" fi @@ -32961,7 +32961,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by xorg-server $as_me 1.20.7, which was +This file was extended by xorg-server $as_me 1.20.8, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -33027,7 +33027,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -xorg-server config.status 1.20.7 +xorg-server config.status 1.20.8 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/xserver/configure.ac b/xserver/configure.ac index 9cb37eaae..298a7aff0 100644 --- a/xserver/configure.ac +++ b/xserver/configure.ac @@ -26,9 +26,9 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.60) -AC_INIT([xorg-server], 1.20.7, [https://gitlab.freedesktop.org/xorg/xserver/issues], xorg-server) -RELEASE_DATE="2020-01-13" -RELEASE_NAME="Stuffed French Toast" +AC_INIT([xorg-server], 1.20.8, [https://gitlab.freedesktop.org/xorg/xserver/issues], xorg-server) +RELEASE_DATE="2020-03-29" +RELEASE_NAME="Chicken Parmigiana" AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) diff --git a/xserver/dix/devices.c b/xserver/dix/devices.c index 1b18b168e..00c453980 100644 --- a/xserver/dix/devices.c +++ b/xserver/dix/devices.c @@ -2656,7 +2656,7 @@ GetPairedDevice(DeviceIntPtr dev) if (!IsMaster(dev) && !IsFloating(dev)) dev = GetMaster(dev, MASTER_ATTACHED); - return dev->spriteInfo->paired; + return dev->spriteInfo? dev->spriteInfo->paired: NULL; } /** diff --git a/xserver/exa/exa_accel.c b/xserver/exa/exa_accel.c index b26d5c804..41fcb129f 100644 --- a/xserver/exa/exa_accel.c +++ b/xserver/exa/exa_accel.c @@ -1037,7 +1037,7 @@ exaFillRegionSolid(DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel, if (pExaPixmap->pDamage && pExaPixmap->sys_ptr && pDrawable->type == DRAWABLE_PIXMAP && pDrawable->width == 1 && pDrawable->height == 1 && - pDrawable->bitsPerPixel != 24) { + pDrawable->bitsPerPixel != 24 && alu == GXcopy) { RegionPtr pending_damage = DamagePendingRegion(pExaPixmap->pDamage); switch (pDrawable->bitsPerPixel) { diff --git a/xserver/glamor/glamor.c b/xserver/glamor/glamor.c index a6cc798f8..abefef614 100644 --- a/xserver/glamor/glamor.c +++ b/xserver/glamor/glamor.c @@ -128,6 +128,21 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex) glamor_pixmap_attach_fbo(pixmap, fbo); } +_X_EXPORT void +glamor_clear_pixmap(PixmapPtr pixmap) +{ + ScreenPtr screen = pixmap->drawable.pScreen; + glamor_screen_private *glamor_priv; + glamor_pixmap_private *pixmap_priv; + + glamor_priv = glamor_get_screen_private(screen); + pixmap_priv = glamor_get_pixmap_private(pixmap); + + assert(pixmap_priv->fbo != NULL); + + glamor_pixmap_clear_fbo(glamor_priv, pixmap_priv->fbo); +} + uint32_t glamor_get_pixmap_texture(PixmapPtr pixmap) { diff --git a/xserver/glamor/glamor.h b/xserver/glamor/glamor.h index 3f9d265db..be04bf858 100644 --- a/xserver/glamor/glamor.h +++ b/xserver/glamor/glamor.h @@ -115,6 +115,9 @@ extern _X_EXPORT void glamor_set_pixmap_texture(PixmapPtr pixmap, extern _X_EXPORT void glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type); + +extern _X_EXPORT void glamor_clear_pixmap(PixmapPtr pixmap); + extern _X_EXPORT void glamor_block_handler(ScreenPtr screen); extern _X_EXPORT PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h, diff --git a/xserver/glamor/glamor_copy.c b/xserver/glamor/glamor_copy.c index e050c0220..1ab2be6c0 100644 --- a/xserver/glamor/glamor_copy.c +++ b/xserver/glamor/glamor_copy.c @@ -221,7 +221,9 @@ glamor_copy_cpu_fbo(DrawablePtr src, goto bail; glamor_make_current(glamor_priv); - glamor_prepare_access(src, GLAMOR_ACCESS_RO); + + if (!glamor_prepare_access(src, GLAMOR_ACCESS_RO)) + goto bail; glamor_get_drawable_deltas(dst, dst_pixmap, &dst_xoff, &dst_yoff); @@ -309,7 +311,9 @@ glamor_copy_fbo_cpu(DrawablePtr src, goto bail; glamor_make_current(glamor_priv); - glamor_prepare_access(dst, GLAMOR_ACCESS_RW); + + if (!glamor_prepare_access(dst, GLAMOR_ACCESS_RW)) + goto bail; glamor_get_drawable_deltas(src, src_pixmap, &src_xoff, &src_yoff); diff --git a/xserver/glamor/glamor_fbo.c b/xserver/glamor/glamor_fbo.c index e8c4330b3..f939a6c2f 100644 --- a/xserver/glamor/glamor_fbo.c +++ b/xserver/glamor/glamor_fbo.c @@ -239,6 +239,18 @@ glamor_create_fbo_array(glamor_screen_private *glamor_priv, return NULL; } +void +glamor_pixmap_clear_fbo(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *fbo) +{ + glamor_make_current(glamor_priv); + + assert(fbo->fb != 0 && fbo->tex != 0); + + glamor_set_destination_pixmap_fbo(glamor_priv, fbo, 0, 0, fbo->width, fbo->height); + glClearColor(0.0, 0.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); +} + glamor_pixmap_fbo * glamor_pixmap_detach_fbo(glamor_pixmap_private *pixmap_priv) { diff --git a/xserver/glamor/glamor_picture.c b/xserver/glamor/glamor_picture.c index 84a33ad6a..685d8d618 100644 --- a/xserver/glamor/glamor_picture.c +++ b/xserver/glamor/glamor_picture.c @@ -340,8 +340,10 @@ glamor_upload_picture_to_texture(PicturePtr picture) else iformat = format; - if (!glamor_pixmap_ensure_fbo(pixmap, iformat, GLAMOR_CREATE_FBO_NO_FBO)) + if (!glamor_pixmap_ensure_fbo(pixmap, iformat, GLAMOR_CREATE_FBO_NO_FBO)) { + ret = FALSE; goto fail; + } glPixelStorei(GL_UNPACK_ALIGNMENT, 4); diff --git a/xserver/glamor/glamor_prepare.c b/xserver/glamor/glamor_prepare.c index 5a73e6c7d..835c4ebea 100644 --- a/xserver/glamor/glamor_prepare.c +++ b/xserver/glamor/glamor_prepare.c @@ -88,11 +88,29 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box) gl_usage = GL_STREAM_READ; + glamor_priv->suppress_gl_out_of_memory_logging = true; + glBindBuffer(GL_PIXEL_PACK_BUFFER, priv->pbo); glBufferData(GL_PIXEL_PACK_BUFFER, pixmap->devKind * pixmap->drawable.height, NULL, gl_usage); - } else { + + glamor_priv->suppress_gl_out_of_memory_logging = false; + + if (glGetError() == GL_OUT_OF_MEMORY) { + if (!glamor_priv->logged_any_pbo_allocation_failure) { + LogMessageVerb(X_WARNING, 0, "glamor: Failed to allocate %d " + "bytes PBO due to GL_OUT_OF_MEMORY.\n", + pixmap->devKind * pixmap->drawable.height); + glamor_priv->logged_any_pbo_allocation_failure = true; + } + glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); + glDeleteBuffers(1, &priv->pbo); + priv->pbo = 0; + } + } + + if (!priv->pbo) { pixmap->devPrivate.ptr = xallocarray(pixmap->devKind, pixmap->drawable.height); if (!pixmap->devPrivate.ptr) @@ -106,7 +124,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box) RegionUninit(®ion); - if (glamor_priv->has_rw_pbo) { + if (priv->pbo) { if (priv->map_access == GLAMOR_ACCESS_RW) gl_access = GL_READ_WRITE; else @@ -128,8 +146,6 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box) static void glamor_fini_pixmap(PixmapPtr pixmap) { - ScreenPtr screen = pixmap->drawable.pScreen; - glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv)) @@ -138,7 +154,7 @@ glamor_fini_pixmap(PixmapPtr pixmap) if (!priv->prepared) return; - if (glamor_priv->has_rw_pbo) { + if (priv->pbo) { glBindBuffer(GL_PIXEL_UNPACK_BUFFER, priv->pbo); glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); pixmap->devPrivate.ptr = NULL; @@ -153,7 +169,7 @@ glamor_fini_pixmap(PixmapPtr pixmap) RegionUninit(&priv->prepare_region); - if (glamor_priv->has_rw_pbo) { + if (priv->pbo) { glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); glDeleteBuffers(1, &priv->pbo); priv->pbo = 0; diff --git a/xserver/glamor/glamor_priv.h b/xserver/glamor/glamor_priv.h index 661c11d90..4353a99f1 100644 --- a/xserver/glamor/glamor_priv.h +++ b/xserver/glamor/glamor_priv.h @@ -289,6 +289,7 @@ typedef struct glamor_screen_private { Bool suppress_gl_out_of_memory_logging; Bool logged_any_fbo_allocation_failure; + Bool logged_any_pbo_allocation_failure; /* xv */ glamor_program xv_prog; @@ -538,6 +539,7 @@ void glamor_destroy_fbo(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *fbo); void glamor_pixmap_destroy_fbo(PixmapPtr pixmap); Bool glamor_pixmap_fbo_fixup(ScreenPtr screen, PixmapPtr pixmap); +void glamor_pixmap_clear_fbo(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *fbo); /* Return whether 'picture' is alpha-only */ static inline Bool glamor_picture_is_alpha(PicturePtr picture) diff --git a/xserver/glx/glxdri2.c b/xserver/glx/glxdri2.c index d402ca860..822515a86 100644 --- a/xserver/glx/glxdri2.c +++ b/xserver/glx/glxdri2.c @@ -295,7 +295,7 @@ __glXDRIcontextWait(__GLXcontext * baseContext, } if (ret) { - *error = -1; + *error = cl->client->noClientException; return TRUE; } diff --git a/xserver/hw/dmx/config/dmxconfig.c b/xserver/hw/dmx/config/dmxconfig.c index c1a9e1cf3..85bc0dbe4 100644 --- a/xserver/hw/dmx/config/dmxconfig.c +++ b/xserver/hw/dmx/config/dmxconfig.c @@ -72,7 +72,7 @@ typedef struct DMXConfigCmdStruct { DMXConfigList *xinputs; } DMXConfigCmd, *DMXConfigCmdPtr; -DMXConfigEntryPtr dmxConfigEntry; +extern DMXConfigEntryPtr dmxConfigEntry; static DMXConfigCmd dmxConfigCmd; static int dmxDisplaysFromCommandLine; diff --git a/xserver/hw/dmx/config/xdmxconfig.c b/xserver/hw/dmx/config/xdmxconfig.c index 49e4b5459..05d839688 100644 --- a/xserver/hw/dmx/config/xdmxconfig.c +++ b/xserver/hw/dmx/config/xdmxconfig.c @@ -65,7 +65,7 @@ extern FILE *yyin; #define DMX_CANVAS_WIDTH 400 #define DMX_CANVAS_HEIGHT 500 -DMXConfigEntryPtr dmxConfigEntry; +extern DMXConfigEntryPtr dmxConfigEntry; static DMXConfigVirtualPtr dmxConfigCurrent, dmxConfigNewVirtual; static DMXConfigDisplayPtr dmxConfigCurrentDisplay, dmxConfigNewDisplay; static int dmxConfigGrabbed, dmxConfigGrabbedFine; diff --git a/xserver/hw/dmx/glxProxy/glxext.c b/xserver/hw/dmx/glxProxy/glxext.c index 49848bbff..ca9780f99 100644 --- a/xserver/hw/dmx/glxProxy/glxext.c +++ b/xserver/hw/dmx/glxProxy/glxext.c @@ -47,8 +47,6 @@ #include "extinit.h" #include "glx_extinit.h" -int noGlxExtension; - /* ** Forward declarations. */ diff --git a/xserver/hw/xfree86/drivers/modesetting/driver.c b/xserver/hw/xfree86/drivers/modesetting/driver.c index 361d129eb..d37c0d282 100644 --- a/xserver/hw/xfree86/drivers/modesetting/driver.c +++ b/xserver/hw/xfree86/drivers/modesetting/driver.c @@ -137,6 +137,7 @@ static const OptionInfoRec Options[] = { {OPTION_PAGEFLIP, "PageFlip", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_ZAPHOD_HEADS, "ZaphodHeads", OPTV_STRING, {0}, FALSE}, {OPTION_DOUBLE_SHADOW, "DoubleShadow", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_ATOMIC, "Atomic", OPTV_BOOLEAN, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE} }; @@ -1044,8 +1045,12 @@ PreInit(ScrnInfoPtr pScrn, int flags) #endif } - ret = drmSetClientCap(ms->fd, DRM_CLIENT_CAP_ATOMIC, 1); - ms->atomic_modeset = (ret == 0); + if (xf86ReturnOptValBool(ms->drmmode.Options, OPTION_ATOMIC, FALSE)) { + ret = drmSetClientCap(ms->fd, DRM_CLIENT_CAP_ATOMIC, 1); + ms->atomic_modeset = (ret == 0); + } else { + ms->atomic_modeset = FALSE; + } ms->kms_has_modifiers = FALSE; ret = drmGetCap(ms->fd, DRM_CAP_ADDFB2_MODIFIERS, &value); diff --git a/xserver/hw/xfree86/drivers/modesetting/driver.h b/xserver/hw/xfree86/drivers/modesetting/driver.h index 493280c1d..8bfb2fc1a 100644 --- a/xserver/hw/xfree86/drivers/modesetting/driver.h +++ b/xserver/hw/xfree86/drivers/modesetting/driver.h @@ -51,6 +51,7 @@ typedef enum { OPTION_PAGEFLIP, OPTION_ZAPHOD_HEADS, OPTION_DOUBLE_SHADOW, + OPTION_ATOMIC, } modesettingOpts; typedef struct diff --git a/xserver/hw/xfree86/drivers/modesetting/drmmode_display.c b/xserver/hw/xfree86/drivers/modesetting/drmmode_display.c index 2bc19dcf4..9a960e3c6 100644 --- a/xserver/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/xserver/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -3735,7 +3735,7 @@ drmmode_handle_uevents(int fd, void *closure) goto out; if (mode_res->count_crtcs != config->num_crtc) { - ErrorF("number of CRTCs changed - failed to handle, %d vs %d\n", mode_res->count_crtcs, config->num_crtc); + /* this triggers with Zaphod mode where we don't currently support connector hotplug or MST. */ goto out_free_res; } @@ -3784,15 +3784,16 @@ drmmode_handle_uevents(int fd, void *closure) drmmode_output_init(scrn, drmmode, mode_res, i, TRUE, 0); } - /* Check to see if a lessee has disappeared */ - drmmode_validate_leases(scrn); - if (changed) { RRSetChanged(xf86ScrnToScreen(scrn)); RRTellChanged(xf86ScrnToScreen(scrn)); } out_free_res: + + /* Check to see if a lessee has disappeared */ + drmmode_validate_leases(scrn); + drmModeFreeResources(mode_res); out: RRGetInfo(xf86ScrnToScreen(scrn), TRUE); diff --git a/xserver/hw/xfree86/modes/xf86Rotate.c b/xserver/hw/xfree86/modes/xf86Rotate.c index 05944cfcb..5415ed97c 100644 --- a/xserver/hw/xfree86/modes/xf86Rotate.c +++ b/xserver/hw/xfree86/modes/xf86Rotate.c @@ -176,7 +176,7 @@ xf86RotateRedisplay(ScreenPtr pScreen) DamagePtr damage = xf86_config->rotation_damage; RegionPtr region; - if (!damage) + if (!damage || !pScreen->root) return FALSE; xf86RotatePrepare(pScreen); region = DamageRegion(damage); diff --git a/xserver/hw/xfree86/os-support/bsd/bsd_init.c b/xserver/hw/xfree86/os-support/bsd/bsd_init.c index 8909a1439..5c1e7d732 100644 --- a/xserver/hw/xfree86/os-support/bsd/bsd_init.c +++ b/xserver/hw/xfree86/os-support/bsd/bsd_init.c @@ -780,7 +780,7 @@ xf86UseMsg(void) } void -xf86OSInputThreadInit() +xf86OSInputThreadInit(void) { return; } diff --git a/xserver/hw/xfree86/os-support/hurd/hurd_init.c b/xserver/hw/xfree86/os-support/hurd/hurd_init.c index ee8fe92c0..c1b632f19 100644 --- a/xserver/hw/xfree86/os-support/hurd/hurd_init.c +++ b/xserver/hw/xfree86/os-support/hurd/hurd_init.c @@ -89,7 +89,7 @@ xf86CloseConsole() } void -xf86OSInputThreadInit() +xf86OSInputThreadInit(void) { return; } diff --git a/xserver/hw/xfree86/os-support/linux/lnx_init.c b/xserver/hw/xfree86/os-support/linux/lnx_init.c index 5c0367c6f..011d8da4f 100644 --- a/xserver/hw/xfree86/os-support/linux/lnx_init.c +++ b/xserver/hw/xfree86/os-support/linux/lnx_init.c @@ -399,7 +399,7 @@ xf86UseMsg(void) } void -xf86OSInputThreadInit() +xf86OSInputThreadInit(void) { return; } diff --git a/xserver/hw/xfree86/os-support/solaris/sun_vid.c b/xserver/hw/xfree86/os-support/solaris/sun_vid.c index edb0a1172..2b48e66b0 100644 --- a/xserver/hw/xfree86/os-support/solaris/sun_vid.c +++ b/xserver/hw/xfree86/os-support/solaris/sun_vid.c @@ -74,7 +74,7 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) /***************************************************************************/ void -xf86OSInputThreadInit() +xf86OSInputThreadInit(void) { /* * Need to enable in input thread as well, as Solaris kernel tracks diff --git a/xserver/hw/xfree86/os-support/stub/stub_init.c b/xserver/hw/xfree86/os-support/stub/stub_init.c index d3e0c3f29..f0d9039b9 100644 --- a/xserver/hw/xfree86/os-support/stub/stub_init.c +++ b/xserver/hw/xfree86/os-support/stub/stub_init.c @@ -24,3 +24,9 @@ void xf86UseMsg(void) { } + +void +xf86OSInputThreadInit(void) +{ + return; +} diff --git a/xserver/hw/xwayland/xwayland-glamor-gbm.c b/xserver/hw/xwayland/xwayland-glamor-gbm.c index febc0b910..dce782fc3 100644 --- a/xserver/hw/xwayland/xwayland-glamor-gbm.c +++ b/xserver/hw/xwayland/xwayland-glamor-gbm.c @@ -242,8 +242,12 @@ xwl_glamor_gbm_create_pixmap(ScreenPtr screen, if (bo) { pixmap = xwl_glamor_gbm_create_pixmap_for_bo(screen, bo, depth); - if (!pixmap) + if (!pixmap) { gbm_bo_destroy(bo); + } + else if (xwl_screen->rootless && hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP) { + glamor_clear_pixmap(pixmap); + } } } @@ -794,6 +798,10 @@ xwl_dmabuf_handle_modifier(void *data, struct zwp_linux_dmabuf_v1 *dmabuf, struct xwl_format *xwl_format = NULL; int i; + if (modifier_hi == (DRM_FORMAT_MOD_INVALID >> 32) && + modifier_lo == (DRM_FORMAT_MOD_INVALID & 0xffffffff)) + return; + for (i = 0; i < xwl_screen->num_formats; i++) { if (xwl_screen->formats[i].format == format) { xwl_format = &xwl_screen->formats[i]; diff --git a/xserver/hw/xwayland/xwayland-present.c b/xserver/hw/xwayland/xwayland-present.c index 31c276623..5ba7dce08 100644 --- a/xserver/hw/xwayland/xwayland-present.c +++ b/xserver/hw/xwayland/xwayland-present.c @@ -60,6 +60,7 @@ xwl_present_window_get_priv(WindowPtr window) xwl_present_window->msc = 1; xwl_present_window->ust = GetTimeInMicros(); + xorg_list_init(&xwl_present_window->frame_callback_list); xorg_list_init(&xwl_present_window->event_list); xorg_list_init(&xwl_present_window->release_queue); @@ -96,7 +97,7 @@ xwl_present_reset_timer(struct xwl_present_window *xwl_present_window) if (xwl_present_has_events(xwl_present_window)) { CARD32 timeout; - if (xwl_present_window->frame_callback) + if (!xorg_list_is_empty(&xwl_present_window->frame_callback_list)) timeout = TIMER_LEN_FLIP; else timeout = TIMER_LEN_COPY; @@ -119,10 +120,7 @@ xwl_present_cleanup(WindowPtr window) if (!xwl_present_window) return; - if (xwl_present_window->frame_callback) { - wl_callback_destroy(xwl_present_window->frame_callback); - xwl_present_window->frame_callback = NULL; - } + xorg_list_del(&xwl_present_window->frame_callback_list); if (xwl_present_window->sync_callback) { wl_callback_destroy(xwl_present_window->sync_callback); @@ -244,7 +242,10 @@ xwl_present_timer_callback(OsTimerPtr timer, { struct xwl_present_window *xwl_present_window = arg; - xwl_present_window->frame_timer_firing = TRUE; + /* If we were expecting a frame callback for this window, it didn't arrive + * in a second. Stop listening to it to avoid double-bumping the MSC + */ + xorg_list_del(&xwl_present_window->frame_callback_list); xwl_present_msc_bump(xwl_present_window); xwl_present_reset_timer(xwl_present_window); @@ -252,20 +253,10 @@ xwl_present_timer_callback(OsTimerPtr timer, return 0; } -static void -xwl_present_frame_callback(void *data, - struct wl_callback *callback, - uint32_t time) +void +xwl_present_frame_callback(struct xwl_present_window *xwl_present_window) { - struct xwl_present_window *xwl_present_window = data; - - wl_callback_destroy(xwl_present_window->frame_callback); - xwl_present_window->frame_callback = NULL; - - if (xwl_present_window->frame_timer_firing) { - /* If the timer is firing, this frame callback is too late */ - return; - } + xorg_list_del(&xwl_present_window->frame_callback_list); xwl_present_msc_bump(xwl_present_window); @@ -275,10 +266,6 @@ xwl_present_frame_callback(void *data, xwl_present_reset_timer(xwl_present_window); } -static const struct wl_callback_listener xwl_present_frame_listener = { - xwl_present_frame_callback -}; - static void xwl_present_sync_callback(void *data, struct wl_callback *callback, @@ -360,6 +347,7 @@ xwl_present_queue_vblank(WindowPtr present_window, uint64_t msc) { 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; event = malloc(sizeof *event); @@ -372,7 +360,15 @@ xwl_present_queue_vblank(WindowPtr present_window, xorg_list_append(&event->list, &xwl_present_window->event_list); - if (!xwl_present_window->frame_timer) + /* If there's a pending frame callback, use that */ + if (xwl_window && xwl_window->frame_callback && + xorg_list_is_empty(&xwl_present_window->frame_callback_list)) { + xorg_list_add(&xwl_present_window->frame_callback_list, + &xwl_window->frame_callback_list); + } + + if ((xwl_window && xwl_window->frame_callback) || + !xwl_present_window->frame_timer) xwl_present_reset_timer(xwl_present_window); return Success; @@ -488,15 +484,15 @@ xwl_present_flip(WindowPtr present_window, /* We can flip directly to the main surface (full screen window without clips) */ wl_surface_attach(xwl_window->surface, buffer, 0, 0); - if (!xwl_present_window->frame_callback) { - xwl_present_window->frame_callback = wl_surface_frame(xwl_window->surface); - wl_callback_add_listener(xwl_present_window->frame_callback, - &xwl_present_frame_listener, - xwl_present_window); + if (!xwl_window->frame_callback) + xwl_window_create_frame_callback(xwl_window); + + if (xorg_list_is_empty(&xwl_present_window->frame_callback_list)) { + xorg_list_add(&xwl_present_window->frame_callback_list, + &xwl_window->frame_callback_list); } /* Realign timer */ - xwl_present_window->frame_timer_firing = FALSE; xwl_present_reset_timer(xwl_present_window); wl_surface_damage(xwl_window->surface, 0, 0, @@ -528,18 +524,12 @@ xwl_present_flips_stop(WindowPtr window) } void -xwl_present_unrealize_window(WindowPtr window) +xwl_present_unrealize_window(struct xwl_present_window *xwl_present_window) { - struct xwl_present_window *xwl_present_window = xwl_present_window_priv(window); - - if (!xwl_present_window || !xwl_present_window->frame_callback) - return; - /* The pending frame callback may never be called, so drop it and shorten * the frame timer interval. */ - wl_callback_destroy(xwl_present_window->frame_callback); - xwl_present_window->frame_callback = NULL; + xorg_list_del(&xwl_present_window->frame_callback_list); xwl_present_reset_timer(xwl_present_window); } diff --git a/xserver/hw/xwayland/xwayland.c b/xserver/hw/xwayland/xwayland.c index 324c68ccf..ed9f2e3c2 100644 --- a/xserver/hw/xwayland/xwayland.c +++ b/xserver/hw/xwayland/xwayland.c @@ -40,7 +40,11 @@ #ifdef XF86VIDMODE #include -_X_EXPORT Bool noXFree86VidModeExtension; +extern _X_EXPORT Bool noXFree86VidModeExtension; +#endif + +#ifdef XWL_HAS_GLAMOR +#include #endif void @@ -596,6 +600,10 @@ ensure_surface_for_window(WindowPtr window) dixSetPrivate(&window->devPrivates, &xwl_window_private_key, xwl_window); xorg_list_init(&xwl_window->link_damage); +#ifdef GLAMOR_HAS_GBM + xorg_list_init(&xwl_window->frame_callback_list); +#endif + xwl_window_init_allow_commits(xwl_window); return TRUE; @@ -680,11 +688,6 @@ xwl_unrealize_window(WindowPtr window) xwl_screen->UnrealizeWindow = screen->UnrealizeWindow; screen->UnrealizeWindow = xwl_unrealize_window; -#ifdef GLAMOR_HAS_GBM - if (xwl_screen->present) - xwl_present_unrealize_window(window); -#endif - xwl_window = xwl_window_get(window); if (!xwl_window) return ret; @@ -696,6 +699,18 @@ xwl_unrealize_window(WindowPtr window) if (xwl_window->frame_callback) wl_callback_destroy(xwl_window->frame_callback); +#ifdef GLAMOR_HAS_GBM + if (xwl_screen->present) { + struct xwl_present_window *xwl_present_window, *tmp; + + xorg_list_for_each_entry_safe(xwl_present_window, tmp, + &xwl_window->frame_callback_list, + frame_callback_list) { + xwl_present_unrealize_window(xwl_present_window); + } + } +#endif + free(xwl_window); dixSetPrivate(&window->devPrivates, &xwl_window_private_key, NULL); @@ -737,12 +752,32 @@ frame_callback(void *data, wl_callback_destroy (xwl_window->frame_callback); xwl_window->frame_callback = NULL; + +#ifdef GLAMOR_HAS_GBM + if (xwl_window->xwl_screen->present) { + struct xwl_present_window *xwl_present_window, *tmp; + + xorg_list_for_each_entry_safe(xwl_present_window, tmp, + &xwl_window->frame_callback_list, + frame_callback_list) { + xwl_present_frame_callback(xwl_present_window); + } + } +#endif } static const struct wl_callback_listener frame_listener = { frame_callback }; +void +xwl_window_create_frame_callback(struct xwl_window *xwl_window) +{ + xwl_window->frame_callback = wl_surface_frame(xwl_window->surface); + wl_callback_add_listener(xwl_window->frame_callback, &frame_listener, + xwl_window); +} + static Bool xwl_destroy_window(WindowPtr window) { @@ -813,19 +848,17 @@ xwl_window_post_damage(struct xwl_window *xwl_window) box->x2 - box->x1, box->y2 - box->y1); } - xwl_window->frame_callback = wl_surface_frame(xwl_window->surface); - wl_callback_add_listener(xwl_window->frame_callback, &frame_listener, xwl_window); - - wl_surface_commit(xwl_window->surface); + xwl_window_create_frame_callback(xwl_window); DamageEmpty(window_get_damage(xwl_window->window)); - - xorg_list_del(&xwl_window->link_damage); } static void xwl_screen_post_damage(struct xwl_screen *xwl_screen) { struct xwl_window *xwl_window, *next_xwl_window; + struct xorg_list commit_window_list; + + xorg_list_init(&commit_window_list); xorg_list_for_each_entry_safe(xwl_window, next_xwl_window, &xwl_screen->damage_window_list, link_damage) { @@ -843,6 +876,24 @@ xwl_screen_post_damage(struct xwl_screen *xwl_screen) #endif xwl_window_post_damage(xwl_window); + xorg_list_del(&xwl_window->link_damage); + xorg_list_append(&xwl_window->link_damage, &commit_window_list); + } + + if (xorg_list_is_empty(&commit_window_list)) + return; + +#ifdef XWL_HAS_GLAMOR + if (xwl_screen->glamor && + xwl_screen->egl_backend == &xwl_screen->gbm_backend) { + glamor_block_handler(xwl_screen->screen); + } +#endif + + xorg_list_for_each_entry_safe(xwl_window, next_xwl_window, + &commit_window_list, link_damage) { + wl_surface_commit(xwl_window->surface); + xorg_list_del(&xwl_window->link_damage); } } diff --git a/xserver/hw/xwayland/xwayland.h b/xserver/hw/xwayland/xwayland.h index 0854df456..daa719209 100644 --- a/xserver/hw/xwayland/xwayland.h +++ b/xserver/hw/xwayland/xwayland.h @@ -183,6 +183,7 @@ struct xwl_window { struct wl_callback *frame_callback; Bool allow_commits; #ifdef GLAMOR_HAS_GBM + struct xorg_list frame_callback_list; Bool present_flipped; #endif }; @@ -192,15 +193,13 @@ struct xwl_present_window { struct xwl_screen *xwl_screen; struct xwl_present_event *sync_flip; WindowPtr window; - struct xorg_list link; + struct xorg_list frame_callback_list; uint64_t msc; uint64_t ust; OsTimerPtr frame_timer; - Bool frame_timer_firing; - struct wl_callback *frame_callback; struct wl_callback *sync_callback; struct xorg_list event_list; @@ -378,6 +377,8 @@ struct xwl_output { Bool xdg_output_done; }; +void xwl_window_create_frame_callback(struct xwl_window *xwl_window); + void xwl_sync_events (struct xwl_screen *xwl_screen); Bool xwl_screen_init_cursor(struct xwl_screen *xwl_screen); @@ -452,9 +453,10 @@ Bool xwl_glamor_allow_commits(struct xwl_window *xwl_window); void xwl_glamor_egl_make_current(struct xwl_screen *xwl_screen); #ifdef GLAMOR_HAS_GBM +void xwl_present_frame_callback(struct xwl_present_window *xwl_present_window); Bool xwl_present_init(ScreenPtr screen); void xwl_present_cleanup(WindowPtr window); -void xwl_present_unrealize_window(WindowPtr window); +void xwl_present_unrealize_window(struct xwl_present_window *xwl_present_window); #endif /* GLAMOR_HAS_GBM */ #ifdef XV diff --git a/xserver/os/io.c b/xserver/os/io.c index b099f0967..939f51743 100644 --- a/xserver/os/io.c +++ b/xserver/os/io.c @@ -557,6 +557,11 @@ void ResetCurrentRequest(ClientPtr client) { OsCommPtr oc = (OsCommPtr) client->osPrivate; + + /* ignore dying clients */ + if (!oc) + return; + register ConnectionInputPtr oci = oc->input; register xReq *request; int gotnow, needed; diff --git a/xserver/test/misc.c b/xserver/test/misc.c index 3c669b677..f1f76cccd 100644 --- a/xserver/test/misc.c +++ b/xserver/test/misc.c @@ -33,7 +33,7 @@ #include "tests-common.h" -ScreenInfo screenInfo; +extern ScreenInfo screenInfo; static void dix_version_compare(void) diff --git a/xserver/test/xi1/protocol-xchangedevicecontrol.c b/xserver/test/xi1/protocol-xchangedevicecontrol.c index 57a15c407..54f1f67cb 100644 --- a/xserver/test/xi1/protocol-xchangedevicecontrol.c +++ b/xserver/test/xi1/protocol-xchangedevicecontrol.c @@ -37,7 +37,7 @@ #include "protocol-common.h" -ClientRec client_window; +extern ClientRec client_window; static ClientRec client_request; static void diff --git a/xserver/test/xi2/protocol-common.c b/xserver/test/xi2/protocol-common.c index 8cd85dd05..05dd3c4e7 100644 --- a/xserver/test/xi2/protocol-common.c +++ b/xserver/test/xi2/protocol-common.c @@ -45,6 +45,8 @@ static ClientRec server_client; void *global_userdata; +void (*reply_handler) (ClientPtr client, int len, char *data, void *userdata); + int enable_GrabButton_wrap = 1; int enable_XISetEventMask_wrap = 1; diff --git a/xserver/test/xi2/protocol-common.h b/xserver/test/xi2/protocol-common.h index 8490529ad..742ce348f 100644 --- a/xserver/test/xi2/protocol-common.h +++ b/xserver/test/xi2/protocol-common.h @@ -99,7 +99,7 @@ extern void *global_userdata; * The reply handler called from WriteToClient. Set this handler if you need * to check the reply values. */ -void (*reply_handler) (ClientPtr client, int len, char *data, void *userdata); +extern void (*reply_handler) (ClientPtr client, int len, char *data, void *userdata); /** * The default screen used for the windows. Initialized by init_simple(). diff --git a/xserver/test/xi2/protocol-xigetclientpointer.c b/xserver/test/xi2/protocol-xigetclientpointer.c index 9c38bd720..244e8438f 100644 --- a/xserver/test/xi2/protocol-xigetclientpointer.c +++ b/xserver/test/xi2/protocol-xigetclientpointer.c @@ -46,7 +46,7 @@ static struct { int win; } test_data; -ClientRec client_window; +extern ClientRec client_window; static ClientRec client_request; static void diff --git a/xserver/test/xi2/protocol-xigetselectedevents.c b/xserver/test/xi2/protocol-xigetselectedevents.c index 9a0fac5d4..b14100224 100644 --- a/xserver/test/xi2/protocol-xigetselectedevents.c +++ b/xserver/test/xi2/protocol-xigetselectedevents.c @@ -60,7 +60,7 @@ static struct { int mask_len; } test_data; -ClientRec client_window; +extern ClientRec client_window; /* AddResource is called from XISetSEventMask, we don't need this */ Bool diff --git a/xserver/test/xi2/protocol-xipassivegrabdevice.c b/xserver/test/xi2/protocol-xipassivegrabdevice.c index c703a1ee8..142bcecb7 100644 --- a/xserver/test/xi2/protocol-xipassivegrabdevice.c +++ b/xserver/test/xi2/protocol-xipassivegrabdevice.c @@ -41,7 +41,7 @@ #include "protocol-common.h" -ClientRec client_window; +extern ClientRec client_window; static ClientRec client_request; #define N_MODS 7 diff --git a/xserver/test/xi2/protocol-xiquerydevice.c b/xserver/test/xi2/protocol-xiquerydevice.c index a068038fd..6ee8a80fc 100644 --- a/xserver/test/xi2/protocol-xiquerydevice.c +++ b/xserver/test/xi2/protocol-xiquerydevice.c @@ -54,7 +54,7 @@ struct test_data { int num_devices_in_reply; }; -ClientRec client_window; +extern ClientRec client_window; static void reply_XIQueryDevice_data(ClientPtr client, int len, char *data, void *closure); diff --git a/xserver/test/xi2/protocol-xiquerypointer.c b/xserver/test/xi2/protocol-xiquerypointer.c index ed75d7910..0f5a2b57a 100644 --- a/xserver/test/xi2/protocol-xiquerypointer.c +++ b/xserver/test/xi2/protocol-xiquerypointer.c @@ -41,7 +41,7 @@ #include "protocol-common.h" -ClientRec client_window; +extern ClientRec client_window; static ClientRec client_request; static void reply_XIQueryPointer_data(ClientPtr client, int len, char *data, void *closure); diff --git a/xserver/test/xi2/protocol-xiqueryversion.c b/xserver/test/xi2/protocol-xiqueryversion.c index 3ce758faa..c7ddbfc10 100644 --- a/xserver/test/xi2/protocol-xiqueryversion.c +++ b/xserver/test/xi2/protocol-xiqueryversion.c @@ -58,7 +58,7 @@ struct test_data { int minor_expected; }; -ClientRec client_window; +extern ClientRec client_window; static void reply_XIQueryVersion(ClientPtr client, int len, char *data, void *closure) diff --git a/xserver/test/xi2/protocol-xiselectevents.c b/xserver/test/xi2/protocol-xiselectevents.c index f136c23d0..06050ade7 100644 --- a/xserver/test/xi2/protocol-xiselectevents.c +++ b/xserver/test/xi2/protocol-xiselectevents.c @@ -62,7 +62,7 @@ static unsigned char *data[4096 * 20]; /* the request data buffer */ -ClientRec client_window; +extern ClientRec client_window; int __real_XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client, diff --git a/xserver/test/xi2/protocol-xisetclientpointer.c b/xserver/test/xi2/protocol-xisetclientpointer.c index 6584bb9cc..ddc9f0000 100644 --- a/xserver/test/xi2/protocol-xisetclientpointer.c +++ b/xserver/test/xi2/protocol-xisetclientpointer.c @@ -48,7 +48,7 @@ #include "protocol-common.h" -ClientRec client_window; +extern ClientRec client_window; static ClientRec client_request; static void diff --git a/xserver/test/xi2/protocol-xiwarppointer.c b/xserver/test/xi2/protocol-xiwarppointer.c index 8484d54e5..e5c2f31ea 100644 --- a/xserver/test/xi2/protocol-xiwarppointer.c +++ b/xserver/test/xi2/protocol-xiwarppointer.c @@ -44,7 +44,7 @@ static int expected_x = SPRITE_X; static int expected_y = SPRITE_Y; -ClientRec client_window; +extern ClientRec client_window; /** * This function overrides the one in the screen rec.