From 0904421f57a6e3c1889cda145ec318c7071a3ee0 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan <ofourdan@redhat.com> Date: Mon, 4 Apr 2022 14:22:20 +0200 Subject: [PATCH] randr: Add "RANDR Emulation" property When RANDR is emulated as with Xwayland, the actual output configuration does not change as RANDR is emulated using viewports. As a result, changes to the CRTC may be skipped, resulting in the configuration being (wrongly) assumed to be unchanged. Add a new output property "RANDR Emulation" that the DDX can set to force RRCrtcSet() to reconfigure the CRTC regardless of the change. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> --- randr/rrcrtc.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index cf66f8ef9b..cf149768fd 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -709,6 +709,25 @@ rrCheckPixmapBounding(ScreenPtr pScreen, return TRUE; } +#define XRANDR_EMULATION_PROP "RANDR Emulation" +static Bool +rrCheckEmulated(RROutputPtr output) +{ + const char *emulStr = XRANDR_EMULATION_PROP; + Atom emulProp; + RRPropertyValuePtr val; + + emulProp = MakeAtom(emulStr, strlen(emulStr), FALSE); + if (emulProp == None) + return FALSE; + + val = RRGetOutputProperty(output, emulProp, TRUE); + if (val && val->data) + return !!val->data; + + return FALSE; +} + /* * Request that the Crtc be reconfigured */ @@ -728,9 +747,11 @@ RRCrtcSet(RRCrtcPtr crtc, crtcChanged = FALSE; for (o = 0; o < numOutputs; o++) { - if (outputs[o] && outputs[o]->crtc != crtc) { - crtcChanged = TRUE; - break; + if (outputs[o]) { + if (rrCheckEmulated(outputs[o]) || (outputs[o]->crtc != crtc)) { + crtcChanged = TRUE; + break; + } } } -- GitLab