xserver: Branch 'master' - 5 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 20 15:25:30 UTC 2023


 .gitlab-ci.yml                    |    2 +-
 .gitlab-ci/cross-prereqs-build.sh |    2 +-
 .gitlab-ci/debian-install.sh      |    8 ++++----
 hw/xwayland/meson.build           |    3 +++
 hw/xwayland/xwayland-present.c    |   21 ++++++++++++++++++---
 hw/xwayland/xwayland-present.h    |    1 +
 hw/xwayland/xwayland-screen.c     |    5 +++++
 hw/xwayland/xwayland-screen.h     |    1 +
 hw/xwayland/xwayland-window.c     |    9 +++++++++
 hw/xwayland/xwayland-window.h     |    1 +
 meson.build                       |    4 +++-
 present/present.c                 |    2 +-
 present/present_vblank.c          |    2 +-
 13 files changed, 49 insertions(+), 12 deletions(-)

New commits:
commit 1ce2025822244c85826ab36febfa5945186b4a2a
Author: Xaver Hugl <xaver.hugl at gmail.com>
Date:   Mon Oct 17 17:58:01 2022 +0200

    xwayland: add support for wp-tearing-control-v1
    
    Signed-off-by: Xaver Hugl <xaver.hugl at gmail.com>
    Acked-by: Michel Dänzer <mdaenzer at redhat.com>
    Reviewed-by: Olivier Fourdan <ofourdan at redhat.com>

diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index b76d205b2..8b3d7595a 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -48,6 +48,7 @@ xdg_shell_xml = join_paths(protodir, 'stable', 'xdg-shell', 'xdg-shell.xml')
 drm_lease_xml = join_paths(protodir, 'staging', 'drm-lease', 'drm-lease-v1.xml')
 shortcuts_inhibit_xml = join_paths(protodir, 'unstable', 'keyboard-shortcuts-inhibit', 'keyboard-shortcuts-inhibit-unstable-v1.xml')
 xwayland_shell_xml = join_paths(protodir, 'staging', 'xwayland-shell', 'xwayland-shell-v1.xml')
