From 9fd68f1b0d21e657d8270cc2882429b6b3efefcf Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Thu, 30 Oct 2025 15:59:39 +0800 Subject: [PATCH 1/2] modesetting: fix PRESENT_FLIP_REASON_BUFFER_FORMAT gets overwritten When dmabuf_capable is enabled, ms_present_check_unflip may return with reason PRESENT_FLIP_REASON_BUFFER_FORMAT to be reported back to client by PresentCompleteModeSuboptimalCopy. We should not overwrite it by page flip reasons anyway when exit. This fix also avoid changing vblank->exec_msc in present_scmd_pixmap() which caused by page flip reasons to prevent a present to be executed immediatly. So that we can cancel pending vblanks when new vblanks with same msc arrive. This happens when application just starts. This problem can be observed at least using radeonsi OGL driver, start xserver with dmabuf_capable enabled, no window manager, glxgears will stuck for the first several seconds. If using a composite window manager like Mutter, we can't observe the glxgears stuck, but the prensent complete event still shows unexpected Copy mode instead of PresentCompleteModeSuboptimalCopy or Skip mode. glxgears window msc is 0 at the beginning, it will send present request with target msc = 1, 2, 3, ... N before server send back the complete event for target msc = 1. But server side window msc is way bigger than N, so it will think all these present requests are outdated and just show the Nth request at the next vblank. [1 .. N-1] requests should be skipped. But without this fix, all [1 .. N] presents will be executed with Copy mode which causes stuck. Fixes: a94dd9536 ("modesetting: add support for TearFree page flips") --- hw/xfree86/drivers/modesetting/present.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/drivers/modesetting/present.c b/hw/xfree86/drivers/modesetting/present.c index 421d70016..7b7490375 100644 --- a/hw/xfree86/drivers/modesetting/present.c +++ b/hw/xfree86/drivers/modesetting/present.c @@ -337,7 +337,7 @@ ms_present_check_flip(RRCrtcPtr crtc, no_flip: /* Export some info about TearFree if Present can't flip anyway */ - if (reason) { + if (reason && *reason == PRESENT_FLIP_REASON_UNKNOWN) { xf86CrtcPtr xf86_crtc = crtc->devPrivate; drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private; drmmode_tearfree_ptr trf = &drmmode_crtc->tearfree; From 9a1aa56cfb2d4080aef5ddedc997a0ca3c4aa97b Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Thu, 30 Oct 2025 16:40:50 +0800 Subject: [PATCH 2/2] glamor: enable dmabuf_capable by default for radeonsi This is needed by radeonsi to support multi plane modifier when using modesetting DDX. xserver reject any multi plane buffer (in DRI3PixmapFromBuffers) without the dmabuf_capable debug option. It's OK for single plane buffer as xserver will fallback to DRI3BufferFromPixmap path. amdgpu DDX does not expose DRI3PixmapFromBuffers, mesa just use the single plane path anyway, so amdgpu DDX does not have this problem. --- glamor/glamor_egl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 2fc63ba46..01a60211b 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -1220,6 +1220,8 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd) glamor_egl->dmabuf_capable = TRUE; else if (strstr((const char *)renderer, "zink")) glamor_egl->dmabuf_capable = TRUE; + else if (strstr((const char *)renderer, "radeonsi")) + glamor_egl->dmabuf_capable = TRUE; else glamor_egl->dmabuf_capable = FALSE; }