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/hw/xfree86/dixmods/extmod/xf86dga2.c | 37 ++++++++++++++--------- xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c | 25 ++++++++------- 2 files changed, 36 insertions(+), 26 deletions(-) (limited to 'xorg-server/hw/xfree86/dixmods') diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c b/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c index 0b7d62dca..453ade80b 100644 --- a/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c +++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86dga2.c @@ -61,10 +61,11 @@ unsigned char DGAReqCode = 0; int DGAErrorBase; int DGAEventBase; -static int DGAScreenPrivateKeyIndex; -static DevPrivateKey DGAScreenPrivateKey = &DGAScreenPrivateKeyIndex; -static int DGAClientPrivateKeyIndex; -static DevPrivateKey DGAClientPrivateKey = &DGAClientPrivateKeyIndex; +static DevPrivateKeyRec DGAScreenPrivateKeyRec; +#define DGAScreenPrivateKey (&DGAScreenPrivateKeyRec) +#define DGAScreenPrivateKeyRegistered (DGAScreenPrivateKeyRec.initialized) +static DevPrivateKeyRec DGAClientPrivateKeyRec; +#define DGAClientPrivateKey (&DGAClientPrivateKeyRec) static int DGACallbackRefCount = 0; /* This holds the client's version information */ @@ -89,6 +90,12 @@ XFree86DGAExtensionInit(INITARGS) { ExtensionEntry* extEntry; + if (!dixRegisterPrivateKey(&DGAClientPrivateKeyRec, PRIVATE_CLIENT, 0)) + return; + + if (!dixRegisterPrivateKey(&DGAScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) + return; + if ((extEntry = AddExtension(XF86DGANAME, XF86DGANumberEvents, XF86DGANumberErrors, @@ -685,10 +692,10 @@ ProcXF86DGAGetVideoLL(ClientPtr client) rep.sequenceNumber = client->sequence; if(!DGAAvailable(stuff->screen)) - return (DGAErrorBase + XF86DGANoDirectVideoMode); + return DGAErrorBase + XF86DGANoDirectVideoMode; if(!(num = DGAGetOldDGAMode(stuff->screen))) - return (DGAErrorBase + XF86DGANoDirectVideoMode); + return DGAErrorBase + XF86DGANoDirectVideoMode; /* get the parameters for the mode that best matches */ DGAGetModeInfo(stuff->screen, &mode, num); @@ -717,24 +724,24 @@ ProcXF86DGADirectVideo(ClientPtr client) if (stuff->screen > screenInfo.numScreens) return BadValue; - owner = DGA_GETCLIENT(stuff->screen); - REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq); if (!DGAAvailable(stuff->screen)) return DGAErrorBase + XF86DGANoDirectVideoMode; + owner = DGA_GETCLIENT(stuff->screen); + if (owner && owner != client) return DGAErrorBase + XF86DGANoDirectVideoMode; if (stuff->enable & XF86DGADirectGraphics) { if(!(num = DGAGetOldDGAMode(stuff->screen))) - return (DGAErrorBase + XF86DGANoDirectVideoMode); + return DGAErrorBase + XF86DGANoDirectVideoMode; } else num = 0; if(Success != DGASetMode(stuff->screen, num, &mode, &pix)) - return (DGAErrorBase + XF86DGAScreenNotActive); + return DGAErrorBase + XF86DGAScreenNotActive; DGASetInputMode (stuff->screen, (stuff->enable & XF86DGADirectKeyb) != 0, @@ -778,10 +785,10 @@ ProcXF86DGAGetViewPortSize(ClientPtr client) rep.sequenceNumber = client->sequence; if (!DGAAvailable(stuff->screen)) - return (DGAErrorBase + XF86DGANoDirectVideoMode); + return DGAErrorBase + XF86DGANoDirectVideoMode; if(!(num = DGAGetOldDGAMode(stuff->screen))) - return (DGAErrorBase + XF86DGANoDirectVideoMode); + return DGAErrorBase + XF86DGANoDirectVideoMode; DGAGetModeInfo(stuff->screen, &mode, num); @@ -806,7 +813,7 @@ ProcXF86DGASetViewPort(ClientPtr client) REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq); if (!DGAAvailable(stuff->screen)) - return (DGAErrorBase + XF86DGANoDirectVideoMode); + return DGAErrorBase + XF86DGANoDirectVideoMode; if (!DGAActive(stuff->screen)) return DGAErrorBase + XF86DGADirectNotActivated; @@ -870,7 +877,7 @@ ProcXF86DGAInstallColormap(ClientPtr client) REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq); if (!DGAActive(stuff->screen)) - return (DGAErrorBase + XF86DGADirectNotActivated); + return DGAErrorBase + XF86DGADirectNotActivated; rc = dixLookupResourceByType((pointer *)&pcmp, stuff->id, RT_COLORMAP, client, DixInstallAccess); @@ -919,7 +926,7 @@ ProcXF86DGAViewPortChanged(ClientPtr client) REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq); if (!DGAActive(stuff->screen)) - return (DGAErrorBase + XF86DGADirectNotActivated); + return DGAErrorBase + XF86DGADirectNotActivated; rep.type = X_Reply; rep.length = 0; diff --git a/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c b/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c index f29f5bad2..31bb311b3 100644 --- a/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c +++ b/xorg-server/hw/xfree86/dixmods/extmod/xf86vmode.c @@ -51,8 +51,8 @@ from Kaleb S. KEITHLEY #define DEFAULT_XF86VIDMODE_VERBOSITY 3 static int VidModeErrorBase; -static int VidModeClientPrivateKeyIndex; -static DevPrivateKey VidModeClientPrivateKey = &VidModeClientPrivateKeyIndex; +static DevPrivateKeyRec VidModeClientPrivateKeyRec; +#define VidModeClientPrivateKey (&VidModeClientPrivateKeyRec) /* This holds the client's version information */ typedef struct { @@ -141,8 +141,8 @@ typedef struct _XF86VidModeScreenPrivate { Bool hasWindow; } XF86VidModeScreenPrivateRec, *XF86VidModeScreenPrivatePtr; -static int ScreenPrivateKeyIndex; -static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKeyIndex; +static DevPrivateKeyRec ScreenPrivateKeyRec; +#define ScreenPrivateKey (&ScreenPrivateKeyRec) #define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \ dixLookupPrivate(&(s)->devPrivates, ScreenPrivateKey)) @@ -169,6 +169,13 @@ XFree86VidModeExtensionInit(void) DEBUG_P("XFree86VidModeExtensionInit"); + if (!dixRegisterPrivateKey(&VidModeClientPrivateKeyRec, PRIVATE_CLIENT, 0)) + return; +#ifdef XF86VIDMODE_EVENTS + if (!dixRegisterPrivateKey(&ScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) + return; +#endif + #ifdef XF86VIDMODE_EVENTS EventType = CreateNewResourceType(XF86VidModeFreeEvents, "VidModeEvent"); #endif @@ -177,9 +184,6 @@ XFree86VidModeExtensionInit(void) pScreen = screenInfo.screens[i]; if (VidModeExtensionInit(pScreen)) enabled = TRUE; -#ifdef XF86VIDMODE_EVENTS - SetScreenPrivate (pScreen, NULL); -#endif } /* This means that the DDX doesn't want the vidmode extension enabled */ if (!enabled) @@ -347,7 +351,7 @@ SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced) ev.type = XF86VidModeNotify + XF86VidModeEventBase; ev.state = state; ev.timestamp = currentTime.milliseconds; - ev.root = WindowTable[pScreen->myNum]->drawable.id; + ev.root = pScreen->root->drawable.id; ev.kind = kind; ev.forced = forced; WriteEventsToClient (pEv->client, 1, (xEvent *) &ev); @@ -516,7 +520,7 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client) modecount = VidModeGetNumOfModes(stuff->screen); if (modecount < 1) - return (VidModeErrorBase + XF86VidModeExtensionDisabled); + return VidModeErrorBase + XF86VidModeExtensionDisabled; if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock)) return BadValue; @@ -1098,8 +1102,7 @@ ProcXF86VidModeValidateModeLine(ClientPtr client) status = VidModeCheckModeForDriver(stuff->screen, modetmp); status_reply: - if(modetmp) - free(modetmp); + free(modetmp); rep.type = X_Reply; rep.length = bytes_to_int32(SIZEOF(xXF86VidModeValidateModeLineReply) -- cgit v1.2.3