Change the devPrivates API to require dixRegisterPrivateKey

This patch only changes the API, not the implementation of the
devPrivates infrastructure. This will permit a new devPrivates
implementation to be layed into the server without requiring
simultaneous changes in every devPrivates user.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com>
This commit is contained in:
Keith Packard 2010-04-26 17:22:21 -07:00
commit faeebead7b
139 changed files with 1105 additions and 711 deletions

View file

@ -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,
@ -717,13 +724,13 @@ 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;

View file

@ -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)