diff --git a/randr/randrstr.h b/randr/randrstr.h index 93960e57e..5e70aa3bf 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -469,7 +469,7 @@ RRTellChanged (ScreenPtr pScreen); * Poll the driver for changed information */ extern _X_EXPORT Bool -RRGetInfo (ScreenPtr pScreen); +RRGetInfo (ScreenPtr pScreen, Bool force_query); extern _X_EXPORT Bool RRInit (void); diff --git a/randr/rrinfo.c b/randr/rrinfo.c index 38314defd..12b9a4aab 100644 --- a/randr/rrinfo.c +++ b/randr/rrinfo.c @@ -178,12 +178,20 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations) * Poll the driver for changed information */ Bool -RRGetInfo (ScreenPtr pScreen) +RRGetInfo (ScreenPtr pScreen, Bool force_query) { rrScrPriv (pScreen); Rotation rotations; int i; + /* Return immediately if we don't need to re-query and we already have the + * information. + */ + if (!force_query) { + if (pScrPriv->numCrtcs != 0 || pScrPriv->numOutputs != 0) + return TRUE; + } + for (i = 0; i < pScrPriv->numOutputs; i++) pScrPriv->outputs[i]->changed = FALSE; for (i = 0; i < pScrPriv->numCrtcs; i++) diff --git a/randr/rrscreen.c b/randr/rrscreen.c index 85a30a4f5..3456c72a4 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -224,7 +224,7 @@ ProcRRGetScreenSizeRange (ClientPtr client) if (pScrPriv) { - if (!RRGetInfo (pScreen)) + if (!RRGetInfo (pScreen, FALSE)) return BadAlloc; rep.minWidth = pScrPriv->minWidth; rep.minHeight = pScrPriv->minHeight; @@ -340,7 +340,7 @@ rrGetScreenResources(ClientPtr client, Bool query) rep.pad = 0; if (query && pScrPriv) - if (!RRGetInfo (pScreen)) + if (!RRGetInfo (pScreen, query)) return BadAlloc; if (!pScrPriv) @@ -612,7 +612,7 @@ ProcRRGetScreenInfo (ClientPtr client) rep.pad = 0; if (pScrPriv) - if (!RRGetInfo (pScreen)) + if (!RRGetInfo (pScreen, FALSE)) return BadAlloc; output = RRFirstOutput (pScreen); @@ -793,7 +793,7 @@ ProcRRSetScreenConfig (ClientPtr client) rep.status = RRSetConfigFailed; goto sendReply; } - if (!RRGetInfo (pScreen)) + if (!RRGetInfo (pScreen, FALSE)) return BadAlloc; output = RRFirstOutput (pScreen); diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c index 5af6fb03b..0a14b7960 100644 --- a/randr/rrxinerama.c +++ b/randr/rrxinerama.c @@ -307,12 +307,8 @@ ProcRRXineramaQueryScreens(ClientPtr client) REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); if (RRXineramaScreenActive (pScreen)) - { - rrScrPriv(pScreen); - if (pScrPriv->numCrtcs == 0 || pScrPriv->numOutputs == 0) - RRGetInfo (pScreen); - } - + RRGetInfo (pScreen, FALSE); + rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.number = RRXineramaScreenCount (pScreen);