+tearing_xml = join_paths(protodir, 'staging', 'tearing-control', 'tearing-control-v1.xml')
 
 client_header = generator(scanner,
     output : '@BASENAME at -client-protocol.h',
@@ -76,6 +77,7 @@ srcs += client_header.process(xdg_shell_xml)
 srcs += client_header.process(drm_lease_xml)
 srcs += client_header.process(shortcuts_inhibit_xml)
 srcs += client_header.process(xwayland_shell_xml)
+srcs += client_header.process(tearing_xml)
 srcs += code.process(relative_xml)
 srcs += code.process(pointer_xml)
 srcs += code.process(gestures_xml)
@@ -88,6 +90,7 @@ srcs += code.process(xdg_shell_xml)
 srcs += code.process(drm_lease_xml)
 srcs += code.process(shortcuts_inhibit_xml)
 srcs += code.process(xwayland_shell_xml)
+srcs += code.process(tearing_xml)
 
 xwayland_glamor = []
 eglstream_srcs = []
diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 66d8b4200..42fd0067a 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -34,8 +34,9 @@
 #include "xwayland-pixmap.h"
 #include "glamor.h"
 
+#include "tearing-control-v1-client-protocol.h"
 
-#define XWL_PRESENT_CAPS PresentCapabilityAsync
+#define XWL_PRESENT_CAPS PresentCapabilityAsync | PresentCapabilityAsyncMayTear
 
 
 /*
@@ -794,6 +795,16 @@ xwl_present_flip(present_vblank_ptr vblank, RegionPtr damage)
                        damage_box->x2 - damage_box->x1,
                        damage_box->y2 - damage_box->y1);
 
+    if (xwl_window->tearing_control) {
+        uint32_t hint;
+        if (event->async_may_tear)
+            hint = WP_TEARING_CONTROL_V1_PRESENTATION_HINT_ASYNC;
+        else
+            hint = WP_TEARING_CONTROL_V1_PRESENTATION_HINT_VSYNC;
+
+        wp_tearing_control_v1_set_presentation_hint(xwl_window->tearing_control, hint);
+    }
+
     wl_surface_commit(xwl_window->surface);
 
     if (!vblank->sync_flip) {
@@ -997,11 +1008,15 @@ xwl_present_pixmap(WindowPtr window,
     }
 
     vblank->event_id = ++xwl_present_event_id;
+    event->async_may_tear = options & PresentOptionAsyncMayTear;
 
-    /* Xwayland presentations always complete (at least) one frame after they
+    /* Synchronous Xwayland presentations always complete (at least) one frame after they
      * are executed
      */
-    vblank->exec_msc = vblank->target_msc - 1;
+    if (event->async_may_tear)
+        vblank->exec_msc = vblank->target_msc;
+    else
+        vblank->exec_msc = vblank->target_msc - 1;
 
     vblank->queued = TRUE;
     if (crtc_msc < vblank->exec_msc) {
diff --git a/hw/xwayland/xwayland-present.h b/hw/xwayland/xwayland-present.h
index 806272089..4fd1e579f 100644
--- a/hw/xwayland/xwayland-present.h
+++ b/hw/xwayland/xwayland-present.h
@@ -59,6 +59,7 @@ struct xwl_present_event {
     present_vblank_rec vblank;
 
     PixmapPtr pixmap;
+    Bool async_may_tear;
 };
 
 Bool xwl_present_entered_for_each_frame_callback(void);
diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c
index ac7238b96..41e7393eb 100644
--- a/hw/xwayland/xwayland-screen.c
+++ b/hw/xwayland/xwayland-screen.c
@@ -60,6 +60,7 @@
 #include "viewporter-client-protocol.h"
 #include "xdg-shell-client-protocol.h"
 #include "xwayland-shell-v1-client-protocol.h"
+#include "tearing-control-v1-client-protocol.h"
 
 static DevPrivateKeyRec xwl_screen_private_key;
 static DevPrivateKeyRec xwl_client_private_key;
@@ -458,6 +459,10 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id,
         xwl_screen->xwayland_shell =
             wl_registry_bind(registry, id, &xwayland_shell_v1_interface, 1);
     }
+    else if (strcmp(interface, "wp_tearing_control_manager_v1") == 0) {
+        xwl_screen->tearing_control_manager =
+            wl_registry_bind(registry, id, &wp_tearing_control_manager_v1_interface, 1);
+    }
 #ifdef XWL_HAS_GLAMOR
     else if (xwl_screen->glamor) {
         xwl_glamor_init_wl_registry(xwl_screen, registry, id, interface,
diff --git a/hw/xwayland/xwayland-screen.h b/hw/xwayland/xwayland-screen.h
index fadd0526e..da97d7f1d 100644
--- a/hw/xwayland/xwayland-screen.h
+++ b/hw/xwayland/xwayland-screen.h
@@ -107,6 +107,7 @@ struct xwl_screen {
     struct zxdg_output_manager_v1 *xdg_output_manager;
     struct wp_viewporter *viewporter;
     struct xwayland_shell_v1 *xwayland_shell;
+    struct wp_tearing_control_manager_v1 *tearing_control_manager;
     struct xorg_list drm_lease_devices;
     struct xorg_list queued_drm_lease_devices;
     struct xorg_list drm_leases;
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index 67485d1d3..ecf18761d 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -46,6 +46,7 @@
 #include "xwayland-shm.h"
 
 #include "linux-dmabuf-unstable-v1-client-protocol.h"
+#include "tearing-control-v1-client-protocol.h"
 #include "viewporter-client-protocol.h"
 #include "xdg-shell-client-protocol.h"
 #include "xwayland-shell-v1-client-protocol.h"
@@ -896,6 +897,11 @@ ensure_surface_for_window(WindowPtr window)
         xwl_window_check_resolution_change_emulation(xwl_window);
     }
 
+    if (xwl_screen->tearing_control_manager) {
+        xwl_window->tearing_control = wp_tearing_control_manager_v1_get_tearing_control(
+            xwl_screen->tearing_control_manager, xwl_window->surface);
+    }
+
     return TRUE;
 
 err:
@@ -1106,6 +1112,9 @@ xwl_unrealize_window(WindowPtr window)
         xwl_present_for_each_frame_callback(xwl_window, xwl_present_unrealize_window);
 #endif
 
+    if (xwl_window->tearing_control)
+        wp_tearing_control_v1_destroy(xwl_window->tearing_control);
+
     release_wl_surface_for_window(xwl_window);
     xorg_list_del(&xwl_window->link_damage);
     xorg_list_del(&xwl_window->link_window);
diff --git a/hw/xwayland/xwayland-window.h b/hw/xwayland/xwayland-window.h
index 92c700e41..45ae16da0 100644
--- a/hw/xwayland/xwayland-window.h
+++ b/hw/xwayland/xwayland-window.h
@@ -121,6 +121,7 @@ struct xwl_window {
     struct xwl_dmabuf_feedback feedback;
     /* If TRUE, the window buffer format supports scanout with implicit modifier */
     Bool has_implicit_scanout_support;
+    struct wp_tearing_control_v1 *tearing_control;
 };
 
 struct xwl_window *xwl_window_get(WindowPtr window);
commit 2adc5c45c1126fc26fb757ddf5b9df5fd0d907eb
Author: Xaver Hugl <xaver.hugl at gmail.com>
Date:   Mon Oct 17 16:31:05 2022 +0200

    present: add support for PresentOptionAsyncMayTear
    
    Signed-off-by: Xaver Hugl <xaver.hugl at gmail.com>
    Acked-by: Michel Dänzer <mdaenzer at redhat.com>
    Reviewed-by: Olivier Fourdan <ofourdan at redhat.com>

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 701963d00..974346aee 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -19,7 +19,7 @@ variables:
     FDO_UPSTREAM_REPO: xorg/xserver
     FDO_DISTRIBUTION_VERSION: bullseye-slim
     FDO_DISTRIBUTION_EXEC: 'env FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} bash .gitlab-ci/debian-install.sh'
-    FDO_DISTRIBUTION_TAG: "2023-06-13-new-xorg-proto"
+    FDO_DISTRIBUTION_TAG: "2023-06-18-xorgproto-2023.2"
 
 include:
   - project: 'freedesktop/ci-templates'
diff --git a/meson.build b/meson.build
index ee308cdcc..ca0ad94ef 100644
--- a/meson.build
+++ b/meson.build
@@ -79,6 +79,7 @@ fixesproto_dep = dependency('fixesproto', version: '>= 6.0', fallback: ['xorgpro
 damageproto_dep = dependency('damageproto', version: '>= 1.1', fallback: ['xorgproto', 'ext_xorgproto'])
 xcmiscproto_dep = dependency('xcmiscproto', version: '>= 1.2.0', fallback: ['xorgproto', 'ext_xorgproto'])
 bigreqsproto_dep = dependency('bigreqsproto', version: '>= 1.1.0', fallback: ['xorgproto', 'ext_xorgproto'])
+presentproto_dep = dependency('presentproto', version: '>= 1.3', fallback: ['xorgproto', 'ext_xorgproto'])
 xtrans_dep = dependency('xtrans', version: '>= 1.3.5')
 
 videoproto_dep = dependency('videoproto', fallback: ['xorgproto', 'ext_xorgproto'])
@@ -602,6 +603,7 @@ common_dep = [
     damageproto_dep,
     xcmiscproto_dep,
     bigreqsproto_dep,
+    presentproto_dep,
     xtrans_dep,
     libsystemd_daemon_dep,
 
diff --git a/present/present.c b/present/present.c
index 271fe32bc..211868341 100644
--- a/present/present.c
+++ b/present/present.c
@@ -157,7 +157,7 @@ present_get_target_msc(uint64_t target_msc_arg,
                        uint64_t remainder,
                        uint32_t options)
 {
-    const Bool  synced_flip = !(options & PresentOptionAsync);
+    const Bool  synced_flip = !(options & PresentAllAsyncOptions);
     uint64_t    target_msc;
 
     /* If the specified target-msc lies in the future, then this
diff --git a/present/present_vblank.c b/present/present_vblank.c
index a9f17d4b2..4f94f16e4 100644
--- a/present/present_vblank.c
+++ b/present/present_vblank.c
@@ -115,7 +115,7 @@ present_vblank_init(present_vblank_ptr vblank,
         {
             vblank->flip = TRUE;
             vblank->sync_flip = TRUE;
-        } else if ((capabilities & PresentCapabilityAsync) &&
+        } else if ((capabilities & PresentAllAsyncCapabilities) &&
             screen_priv->check_flip (target_crtc, window, pixmap, FALSE, valid, x_off, y_off, &reason))
         {
             vblank->flip = TRUE;
commit c6bf0e3950592b4b7c0ed53f5bd48ffa0fc54dff
Author: Xaver Hugl <xaver.hugl at gmail.com>
Date:   Mon Nov 28 13:19:11 2022 +0100

    Update CI to xorgproto 2023.2
    
    This is needed to support tearing-updates-v1
    
    Signed-off-by: Xaver Hugl <xaver.hugl at gmail.com>
    Reviewed-by: Olivier Fourdan <ofourdan at redhat.com>

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 63431d146..701963d00 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -19,7 +19,7 @@ variables:
     FDO_UPSTREAM_REPO: xorg/xserver
     FDO_DISTRIBUTION_VERSION: bullseye-slim
     FDO_DISTRIBUTION_EXEC: 'env FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} bash .gitlab-ci/debian-install.sh'
-    FDO_DISTRIBUTION_TAG: "2023-03-04-new-wayland-protocols"
+    FDO_DISTRIBUTION_TAG: "2023-06-13-new-xorg-proto"
 
 include:
   - project: 'freedesktop/ci-templates'
diff --git a/.gitlab-ci/cross-prereqs-build.sh b/.gitlab-ci/cross-prereqs-build.sh
index c3502e932..dabc041ed 100755
--- a/.gitlab-ci/cross-prereqs-build.sh
+++ b/.gitlab-ci/cross-prereqs-build.sh
@@ -49,7 +49,7 @@ build 'https://gitlab.freedesktop.org/pixman/pixman.git' 'pixman-0.38.4'
 build 'https://gitlab.freedesktop.org/xorg/lib/pthread-stubs.git' '0.4'
 # we can't use the xorgproto pkgconfig files from /usr/share/pkgconfig, because
 # these would add -I/usr/include to CFLAGS, which breaks cross-compilation
-build 'https://gitlab.freedesktop.org/xorg/proto/xorgproto.git' 'xorgproto-2021.4.99.2' '--datadir=/lib'
+build 'https://gitlab.freedesktop.org/xorg/proto/xorgproto.git' 'xorgproto-2023.2' '--datadir=/lib'
 build 'https://gitlab.freedesktop.org/xorg/lib/libXau.git' 'libXau-1.0.9'
 build 'https://gitlab.freedesktop.org/xorg/proto/xcbproto.git' 'xcb-proto-1.14.1'
 build 'https://gitlab.freedesktop.org/xorg/lib/libxcb.git' 'libxcb-1.14'
diff --git a/.gitlab-ci/debian-install.sh b/.gitlab-ci/debian-install.sh
index e1addb208..b9a35e66e 100644
--- a/.gitlab-ci/debian-install.sh
+++ b/.gitlab-ci/debian-install.sh
@@ -129,8 +129,8 @@ ninja -C _build -j${FDO_CI_CONCURRENT:-4} install
 cd ..
 rm -rf libxcvt
 
-# xserver requires xorgproto >= 2022.2 for XWAYLAND
-git clone https://gitlab.freedesktop.org/xorg/proto/xorgproto.git --depth 1 --branch=xorgproto-2022.2
+# xserver requires xorgproto >= 2023.2 for XWAYLAND
+git clone https://gitlab.freedesktop.org/xorg/proto/xorgproto.git --depth 1 --branch=xorgproto-2023.2
 pushd xorgproto
 ./autogen.sh
 make -j${FDO_CI_CONCURRENT:-4} install
commit 0cfe09c458e1217f2126b6ae819b05aa01522bbd
Author: Xaver Hugl <xaver.hugl at gmail.com>
Date:   Fri Nov 25 21:19:44 2022 +0100

    require wayland-protocols 1.30
    
    This is needed for tearing-updates-v1
    
    Signed-off-by: Xaver Hugl <xaver.hugl at gmail.com>
    Acked-by: Michel Dänzer <mdaenzer at redhat.com>
    Reviewed-by: Olivier Fourdan <ofourdan at redhat.com>

diff --git a/meson.build b/meson.build
index 9657fe8e4..ee308cdcc 100644
--- a/meson.build
+++ b/meson.build
@@ -64,7 +64,7 @@ libdrm_req = '>= 2.4.109'
 libselinux_req = '>= 2.0.86'
 xext_req = '>= 1.0.99.4'
 wayland_req = '>= 1.21.0'
-wayland_protocols_req = '>= 1.28'
+wayland_protocols_req = '>= 1.30'
 gbm_req = '>= 10.2'
 xf86dgaproto_req = '>= 2.0.99.1'
 
commit e3480b0d78d05ab3b05541936314f1c34233c9b6
Author: Xaver Hugl <xaver.hugl at gmail.com>
Date:   Fri Nov 25 21:18:27 2022 +0100

    Update the CI to provide wayland-protocols 1.30
    
    This is needed for tearing-updates-v1
    
    Signed-off-by: Xaver Hugl <xaver.hugl at gmail.com>
    Acked-by: Michel Dänzer <mdaenzer at redhat.com>
    Reviewed-by: Olivier Fourdan <ofourdan at redhat.com>

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a61bf4def..63431d146 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -19,7 +19,7 @@ variables:
     FDO_UPSTREAM_REPO: xorg/xserver
     FDO_DISTRIBUTION_VERSION: bullseye-slim
     FDO_DISTRIBUTION_EXEC: 'env FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} bash .gitlab-ci/debian-install.sh'
-    FDO_DISTRIBUTION_TAG: "2023-01-25-libdrm-update"
+    FDO_DISTRIBUTION_TAG: "2023-03-04-new-wayland-protocols"
 
 include:
   - project: 'freedesktop/ci-templates'
diff --git a/.gitlab-ci/debian-install.sh b/.gitlab-ci/debian-install.sh
index 62c292be5..e1addb208 100644
--- a/.gitlab-ci/debian-install.sh
+++ b/.gitlab-ci/debian-install.sh
@@ -145,8 +145,8 @@ ninja -C _build -j${FDO_CI_CONCURRENT:-4} install
 cd ..
 rm -rf wayland
 
-# Xwayland requires wayland-protocols >= 1.28, but Debian bullseye has 1.20 only
-git clone https://gitlab.freedesktop.org/wayland/wayland-protocols.git --depth 1 --branch=1.28
+# Xwayland requires wayland-protocols >= 1.30, but Debian bullseye has 1.20 only
+git clone https://gitlab.freedesktop.org/wayland/wayland-protocols.git --depth 1 --branch=1.30
 cd wayland-protocols
 meson _build
 ninja -C _build -j${FDO_CI_CONCURRENT:-4} install


More information about the xorg-commit mailing list