summaryrefslogtreecommitdiff
path: root/xserver/randr
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2021-09-03 13:19:16 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2021-09-03 13:19:16 +0000
commit9b652580565e960bd497459fbf8f8baffb64d726 (patch)
treefc4b94130ced7fddea8a744ddaf4f5608885e256 /xserver/randr
parent595f95ad32a0d11859017ff1f97e17b5bf1ea25b (diff)
Update to xserver 1.20.13.
Diffstat (limited to 'xserver/randr')
-rw-r--r--xserver/randr/randr.c27
-rw-r--r--xserver/randr/randrstr.h7
-rw-r--r--xserver/randr/rrcrtc.c43
-rw-r--r--xserver/randr/rrprovider.c2
4 files changed, 77 insertions, 2 deletions
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
@@ -643,6 +645,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
*/
extern _X_EXPORT void
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 <X11/Xatom.h>
-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 <X11/Xatom.h>
-RESTYPE RRProviderType;
+RESTYPE RRProviderType = 0;
/*
* Initialize provider type error value