RandR: config time updates when hardware config changes.

The config time in the RandR protocol reflects when the hardware state has
changed. It was getting changed anytime the driver changed the usage
of the hardware as well.
(cherry picked from 98d18a6578130adb411ca4bcc776fcb7e07f189f commit)
This commit is contained in:
Keith Packard 2006-12-12 22:59:03 -08:00 committed by Dave Airlie
parent d742025f43
commit 628c7daeb1
5 changed files with 29 additions and 15 deletions

View File

@ -415,7 +415,11 @@ RRTellChanged (ScreenPtr pScreen)
if (pScrPriv->changed) if (pScrPriv->changed)
{ {
UpdateCurrentTime (); UpdateCurrentTime ();
pScrPriv->lastConfigTime = currentTime; if (pScrPriv->configChanged)
{
pScrPriv->lastConfigTime = currentTime;
pScrPriv->configChanged = FALSE;
}
pScrPriv->changed = FALSE; pScrPriv->changed = FALSE;
WalkTree (pScreen, TellChanged, (pointer) pScreen); WalkTree (pScreen, TellChanged, (pointer) pScreen);
for (i = 0; i < pScrPriv->numOutputs; i++) for (i = 0; i < pScrPriv->numOutputs; i++)

View File

@ -216,11 +216,14 @@ typedef struct _rrScrPriv {
TimeStamp lastSetTime; /* last changed by client */ TimeStamp lastSetTime; /* last changed by client */
TimeStamp lastConfigTime; /* possible configs changed */ TimeStamp lastConfigTime; /* possible configs changed */
RRCloseScreenProcPtr CloseScreen; RRCloseScreenProcPtr CloseScreen;
Bool changed; /* some config changed */ Bool changed; /* some config changed */
Bool configChanged; /* configuration changed */
Bool layoutChanged; /* screen layout changed */
CARD16 minWidth, minHeight; CARD16 minWidth, minHeight;
CARD16 maxWidth, maxHeight; CARD16 maxWidth, maxHeight;
CARD16 width, height; /* last known screen size */ CARD16 width, height; /* last known screen size */
Bool layoutChanged; /* screen layout changed */
int numOutputs; int numOutputs;
RROutputPtr *outputs; RROutputPtr *outputs;
@ -619,10 +622,13 @@ ProcRRDeleteOutputMode (ClientPtr client);
/* rroutput.c */ /* rroutput.c */
/* /*
* Notify the output of some change * Notify the output of some change. configChanged indicates whether
* any external configuration (mode list, clones, connected status)
* has changed, or whether the change was strictly internal
* (which crtc is in use)
*/ */
void void
RROutputChanged (RROutputPtr output); RROutputChanged (RROutputPtr output, Bool configChanged);
/* /*
* Create an output * Create an output

View File

@ -136,7 +136,7 @@ RRCrtcNotify (RRCrtcPtr crtc,
break; break;
if (j == crtc->numOutputs) if (j == crtc->numOutputs)
{ {
RROutputChanged (outputs[i]); RROutputChanged (outputs[i], FALSE);
RRCrtcChanged (crtc, FALSE); RRCrtcChanged (crtc, FALSE);
} }
} }
@ -151,7 +151,7 @@ RRCrtcNotify (RRCrtcPtr crtc,
break; break;
if (i == numOutputs) if (i == numOutputs)
{ {
RROutputChanged (crtc->outputs[j]); RROutputChanged (crtc->outputs[j], FALSE);
RRCrtcChanged (crtc, FALSE); RRCrtcChanged (crtc, FALSE);
} }
} }

View File

@ -69,6 +69,7 @@ RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
output->modes = modes; output->modes = modes;
output->changed = TRUE; output->changed = TRUE;
pScrPriv->changed = TRUE; pScrPriv->changed = TRUE;
pScrPriv->configChanged = TRUE;
return mode; return mode;
} }
@ -205,6 +206,7 @@ RRGetInfo (ScreenPtr pScreen)
rotations = 0; rotations = 0;
pScrPriv->changed = FALSE; pScrPriv->changed = FALSE;
pScrPriv->configChanged = FALSE;
if (!(*pScrPriv->rrGetInfo) (pScreen, &rotations)) if (!(*pScrPriv->rrGetInfo) (pScreen, &rotations))
return FALSE; return FALSE;

View File

@ -28,7 +28,7 @@ RESTYPE RROutputType;
* Notify the output of some change * Notify the output of some change
*/ */
void void
RROutputChanged (RROutputPtr output) RROutputChanged (RROutputPtr output, Bool configChanged)
{ {
ScreenPtr pScreen = output->pScreen; ScreenPtr pScreen = output->pScreen;
@ -37,6 +37,8 @@ RROutputChanged (RROutputPtr output)
{ {
rrScrPriv (pScreen); rrScrPriv (pScreen);
pScrPriv->changed = TRUE; pScrPriv->changed = TRUE;
if (configChanged)
pScrPriv->configChanged = TRUE;
} }
} }
@ -106,7 +108,7 @@ RROutputAttachScreen (RROutputPtr output, ScreenPtr pScreen)
output->pScreen = pScreen; output->pScreen = pScreen;
pScrPriv->outputs = outputs; pScrPriv->outputs = outputs;
pScrPriv->outputs[pScrPriv->numOutputs++] = output; pScrPriv->outputs[pScrPriv->numOutputs++] = output;
RROutputChanged (output); RROutputChanged (output, FALSE);
return TRUE; return TRUE;
} }
@ -142,7 +144,7 @@ RROutputSetClones (RROutputPtr output,
memcpy (newClones, clones, numClones * sizeof (RROutputPtr)); memcpy (newClones, clones, numClones * sizeof (RROutputPtr));
output->clones = newClones; output->clones = newClones;
output->numClones = numClones; output->numClones = numClones;
RROutputChanged (output); RROutputChanged (output, TRUE);
return TRUE; return TRUE;
} }
@ -186,7 +188,7 @@ RROutputSetModes (RROutputPtr output,
output->modes = newModes; output->modes = newModes;
output->numModes = numModes; output->numModes = numModes;
output->numPreferred = numPreferred; output->numPreferred = numPreferred;
RROutputChanged (output); RROutputChanged (output, TRUE);
return TRUE; return TRUE;
} }
@ -219,7 +221,7 @@ RROutputSetCrtcs (RROutputPtr output,
memcpy (newCrtcs, crtcs, numCrtcs * sizeof (RRCrtcPtr)); memcpy (newCrtcs, crtcs, numCrtcs * sizeof (RRCrtcPtr));
output->crtcs = newCrtcs; output->crtcs = newCrtcs;
output->numCrtcs = numCrtcs; output->numCrtcs = numCrtcs;
RROutputChanged (output); RROutputChanged (output, TRUE);
return TRUE; return TRUE;
} }
@ -229,7 +231,7 @@ RROutputSetCrtc (RROutputPtr output, RRCrtcPtr crtc)
if (output->crtc == crtc) if (output->crtc == crtc)
return; return;
output->crtc = crtc; output->crtc = crtc;
RROutputChanged (output); RROutputChanged (output, FALSE);
} }
Bool Bool
@ -239,7 +241,7 @@ RROutputSetConnection (RROutputPtr output,
if (output->connection == connection) if (output->connection == connection)
return TRUE; return TRUE;
output->connection = connection; output->connection = connection;
RROutputChanged (output); RROutputChanged (output, TRUE);
return TRUE; return TRUE;
} }
@ -251,7 +253,7 @@ RROutputSetSubpixelOrder (RROutputPtr output,
return TRUE; return TRUE;
output->subpixelOrder = subpixelOrder; output->subpixelOrder = subpixelOrder;
RROutputChanged (output); RROutputChanged (output, FALSE);
return TRUE; return TRUE;
} }
@ -264,7 +266,7 @@ RROutputSetPhysicalSize (RROutputPtr output,
return TRUE; return TRUE;
output->mmWidth = mmWidth; output->mmWidth = mmWidth;
output->mmHeight = mmHeight; output->mmHeight = mmHeight;
RROutputChanged (output); RROutputChanged (output, FALSE);
return TRUE; return TRUE;
} }