From 4c61bf84b11e26e6f22648668c95ea760a379163 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 11 Jun 2010 12:14:52 +0000 Subject: xserver git update 11/6/2010 --- xorg-server/randr/randr.c | 15 ++--- xorg-server/randr/randrstr.h | 6 +- xorg-server/randr/rrcrtc.c | 69 ++++------------------- xorg-server/randr/rroutput.c | 15 ++--- xorg-server/randr/rrproperty.c | 122 +++++++++++++++++----------------------- xorg-server/randr/rrscreen.c | 13 ++--- xorg-server/randr/rrtransform.c | 6 +- xorg-server/randr/rrxinerama.c | 2 +- 8 files changed, 91 insertions(+), 157 deletions(-) (limited to 'xorg-server/randr') diff --git a/xorg-server/randr/randr.c b/xorg-server/randr/randr.c index b843f588d..e816461d8 100644 --- a/xorg-server/randr/randr.c +++ b/xorg-server/randr/randr.c @@ -54,11 +54,9 @@ static int SProcRRDispatch (ClientPtr pClient); int RREventBase; int RRErrorBase; RESTYPE RRClientType, RREventType; /* resource types for event masks */ -static int RRClientPrivateKeyIndex; -DevPrivateKey RRClientPrivateKey = &RRClientPrivateKeyIndex; +DevPrivateKeyRec RRClientPrivateKeyRec; -static int rrPrivKeyIndex; -DevPrivateKey rrPrivKey = &rrPrivKeyIndex; +DevPrivateKeyRec rrPrivKeyRec; static void RRClientCallback (CallbackListPtr *list, @@ -215,6 +213,9 @@ Bool RRInit (void) return FALSE; RRGeneration = serverGeneration; } + if (!dixRegisterPrivateKey(&rrPrivKeyRec, PRIVATE_SCREEN, 0)) + return FALSE; + return TRUE; } @@ -329,9 +330,9 @@ RRExtensionInit (void) if (RRNScreens == 0) return; - if (!dixRequestPrivate(RRClientPrivateKey, - sizeof (RRClientRec) + - screenInfo.numScreens * sizeof (RRTimesRec))) + if (!dixRegisterPrivateKey(&RRClientPrivateKeyRec, PRIVATE_CLIENT, + sizeof (RRClientRec) + + screenInfo.numScreens * sizeof (RRTimesRec))) return; if (!AddCallback (&ClientStateCallback, RRClientCallback, 0)) return; diff --git a/xorg-server/randr/randrstr.h b/xorg-server/randr/randrstr.h index aa938d651..45c2a5043 100644 --- a/xorg-server/randr/randrstr.h +++ b/xorg-server/randr/randrstr.h @@ -299,7 +299,8 @@ typedef struct _rrScrPriv { #endif } rrScrPrivRec, *rrScrPrivPtr; -extern _X_EXPORT DevPrivateKey rrPrivKey; +extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec; +#define rrPrivKey (&rrPrivKeyRec) #define rrGetScrPriv(pScr) ((rrScrPrivPtr)dixLookupPrivate(&(pScr)->devPrivates, rrPrivKey)) #define rrScrPriv(pScr) rrScrPrivPtr pScrPriv = rrGetScrPriv(pScr) @@ -335,7 +336,8 @@ typedef struct _RRClient { } RRClientRec, *RRClientPtr; extern _X_EXPORT RESTYPE RRClientType, RREventType; /* resource types for event masks */ -extern _X_EXPORT DevPrivateKey RRClientPrivateKey; +extern _X_EXPORT DevPrivateKeyRec RRClientPrivateKeyRec; +#define RRClientPrivateKey (&RRClientPrivateKeyRec) extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType; #define VERIFY_RR_OUTPUT(id, ptr, a)\ diff --git a/xorg-server/randr/rrcrtc.c b/xorg-server/randr/rrcrtc.c index 278b7ff77..60e254e03 100644 --- a/xorg-server/randr/rrcrtc.c +++ b/xorg-server/randr/rrcrtc.c @@ -190,8 +190,7 @@ RRCrtcNotify (RRCrtcPtr crtc, } else { - if (crtc->outputs) - free(crtc->outputs); + free(crtc->outputs); newoutputs = NULL; } crtc->outputs = newoutputs; @@ -440,8 +439,7 @@ RRCrtcDestroyResource (pointer value, XID pid) } } } - if (crtc->gammaRed) - free(crtc->gammaRed); + free(crtc->gammaRed); if (crtc->mode) RRModeDestroy (crtc->mode); free(crtc); @@ -563,8 +561,7 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc, } else gamma = NULL; - if (crtc->gammaRed) - free(crtc->gammaRed); + free(crtc->gammaRed); crtc->gammaRed = gamma; crtc->gammaGreen = gamma + size; crtc->gammaBlue = gamma + size*2; @@ -805,8 +802,7 @@ ProcRRSetCrtcConfig (ClientPtr client) RROutputType, client, DixSetAttrAccess); if (rc != Success) { - if (outputs) - free(outputs); + free(outputs); return rc; } /* validate crtc for this output */ @@ -815,8 +811,7 @@ ProcRRSetCrtcConfig (ClientPtr client) break; if (j == outputs[i]->numCrtcs) { - if (outputs) - free(outputs); + free(outputs); return BadMatch; } /* validate mode for this output */ @@ -830,8 +825,7 @@ ProcRRSetCrtcConfig (ClientPtr client) } if (j == outputs[i]->numModes + outputs[i]->numUserModes) { - if (outputs) - free(outputs); + free(outputs); return BadMatch; } } @@ -850,8 +844,7 @@ ProcRRSetCrtcConfig (ClientPtr client) } if (k == outputs[i]->numClones) { - if (outputs) - free(outputs); + free(outputs); return BadMatch; } } @@ -870,19 +863,6 @@ ProcRRSetCrtcConfig (ClientPtr client) goto sendReply; } -#if 0 - /* - * if the client's config timestamp is not the same as the last config - * timestamp, then the config information isn't up-to-date and - * can't even be validated - */ - if (CompareTimeStamps (configTime, pScrPriv->lastConfigTime) != 0) - { - rep.status = RRSetConfigInvalidConfigTime; - goto sendReply; - } -#endif - /* * Validate requested rotation */ @@ -900,8 +880,7 @@ ProcRRSetCrtcConfig (ClientPtr client) * Invalid rotation */ client->errorValue = stuff->rotation; - if (outputs) - free(outputs); + free(outputs); return BadValue; } @@ -913,8 +892,7 @@ ProcRRSetCrtcConfig (ClientPtr client) * requested rotation or reflection not supported by screen */ client->errorValue = stuff->rotation; - if (outputs) - free(outputs); + free(outputs); return BadMatch; } @@ -943,32 +921,20 @@ ProcRRSetCrtcConfig (ClientPtr client) if (stuff->x + source_width > pScreen->width) { client->errorValue = stuff->x; - if (outputs) - free(outputs); + free(outputs); return BadValue; } if (stuff->y + source_height > pScreen->height) { client->errorValue = stuff->y; - if (outputs) - free(outputs); + free(outputs); return BadValue; } } #endif } - /* - * Make sure the requested set-time is not older than - * the last set-time - */ - if (CompareTimeStamps (time, pScrPriv->lastSetTime) < 0) - { - rep.status = RRSetConfigInvalidTime; - goto sendReply; - } - if (!RRCrtcSet (crtc, mode, stuff->x, stuff->y, rotation, numOutputs, outputs)) { @@ -979,8 +945,7 @@ ProcRRSetCrtcConfig (ClientPtr client) pScrPriv->lastSetTime = time; sendReply: - if (outputs) - free(outputs); + free(outputs); rep.type = X_Reply; /* rep.status has already been filled in */ @@ -1100,16 +1065,6 @@ ProcRRSetPanning (ClientPtr client) time = ClientTimeToServerTime(stuff->timestamp); - /* - * Make sure the requested set-time is not older than - * the last set-time - */ - if (CompareTimeStamps (time, pScrPriv->lastSetTime) < 0) - { - rep.status = RRSetConfigInvalidTime; - goto sendReply; - } - if (!pScrPriv->rrGetPanning) return RRErrorBase + BadRRCrtc; diff --git a/xorg-server/randr/rroutput.c b/xorg-server/randr/rroutput.c index 51ebaa861..1fd1f1846 100644 --- a/xorg-server/randr/rroutput.c +++ b/xorg-server/randr/rroutput.c @@ -134,8 +134,7 @@ RROutputSetClones (RROutputPtr output, } else newClones = NULL; - if (output->clones) - free(output->clones); + free(output->clones); memcpy (newClones, clones, numClones * sizeof (RROutputPtr)); output->clones = newClones; output->numClones = numClones; @@ -280,8 +279,7 @@ RROutputSetCrtcs (RROutputPtr output, } else newCrtcs = NULL; - if (output->crtcs) - free(output->crtcs); + free(output->crtcs); memcpy (newCrtcs, crtcs, numCrtcs * sizeof (RRCrtcPtr)); output->crtcs = newCrtcs; output->numCrtcs = numCrtcs; @@ -402,13 +400,10 @@ RROutputDestroyResource (pointer value, XID pid) for (m = 0; m < output->numUserModes; m++) RRModeDestroy (output->userModes[m]); - if (output->userModes) - free(output->userModes); + free(output->userModes); - if (output->crtcs) - free(output->crtcs); - if (output->clones) - free(output->clones); + free(output->crtcs); + free(output->clones); RRDeleteAllOutputProperties (output); free(output); return 1; diff --git a/xorg-server/randr/rrproperty.c b/xorg-server/randr/rrproperty.c index 898730eef..dd0caa0b3 100644 --- a/xorg-server/randr/rrproperty.c +++ b/xorg-server/randr/rrproperty.c @@ -53,27 +53,39 @@ static void RRDeliverPropertyEvent(ScreenPtr pScreen, xEvent *event) WalkTree(pScreen, DeliverPropertyEvent, event); } +static void +RRDestroyOutputProperty (RRPropertyPtr prop) +{ + free(prop->valid_values); + free(prop->current.data); + free(prop->pending.data); + free(prop); +} + +static void +RRDeleteProperty(RROutputRec *output, RRPropertyRec *prop) +{ + xRROutputPropertyNotifyEvent event; + event.type = RREventBase + RRNotify; + event.subCode = RRNotify_OutputProperty; + event.output = output->id; + event.state = PropertyDelete; + event.atom = prop->propertyName; + event.timestamp = currentTime.milliseconds; + + RRDeliverPropertyEvent(output->pScreen, (xEvent *)&event); + + RRDestroyOutputProperty(prop); +} + void -RRDeleteAllOutputProperties (RROutputPtr output) +RRDeleteAllOutputProperties(RROutputPtr output) { RRPropertyPtr prop, next; - xRROutputPropertyNotifyEvent event; - for (prop = output->properties; prop; prop = next) - { + for (prop = output->properties; prop; prop = next) { next = prop->next; - event.type = RREventBase + RRNotify; - event.subCode = RRNotify_OutputProperty; - event.output = output->id; - event.state = PropertyDelete; - event.atom = prop->propertyName; - event.timestamp = currentTime.milliseconds; - RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event); - if (prop->current.data) - free(prop->current.data); - if (prop->pending.data) - free(prop->pending.data); - free(prop); + RRDeleteProperty(output, prop); } } @@ -106,41 +118,17 @@ RRCreateOutputProperty (Atom property) return prop; } -static void -RRDestroyOutputProperty (RRPropertyPtr prop) -{ - if (prop->valid_values) - free(prop->valid_values); - if (prop->current.data) - free(prop->current.data); - if (prop->pending.data) - free(prop->pending.data); - if (prop->valid_values) - free(prop->valid_values); - free(prop); -} - void -RRDeleteOutputProperty (RROutputPtr output, Atom property) +RRDeleteOutputProperty(RROutputPtr output, Atom property) { - RRPropertyPtr prop, *prev; - xRROutputPropertyNotifyEvent event; + RRPropertyRec *prop, **prev; for (prev = &output->properties; (prop = *prev); prev = &(prop->next)) - if (prop->propertyName == property) - break; - if (prop) - { - *prev = prop->next; - event.type = RREventBase + RRNotify; - event.subCode = RRNotify_OutputProperty; - event.output = output->id; - event.state = PropertyDelete; - event.atom = prop->propertyName; - event.timestamp = currentTime.milliseconds; - RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event); - RRDestroyOutputProperty (prop); - } + if (prop->propertyName == property) { + *prev = prop->next; + RRDeleteProperty(output, prop); + return; + } } int @@ -166,7 +154,7 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, { prop = RRCreateOutputProperty (property); if (!prop) - return(BadAlloc); + return BadAlloc; add = TRUE; mode = PropModeReplace; } @@ -181,9 +169,9 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, "PropModeReplace" since they will be written over. */ if ((format != prop_value->format) && (mode != PropModeReplace)) - return(BadMatch); + return BadMatch; if ((prop_value->type != type) && (mode != PropModeReplace)) - return(BadMatch); + return BadMatch; new_value = *prop_value; if (mode == PropModeReplace) total_len = len; @@ -232,12 +220,10 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, !pScrPriv->rrOutputSetProperty(output->pScreen, output, prop->propertyName, &new_value)) { - if (new_value.data) - free(new_value.data); - return (BadValue); + free(new_value.data); + return BadValue; } - if (prop_value->data) - free(prop_value->data); + free(prop_value->data); *prop_value = new_value; } @@ -265,7 +251,7 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, event.timestamp = currentTime.milliseconds; RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event); } - return(Success); + return Success; } Bool @@ -355,10 +341,10 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property, { prop = RRCreateOutputProperty (property); if (!prop) - return(BadAlloc); + return BadAlloc; add = TRUE; } else if (prop->immutable && !immutable) - return(BadAccess); + return BadAccess; /* * ranges must have even number of values @@ -378,8 +364,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property, */ if (prop->is_pending && !pending) { - if (prop->pending.data) - free(prop->pending.data); + free(prop->pending.data); RRInitOutputPropertyValue (&prop->pending); } @@ -387,8 +372,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property, prop->range = range; prop->immutable = immutable; prop->num_valid = num_values; - if (prop->valid_values) - free(prop->valid_values); + free(prop->valid_values); prop->valid_values = new_values; if (add) { @@ -417,7 +401,7 @@ ProcRRListOutputProperties (ClientPtr client) numProps++; if (numProps) if(!(pAtoms = (Atom *)malloc(numProps * sizeof(Atom)))) - return(BadAlloc); + return BadAlloc; rep.type = X_Reply; rep.length = bytes_to_int32(numProps * sizeof(Atom)); @@ -546,12 +530,12 @@ ProcRRChangeOutputProperty (ClientPtr client) if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; - return(BadAtom); + return BadAtom; } if (!ValidAtom(stuff->type)) { client->errorValue = stuff->type; - return(BadAtom); + return BadAtom; } err = RRChangeOutputProperty(output, stuff->property, @@ -576,7 +560,7 @@ ProcRRDeleteOutputProperty (ClientPtr client) if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; - return (BadAtom); + return BadAtom; } @@ -604,17 +588,17 @@ ProcRRGetOutputProperty (ClientPtr client) if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; - return(BadAtom); + return BadAtom; } if ((stuff->delete != xTrue) && (stuff->delete != xFalse)) { client->errorValue = stuff->delete; - return(BadValue); + return BadValue; } if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type)) { client->errorValue = stuff->type; - return(BadAtom); + return BadAtom; } for (prev = &output->properties; (prop = *prev); prev = &prop->next) diff --git a/xorg-server/randr/rrscreen.c b/xorg-server/randr/rrscreen.c index a5e01dced..6f842fe62 100644 --- a/xorg-server/randr/rrscreen.c +++ b/xorg-server/randr/rrscreen.c @@ -73,7 +73,7 @@ RREditConnectionInfo (ScreenPtr pScreen) void RRSendConfigNotify (ScreenPtr pScreen) { - WindowPtr pWin = WindowTable[pScreen->myNum]; + WindowPtr pWin = pScreen->root; xEvent event; event.u.u.type = ConfigureNotify; @@ -97,7 +97,7 @@ RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen) rrScrPriv (pScreen); xRRScreenChangeNotifyEvent se; RRCrtcPtr crtc = pScrPriv->numCrtcs ? pScrPriv->crtcs[0] : NULL; - WindowPtr pRoot = WindowTable[pScreen->myNum]; + WindowPtr pRoot = pScreen->root; se.type = RRScreenChangeNotify + RREventBase; se.rotation = (CARD8) (crtc ? crtc->rotation : RR_Rotate_0); @@ -620,7 +620,7 @@ ProcRRGetScreenInfo (ClientPtr client) rep.setOfRotations = RR_Rotate_0; rep.sequenceNumber = client->sequence; rep.length = 0; - rep.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; + rep.root = pWin->drawable.pScreen->root->drawable.id; rep.timestamp = currentTime.milliseconds; rep.configTimestamp = currentTime.milliseconds; rep.nSizes = 0; @@ -649,7 +649,7 @@ ProcRRGetScreenInfo (ClientPtr client) rep.setOfRotations = output->crtc->rotations; rep.sequenceNumber = client->sequence; rep.length = 0; - rep.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; + rep.root = pWin->drawable.pScreen->root->drawable.id; rep.timestamp = pScrPriv->lastSetTime.milliseconds; rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds; rep.rotation = output->crtc->rotation; @@ -951,8 +951,7 @@ ProcRRSetScreenConfig (ClientPtr client) sendReply: - if (pData) - free(pData); + free(pData); rep.type = X_Reply; /* rep.status has already been filled in */ @@ -961,7 +960,7 @@ sendReply: rep.newTimestamp = pScrPriv->lastSetTime.milliseconds; rep.newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds; - rep.root = WindowTable[pDraw->pScreen->myNum]->drawable.id; + rep.root = pDraw->pScreen->root->drawable.id; if (client->swapped) { diff --git a/xorg-server/randr/rrtransform.c b/xorg-server/randr/rrtransform.c index 6740e4825..03c5c97ba 100644 --- a/xorg-server/randr/rrtransform.c +++ b/xorg-server/randr/rrtransform.c @@ -37,8 +37,7 @@ RRTransformInit (RRTransformPtr transform) void RRTransformFini (RRTransformPtr transform) { - if (transform->params) - free(transform->params); + free(transform->params); } Bool @@ -82,8 +81,7 @@ RRTransformSetFilter (RRTransformPtr dst, } else new_params = NULL; - if (dst->params) - free(dst->params); + free(dst->params); dst->filter = filter; dst->params = new_params; dst->nparams = nparams; diff --git a/xorg-server/randr/rrxinerama.c b/xorg-server/randr/rrxinerama.c index 374789374..1dee6ca22 100644 --- a/xorg-server/randr/rrxinerama.c +++ b/xorg-server/randr/rrxinerama.c @@ -216,7 +216,7 @@ ProcRRXineramaGetScreenSize(ClientPtr client) return rc; pScreen = pWin->drawable.pScreen; - pRoot = WindowTable[pScreen->myNum]; + pRoot = pScreen->root; rep.type = X_Reply; rep.length = 0; -- cgit v1.2.3