Comment 20 for bug 1759950

Revision history for this message
TJ (tj) wrote :

Added:

Description: Loop delay on CRTc config failure

--- xfce4-settings-4.13.4.orig/xfsettingsd/displays.c
+++ xfce4-settings-4.13.4/xfsettingsd/displays.c
@@ -1256,10 +1256,17 @@ xfce_displays_helper_apply_crtc (XfceRRC
             ret = xfce_displays_helper_disable_crtc (helper, crtc->id);
         } else {
             xfce_displays_helper_apply_crtc_transform (crtc, helper);
-
- ret = XRRSetCrtcConfig (helper->xdisplay, helper->resources, crtc->id,
+ gint l = 5;
+ while (l--) {
+ ret = XRRSetCrtcConfig (helper->xdisplay, helper->resources, crtc->id,
                                     CurrentTime, crtc->x, crtc->y, crtc->mode,
                                     crtc->rotation, crtc->outputs, crtc->noutput);
+ if (ret != RRSetConfigSuccess) {
+ g_warning("XRRSetCrtcConfig()=%d, sleeping", ret);
+ g_usleep(1000);
+ } else
+ break;
+ }
         }

From a fresh boot and then in TTY console:

DISPLAY=:0 XFSETTINGSD_DEBUG=1 xfsettingsd --replace --no-daemon

Lid-close->suspend, Lid-open, tap key->resume, GUI password

On first cycle GUI comes back correctly. On Second cycle it doesn't, and I see:

xfce4-settings(displays): Configuring CRTC 79.
xfce4-settings(displays): Applying changes to CRTC 79.
xfce4-settings(displays): Applying CRTC 79 Transform: x=0.000000 y=0.000000, filter=bilinear.

(xfsettingsd:2485): xfsettingsd-WARNING **: 17:56:50.285: XRRSetCrtcConfig()=3, sleeping

(xfsettingsd:2485): xfsettingsd-WARNING **: 17:56:50.286: XRRSetCrtcConfig()=3, sleeping

(xfsettingsd:2485): xfsettingsd-WARNING **: 17:56:50.288: XRRSetCrtcConfig()=3, sleeping

(xfsettingsd:2485): xfsettingsd-WARNING **: 17:56:50.290: XRRSetCrtcConfig()=3, sleeping

(xfsettingsd:2485): xfsettingsd-WARNING **: 17:56:50.292: XRRSetCrtcConfig()=3, sleeping

(xfsettingsd:2485): xfsettingsd-WARNING **: 17:56:50.293: Failed to configure CRTC 79 XRRSetCrtcConfig()=3.
xfce4-settings(displays): Configuring CRTC 80.

(xfsettingsd:2485): xfsettingsd-CRITICAL **: 17:56:50.294: Failed to apply display settings

So even with a 1000 u-second delay and retry, repeated 5 times, the issue remains. This looks like a problem with the underlying libraries.

The return value of 3 is RRSetConfigFailed from libxrandr::src/XrrCrtc.c::XRRSetCrtcConfig()

Tracking it back further looks to be extremely difficult.

I'm attaching the complete xfsettingd log for these successful + failed cycles in case someone with more insight than me can spot more clues.