Skip to content

Commit

Permalink
RandR: config time updates when hardware config changes.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Keith Packard committed Dec 13, 2006
1 parent 78689d0 commit 98d18a6
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 15 deletions.
6 changes: 5 additions & 1 deletion randr/randr.c
Expand Up @@ -415,7 +415,11 @@ RRTellChanged (ScreenPtr pScreen)
if (pScrPriv->changed)
{
UpdateCurrentTime ();
pScrPriv->lastConfigTime = currentTime;
if (pScrPriv->configChanged)
{
pScrPriv->lastConfigTime = currentTime;
pScrPriv->configChanged = FALSE;
}
pScrPriv->changed = FALSE;
WalkTree (pScreen, TellChanged, (pointer) pScreen);
for (i = 0; i < pScrPriv->numOutputs; i++)
Expand Down
12 changes: 9 additions & 3 deletions randr/randrstr.h
Expand Up @@ -216,11 +216,14 @@ typedef struct _rrScrPriv {
TimeStamp lastSetTime; /* last changed by client */
TimeStamp lastConfigTime; /* possible configs changed */
RRCloseScreenProcPtr CloseScreen;

Bool changed; /* some config changed */
Bool configChanged; /* configuration changed */
Bool layoutChanged; /* screen layout changed */

CARD16 minWidth, minHeight;
CARD16 maxWidth, maxHeight;
CARD16 width, height; /* last known screen size */
Bool layoutChanged; /* screen layout changed */

int numOutputs;
RROutputPtr *outputs;
Expand Down Expand Up @@ -619,10 +622,13 @@ ProcRRDeleteOutputMode (ClientPtr client);
/* 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
RROutputChanged (RROutputPtr output);
RROutputChanged (RROutputPtr output, Bool configChanged);

/*
* Create an output
Expand Down
4 changes: 2 additions & 2 deletions randr/rrcrtc.c
Expand Up @@ -136,7 +136,7 @@ RRCrtcNotify (RRCrtcPtr crtc,
break;
if (j == crtc->numOutputs)
{
RROutputChanged (outputs[i]);
RROutputChanged (outputs[i], FALSE);
RRCrtcChanged (crtc, FALSE);
}
}
Expand All @@ -151,7 +151,7 @@ RRCrtcNotify (RRCrtcPtr crtc,
break;
if (i == numOutputs)
{
RROutputChanged (crtc->outputs[j]);
RROutputChanged (crtc->outputs[j], FALSE);
RRCrtcChanged (crtc, FALSE);
}
}
Expand Down
2 changes: 2 additions & 0 deletions randr/rrinfo.c
Expand Up @@ -69,6 +69,7 @@ RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
output->modes = modes;
output->changed = TRUE;
pScrPriv->changed = TRUE;
pScrPriv->configChanged = TRUE;
return mode;
}

Expand Down Expand Up @@ -205,6 +206,7 @@ RRGetInfo (ScreenPtr pScreen)

rotations = 0;
pScrPriv->changed = FALSE;
pScrPriv->configChanged = FALSE;

if (!(*pScrPriv->rrGetInfo) (pScreen, &rotations))
return FALSE;
Expand Down
20 changes: 11 additions & 9 deletions randr/rroutput.c
Expand Up @@ -28,7 +28,7 @@ RESTYPE RROutputType;
* Notify the output of some change
*/
void
RROutputChanged (RROutputPtr output)
RROutputChanged (RROutputPtr output, Bool configChanged)
{
ScreenPtr pScreen = output->pScreen;

Expand All @@ -37,6 +37,8 @@ RROutputChanged (RROutputPtr output)
{
rrScrPriv (pScreen);
pScrPriv->changed = TRUE;
if (configChanged)
pScrPriv->configChanged = TRUE;
}
}

Expand Down Expand Up @@ -106,7 +108,7 @@ RROutputAttachScreen (RROutputPtr output, ScreenPtr pScreen)
output->pScreen = pScreen;
pScrPriv->outputs = outputs;
pScrPriv->outputs[pScrPriv->numOutputs++] = output;
RROutputChanged (output);
RROutputChanged (output, FALSE);
return TRUE;
}

Expand Down Expand Up @@ -142,7 +144,7 @@ RROutputSetClones (RROutputPtr output,
memcpy (newClones, clones, numClones * sizeof (RROutputPtr));
output->clones = newClones;
output->numClones = numClones;
RROutputChanged (output);
RROutputChanged (output, TRUE);
return TRUE;
}

Expand Down Expand Up @@ -186,7 +188,7 @@ RROutputSetModes (RROutputPtr output,
output->modes = newModes;
output->numModes = numModes;
output->numPreferred = numPreferred;
RROutputChanged (output);
RROutputChanged (output, TRUE);
return TRUE;
}

Expand Down Expand Up @@ -219,7 +221,7 @@ RROutputSetCrtcs (RROutputPtr output,
memcpy (newCrtcs, crtcs, numCrtcs * sizeof (RRCrtcPtr));
output->crtcs = newCrtcs;
output->numCrtcs = numCrtcs;
RROutputChanged (output);
RROutputChanged (output, TRUE);
return TRUE;
}

Expand All @@ -229,7 +231,7 @@ RROutputSetCrtc (RROutputPtr output, RRCrtcPtr crtc)
if (output->crtc == crtc)
return;
output->crtc = crtc;
RROutputChanged (output);
RROutputChanged (output, FALSE);
}

Bool
Expand All @@ -239,7 +241,7 @@ RROutputSetConnection (RROutputPtr output,
if (output->connection == connection)
return TRUE;
output->connection = connection;
RROutputChanged (output);
RROutputChanged (output, TRUE);
return TRUE;
}

Expand All @@ -251,7 +253,7 @@ RROutputSetSubpixelOrder (RROutputPtr output,
return TRUE;

output->subpixelOrder = subpixelOrder;
RROutputChanged (output);
RROutputChanged (output, FALSE);
return TRUE;
}

Expand All @@ -264,7 +266,7 @@ RROutputSetPhysicalSize (RROutputPtr output,
return TRUE;
output->mmWidth = mmWidth;
output->mmHeight = mmHeight;
RROutputChanged (output);
RROutputChanged (output, FALSE);
return TRUE;
}

Expand Down

0 comments on commit 98d18a6

Please sign in to comment.