From https://gitlab.xfce.org/xfce/xfwm4/-/merge_requests/142.patch
From 0954788f4608c8db9ab7f693325a3088c9ab9f60 Mon Sep 17 00:00:00 2001
From: Icenowy Zheng <uwu@icenowy.me>
Date: Wed, 27 Dec 2023 11:42:28 +0800
Subject: [PATCH] compositor: verify Present extension's capability before
 using

Current X servers expose Present extension regardless of the DDX
supporting it or not, because the Present extension defines a interface
to verify its capability, and the capability returned could be None.

Verify the capability being not None before using Present for vblank.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
---
 src/compositor.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/compositor.c b/src/compositor.c
index 49c27f730..beea3655c 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -4937,6 +4937,15 @@ compositorManageScreen (ScreenInfo *screen_info)
                                (screen_info->vblank_mode == VBLANK_AUTO ||
                                 screen_info->vblank_mode == VBLANK_XPRESENT);
     if (screen_info->use_present)
+    {
+        uint32_t capability;
+
+        capability = XPresentQueryCapabilities (display_info->dpy,
+                                                screen_info->output);
+        if (capability == PresentCapabilityNone)
+            screen_info->use_present = FALSE;
+    }
+    if (screen_info->use_present)
     {
         screen_info->use_n_buffers = N_BUFFERS;
         screen_info->present_pending = FALSE;
-- 
GitLab

