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.
This commit is contained in:
Eric Anholt 2009-01-30 19:06:17 -08:00
parent c1f2be1f3f
commit 317f2b4a9f
4 changed files with 16 additions and 12 deletions

View File

@ -469,7 +469,7 @@ RRTellChanged (ScreenPtr pScreen);
* Poll the driver for changed information * Poll the driver for changed information
*/ */
extern _X_EXPORT Bool extern _X_EXPORT Bool
RRGetInfo (ScreenPtr pScreen); RRGetInfo (ScreenPtr pScreen, Bool force_query);
extern _X_EXPORT Bool RRInit (void); extern _X_EXPORT Bool RRInit (void);

View File

@ -178,12 +178,20 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
* Poll the driver for changed information * Poll the driver for changed information
*/ */
Bool Bool
RRGetInfo (ScreenPtr pScreen) RRGetInfo (ScreenPtr pScreen, Bool force_query)
{ {
rrScrPriv (pScreen); rrScrPriv (pScreen);
Rotation rotations; Rotation rotations;
int i; 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++) for (i = 0; i < pScrPriv->numOutputs; i++)
pScrPriv->outputs[i]->changed = FALSE; pScrPriv->outputs[i]->changed = FALSE;
for (i = 0; i < pScrPriv->numCrtcs; i++) for (i = 0; i < pScrPriv->numCrtcs; i++)

View File

@ -224,7 +224,7 @@ ProcRRGetScreenSizeRange (ClientPtr client)
if (pScrPriv) if (pScrPriv)
{ {
if (!RRGetInfo (pScreen)) if (!RRGetInfo (pScreen, FALSE))
return BadAlloc; return BadAlloc;
rep.minWidth = pScrPriv->minWidth; rep.minWidth = pScrPriv->minWidth;
rep.minHeight = pScrPriv->minHeight; rep.minHeight = pScrPriv->minHeight;
@ -340,7 +340,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
rep.pad = 0; rep.pad = 0;
if (query && pScrPriv) if (query && pScrPriv)
if (!RRGetInfo (pScreen)) if (!RRGetInfo (pScreen, query))
return BadAlloc; return BadAlloc;
if (!pScrPriv) if (!pScrPriv)
@ -612,7 +612,7 @@ ProcRRGetScreenInfo (ClientPtr client)
rep.pad = 0; rep.pad = 0;
if (pScrPriv) if (pScrPriv)
if (!RRGetInfo (pScreen)) if (!RRGetInfo (pScreen, FALSE))
return BadAlloc; return BadAlloc;
output = RRFirstOutput (pScreen); output = RRFirstOutput (pScreen);
@ -793,7 +793,7 @@ ProcRRSetScreenConfig (ClientPtr client)
rep.status = RRSetConfigFailed; rep.status = RRSetConfigFailed;
goto sendReply; goto sendReply;
} }
if (!RRGetInfo (pScreen)) if (!RRGetInfo (pScreen, FALSE))
return BadAlloc; return BadAlloc;
output = RRFirstOutput (pScreen); output = RRFirstOutput (pScreen);

View File

@ -307,12 +307,8 @@ ProcRRXineramaQueryScreens(ClientPtr client)
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
if (RRXineramaScreenActive (pScreen)) if (RRXineramaScreenActive (pScreen))
{ RRGetInfo (pScreen, FALSE);
rrScrPriv(pScreen);
if (pScrPriv->numCrtcs == 0 || pScrPriv->numOutputs == 0)
RRGetInfo (pScreen);
}
rep.type = X_Reply; rep.type = X_Reply;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.number = RRXineramaScreenCount (pScreen); rep.number = RRXineramaScreenCount (pScreen);