diff options
author | Keith Packard <keithp@neko.keithp.com> | 2007-03-23 23:41:36 -0700 |
---|---|---|
committer | Keith Packard <keithp@neko.keithp.com> | 2007-03-24 00:01:47 -0700 |
commit | 804080a7096347d48c686f2c8fbfd06326bce400 (patch) | |
tree | cb229530ce3043cfd3da2a34e40981abe006e6fb /randr/rrcrtc.c | |
parent | 1f77120775dc05fc84a00dd55190af2fa50ae509 (diff) |
Make pending properties force mode set. And, remove AttachScreen calls.
Yes, two changes in one commit. Sorry 'bout that.
The first change ensures that when pending property values have been
changed, a mode set to the current mode will actually do something, rather
than being identified as a no-op. In addition, the driver no longer needs to
manage the migration of pending to current values, that is handled both
within the xf86 mode setting code (to deal with non-RandR changes) as well
as within the RandR extension itself.
The second change eliminates the two-call Create/AttachScreen stuff that was
done in a failed attempt to create RandR resources before the screen
structures were allocated. Merging these back into the Create function is
cleaner.
(cherry picked from commit 57e87e0d006cbf1f5b175fe02eeb981f741d92f0)
Conflicts:
randr/randrstr.h
randr/rrcrtc.c
I think master and server-1.3-branch are more in sync now.
Diffstat (limited to 'randr/rrcrtc.c')
-rw-r--r-- | randr/rrcrtc.c | 92 |
1 files changed, 51 insertions, 41 deletions
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 7131dfb3a..1dfc3bbb0 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -51,17 +51,32 @@ RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged) * Create a CRTC */ RRCrtcPtr -RRCrtcCreate (void *devPrivate) +RRCrtcCreate (ScreenPtr pScreen, void *devPrivate) { - RRCrtcPtr crtc; - + RRCrtcPtr crtc; + RRCrtcPtr *crtcs; + rrScrPrivPtr pScrPriv; + if (!RRInit()) return NULL; + + pScrPriv = rrGetScrPriv(pScreen); + + /* make space for the crtc pointer */ + if (pScrPriv->numCrtcs) + crtcs = xrealloc (pScrPriv->crtcs, + (pScrPriv->numCrtcs + 1) * sizeof (RRCrtcPtr)); + else + crtcs = xalloc (sizeof (RRCrtcPtr)); + if (!crtcs) + return FALSE; + pScrPriv->crtcs = crtcs; + crtc = xalloc (sizeof (RRCrtcRec)); if (!crtc) return NULL; crtc->id = FakeClientID (0); - crtc->pScreen = NULL; + crtc->pScreen = pScreen; crtc->mode = NULL; crtc->x = 0; crtc->y = 0; @@ -77,37 +92,20 @@ RRCrtcCreate (void *devPrivate) if (!AddResource (crtc->id, RRCrtcType, (pointer) crtc)) return NULL; + /* attach the screen and crtc together */ + crtc->pScreen = pScreen; + pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc; + return crtc; } /* - * Attach a Crtc to a screen. This is done as a separate step - * so that an xf86-based driver can create CRTCs in PreInit - * before the Screen has been created + * Set the allowed rotations on a CRTC */ - -Bool -RRCrtcAttachScreen (RRCrtcPtr crtc, ScreenPtr pScreen) +void +RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations) { - rrScrPriv (pScreen); - RRCrtcPtr *crtcs; - - /* make space for the crtc pointer */ - if (pScrPriv->numCrtcs) - crtcs = xrealloc (pScrPriv->crtcs, - (pScrPriv->numCrtcs + 1) * sizeof (RRCrtcPtr)); - else - crtcs = xalloc (sizeof (RRCrtcPtr)); - if (!crtcs) - return FALSE; - - /* attach the screen and crtc together */ - crtc->pScreen = pScreen; - pScrPriv->crtcs = crtcs; - pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc; - - RRCrtcChanged (crtc, TRUE); - return TRUE; + crtc->rotations = rotations; } /* @@ -249,6 +247,22 @@ RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc) WriteEventsToClient (client, 1, (xEvent *) &ce); } +static Bool +RRCrtcPendingProperties (RRCrtcPtr crtc) +{ + ScreenPtr pScreen = crtc->pScreen; + rrScrPriv(pScreen); + int o; + + for (o = 0; o < pScrPriv->numOutputs; o++) + { + RROutputPtr output = pScrPriv->outputs[o]; + if (output->crtc == crtc && output->pendingProperties) + return TRUE; + } + return FALSE; +} + /* * Request that the Crtc be reconfigured */ @@ -271,7 +285,8 @@ RRCrtcSet (RRCrtcPtr crtc, crtc->y == y && crtc->rotation == rotation && crtc->numOutputs == numOutputs && - !memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr))) + !memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr)) && + !RRCrtcPendingProperties (crtc)) { ret = TRUE; } @@ -328,7 +343,13 @@ RRCrtcSet (RRCrtcPtr crtc, #endif } if (ret) + { + int o; RRTellChanged (pScreen); + + for (o = 0; o < numOutputs; o++) + RRPostPendingProperties (outputs[o]); + } } return ret; } @@ -469,17 +490,6 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc, } /* - * Set the allowable rotations of the CRTC. - */ -Bool -RRCrtcSetRotations (RRCrtcPtr crtc, - Rotation rotations) -{ - crtc->rotations = rotations; - return TRUE; -} - -/* * Initialize crtc type */ Bool |