From 98d18a6578130adb411ca4bcc776fcb7e07f189f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 12 Dec 2006 22:59:03 -0800 Subject: [PATCH] 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. --- randr/randr.c | 6 +++++- randr/randrstr.h | 12 +++++++++--- randr/rrcrtc.c | 4 ++-- randr/rrinfo.c | 2 ++ randr/rroutput.c | 20 +++++++++++--------- 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/randr/randr.c b/randr/randr.c index 147df8c2c..1470035ca 100644 --- a/randr/randr.c +++ b/randr/randr.c @@ -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++) diff --git a/randr/randrstr.h b/randr/randrstr.h index 27ede9226..88f7588ae 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -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; @@ -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 diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index e8a7b79e1..5100bda41 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -136,7 +136,7 @@ RRCrtcNotify (RRCrtcPtr crtc, break; if (j == crtc->numOutputs) { - RROutputChanged (outputs[i]); + RROutputChanged (outputs[i], FALSE); RRCrtcChanged (crtc, FALSE); } } @@ -151,7 +151,7 @@ RRCrtcNotify (RRCrtcPtr crtc, break; if (i == numOutputs) { - RROutputChanged (crtc->outputs[j]); + RROutputChanged (crtc->outputs[j], FALSE); RRCrtcChanged (crtc, FALSE); } } diff --git a/randr/rrinfo.c b/randr/rrinfo.c index 244b089f3..85426f654 100644 --- a/randr/rrinfo.c +++ b/randr/rrinfo.c @@ -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; } @@ -205,6 +206,7 @@ RRGetInfo (ScreenPtr pScreen) rotations = 0; pScrPriv->changed = FALSE; + pScrPriv->configChanged = FALSE; if (!(*pScrPriv->rrGetInfo) (pScreen, &rotations)) return FALSE; diff --git a/randr/rroutput.c b/randr/rroutput.c index 430f8bdaa..8007a8a55 100644 --- a/randr/rroutput.c +++ b/randr/rroutput.c @@ -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; @@ -37,6 +37,8 @@ RROutputChanged (RROutputPtr output) { rrScrPriv (pScreen); pScrPriv->changed = TRUE; + if (configChanged) + pScrPriv->configChanged = TRUE; } } @@ -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; } @@ -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; } @@ -186,7 +188,7 @@ RROutputSetModes (RROutputPtr output, output->modes = newModes; output->numModes = numModes; output->numPreferred = numPreferred; - RROutputChanged (output); + RROutputChanged (output, TRUE); return TRUE; } @@ -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; } @@ -229,7 +231,7 @@ RROutputSetCrtc (RROutputPtr output, RRCrtcPtr crtc) if (output->crtc == crtc) return; output->crtc = crtc; - RROutputChanged (output); + RROutputChanged (output, FALSE); } Bool @@ -239,7 +241,7 @@ RROutputSetConnection (RROutputPtr output, if (output->connection == connection) return TRUE; output->connection = connection; - RROutputChanged (output); + RROutputChanged (output, TRUE); return TRUE; } @@ -251,7 +253,7 @@ RROutputSetSubpixelOrder (RROutputPtr output, return TRUE; output->subpixelOrder = subpixelOrder; - RROutputChanged (output); + RROutputChanged (output, FALSE); return TRUE; } @@ -264,7 +266,7 @@ RROutputSetPhysicalSize (RROutputPtr output, return TRUE; output->mmWidth = mmWidth; output->mmHeight = mmHeight; - RROutputChanged (output); + RROutputChanged (output, FALSE); return TRUE; }