diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index d2fa4e0bb2b7ad4b468c317d573768f8f02a038e..3ad8adc8bdd23ec4d854754773a0bcd17056d71f 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -720,6 +720,27 @@ static const struct zxdg_output_v1_listener xdg_output_listener = { xdg_output_handle_description, }; +#define XRANDR_EMULATION_PROP "RANDR Emulation" +static Atom +get_rand_emulation_property(void) +{ + const char *emulStr = XRANDR_EMULATION_PROP; + + return MakeAtom(emulStr, strlen(emulStr), TRUE); +} + +static void +xwl_output_set_emulated(struct xwl_output *xwl_output) +{ + int32_t val = TRUE; + + RRChangeOutputProperty(xwl_output->randr_output, + get_rand_emulation_property(), + XA_INTEGER, + 32, PropModeReplace, 1, + &val, FALSE, FALSE); +} + struct xwl_output * xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id) { @@ -758,6 +779,7 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id) ErrorF("Failed creating RandR Output\n"); goto err; } + xwl_output_set_emulated(xwl_output); RRCrtcGammaSetSize(xwl_output->randr_crtc, 256); RROutputSetCrtcs(xwl_output->randr_output, &xwl_output->randr_crtc, 1); @@ -896,6 +918,10 @@ xwl_randr_output_set_property(ScreenPtr pScreen, Atom property, RRPropertyValuePtr value) { + /* RANDR Emulation property is read-only. */ + if (get_rand_emulation_property() == property) + return FALSE; + return TRUE; } diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index cf66f8ef9b6762fc20d198962a99a8a4aefb4412..cf149768fd3d8474e144f339c656a9d2bcfaad1f 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; + } } }