summaryrefslogtreecommitdiff
path: root/randr
diff options
context:
space:
mode:
authorŁukasz Spintzyk <lukasz.spintzyk@synaptics.com>2021-07-19 14:25:28 +0200
committerŁukasz Spintzyk <lukasz.spintzyk@synaptics.com>2021-07-20 08:10:46 +0200
commitd6c02ffd9c910637f6b3b7249507998e9e45f93c (patch)
treee5c71c80f92cedaba9ab45ff40aabf57ad96da18 /randr
parentf6f2f203bcde47c334836191982d77bbbbbf533c (diff)
present: fallback get_crtc to return crtc belonging to screen with present extension
Since crtc can belong to secondary output that may not have present extension enabled we should fallback to first enabled crtc or fake crtc. Fix for issue xorg/xserver#1195
Diffstat (limited to 'randr')
-rw-r--r--randr/randr.c27
-rw-r--r--randr/randrstr.h2
2 files changed, 29 insertions, 0 deletions
diff --git a/randr/randr.c b/randr/randr.c
index 3f94c2f6c..6d02c2577 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -697,6 +697,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/randr/randrstr.h b/randr/randrstr.h
index 8f427a48e..b23390575 100644
--- a/randr/randrstr.h
+++ b/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