diff options
author | Keith Packard <keithp@keithp.com> | 2009-01-30 20:17:10 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-01-30 20:22:04 -0800 |
commit | 6d928aa227b12832dd358619722a5f4dc71b5d19 (patch) | |
tree | 47c6f5f72a605399c426a0ad00731ac4447fd314 | |
parent | 759ed0679a030f502b74a6ff44c15d1c97d9a937 (diff) |
RandR crtcs not fetched correctly when primary output is set.
Primary outputs may not have a CRTC.
Loops fetching CRTCs respecting primary output were broken.
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 4de5705545792d77c9990bbec3e263a517757a2a)
-rw-r--r-- | randr/randr.c | 2 | ||||
-rw-r--r-- | randr/rrscreen.c | 13 | ||||
-rw-r--r-- | randr/rrxinerama.c | 15 |
3 files changed, 19 insertions, 11 deletions
diff --git a/randr/randr.c b/randr/randr.c index 2e482f038..6fe9b56d8 100644 --- a/randr/randr.c +++ b/randr/randr.c @@ -438,7 +438,7 @@ RRFirstOutput (ScreenPtr pScreen) RROutputPtr output; int i, j; - if (pScrPriv->primaryOutput) + if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) return pScrPriv->primaryOutput; for (i = 0; i < pScrPriv->numCrtcs; i++) diff --git a/randr/rrscreen.c b/randr/rrscreen.c index 9b1024e11..95662c9a9 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -324,7 +324,7 @@ rrGetScreenResources(ClientPtr client, Bool query) rrScrPrivPtr pScrPriv; CARD8 *extra; unsigned long extraLen; - int i, n, rc, has_primary; + int i, n, rc, has_primary = 0; RRCrtc *crtcs; RROutput *outputs; xRRModeInfo *modeinfos; @@ -402,19 +402,22 @@ rrGetScreenResources(ClientPtr client, Bool query) modeinfos = (xRRModeInfo *) (outputs + pScrPriv->numOutputs); names = (CARD8 *) (modeinfos + num_modes); - has_primary = (pScrPriv->primaryOutput != NULL); - if (pScrPriv->primaryOutput) + if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) { - crtcs[0] = pScrPriv->primaryOutput->id; + has_primary = 1; + crtcs[0] = pScrPriv->primaryOutput->crtc->id; if (client->swapped) swapl (&crtcs[0], n); } for (i = 0; i < pScrPriv->numCrtcs; i++) { - if (pScrPriv->primaryOutput && + if (has_primary && pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i]) + { + has_primary = 0; continue; + } crtcs[i + has_primary] = pScrPriv->crtcs[i]->id; if (client->swapped) swapl (&crtcs[i + has_primary], n); diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c index 5af6fb03b..7f9a79827 100644 --- a/randr/rrxinerama.c +++ b/randr/rrxinerama.c @@ -328,16 +328,21 @@ ProcRRXineramaQueryScreens(ClientPtr client) if(rep.number) { rrScrPriv(pScreen); int i; - int has_primary = (pScrPriv->primaryOutput != NULL); + int has_primary = 0; - if (has_primary) { + if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) { + has_primary = 1; RRXineramaWriteCrtc(client, pScrPriv->primaryOutput->crtc); } for(i = 0; i < pScrPriv->numCrtcs; i++) { - RRCrtcPtr crtc = pScrPriv->crtcs[i]; - if (!has_primary || (crtc != pScrPriv->primaryOutput->crtc)) - RRXineramaWriteCrtc(client, crtc); + if (has_primary && + pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i]) + { + has_primary = 0; + continue; + } + RRXineramaWriteCrtc(client, pScrPriv->crtcs[i]); } } |