From ab86be0ed9233d6683daf00d359c562b12e137c8 Mon Sep 17 00:00:00 2001 From: Mario Kleiner Date: Fri, 27 Aug 2021 19:27:29 +0200 Subject: [PATCH] modesetting: Fix VRR window property handling. A misplaced error check can cause this failure scenario, and does so reliably as tested on Ubuntu 21.04 with KDE Plasma 5 desktop within the first few seconds of login session startup, rendering VRR under modesetting-ddx unusable: 1. Some X11 client application changes some window property. 2. ms_change_property() is called as part of the property change handling call chain (client->requestVector[X_ChangeProperty]). It removes itself temporarily from the call chain - or so it thinks, hooking up saved_change_property instead. 3. ret = saved_change_property(client) is called and fails temporarily for some non-critical reason. 4. The misplaced error check returns early (error abort), without first restoring ms_change_property() as initial X_ChangeProperty handler in the call chain again. -> Now ms_change_property() has removed itself permanently from the property handler call chain for the remainder of the X session and VRR property changes on windows are no longer handled, ie. VRR no longer gets enabled/disabled in response to window VRR property changes. Place the error check at the proper place, just as it is correctly done by amdgpu-ddx, and in modesetting-ddx ms_delete_property() function. Verified to fix VRR handling with an AMD gpu under KDE desktop session. Please consider merging before branching the server 1.21 branch. Signed-off-by: Mario Kleiner --- hw/xfree86/drivers/modesetting/driver.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c index 948fa649a..df1abea17 100644 --- a/hw/xfree86/drivers/modesetting/driver.c +++ b/hw/xfree86/drivers/modesetting/driver.c @@ -751,14 +751,15 @@ ms_change_property(ClientPtr client) client->requestVector[X_ChangeProperty] = saved_change_property; ret = saved_change_property(client); - if (ret != Success) - return ret; if (restore_property_vector) return ret; client->requestVector[X_ChangeProperty] = ms_change_property; + if (ret != Success) + return ret; + ret = dixLookupWindow(&window, stuff->window, client, DixSetPropAccess); if (ret != Success) return ret;