summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-01-30 19:06:17 -0800
committerKeith Packard <keithp@keithp.com>2009-01-30 20:34:07 -0800
commit56f6fb8c8652c85e522e42557f8969987069076b (patch)
tree3b3650898393dd9def6e14621eb50b10fbd5a907
parent6d928aa227b12832dd358619722a5f4dc71b5d19 (diff)
randr: Avoid re-querying the configuration on everything but GetScreenResources.
The new path should only re-query on the other requests when we haven't gathered the information from the DDX yet (such as with a non-RandR 1.2 DDX). Bug #19037. (cherry picked from commit 317f2b4a9fe4b606975711bc332166a82db5087d)
-rw-r--r--randr/randrstr.h2
-rw-r--r--randr/rrinfo.c10
-rw-r--r--randr/rrscreen.c8
-rw-r--r--randr/rrxinerama.c8
4 files changed, 16 insertions, 12 deletions
diff --git a/randr/randrstr.h b/randr/randrstr.h
index b5cebdc7e..9c9b7c074 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -468,7 +468,7 @@ RRTellChanged (ScreenPtr pScreen);
* Poll the driver for changed information
*/
Bool
-RRGetInfo (ScreenPtr pScreen);
+RRGetInfo (ScreenPtr pScreen, Bool force_query);
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 95662c9a9..da633b237 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)
@@ -615,7 +615,7 @@ ProcRRGetScreenInfo (ClientPtr client)
rep.pad = 0;
if (pScrPriv)
- if (!RRGetInfo (pScreen))
+ if (!RRGetInfo (pScreen, FALSE))
return BadAlloc;
output = RRFirstOutput (pScreen);
@@ -796,7 +796,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 7f9a79827..36135c6c1 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);