From 9b652580565e960bd497459fbf8f8baffb64d726 Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Fri, 3 Sep 2021 13:19:16 +0000 Subject: Update to xserver 1.20.13. --- xserver/randr/randr.c | 27 +++++++++++++++++++++++++++ xserver/randr/randrstr.h | 7 +++++++ xserver/randr/rrcrtc.c | 43 ++++++++++++++++++++++++++++++++++++++++++- xserver/randr/rrprovider.c | 2 +- 4 files changed, 77 insertions(+), 2 deletions(-) (limited to 'xserver/randr') diff --git a/xserver/randr/randr.c b/xserver/randr/randr.c index 5db8b5ced..afc867ea9 100644 --- a/xserver/randr/randr.c +++ b/xserver/randr/randr.c @@ -693,6 +693,33 @@ RRFirstOutput(ScreenPtr pScreen) return NULL; } +RRCrtcPtr +RRFirstEnabledCrtc(ScreenPtr pScreen) +{ + rrScrPriv(pScreen); + RROutputPtr output; + int i, j; + + if (!pScrPriv) + return NULL; + + if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc && + pScrPriv->primaryOutput->pScreen == pScreen) + return pScrPriv->primaryOutput->crtc; + + for (i = 0; i < pScrPriv->numCrtcs; i++) { + RRCrtcPtr crtc = pScrPriv->crtcs[i]; + + for (j = 0; j < pScrPriv->numOutputs; j++) { + output = pScrPriv->outputs[j]; + if (output->crtc == crtc && crtc->mode) + return crtc; + } + } + return NULL; +} + + CARD16 RRVerticalRefresh(xRRModeInfo * mode) { diff --git a/xserver/randr/randrstr.h b/xserver/randr/randrstr.h index 2cede92e3..28ba4ea91 100644 --- a/xserver/randr/randrstr.h +++ b/xserver/randr/randrstr.h @@ -593,6 +593,8 @@ extern _X_EXPORT Bool RRScreenInit(ScreenPtr pScreen); extern _X_EXPORT RROutputPtr RRFirstOutput(ScreenPtr pScreen); +extern _X_EXPORT RRCrtcPtr RRFirstEnabledCrtc(ScreenPtr pScreen); + extern _X_EXPORT Bool RROutputSetNonDesktop(RROutputPtr output, Bool non_desktop); extern _X_EXPORT CARD16 @@ -642,6 +644,11 @@ extern _X_EXPORT void */ extern _X_EXPORT RRCrtcPtr RRCrtcCreate(ScreenPtr pScreen, void *devPrivate); +/* + * Tests if findCrtc belongs to pScreen or slave screens + */ +extern _X_EXPORT Bool RRCrtcExists(ScreenPtr pScreen, RRCrtcPtr findCrtc); + /* * Set the allowed rotations on a CRTC */ diff --git a/xserver/randr/rrcrtc.c b/xserver/randr/rrcrtc.c index 7839a0eda..027a31a9e 100644 --- a/xserver/randr/rrcrtc.c +++ b/xserver/randr/rrcrtc.c @@ -27,7 +27,7 @@ #include -RESTYPE RRCrtcType; +RESTYPE RRCrtcType = 0; /* * Notify the CRTC of some change @@ -960,6 +960,47 @@ RRCrtcGammaGet(RRCrtcPtr crtc) return ret; } +static Bool RRCrtcInScreen(ScreenPtr pScreen, RRCrtcPtr findCrtc) +{ + rrScrPrivPtr pScrPriv; + int c; + + if (pScreen == NULL) + return FALSE; + + if (findCrtc == NULL) + return FALSE; + + if (!dixPrivateKeyRegistered(rrPrivKey)) + return FALSE; + + pScrPriv = rrGetScrPriv(pScreen); + for (c = 0; c < pScrPriv->numCrtcs; c++) { + if (pScrPriv->crtcs[c] == findCrtc) + return TRUE; + } + + return FALSE; +} + +Bool RRCrtcExists(ScreenPtr pScreen, RRCrtcPtr findCrtc) +{ + ScreenPtr slave= NULL; + + if (RRCrtcInScreen(pScreen, findCrtc)) + return TRUE; + + xorg_list_for_each_entry(slave, &pScreen->slave_list, slave_head) { + if (!slave->is_output_slave) + continue; + if (RRCrtcInScreen(slave, findCrtc)) + return TRUE; + } + + return FALSE; +} + + /* * Notify the extension that the Crtc gamma has been changed * The driver calls this whenever it has changed the gamma values diff --git a/xserver/randr/rrprovider.c b/xserver/randr/rrprovider.c index c430f7477..d90477235 100644 --- a/xserver/randr/rrprovider.c +++ b/xserver/randr/rrprovider.c @@ -27,7 +27,7 @@ #include -RESTYPE RRProviderType; +RESTYPE RRProviderType = 0; /* * Initialize provider type error value -- cgit v1.2.3