summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/darwin/darwin.h6
-rw-r--r--hw/darwin/darwinEvents.c2
-rw-r--r--hw/darwin/iokit/xfIOKit.h6
-rw-r--r--hw/darwin/iokit/xfIOKitCursor.c38
-rw-r--r--hw/darwin/quartz/applewm.c41
-rw-r--r--hw/darwin/quartz/fullscreen/fullscreen.c28
-rw-r--r--hw/darwin/quartz/fullscreen/quartzCursor.c26
-rw-r--r--hw/darwin/quartz/pseudoramiX.c14
-rw-r--r--hw/darwin/quartz/quartz.c10
-rw-r--r--hw/darwin/quartz/quartzCommon.h4
-rw-r--r--hw/darwin/quartz/quartzCursor.c26
-rw-r--r--hw/darwin/quartz/xpr/appledri.c29
-rw-r--r--hw/darwin/quartz/xpr/dri.c47
-rw-r--r--hw/darwin/quartz/xpr/dristruct.h21
-rw-r--r--hw/darwin/quartz/xpr/xprCursor.c19
-rw-r--r--hw/darwin/quartz/xpr/xprFrame.c2
-rw-r--r--hw/dmx/dmx.c40
-rw-r--r--hw/dmx/dmxcmap.c14
-rw-r--r--hw/dmx/dmxcmap.h9
-rw-r--r--hw/dmx/dmxcursor.c8
-rw-r--r--hw/dmx/dmxcursor.h7
-rw-r--r--hw/dmx/dmxdpms.c9
-rw-r--r--hw/dmx/dmxfont.c7
-rw-r--r--hw/dmx/dmxgc.c6
-rw-r--r--hw/dmx/dmxgc.h4
-rw-r--r--hw/dmx/dmxpict.c3
-rw-r--r--hw/dmx/dmxpict.h10
-rw-r--r--hw/dmx/dmxpixmap.c5
-rw-r--r--hw/dmx/dmxpixmap.h4
-rw-r--r--hw/dmx/dmxscrinit.c46
-rw-r--r--hw/dmx/dmxscrinit.h2
-rw-r--r--hw/dmx/dmxwindow.c3
-rw-r--r--hw/dmx/dmxwindow.h6
-rw-r--r--hw/dmx/input/dmxconsole.c13
-rw-r--r--hw/dmx/input/dmxeq.c4
-rw-r--r--hw/kdrive/ephyr/ephyr.c2
-rw-r--r--hw/kdrive/savage/s3draw.c17
-rw-r--r--hw/kdrive/savage/s3draw.h18
-rw-r--r--hw/kdrive/src/kaa.c22
-rw-r--r--hw/kdrive/src/kaa.h13
-rw-r--r--hw/kdrive/src/kdrive.h8
-rw-r--r--hw/kdrive/src/kxv.c44
-rw-r--r--hw/kdrive/vxworks/vxkbd.c2
-rw-r--r--hw/xfree86/common/xf86.h10
-rw-r--r--hw/xfree86/common/xf86DGA.c44
-rw-r--r--hw/xfree86/common/xf86DPMS.c48
-rw-r--r--hw/xfree86/common/xf86Events.c6
-rw-r--r--hw/xfree86/common/xf86Globals.c8
-rw-r--r--hw/xfree86/common/xf86Init.c26
-rw-r--r--hw/xfree86/common/xf86PM.c2
-rw-r--r--hw/xfree86/common/xf86RandR.c20
-rw-r--r--hw/xfree86/common/xf86VidMode.c27
-rw-r--r--hw/xfree86/common/xf86Xinput.c1
-rw-r--r--hw/xfree86/common/xf86cmap.c122
-rw-r--r--hw/xfree86/common/xf86fbman.c148
-rw-r--r--hw/xfree86/common/xf86sbusBus.c13
-rw-r--r--hw/xfree86/common/xf86xv.c45
-rw-r--r--hw/xfree86/common/xf86xvmc.c20
-rw-r--r--hw/xfree86/common/xf86xvpriv.h3
-rw-r--r--hw/xfree86/dixmods/extmod/modinit.h5
-rw-r--r--hw/xfree86/dixmods/extmod/xf86dga2.c98
-rw-r--r--hw/xfree86/dixmods/extmod/xf86misc.c86
-rw-r--r--hw/xfree86/dixmods/extmod/xf86vmode.c110
-rw-r--r--hw/xfree86/dixmods/extmod/xvmod.c2
-rw-r--r--hw/xfree86/dixmods/extmod/xvmodproc.h2
-rw-r--r--hw/xfree86/dri/dri.c52
-rw-r--r--hw/xfree86/dri/dristruct.h22
-rw-r--r--hw/xfree86/dri/xf86dri.c38
-rw-r--r--hw/xfree86/exa/examodule.c18
-rw-r--r--hw/xfree86/loader/dixsym.c61
-rw-r--r--hw/xfree86/loader/misym.c4
-rw-r--r--hw/xfree86/loader/xf86sym.c4
-rw-r--r--hw/xfree86/modes/xf86Cursors.c5
-rw-r--r--hw/xfree86/modes/xf86RandR12.c13
-rw-r--r--hw/xfree86/os-support/solaris/sun_mouse.c14
-rw-r--r--hw/xfree86/rac/xf86RAC.c68
-rw-r--r--hw/xfree86/ramdac/xf86Cursor.c75
-rw-r--r--hw/xfree86/ramdac/xf86CursorPriv.h2
-rw-r--r--hw/xfree86/ramdac/xf86HWCurs.c20
-rw-r--r--hw/xfree86/shadowfb/shadow.c20
-rw-r--r--hw/xfree86/xaa/xaaDashLine.c3
-rw-r--r--hw/xfree86/xaa/xaaGC.c3
-rw-r--r--hw/xfree86/xaa/xaaGCmisc.c3
-rw-r--r--hw/xfree86/xaa/xaaInit.c45
-rw-r--r--hw/xfree86/xaa/xaaLineMisc.c3
-rw-r--r--hw/xfree86/xaa/xaaOverlayDF.c15
-rw-r--r--hw/xfree86/xaa/xaaStateChange.c15
-rw-r--r--hw/xfree86/xaa/xaaWrapper.c31
-rw-r--r--hw/xfree86/xaa/xaalocal.h22
-rw-r--r--hw/xfree86/xaa/xaawrap.h14
-rw-r--r--hw/xfree86/xf4bpp/mfbfillarc.c3
-rw-r--r--hw/xfree86/xf4bpp/mfbimggblt.c3
-rw-r--r--hw/xfree86/xf4bpp/mfbzerarc.c3
-rw-r--r--hw/xfree86/xf4bpp/ppcArea.c2
-rw-r--r--hw/xfree86/xf4bpp/ppcGC.c10
-rw-r--r--hw/xfree86/xf4bpp/ppcPixFS.c24
-rw-r--r--hw/xfree86/xf4bpp/ppcPixmap.c1
-rw-r--r--hw/xfree86/xf4bpp/ppcPolyPnt.c2
-rw-r--r--hw/xfree86/xf4bpp/ppcWinFS.c24
-rw-r--r--hw/xfree86/xf4bpp/vgaGC.c2
-rw-r--r--hw/xfree86/xf8_32bpp/cfb8_32.h14
-rw-r--r--hw/xfree86/xf8_32bpp/cfbscrinit.c33
-rw-r--r--hw/xfree86/xf8_32bpp/xf86overlay.c35
-rw-r--r--hw/xgl/egl/kinput.c2
-rw-r--r--hw/xgl/egl/xegl.c20
-rw-r--r--hw/xgl/egl/xegl.h6
-rw-r--r--hw/xgl/glx/xglx.c26
-rw-r--r--hw/xgl/xgl.h33
-rw-r--r--hw/xgl/xglinput.c2
-rw-r--r--hw/xgl/xglpixmap.c1
-rw-r--r--hw/xgl/xglscreen.c3
-rw-r--r--hw/xgl/xglxv.c8
-rw-r--r--hw/xnest/Cursor.c6
-rw-r--r--hw/xnest/GC.c2
-rw-r--r--hw/xnest/Init.c2
-rw-r--r--hw/xnest/Pixmap.c8
-rw-r--r--hw/xnest/Screen.c20
-rw-r--r--hw/xnest/Window.c2
-rw-r--r--hw/xnest/XNCursor.h9
-rw-r--r--hw/xnest/XNGC.h6
-rw-r--r--hw/xnest/XNPixmap.h6
-rw-r--r--hw/xnest/XNWindow.h6
-rw-r--r--hw/xprint/attributes.c27
-rw-r--r--hw/xprint/pcl/Pcl.h8
-rw-r--r--hw/xprint/pcl/PclArc.c2
-rw-r--r--hw/xprint/pcl/PclColor.c28
-rw-r--r--hw/xprint/pcl/PclGC.c15
-rw-r--r--hw/xprint/pcl/PclInit.c62
-rw-r--r--hw/xprint/pcl/PclLine.c4
-rw-r--r--hw/xprint/pcl/PclPixel.c8
-rw-r--r--hw/xprint/pcl/PclPolygon.c6
-rw-r--r--hw/xprint/pcl/PclPrint.c20
-rw-r--r--hw/xprint/pcl/PclText.c4
-rw-r--r--hw/xprint/pcl/PclWindow.c7
-rw-r--r--hw/xprint/pcl/Pclmap.h10
-rw-r--r--hw/xprint/ps/Ps.h8
-rw-r--r--hw/xprint/ps/PsGC.c14
-rw-r--r--hw/xprint/ps/PsInit.c48
-rw-r--r--hw/xprint/ps/PsPixmap.c3
-rw-r--r--hw/xprint/ps/PsPrint.c33
-rw-r--r--hw/xprint/ps/PsWindow.c7
-rw-r--r--hw/xprint/raster/Raster.c44
-rw-r--r--hw/xwin/win.h40
-rw-r--r--hw/xwin/winallpriv.c18
-rwxr-xr-xhw/xwin/winclipboardwrappers.c1
-rw-r--r--hw/xwin/wincursor.c3
-rw-r--r--hw/xwin/winfillsp.c9
-rw-r--r--hw/xwin/winglobals.c10
-rw-r--r--hw/xwin/winmultiwindowwndproc.c2
-rw-r--r--hw/xwin/winpixmap.c7
-rw-r--r--hw/xwin/winscrinit.c3
-rw-r--r--hw/xwin/winsetsp.c9
-rwxr-xr-xhw/xwin/winwin32rootless.c2
-rwxr-xr-xhw/xwin/winwindowswm.c31
154 files changed, 1397 insertions, 1481 deletions
diff --git a/hw/darwin/darwin.h b/hw/darwin/darwin.h
index e63385882..1d0da9ff4 100644
--- a/hw/darwin/darwin.h
+++ b/hw/darwin/darwin.h
@@ -88,8 +88,8 @@ void DarwinModeBell(int volume, DeviceIntPtr pDevice, pointer ctrl, int class);
#define kern_assert(x) { if ((x) != KERN_SUCCESS) \
FatalError("assert failed on line %d of %s with kernel return 0x%x!\n", \
__LINE__, __FILE__, x); }
-#define SCREEN_PRIV(pScreen) \
- ((DarwinFramebufferPtr)pScreen->devPrivates[darwinScreenIndex].ptr)
+#define SCREEN_PRIV(pScreen) ((DarwinFramebufferPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, darwinScreenKey))
#define MIN_KEYCODE XkbMinLegalKeyCode // unfortunately, this isn't 0...
@@ -98,7 +98,7 @@ void DarwinModeBell(int volume, DeviceIntPtr pDevice, pointer ctrl, int class);
/*
* Global variables from darwin.c
*/
-extern int darwinScreenIndex; // index into pScreen.devPrivates
+extern DevPrivateKey darwinScreenKey; // index into pScreen.devPrivates
extern int darwinScreensFound;
extern io_connect_t darwinParamConnect;
extern int darwinEventReadFD;
diff --git a/hw/darwin/darwinEvents.c b/hw/darwin/darwinEvents.c
index 3d7f268ca..97ad8577e 100644
--- a/hw/darwin/darwinEvents.c
+++ b/hw/darwin/darwinEvents.c
@@ -276,7 +276,7 @@ void ProcessInputEvents(void) {
while (darwinEventQueue.head != darwinEventQueue.tail)
{
if (screenIsSaved == SCREEN_SAVER_ON)
- SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
+ SaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
e = &darwinEventQueue.events[darwinEventQueue.head];
xe = e->event;
diff --git a/hw/darwin/iokit/xfIOKit.h b/hw/darwin/iokit/xfIOKit.h
index 27d27bc70..7d9a48702 100644
--- a/hw/darwin/iokit/xfIOKit.h
+++ b/hw/darwin/iokit/xfIOKit.h
@@ -45,10 +45,10 @@ typedef struct {
unsigned char *shadowPtr;
} XFIOKitScreenRec, *XFIOKitScreenPtr;
-#define XFIOKIT_SCREEN_PRIV(pScreen) \
- ((XFIOKitScreenPtr)pScreen->devPrivates[xfIOKitScreenIndex].ptr)
+#define XFIOKIT_SCREEN_PRIV(pScreen) ((XFIOKitScreenPtr) \
+ dixLookupPrivate(&pScreen->devPrivates, xfIOKitScreenKey))
-extern int xfIOKitScreenIndex; // index into pScreen.devPrivates
+extern DevPrivateKey xfIOKitScreenKey; // index into pScreen.devPrivates
extern io_connect_t xfIOKitInputConnect;
Bool XFIOKitInitCursor(ScreenPtr pScreen);
diff --git a/hw/darwin/iokit/xfIOKitCursor.c b/hw/darwin/iokit/xfIOKitCursor.c
index e9c78c130..33ce9e417 100644
--- a/hw/darwin/iokit/xfIOKitCursor.c
+++ b/hw/darwin/iokit/xfIOKitCursor.c
@@ -72,8 +72,8 @@
#include <assert.h>
#define DUMP_DARWIN_CURSOR FALSE
-#define CURSOR_PRIV(pScreen) \
- ((XFIOKitCursorScreenPtr)pScreen->devPrivates[darwinCursorScreenIndex].ptr)
+#define CURSOR_PRIV(pScreen) ((XFIOKitCursorScreenPtr) \
+ dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey))
// The cursors format are documented in IOFramebufferShared.h.
#define RGBto34WithGamma(red, green, blue) \
@@ -98,8 +98,7 @@ typedef struct {
ColormapPtr pInstalledMap;
} XFIOKitCursorScreenRec, *XFIOKitCursorScreenPtr;
-static int darwinCursorScreenIndex = -1;
-static unsigned long darwinCursorGeneration = 0;
+static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey;
/*
===========================================================================
@@ -202,7 +201,7 @@ XFIOKitRealizeCursor8(
}
// save the result
- pCursor->devPriv[pScreen->myNum] = (pointer) newCursor;
+ dixSetPrivate(&pCursor->devPrivates, pScreen, newCursor);
return TRUE;
}
@@ -285,7 +284,7 @@ XFIOKitRealizeCursor15(
#endif
// save the result
- pCursor->devPriv[pScreen->myNum] = (pointer) newCursor;
+ dixSetPrivate(&pCursor->devPrivates, pScreen, newCursor);
return TRUE;
}
@@ -369,7 +368,7 @@ XFIOKitRealizeCursor24(
#endif
// save the result
- pCursor->devPriv[pScreen->myNum] = (pointer) newCursor;
+ dixSetPrivate(&pCursor->devPrivates, pScreen, newCursor);
return TRUE;
}
@@ -422,7 +421,7 @@ XFIOKitUnrealizeCursor(
!ScreenPriv->canHWCursor) {
result = (*ScreenPriv->spriteFuncs->UnrealizeCursor)(pScreen, pCursor);
} else {
- xfree( pCursor->devPriv[pScreen->myNum] );
+ xfree(dixLookupPrivate(&pCursor->devPrivates, pScreen));
result = TRUE;
}
@@ -476,20 +475,20 @@ XFIOKitSetCursor(
// change the cursor image in shared memory
if (dfb->bitsPerPixel == 8) {
- cursorPrivPtr newCursor =
- (cursorPrivPtr) pCursor->devPriv[pScreen->myNum];
+ cursorPrivPtr newCursor = dixLookupPrivate(&pCursor->devPrivates,
+ pScreen);
memcpy(cshmem->cursor.bw8.image[0], newCursor->image,
CURSORWIDTH*CURSORHEIGHT);
memcpy(cshmem->cursor.bw8.mask[0], newCursor->mask,
CURSORWIDTH*CURSORHEIGHT);
} else if (dfb->bitsPerPixel == 16) {
- unsigned short *newCursor =
- (unsigned short *) pCursor->devPriv[pScreen->myNum];
+ unsigned short *newCursor = dixLookupPrivate(&pCursor->devPrivates,
+ pScreen);
memcpy(cshmem->cursor.rgb.image[0], newCursor,
2*CURSORWIDTH*CURSORHEIGHT);
} else {
- unsigned int *newCursor =
- (unsigned int *) pCursor->devPriv[pScreen->myNum];
+ unsigned int *newCursor = dixLookupPrivate(&pCursor->devPrivates,
+ pScreen);
memcpy(cshmem->cursor.rgb24.image[0], newCursor,
4*CURSORWIDTH*CURSORHEIGHT);
}
@@ -678,17 +677,10 @@ XFIOKitInitCursor(
return FALSE;
}
- // allocate private storage for this screen's hardware cursor info
- if (darwinCursorGeneration != serverGeneration) {
- if ((darwinCursorScreenIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- darwinCursorGeneration = serverGeneration;
- }
-
ScreenPriv = xcalloc( 1, sizeof(XFIOKitCursorScreenRec) );
if (!ScreenPriv) return FALSE;
- pScreen->devPrivates[darwinCursorScreenIndex].ptr = (pointer) ScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, darwinCursorScreenKey, ScreenPriv);
// check if a hardware cursor is supported
if (!iokitScreen->cursorShmem->hardwareCursorCapable) {
@@ -721,7 +713,7 @@ XFIOKitInitCursor(
// initialize hardware cursor handling
PointPriv = (miPointerScreenPtr)
- pScreen->devPrivates[miPointerScreenIndex].ptr;
+ dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
PointPriv->spriteFuncs = &darwinSpriteFuncsRec;
diff --git a/hw/darwin/quartz/applewm.c b/hw/darwin/quartz/applewm.c
index 308c51074..fecafe8fb 100644
--- a/hw/darwin/quartz/applewm.c
+++ b/hw/darwin/quartz/applewm.c
@@ -42,6 +42,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "servermd.h"
#include "swaprep.h"
#include "propertyst.h"
+#include "registry.h"
#include <X11/Xatom.h>
#include "darwin.h"
#define _APPLEWM_SERVER_
@@ -127,7 +128,45 @@ AppleWMExtensionInit(
WMEventBase = extEntry->eventBase;
EventSwapVector[WMEventBase] = (EventSwapPtr) SNotifyEvent;
appleWMProcs = procsPtr;
- }
+ } else
+ return;
+
+ RegisterRequestName(WMReqCode, X_AppleWMQueryVersion,
+ APPLEWMNAME ":QueryVersion");
+ RegisterRequestName(WMReqCode, X_AppleWMFrameGetRect,
+ APPLEWMNAME ":FrameGetRect");
+ RegisterRequestName(WMReqCode, X_AppleWMFrameHitTest,
+ APPLEWMNAME ":FrameHitTest");
+ RegisterRequestName(WMReqCode, X_AppleWMFrameDraw,
+ APPLEWMNAME ":FrameDraw");
+ RegisterRequestName(WMReqCode, X_AppleWMDisableUpdate,
+ APPLEWMNAME ":DisableUpdate");
+ RegisterRequestName(WMReqCode, X_AppleWMReenableUpdate,
+ APPLEWMNAME ":ReenableUpdate");
+ RegisterRequestName(WMReqCode, X_AppleWMSelectInput,
+ APPLEWMNAME ":SelectInput");
+ RegisterRequestName(WMReqCode, X_AppleWMSetWindowMenuCheck,
+ APPLEWMNAME ":SetWindowMenuCheck");
+ RegisterRequestName(WMReqCode, X_AppleWMSetFrontProcess,
+ APPLEWMNAME ":SetFrontProcess");
+ RegisterRequestName(WMReqCode, X_AppleWMSetWindowLevel,
+ APPLEWMNAME ":SetWindowLevel");
+ RegisterRequestName(WMReqCode, X_AppleWMSetCanQuit,
+ APPLEWMNAME ":SetCanQuit");
+ RegisterRequestName(WMReqCode, X_AppleWMSetWindowMenu,
+ APPLEWMNAME ":SetWindowMenu");
+
+ RegisterEventName(WMEventBase + AppleWMControllerNotify,
+ APPLEWMNAME ":ControllerNotify");
+ RegisterEventName(WMEventBase + AppleWMActivationNotify,
+ APPLEWMNAME ":ActivationNotify");
+ RegisterEventName(WMEventBase + AppleWMPasteboardNotify,
+ APPLEWMNAME ":PasteboardNotify");
+
+ RegisterErrorName(WMErrorBase + AppleWMClientNotLocal,
+ APPLEWMNAME ":ClientNotLocal");
+ RegisterErrorName(WMErrorBase + AppleWMOperationNotSupported,
+ APPLEWMNAME ":OperationNotSupported");
}
/*ARGSUSED*/
diff --git a/hw/darwin/quartz/fullscreen/fullscreen.c b/hw/darwin/quartz/fullscreen/fullscreen.c
index 2021ea2d3..0c87536e9 100644
--- a/hw/darwin/quartz/fullscreen/fullscreen.c
+++ b/hw/darwin/quartz/fullscreen/fullscreen.c
@@ -49,18 +49,17 @@ typedef struct {
} FSScreenRec, *FSScreenPtr;
#define FULLSCREEN_PRIV(pScreen) \
- ((FSScreenPtr)pScreen->devPrivates[fsScreenIndex].ptr)
+ ((FSScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, fsScreenKey))
-static int fsScreenIndex;
+static DevPrivateKey fsScreenKey = &fsScreenKey;
static CGDirectDisplayID *quartzDisplayList = NULL;
static int quartzNumScreens = 0;
static FSScreenPtr quartzScreens[MAXSCREENS];
-static int darwinCmapPrivateIndex = -1;
-static unsigned long darwinCmapGeneration = 0;
+static DevPrivateKey darwinCmapPrivateKey = &darwinCmapPrivateKey;
-#define CMAP_PRIV(pCmap) \
- ((CGDirectPaletteRef) (pCmap)->devPrivates[darwinCmapPrivateIndex].ptr)
+#define CMAP_PRIV(pCmap) ((CGDirectPaletteRef) \
+ dixLookupPrivate(&(pCmap)->devPrivates, darwinCmapPrivateKey))
/*
=============================================================================
@@ -95,16 +94,6 @@ FSCreateColormap(
{
CGDirectPaletteRef pallete;
- // Allocate private storage for the hardware dependent colormap info.
- if (darwinCmapGeneration != serverGeneration) {
- if ((darwinCmapPrivateIndex =
- AllocateColormapPrivateIndex(FSInitCmapPrivates)) < 0)
- {
- return FALSE;
- }
- darwinCmapGeneration = serverGeneration;
- }
-
pallete = CGPaletteCreateDefaultColorPalette();
if (!pallete) return FALSE;
@@ -283,17 +272,10 @@ static void FSResumeScreen(
*/
static void FSDisplayInit(void)
{
- static unsigned long generation = 0;
CGDisplayCount quartzDisplayCount = 0;
ErrorF("Display mode: Full screen Quartz -- Direct Display\n");
- // Allocate private storage for each screen's mode specific info
- if (generation != serverGeneration) {
- fsScreenIndex = AllocateScreenPrivateIndex();
- generation = serverGeneration;
- }
-
// Find all the CoreGraphics displays
CGGetActiveDisplayList(0, NULL, &quartzDisplayCount);
quartzDisplayList = xalloc(quartzDisplayCount * sizeof(CGDirectDisplayID));
diff --git a/hw/darwin/quartz/fullscreen/quartzCursor.c b/hw/darwin/quartz/fullscreen/quartzCursor.c
index a97a36d88..ad42ef61b 100644
--- a/hw/darwin/quartz/fullscreen/quartzCursor.c
+++ b/hw/darwin/quartz/fullscreen/quartzCursor.c
@@ -56,8 +56,7 @@ typedef struct {
miPointerSpriteFuncPtr spriteFuncs;
} QuartzCursorScreenRec, *QuartzCursorScreenPtr;
-static int darwinCursorScreenIndex = -1;
-static unsigned long darwinCursorGeneration = 0;
+static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey;
static CursorPtr quartzLatentCursor = NULL;
static QD_Cursor gQDArrow; // QuickDraw arrow cursor
@@ -66,8 +65,8 @@ static CCrsrHandle currentCursor = NULL;
static pthread_mutex_t cursorMutex;
static pthread_cond_t cursorCondition;
-#define CURSOR_PRIV(pScreen) \
- ((QuartzCursorScreenPtr)pScreen->devPrivates[darwinCursorScreenIndex].ptr)
+#define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, darwinCursorScreenKey))
#define HIDE_QD_CURSOR(pScreen, visible) \
if (visible) { \
@@ -319,7 +318,7 @@ QuartzRealizeCursor(
if (!qdCursor) return FALSE;
// save the result
- pCursor->devPriv[pScreen->myNum] = (pointer) qdCursor;
+ dixSetPrivate(&pCursor->devPrivates, pScreen, qdCursor);
return TRUE;
}
@@ -346,13 +345,13 @@ QuartzUnrealizeCursor(
(pScreen, pCursor);
}
} else {
- CCrsrHandle oldCursor = (CCrsrHandle) pCursor->devPriv[pScreen->myNum];
-
+ CCrsrHandle oldCursor = dixLookupPrivate(&pCursor->devPrivates,
+ pScreen);
if (currentCursor != oldCursor) {
// This should only fail when quitting, in which case we just leak.
FreeQDCursor(oldCursor);
}
- pCursor->devPriv[pScreen->myNum] = NULL;
+ dixSetPrivate(&pCursor->devPrivates, pScreen, NULL);
return TRUE;
}
}
@@ -392,7 +391,7 @@ QuartzSetCursor(
(*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y);
ScreenPriv->qdCursorMode = TRUE;
- CHANGE_QD_CURSOR(pCursor->devPriv[pScreen->myNum]);
+ CHANGE_QD_CURSOR(dixLookupPrivate(&pCursor->devPrivates, pScreen));
SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
}
else if (quartzRootless) {
@@ -592,13 +591,6 @@ QuartzInitCursor(
return FALSE;
}
- // allocate private storage for this screen's QuickDraw cursor info
- if (darwinCursorGeneration != serverGeneration) {
- if ((darwinCursorScreenIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- darwinCursorGeneration = serverGeneration;
- }
-
ScreenPriv = xcalloc( 1, sizeof(QuartzCursorScreenRec) );
if (!ScreenPriv) return FALSE;
@@ -611,7 +603,7 @@ QuartzInitCursor(
// initialize QuickDraw cursor handling
GetQDGlobalsArrow(&gQDArrow);
PointPriv = (miPointerScreenPtr)
- pScreen->devPrivates[miPointerScreenIndex].ptr;
+ dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
PointPriv->spriteFuncs = &quartzSpriteFuncsRec;
diff --git a/hw/darwin/quartz/pseudoramiX.c b/hw/darwin/quartz/pseudoramiX.c
index 787601b5d..cdd4fffff 100644
--- a/hw/darwin/quartz/pseudoramiX.c
+++ b/hw/darwin/quartz/pseudoramiX.c
@@ -42,6 +42,7 @@ Equipment Corporation.
#include "window.h"
#include <X11/extensions/panoramiXproto.h>
#include "globals.h"
+#include "registry.h"
extern int noPseudoramiXExtension;
extern int noPanoramiXExtension;
@@ -147,6 +148,19 @@ void PseudoramiXExtensionInit(int argc, char *argv[])
PANORAMIX_PROTOCOL_NAME);
return;
}
+
+ RegisterRequestName(extEntry->base, X_PanoramiXQueryVersion,
+ PANORAMIX_PROTOCOL_NAME ":QueryVersion");
+ RegisterRequestName(extEntry->base, X_PanoramiXGetState,
+ PANORAMIX_PROTOCOL_NAME ":GetState");
+ RegisterRequestName(extEntry->base, X_PanoramiXGetScreenCount,
+ PANORAMIX_PROTOCOL_NAME ":GetScreenCount");
+ RegisterRequestName(extEntry->base, X_PanoramiXGetScreenSize,
+ PANORAMIX_PROTOCOL_NAME ":GetScreenSize");
+ RegisterRequestName(extEntry->base, X_XineramaIsActive,
+ PANORAMIX_PROTOCOL_NAME ":IsActive");
+ RegisterRequestName(extEntry->base, X_XineramaQueryScreens,
+ PANORAMIX_PROTOCOL_NAME ":QueryScreens");
}
diff --git a/hw/darwin/quartz/quartz.c b/hw/darwin/quartz/quartz.c
index 762a84b75..6f07cf2e3 100644
--- a/hw/darwin/quartz/quartz.c
+++ b/hw/darwin/quartz/quartz.c
@@ -60,7 +60,7 @@ int quartzUseAGL = 1;
int quartzEnableKeyEquivalents = 1;
int quartzServerVisible = TRUE;
int quartzServerQuitting = FALSE;
-int quartzScreenIndex = 0;
+DevPrivateKey quartzScreenKey = &quartzScreenKey;
int aquaMenuBarHeight = 0;
int noPseudoramiXExtension = FALSE;
QuartzModeProcsPtr quartzProcs = NULL;
@@ -119,14 +119,6 @@ void DarwinModeInitOutput(
int argc,
char **argv )
{
- static unsigned long generation = 0;
-
- // Allocate private storage for each screen's Quartz specific info
- if (generation != serverGeneration) {
- quartzScreenIndex = AllocateScreenPrivateIndex();
- generation = serverGeneration;
- }
-
if (serverGeneration == 0) {
QuartzAudioInit();
}
diff --git a/hw/darwin/quartz/quartzCommon.h b/hw/darwin/quartz/quartzCommon.h
index f5dff662c..5e199d362 100644
--- a/hw/darwin/quartz/quartzCommon.h
+++ b/hw/darwin/quartz/quartzCommon.h
@@ -58,7 +58,7 @@ typedef struct {
} QuartzScreenRec, *QuartzScreenPtr;
#define QUARTZ_PRIV(pScreen) \
- ((QuartzScreenPtr)pScreen->devPrivates[quartzScreenIndex].ptr)
+ ((QuartzScreenPtr)dixLookupPrivate(&pScreen->devPrivates, quartzScreenKey))
// Data stored at startup for Cocoa front end
extern int quartzEventWriteFD;
@@ -73,7 +73,7 @@ extern int quartzEnableKeyEquivalents;
// Other shared data
extern int quartzServerVisible;
extern int quartzServerQuitting;
-extern int quartzScreenIndex;
+extern DevPrivateKey quartzScreenKey;
extern int aquaMenuBarHeight;
// Name of GLX bundle for native OpenGL
diff --git a/hw/darwin/quartz/quartzCursor.c b/hw/darwin/quartz/quartzCursor.c
index 0fa04e677..8182a7ad3 100644
--- a/hw/darwin/quartz/quartzCursor.c
+++ b/hw/darwin/quartz/quartzCursor.c
@@ -56,8 +56,7 @@ typedef struct {
miPointerSpriteFuncPtr spriteFuncs;
} QuartzCursorScreenRec, *QuartzCursorScreenPtr;
-static int darwinCursorScreenIndex = -1;
-static unsigned long darwinCursorGeneration = 0;
+static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey;
static CursorPtr quartzLatentCursor = NULL;
static QD_Cursor gQDArrow; // QuickDraw arrow cursor
@@ -66,8 +65,8 @@ static CCrsrHandle currentCursor = NULL;
static pthread_mutex_t cursorMutex;
static pthread_cond_t cursorCondition;
-#define CURSOR_PRIV(pScreen) \
- ((QuartzCursorScreenPtr)pScreen->devPrivates[darwinCursorScreenIndex].ptr)
+#define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \
+ dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey))
#define HIDE_QD_CURSOR(pScreen, visible) \
if (visible) { \
@@ -321,7 +320,7 @@ QuartzRealizeCursor(
if (!qdCursor) return FALSE;
// save the result
- pCursor->devPriv[pScreen->myNum] = (pointer) qdCursor;
+ dixSetPrivate(&pCursor->devPrivates, pScreen, qdCursor);
return TRUE;
}
@@ -348,13 +347,13 @@ QuartzUnrealizeCursor(
(pScreen, pCursor);
}
} else {
- CCrsrHandle oldCursor = (CCrsrHandle) pCursor->devPriv[pScreen->myNum];
-
+ CCrsrHandle oldCursor = dixLookupPrivate(&pCursor->devPrivates,
+ pScreen);
if (currentCursor != oldCursor) {
// This should only fail when quitting, in which case we just leak.
FreeQDCursor(oldCursor);
}
- pCursor->devPriv[pScreen->myNum] = NULL;
+ dixSetPrivate(&pCursor->devPrivates, pScreen, NULL);
return TRUE;
}
}
@@ -394,7 +393,7 @@ QuartzSetCursor(
(*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y);
ScreenPriv->qdCursorMode = TRUE;
- CHANGE_QD_CURSOR(pCursor->devPriv[pScreen->myNum]);
+ CHANGE_QD_CURSOR(dixLookupPrivate(&pCursor->devPrivates, pScreen));
SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
}
else if (quartzRootless) {
@@ -594,13 +593,6 @@ QuartzInitCursor(
return FALSE;
}
- // allocate private storage for this screen's QuickDraw cursor info
- if (darwinCursorGeneration != serverGeneration) {
- if ((darwinCursorScreenIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- darwinCursorGeneration = serverGeneration;
- }
-
ScreenPriv = xcalloc( 1, sizeof(QuartzCursorScreenRec) );
if (!ScreenPriv) return FALSE;
@@ -613,7 +605,7 @@ QuartzInitCursor(
// initialize QuickDraw cursor handling
GetQDGlobalsArrow(&gQDArrow);
PointPriv = (miPointerScreenPtr)
- pScreen->devPrivates[miPointerScreenIndex].ptr;
+ dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
PointPriv->spriteFuncs = &quartzSpriteFuncsRec;
diff --git a/hw/darwin/quartz/xpr/appledri.c b/hw/darwin/quartz/xpr/appledri.c
index 70b740077..d9690fdb1 100644
--- a/hw/darwin/quartz/xpr/appledri.c
+++ b/hw/darwin/quartz/xpr/appledri.c
@@ -53,6 +53,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "swaprep.h"
#include "dri.h"
#include "dristruct.h"
+#include "registry.h"
static int DRIErrorBase = 0;
@@ -92,7 +93,33 @@ AppleDRIExtensionInit(void)
DRIErrorBase = extEntry->errorBase;
DRIEventBase = extEntry->eventBase;
EventSwapVector[DRIEventBase] = (EventSwapPtr) SNotifyEvent;
- }
+ } else
+ return;
+
+ RegisterRequestName(DRIReqCode, X_AppleDRIQueryVersion,
+ APPLEDRINAME ":QueryVersion");
+ RegisterRequestName(DRIReqCode, X_AppleDRIQueryDirectRenderingCapable,
+ APPLEDRINAME ":QueryDirectRenderingCapable");
+ RegisterRequestName(DRIReqCode, X_AppleDRICreateSurface,
+ APPLEDRINAME ":CreateSurface");
+ RegisterRequestName(DRIReqCode, X_AppleDRIDestroySurface,
+ APPLEDRINAME ":DestroySurface");
+ RegisterRequestName(DRIReqCode, X_AppleDRIAuthConnection,
+ APPLEDRINAME ":AuthConnection");
+
+ RegisterEventName(DRIEventBase + AppleDRIObsoleteEvent1,
+ APPLEDRINAME ":ObsoleteEvent1");
+ RegisterEventName(DRIEventBase + AppleDRIObsoleteEvent2,
+ APPLEDRINAME ":ObsoleteEvent2");
+ RegisterEventName(DRIEventBase + AppleDRIObsoleteEvent3,
+ APPLEDRINAME ":ObsoleteEvent3");
+ RegisterEventName(DRIEventBase + AppleDRISurfaceNotify,
+ APPLEDRINAME ":SurfaceNotify");
+
+ RegisterErrorName(DRIEventBase + AppleDRIClientNotLocal,
+ APPLEDRINAME ":ClientNotLocal");
+ RegisterErrorName(DRIEventBase + AppleDRIOperationNotSupported,
+ APPLEDRINAME ":OperationNotSupported");
}
/*ARGSUSED*/
diff --git a/hw/darwin/quartz/xpr/dri.c b/hw/darwin/quartz/xpr/dri.c
index fd0bff1a9..379d3c0e9 100644
--- a/hw/darwin/quartz/xpr/dri.c
+++ b/hw/darwin/quartz/xpr/dri.c
@@ -64,9 +64,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <AvailabilityMacros.h>
-static int DRIScreenPrivIndex = -1;
-static int DRIWindowPrivIndex = -1;
-static int DRIPixmapPrivIndex = -1;
+static DevPrivateKey DRIScreenPrivKey = &DRIScreenPrivKey;
+static DevPrivateKey DRIWindowPrivKey = &DRIWindowPrivKey;
+static DevPrivateKey DRIPixmapPrivKey = &DRIPixmapPrivKey;
static RESTYPE DRIDrawablePrivResType;
@@ -178,11 +178,11 @@ DRIScreenInit(ScreenPtr pScreen)
pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec));
if (!pDRIPriv) {
- pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
return FALSE;
}
- pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer) pDRIPriv;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, pDRIPriv);
pDRIPriv->directRenderingSupport = TRUE;
pDRIPriv->nrWindows = 0;
@@ -213,13 +213,6 @@ DRIFinishScreenInit(ScreenPtr pScreen)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
- /* Allocate zero sized private area for each window. Should a window
- * become a DRI window, we'll hang a DRIWindowPrivateRec off of this
- * private index.
- */
- if (!AllocateWindowPrivate(pScreen, DRIWindowPrivIndex, 0))
- return FALSE;
-
/* Wrap DRI support */
pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree;
pScreen->ValidateTree = DRIValidateTree;
@@ -248,31 +241,13 @@ DRICloseScreen(ScreenPtr pScreen)
if (pDRIPriv && pDRIPriv->directRenderingSupport) {
xfree(pDRIPriv);
- pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
}
}
Bool
DRIExtensionInit(void)
{
- static unsigned long DRIGeneration = 0;
-
- if (DRIGeneration != serverGeneration) {
- if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- DRIGeneration = serverGeneration;
- }
-
- /*
- * Allocate a window private index with a zero sized private area for
- * each window, then should a window become a DRI window, we'll hang
- * a DRIWindowPrivateRec off of this private index. Do same for pixmaps.
- */
- if ((DRIWindowPrivIndex = AllocateWindowPrivateIndex()) < 0)
- return FALSE;
- if ((DRIPixmapPrivIndex = AllocatePixmapPrivateIndex()) < 0)
- return FALSE;
-
DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete);
return TRUE;
@@ -416,7 +391,8 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
}
/* save private off of preallocated index */
- pWin->devPrivates[DRIWindowPrivIndex].ptr = (pointer)pDRIDrawablePriv;
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey,
+ pDRIDrawablePriv);
}
}
@@ -449,7 +425,8 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
}
/* save private off of preallocated index */
- pPix->devPrivates[DRIPixmapPrivIndex].ptr = (pointer)pDRIDrawablePriv;
+ dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey,
+ pDRIDrawablePriv);
}
}
#endif
@@ -576,9 +553,9 @@ DRIDrawablePrivDelete(pointer pResource, XID id)
xfree(pDRIDrawablePriv);
if (pDrawable->type == DRAWABLE_WINDOW) {
- pWin->devPrivates[DRIWindowPrivIndex].ptr = NULL;
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL);
} else if (pDrawable->type == DRAWABLE_PIXMAP) {
- pPix->devPrivates[DRIPixmapPrivIndex].ptr = NULL;
+ dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL);
}
--pDRIPriv->nrWindows;
diff --git a/hw/darwin/quartz/xpr/dristruct.h b/hw/darwin/quartz/xpr/dristruct.h
index 9a3d01c9b..19d78a973 100644
--- a/hw/darwin/quartz/xpr/dristruct.h
+++ b/hw/darwin/quartz/xpr/dristruct.h
@@ -40,15 +40,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define DRI_MAX_DRAWABLES 256
-#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) \
- ((DRIWindowPrivIndex < 0) ? \
- NULL : \
- ((DRIDrawablePrivPtr)((pWin)->devPrivates[DRIWindowPrivIndex].ptr)))
+#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey))
-#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) \
- ((DRIPixmapPrivIndex < 0) ? \
- NULL : \
- ((DRIDrawablePrivPtr)((pPix)->devPrivates[DRIPixmapPrivIndex].ptr)))
+#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \
+ dixLookupPrivate(&(pPix)->devPrivates, DRIPixmapPrivKey))
typedef struct _DRIDrawablePrivRec
{
@@ -61,13 +57,12 @@ typedef struct _DRIDrawablePrivRec
x_list *notifiers; /* list of (FUN . DATA) */
} DRIDrawablePrivRec, *DRIDrawablePrivPtr;
-#define DRI_SCREEN_PRIV(pScreen) \
- ((DRIScreenPrivIndex < 0) ? \
- NULL : \
- ((DRIScreenPrivPtr)((pScreen)->devPrivates[DRIScreenPrivIndex].ptr)))
+#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey))
#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
- (screenInfo.screens[screenIndex]->devPrivates[DRIScreenPrivIndex].ptr))
+ dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \
+ DRIScreenPrivKey))
typedef struct _DRIScreenPrivRec
diff --git a/hw/darwin/quartz/xpr/xprCursor.c b/hw/darwin/quartz/xpr/xprCursor.c
index 10d326444..e3ae9e977 100644
--- a/hw/darwin/quartz/xpr/xprCursor.c
+++ b/hw/darwin/quartz/xpr/xprCursor.c
@@ -51,11 +51,10 @@ typedef struct {
miPointerSpriteFuncPtr spriteFuncs;
} QuartzCursorScreenRec, *QuartzCursorScreenPtr;
-static int darwinCursorScreenIndex = -1;
-static unsigned long darwinCursorGeneration = 0;
+static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey;
-#define CURSOR_PRIV(pScreen) \
- ((QuartzCursorScreenPtr)pScreen->devPrivates[darwinCursorScreenIndex].ptr)
+#define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \
+ dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey))
static Bool
@@ -367,15 +366,6 @@ QuartzInitCursor(ScreenPtr pScreen)
if (!miDCInitialize(pScreen, &quartzScreenFuncsRec))
return FALSE;
- /* allocate private storage for this screen's QuickDraw cursor info */
- if (darwinCursorGeneration != serverGeneration)
- {
- if ((darwinCursorScreenIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
-
- darwinCursorGeneration = serverGeneration;
- }
-
ScreenPriv = xcalloc(1, sizeof(QuartzCursorScreenRec));
if (ScreenPriv == NULL)
return FALSE;
@@ -386,7 +376,8 @@ QuartzInitCursor(ScreenPtr pScreen)
ScreenPriv->QueryBestSize = pScreen->QueryBestSize;
pScreen->QueryBestSize = QuartzCursorQueryBestSize;
- PointPriv = (miPointerScreenPtr) pScreen->devPrivates[miPointerScreenIndex].ptr;
+ PointPriv = (miPointerScreenPtr)
+ dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
PointPriv->spriteFuncs = &quartzSpriteFuncsRec;
diff --git a/hw/darwin/quartz/xpr/xprFrame.c b/hw/darwin/quartz/xpr/xprFrame.c
index ddb6d2dda..5fc4c155f 100644
--- a/hw/darwin/quartz/xpr/xprFrame.c
+++ b/hw/darwin/quartz/xpr/xprFrame.c
@@ -337,7 +337,7 @@ xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects,
void
xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin)
{
- DeleteProperty(oldWin, xa_native_window_id());
+ DeleteProperty(serverClient, oldWin, xa_native_window_id());
xprSetNativeProperty(pFrame);
}
diff --git a/hw/dmx/dmx.c b/hw/dmx/dmx.c
index 5f1fc0546..840356f02 100644
--- a/hw/dmx/dmx.c
+++ b/hw/dmx/dmx.c
@@ -54,6 +54,7 @@
#define EXTENSION_PROC_ARGS void *
#include "extnsionst.h"
#include "opaque.h"
+#include "registry.h"
#include "dmxextension.h"
#include <X11/extensions/dmxproto.h>
@@ -126,6 +127,45 @@ void DMXExtensionInit(void)
ProcDMXDispatch, SProcDMXDispatch,
DMXResetProc, StandardMinorOpcode)))
DMXCode = extEntry->base;
+ else
+ return;
+
+ RegisterRequestName(DMXCode, X_DMXQueryVersion,
+ DMX_EXTENSION_NAME ":DMXQueryVersion");
+ RegisterRequestName(DMXCode, X_DMXGetScreenCount,
+ DMX_EXTENSION_NAME ":DMXGetScreenCount");
+ RegisterRequestName(DMXCode, X_DMXGetScreenInformationDEPRECATED,
+ DMX_EXTENSION_NAME ":DMXGetScreenInfoDEPRECATED");
+ RegisterRequestName(DMXCode, X_DMXGetWindowAttributes,
+ DMX_EXTENSION_NAME ":DMXGetWindowAttributes");
+ RegisterRequestName(DMXCode, X_DMXGetInputCount,
+ DMX_EXTENSION_NAME ":DMXGetInputCount");
+ RegisterRequestName(DMXCode, X_DMXGetInputAttributes,
+ DMX_EXTENSION_NAME ":DMXGetInputAttributes");
+ RegisterRequestName(DMXCode, X_DMXForceWindowCreationDEPRECATED,
+ DMX_EXTENSION_NAME ":DMXForceWindowCreationDEPRECATED");
+ RegisterRequestName(DMXCode, X_DMXReconfigureScreenDEPRECATED,
+ DMX_EXTENSION_NAME ":DMXReconfigureScreenDEPRECATED");
+ RegisterRequestName(DMXCode, X_DMXSync,
+ DMX_EXTENSION_NAME ":DMXSync");
+ RegisterRequestName(DMXCode, X_DMXForceWindowCreation,
+ DMX_EXTENSION_NAME ":DMXForceWindowCreation");
+ RegisterRequestName(DMXCode, X_DMXGetScreenAttributes,
+ DMX_EXTENSION_NAME ":DMXGetScreenAttributes");
+ RegisterRequestName(DMXCode, X_DMXChangeScreensAttributes,
+ DMX_EXTENSION_NAME ":DMXChangeScreensAttributes");
+ RegisterRequestName(DMXCode, X_DMXAddScreen,
+ DMX_EXTENSION_NAME ":DMXAddScreen");
+ RegisterRequestName(DMXCode, X_DMXRemoveScreen,
+ DMX_EXTENSION_NAME ":DMXRemoveScreen");
+ RegisterRequestName(DMXCode, X_DMXGetDesktopAttributes,
+ DMX_EXTENSION_NAME ":DMXGetDesktopAttributes");
+ RegisterRequestName(DMXCode, X_DMXChangeDesktopAttributes,
+ DMX_EXTENSION_NAME ":DMXChangeDesktopAttributes");
+ RegisterRequestName(DMXCode, X_DMXAddInput,
+ DMX_EXTENSION_NAME ":DMXAddInput");
+ RegisterRequestName(DMXCode, X_DMXRemoveInput,
+ DMX_EXTENSION_NAME ":DMXRemoveInput");
}
static void dmxSetScreenAttribute(int bit, DMXScreenAttributesPtr attr,
diff --git a/hw/dmx/dmxcmap.c b/hw/dmx/dmxcmap.c
index 949d7d689..4aa586aff 100644
--- a/hw/dmx/dmxcmap.c
+++ b/hw/dmx/dmxcmap.c
@@ -46,24 +46,10 @@
#include "micmap.h"
-static int dmxInitColormapPrivateFunc(ColormapPtr pColormap, int index)
-{
- return TRUE;
-}
-
static Bool dmxAllocateColormapPrivates(ColormapPtr pColormap)
{
- static unsigned long dmxColormapGeneration;
dmxColormapPrivPtr pCmapPriv;
- if (dmxColormapGeneration != serverGeneration) {
- if ((dmxColormapPrivateIndex
- = AllocateColormapPrivateIndex(dmxInitColormapPrivateFunc)) < 0)
- return FALSE;
-
- dmxColormapGeneration = serverGeneration;
- }
-
pCmapPriv = (dmxColormapPrivPtr)xalloc(sizeof(*pCmapPriv));
if (!pCmapPriv)
return FALSE;
diff --git a/hw/dmx/dmxcmap.h b/hw/dmx/dmxcmap.h
index 228f8662e..f968f8622 100644
--- a/hw/dmx/dmxcmap.h
+++ b/hw/dmx/dmxcmap.h
@@ -56,15 +56,14 @@ extern Bool dmxBECreateColormap(ColormapPtr pColormap);
extern Bool dmxBEFreeColormap(ColormapPtr pColormap);
/** Private index. \see dmxcmap.c \see dmxscrinit.c \see dmxwindow.c */
-extern int dmxColormapPrivateIndex;
+extern DevPrivateKey dmxColormapPrivateKey;
/** Set colormap private structure. */
#define DMX_SET_COLORMAP_PRIV(_pCMap, _pCMapPriv) \
- (_pCMap)->devPrivates[dmxColormapPrivateIndex].ptr \
- = (pointer)(_pCMapPriv);
+ dixSetPrivate(&(_pCMap)->devPrivates, dmxColormapPrivateKey, _pCMapPriv)
/** Get colormap private structure. */
-#define DMX_GET_COLORMAP_PRIV(_pCMap) \
- (dmxColormapPrivPtr)(_pCMap)->devPrivates[dmxColormapPrivateIndex].ptr
+#define DMX_GET_COLORMAP_PRIV(_pCMap) (dmxColormapPrivPtr) \
+ dixLookupPrivate(&(_pCMap)->devPrivates, dmxColormapPrivateKey)
#endif /* DMXCMAP_H */
diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c
index 1ad199d58..8a801169c 100644
--- a/hw/dmx/dmxcursor.c
+++ b/hw/dmx/dmxcursor.c
@@ -662,8 +662,8 @@ static Bool _dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
DMXDBG2("_dmxRealizeCursor(%d,%p)\n", pScreen->myNum, pCursor);
- pCursor->devPriv[pScreen->myNum] = xalloc(sizeof(*pCursorPriv));
- if (!pCursor->devPriv[pScreen->myNum])
+ DMX_SET_CURSOR_PRIV(pCursor, pScreen, xalloc(sizeof(*pCursorPriv)));
+ if (!DMX_GET_CURSOR_PRIV(pCursor, pScreen))
return FALSE;
pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
@@ -700,9 +700,9 @@ static Bool _dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
if (dmxScreen->beDisplay) {
if (dmxBEFreeCursor(pScreen, pCursor))
- xfree(pCursor->devPriv[pScreen->myNum]);
+ xfree(DMX_GET_CURSOR_PRIV(pCursor, pScreen));
}
- pCursor->devPriv[pScreen->myNum] = NULL;
+ DMX_SET_CURSOR_PRIV(pCursor, pScreen, NULL);
return TRUE;
}
diff --git a/hw/dmx/dmxcursor.h b/hw/dmx/dmxcursor.h
index 7b70c6250..d909bd01e 100644
--- a/hw/dmx/dmxcursor.h
+++ b/hw/dmx/dmxcursor.h
@@ -63,7 +63,10 @@ extern void dmxHideCursor(DMXScreenInfo *dmxScreen);
extern void dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor);
extern Bool dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor);
-#define DMX_GET_CURSOR_PRIV(_pCursor, _pScreen) \
- (dmxCursorPrivPtr)(_pCursor)->devPriv[(_pScreen)->myNum]
+#define DMX_GET_CURSOR_PRIV(_pCursor, _pScreen) \
+ ((dmxCursorPrivPtr)dixLookupPrivate(&(_pCursor)->devPrivates, _pScreen))
+
+#define DMX_SET_CURSOR_PRIV(_pCursor, _pScreen, v) \
+ dixSetPrivate(&(_pCursor)->devPrivates, _pScreen, v)
#endif /* DMXCURSOR_H */
diff --git a/hw/dmx/dmxdpms.c b/hw/dmx/dmxdpms.c
index 5c176dfc3..8c745a6aa 100644
--- a/hw/dmx/dmxdpms.c
+++ b/hw/dmx/dmxdpms.c
@@ -175,9 +175,9 @@ void dmxDPMSTerm(DMXScreenInfo *dmxScreen)
void dmxDPMSWakeup(void)
{
if (screenIsSaved == SCREEN_SAVER_ON)
- SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset);
+ SaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
#ifdef DPMSExtension
- if (DPMSPowerLevel) DPMSSet(0);
+ if (DPMSPowerLevel) DPMSSet(serverClient, 0);
#endif
}
@@ -190,11 +190,11 @@ Bool DPMSSupported(void)
}
/** This is used by clients (e.g., xset) to set the DPMS level. */
-void DPMSSet(int level)
+int DPMSSet(ClientPtr client, int level)
{
int i;
- if (!dpmsSupported) return;
+ if (!dpmsSupported) return Success;
if (level < 0) level = DPMSModeOn;
if (level > 3) level = DPMSModeOff;
@@ -208,5 +208,6 @@ void DPMSSet(int level)
dmxSync(dmxScreen, FALSE);
}
}
+ return Success;
}
#endif
diff --git a/hw/dmx/dmxfont.c b/hw/dmx/dmxfont.c
index 500b5682a..b70f7d2df 100644
--- a/hw/dmx/dmxfont.c
+++ b/hw/dmx/dmxfont.c
@@ -66,7 +66,7 @@ static char **dmxGetFontPath(int *npaths)
char *newfp;
int len, l, i;
- paths = GetFontPath(npaths, &len);
+ GetFontPath(serverClient, npaths, &len, &paths);
newfp = xalloc(*npaths + len);
c = (unsigned char *)newfp;
@@ -194,7 +194,7 @@ static int dmxProcSetFontPath(ClientPtr client)
if (total >= 4)
return BadLength;
- tmpFontPath = GetFontPath(&nOldPaths, &lenOldPaths);
+ GetFontPath(serverClient, &nOldPaths, &lenOldPaths, &tmpFontPath);
oldFontPath = xalloc(nOldPaths + lenOldPaths);
memmove(oldFontPath, tmpFontPath, nOldPaths + lenOldPaths);
@@ -361,7 +361,8 @@ Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
}
}
- if (SetFontPath(NULL, newnpaths, (unsigned char *)newfp, &error)) {
+ if (SetFontPath(serverClient, newnpaths, (unsigned char *)newfp,
+ &error)) {
/* Note that this should never happen since all of the
* FPEs were previously valid. */
dmxLog(dmxError, "Cannot reset the default font path.\n");
diff --git a/hw/dmx/dmxgc.c b/hw/dmx/dmxgc.c
index 981f64d0a..ce1730cff 100644
--- a/hw/dmx/dmxgc.c
+++ b/hw/dmx/dmxgc.c
@@ -82,13 +82,9 @@ static GCOps dmxGCOps = {
dmxPushPixels
};
-/** Initialize the GC on \a pScreen, which currently involves allocating
- * the GC private associated with this screen. */
+/** Initialize the GC on \a pScreen */
Bool dmxInitGC(ScreenPtr pScreen)
{
- if (!AllocateGCPrivate(pScreen, dmxGCPrivateIndex, sizeof(dmxGCPrivRec)))
- return FALSE;
-
return TRUE;
}
diff --git a/hw/dmx/dmxgc.h b/hw/dmx/dmxgc.h
index 3d49f6735..2da3ba85e 100644
--- a/hw/dmx/dmxgc.h
+++ b/hw/dmx/dmxgc.h
@@ -64,11 +64,11 @@ extern void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC);
extern Bool dmxBEFreeGC(GCPtr pGC);
/** Private index. \see dmxgc.c \see dmxscrinit.c */
-extern int dmxGCPrivateIndex;
+extern DevPrivateKey dmxGCPrivateKey;
/** Get private. */
#define DMX_GET_GC_PRIV(_pGC) \
- (dmxGCPrivPtr)(_pGC)->devPrivates[dmxGCPrivateIndex].ptr
+ (dmxGCPrivPtr)dixLookupPrivate(&(_pGC)->devPrivates, dmxGCPrivateKey)
#define DMX_GC_FUNC_PROLOGUE(_pGC) \
do { \
diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c
index bbb744c45..37dfa10ac 100644
--- a/hw/dmx/dmxpict.c
+++ b/hw/dmx/dmxpict.c
@@ -144,8 +144,7 @@ Bool dmxPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
if (!miPictureInit(pScreen, formats, nformats))
return FALSE;
- if (!AllocatePicturePrivate(pScreen, dmxPictPrivateIndex,
- sizeof(dmxPictPrivRec)))
+ if (!dixRequestPrivate(dmxPictPrivateKey, sizeof(dmxPictPrivRec)))
return FALSE;
ps = GetPictureScreen(pScreen);
diff --git a/hw/dmx/dmxpict.h b/hw/dmx/dmxpict.h
index c178ef39c..a81eb7d37 100644
--- a/hw/dmx/dmxpict.h
+++ b/hw/dmx/dmxpict.h
@@ -116,19 +116,19 @@ extern Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet);
extern int dmxBECreatePicture(PicturePtr pPicture);
extern Bool dmxBEFreePicture(PicturePtr pPicture);
-extern int dmxPictPrivateIndex; /**< Index for picture private data */
-extern int dmxGlyphSetPrivateIndex; /**< Index for glyphset private data */
+extern DevPrivateKey dmxPictPrivateKey; /**< Index for picture private data */
+extern DevPrivateKey dmxGlyphSetPrivateKey; /**< Index for glyphset private data */
/** Get the picture private data given a picture pointer */
#define DMX_GET_PICT_PRIV(_pPict) \
- (dmxPictPrivPtr)(_pPict)->devPrivates[dmxPictPrivateIndex].ptr
+ (dmxPictPrivPtr)dixLookupPrivate(&(_pPict)->devPrivates, dmxPictPrivateKey)
/** Set the glyphset private data given a glyphset pointer */
#define DMX_SET_GLYPH_PRIV(_pGlyph, _pPriv) \
- GlyphSetSetPrivate((_pGlyph), dmxGlyphSetPrivateIndex, (_pPriv))
+ GlyphSetSetPrivate((_pGlyph), dmxGlyphSetPrivateKey, (_pPriv))
/** Get the glyphset private data given a glyphset pointer */
#define DMX_GET_GLYPH_PRIV(_pGlyph) \
- (dmxGlyphPrivPtr)GlyphSetGetPrivate((_pGlyph), dmxGlyphSetPrivateIndex)
+ (dmxGlyphPrivPtr)GlyphSetGetPrivate((_pGlyph), dmxGlyphSetPrivateKey)
#endif /* DMXPICT_H */
diff --git a/hw/dmx/dmxpixmap.c b/hw/dmx/dmxpixmap.c
index acc08c38a..d24988204 100644
--- a/hw/dmx/dmxpixmap.c
+++ b/hw/dmx/dmxpixmap.c
@@ -44,12 +44,12 @@
#include "pixmapstr.h"
#include "servermd.h"
+#include "privates.h"
/** Initialize a private area in \a pScreen for pixmap information. */
Bool dmxInitPixmap(ScreenPtr pScreen)
{
- if (!AllocatePixmapPrivate(pScreen, dmxPixPrivateIndex,
- sizeof(dmxPixPrivRec)))
+ if (!dixRequestPrivate(dmxPixPrivateKey, sizeof(dmxPixPrivRec)))
return FALSE;
return TRUE;
@@ -173,6 +173,7 @@ Bool dmxDestroyPixmap(PixmapPtr pPixmap)
dmxSync(dmxScreen, FALSE);
}
}
+ dixFreePrivates(pPixmap->devPrivates);
xfree(pPixmap);
#if 0
diff --git a/hw/dmx/dmxpixmap.h b/hw/dmx/dmxpixmap.h
index 5cca7f44a..64418340c 100644
--- a/hw/dmx/dmxpixmap.h
+++ b/hw/dmx/dmxpixmap.h
@@ -58,10 +58,10 @@ extern void dmxBECreatePixmap(PixmapPtr pPixmap);
extern Bool dmxBEFreePixmap(PixmapPtr pPixmap);
/** Private index. \see dmxpicmap.h \see dmxscrinit.c */
-extern int dmxPixPrivateIndex;
+extern DevPrivateKey dmxPixPrivateKey;
/** Get pixmap private pointer. */
#define DMX_GET_PIXMAP_PRIV(_pPix) \
- (dmxPixPrivPtr)(_pPix)->devPrivates[dmxPixPrivateIndex].ptr
+ (dmxPixPrivPtr)dixLookupPrivate(&(_pPix)->devPrivates, dmxPixPrivateKey)
#endif /* DMXPIXMAP_H */
diff --git a/hw/dmx/dmxscrinit.c b/hw/dmx/dmxscrinit.c
index a78e3ae8d..1d12ec32d 100644
--- a/hw/dmx/dmxscrinit.c
+++ b/hw/dmx/dmxscrinit.c
@@ -67,15 +67,15 @@ static Bool dmxSaveScreen(ScreenPtr pScreen, int what);
static unsigned long dmxGeneration;
static unsigned long *dmxCursorGeneration;
-int dmxGCPrivateIndex; /**< Private index for GCs */
-int dmxWinPrivateIndex; /**< Private index for Windows */
-int dmxPixPrivateIndex; /**< Private index for Pixmaps */
+DevPrivateKey dmxGCPrivateKey = &dmxGCPrivateKey; /**< Private index for GCs */
+DevPrivateKey dmxWinPrivateKey = &dmxWinPrivateKey; /**< Private index for Windows */
+DevPrivateKey dmxPixPrivateKey = &dmxPixPrivateKey; /**< Private index for Pixmaps */
int dmxFontPrivateIndex; /**< Private index for Fonts */
-int dmxScreenPrivateIndex; /**< Private index for Screens */
-int dmxColormapPrivateIndex; /**< Private index for Colormaps */
+DevPrivateKey dmxScreenPrivateKey = &dmxScreenPrivateKey; /**< Private index for Screens */
+DevPrivateKey dmxColormapPrivateKey = &dmxColormapPrivateKey; /**< Private index for Colormaps */
#ifdef RENDER
-int dmxPictPrivateIndex; /**< Private index for Picts */
-int dmxGlyphSetPrivateIndex; /**< Private index for GlyphSets */
+DevPrivateKey dmxPictPrivateKey = &dmxPictPrivateKey; /**< Private index for Picts */
+DevPrivateKey dmxGlyphSetPrivateKey = &dmxGlyphSetPrivateKey; /**< Private index for GlyphSets */
#endif
/** Initialize the parts of screen \a idx that require access to the
@@ -208,43 +208,11 @@ Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
int i, j;
if (dmxGeneration != serverGeneration) {
-#ifdef RENDER
- /* Allocate picture private index */
- dmxPictPrivateIndex = AllocatePicturePrivateIndex();
- if (dmxPictPrivateIndex == -1)
- return FALSE;
-
- /* Allocate glyph set private index */
- dmxGlyphSetPrivateIndex = AllocateGlyphSetPrivateIndex();
- if (dmxGlyphSetPrivateIndex == -1)
- return FALSE;
-#endif
-
- /* Allocate GC private index */
- dmxGCPrivateIndex = AllocateGCPrivateIndex();
- if (dmxGCPrivateIndex == -1)
- return FALSE;
-
- /* Allocate window private index */
- dmxWinPrivateIndex = AllocateWindowPrivateIndex();
- if (dmxWinPrivateIndex == -1)
- return FALSE;
-
- /* Allocate pixmap private index */
- dmxPixPrivateIndex = AllocatePixmapPrivateIndex();
- if (dmxPixPrivateIndex == -1)
- return FALSE;
-
/* Allocate font private index */
dmxFontPrivateIndex = AllocateFontPrivateIndex();
if (dmxFontPrivateIndex == -1)
return FALSE;
- /* Allocate screen private index */
- dmxScreenPrivateIndex = AllocateScreenPrivateIndex();
- if (dmxScreenPrivateIndex == -1)
- return FALSE;
-
dmxGeneration = serverGeneration;
}
diff --git a/hw/dmx/dmxscrinit.h b/hw/dmx/dmxscrinit.h
index 46a0a00a4..a4642350c 100644
--- a/hw/dmx/dmxscrinit.h
+++ b/hw/dmx/dmxscrinit.h
@@ -41,7 +41,7 @@
#include "scrnintstr.h"
/** Private index. \see dmxscrrinit.c \see input/dmxconcole.c */
-extern int dmxScreenPrivateIndex;
+extern DevPrivateKey dmxScreenPrivateKey;
extern Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[]);
diff --git a/hw/dmx/dmxwindow.c b/hw/dmx/dmxwindow.c
index 7ccecfb5b..7494e6df2 100644
--- a/hw/dmx/dmxwindow.c
+++ b/hw/dmx/dmxwindow.c
@@ -64,8 +64,7 @@ static void dmxDoSetShape(WindowPtr pWindow);
/** Initialize the private area for the window functions. */
Bool dmxInitWindow(ScreenPtr pScreen)
{
- if (!AllocateWindowPrivate(pScreen, dmxWinPrivateIndex,
- sizeof(dmxWinPrivRec)))
+ if (!dixRequestPrivate(dmxWinPrivateKey, sizeof(dmxWinPrivRec)))
return FALSE;
return TRUE;
diff --git a/hw/dmx/dmxwindow.h b/hw/dmx/dmxwindow.h
index 79f85ac3a..72c76aa3b 100644
--- a/hw/dmx/dmxwindow.h
+++ b/hw/dmx/dmxwindow.h
@@ -103,11 +103,11 @@ extern void dmxSetShape(WindowPtr pWindow);
#endif
/** Private index. \see dmxwindow.c \see dmxscrinit.c */
-extern int dmxWinPrivateIndex;
+extern DevPrivateKey dmxWinPrivateKey;
/** Get window private pointer. */
-#define DMX_GET_WINDOW_PRIV(_pWin) \
- ((dmxWinPrivPtr)(_pWin)->devPrivates[dmxWinPrivateIndex].ptr)
+#define DMX_GET_WINDOW_PRIV(_pWin) ((dmxWinPrivPtr) \
+ dixLookupPrivate(&(_pWin)->devPrivates, dmxWinPrivateKey))
/* All of these macros are only used in dmxwindow.c */
#define DMX_WINDOW_FUNC_PROLOGUE(_pGC) \
diff --git a/hw/dmx/input/dmxconsole.c b/hw/dmx/input/dmxconsole.c
index cc820a204..b2a2ec302 100644
--- a/hw/dmx/input/dmxconsole.c
+++ b/hw/dmx/input/dmxconsole.c
@@ -612,7 +612,8 @@ static Bool dmxCloseConsoleScreen(int idx, ScreenPtr pScreen)
{
myPrivate *priv, *last;
- for (last = priv = pScreen->devPrivates[dmxScreenPrivateIndex].ptr;
+ for (last = priv = (myPrivate *)dixLookupPrivate(&pScreen->devPrivates,
+ dmxScreenPrivateKey);
priv;
priv = priv->next) dmxCloseConsole(last = priv);
@@ -846,13 +847,15 @@ void dmxConsoleInit(DevicePtr pDev)
dmxConsoleDraw(priv, 1, 1);
- if (screenInfo.screens[0]->devPrivates[dmxScreenPrivateIndex].ptr)
- priv->next = (screenInfo.screens[0]
- ->devPrivates[dmxScreenPrivateIndex].ptr);
+ if (dixLookupPrivate(&screenInfo.screens[0]->devPrivates,
+ dmxScreenPrivateKey))
+ priv->next = dixLookupPrivate(&screenInfo.screens[0]->devPrivates,
+ dmxScreenPrivateKey);
else
DMX_WRAP(CloseScreen, dmxCloseConsoleScreen,
priv, screenInfo.screens[0]);
- screenInfo.screens[0]->devPrivates[dmxScreenPrivateIndex].ptr = priv;
+ dixSetPrivate(&screenInfo.screens[0]->devPrivates, dmxScreenPrivateKey,
+ priv);
}
/** Fill in the \a info structure for the specified \a pDev. Only used
diff --git a/hw/dmx/input/dmxeq.c b/hw/dmx/input/dmxeq.c
index 3e98fb799..dff0b4423 100644
--- a/hw/dmx/input/dmxeq.c
+++ b/hw/dmx/input/dmxeq.c
@@ -82,7 +82,6 @@
#ifdef XINPUT
#include <X11/extensions/XIproto.h>
#define EXTENSION_PROC_ARGS void *
-#include "extinit.h" /* For LookupDeviceIntRec */
#endif
#if DMX_EQ_DEBUG
@@ -217,8 +216,9 @@ static void dmxeqProcessXInputEvent(xEvent *xe, EventRec *e)
{
deviceKeyButtonPointer *ev = (deviceKeyButtonPointer *)xe;
int id = ev->deviceid & DEVICE_BITS;
- DeviceIntPtr pDevice = LookupDeviceIntRec(id);
+ DeviceIntPtr pDevice;
+ dixLookupDevice(&pDevice, id, serverClient, DixUnknownAccess);
if (!pDevice) {
dmxLog(dmxError, "dmxeqProcessInputEvents: id %d not found\n", id);
return;
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index 282b52868..a4d995cb8 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -737,7 +737,7 @@ ephyrUpdateModifierState(unsigned int state)
int i;
CARD8 mask;
- pkeydev = (DeviceIntPtr)LookupKeyboardDevice();
+ pkeydev = inputInfo.keyboard;
if (!pkeydev)
return;
diff --git a/hw/kdrive/savage/s3draw.c b/hw/kdrive/savage/s3draw.c
index e2766df0f..da0d6849f 100644
--- a/hw/kdrive/savage/s3draw.c
+++ b/hw/kdrive/savage/s3draw.c
@@ -78,9 +78,8 @@ short s3alu[16] = {
#define PixTransStore(t) *pix_trans = (t)
#endif
-int s3GCPrivateIndex;
-int s3WindowPrivateIndex;
-int s3Generation;
+DevPrivateKey s3GCPrivateKey = &s3GCPrivateKey;
+DevPrivateKey s3WindowPrivateKey = &s3WindowPrivateKey;
/*
s3DoBitBlt
@@ -2182,7 +2181,7 @@ s3CreateWindow (WindowPtr pWin)
KdScreenPriv(pWin->drawable.pScreen);
s3ScreenInfo(pScreenPriv);
- pWin->devPrivates[s3WindowPrivateIndex].ptr = 0;
+ dixSetPrivate(&pWin->devPrivates, s3WindowPrivateKey, NULL);
return KdCreateWindow (pWin);
}
@@ -2979,15 +2978,7 @@ s3DrawInit (ScreenPtr pScreen)
}
else
{
- if (serverGeneration != s3Generation)
- {
- s3GCPrivateIndex = AllocateGCPrivateIndex ();
- s3WindowPrivateIndex = AllocateWindowPrivateIndex ();
- s3Generation = serverGeneration;
- }
- if (!AllocateWindowPrivate(pScreen, s3WindowPrivateIndex, 0))
- return FALSE;
- if (!AllocateGCPrivate(pScreen, s3GCPrivateIndex, sizeof (s3PrivGCRec)))
+ if (!dixRequestPrivate(s3GCPrivateKey, sizeof (s3PrivGCRec)))
return FALSE;
pScreen->CreateGC = s3CreateGC;
pScreen->CreateWindow = s3CreateWindow;
diff --git a/hw/kdrive/savage/s3draw.h b/hw/kdrive/savage/s3draw.h
index 068904370..eab8e395e 100644
--- a/hw/kdrive/savage/s3draw.h
+++ b/hw/kdrive/savage/s3draw.h
@@ -24,8 +24,8 @@
#ifndef _S3DRAW_H_
#define _S3DRAW_H_
-extern int s3GCPrivateIndex;
-extern int s3WindowPrivateIndex;
+extern DevPrivateKey s3GCPrivateKey;
+extern DevPrivateKey s3WindowPrivateKey;
typedef struct _s3Pattern {
S3PatternCache *cache;
@@ -42,16 +42,16 @@ typedef struct _s3PrivGC {
s3PatternPtr pPattern; /* pattern */
} s3PrivGCRec, *s3PrivGCPtr;
-#define s3GetGCPrivate(g) ((s3PrivGCPtr) \
- (g)->devPrivates[s3GCPrivateIndex].ptr)
+#define s3GetGCPrivate(g) ((s3PrivGCPtr) \
+ dixLookupPrivate(&(g)->devPrivates, s3GCPrivateKey))
-#define s3GCPrivate(g) s3PrivGCPtr s3Priv = s3GetGCPrivate(g)
+#define s3GCPrivate(g) s3PrivGCPtr s3Priv = s3GetGCPrivate(g)
-#define s3GetWindowPrivate(w) ((s3PatternPtr) \
- (w)->devPrivates[s3WindowPrivateIndex].ptr)
+#define s3GetWindowPrivate(w) ((s3PatternPtr) \
+ dixLookupPrivate(&(w)->devPrivates, s3WindowPrivateKey))
-#define s3SetWindowPrivate(w,p) (\
- (w)->devPrivates[s3WindowPrivateIndex].ptr = (pointer) p)
+#define s3SetWindowPrivate(w,p) \
+ dixSetPrivate(&(w)->devPrivates, s3WindowPrivateKey, p)
void _s3LoadPattern (ScreenPtr pScreen, int fb, s3PatternPtr pPattern);
diff --git a/hw/kdrive/src/kaa.c b/hw/kdrive/src/kaa.c
index 9cf9bf201..88873513a 100644
--- a/hw/kdrive/src/kaa.c
+++ b/hw/kdrive/src/kaa.c
@@ -42,9 +42,8 @@
#define DBG_PIXMAP(a)
#endif
-int kaaGeneration;
-int kaaScreenPrivateIndex;
-int kaaPixmapPrivateIndex;
+DevPrivateKey kaaScreenPrivateKey = &kaaScreenPrivateKey;
+DevPrivateKey kaaPixmapPrivateKey = &kaaPixmapPrivateKey;
#define KAA_PIXMAP_SCORE_MOVE_IN 10
#define KAA_PIXMAP_SCORE_MAX 20
@@ -1020,13 +1019,6 @@ kaaDrawInit (ScreenPtr pScreen,
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif
- if (kaaGeneration != serverGeneration)
- {
- kaaScreenPrivateIndex = AllocateScreenPrivateIndex();
- kaaPixmapPrivateIndex = AllocatePixmapPrivateIndex();
- kaaGeneration = serverGeneration;
- }
-
pKaaScr = xalloc (sizeof (KaaScreenPrivRec));
if (!pKaaScr)
@@ -1034,7 +1026,7 @@ kaaDrawInit (ScreenPtr pScreen,
pKaaScr->info = pScreenInfo;
- pScreen->devPrivates[kaaScreenPrivateIndex].ptr = (pointer) pKaaScr;
+ dixSetPrivate(&pScreen->devPrivates, kaaScreenPrivateKey, pKaaScr);
/*
* Hook up asynchronous drawing
@@ -1058,17 +1050,11 @@ kaaDrawInit (ScreenPtr pScreen,
if ((pKaaScr->info->flags & KAA_OFFSCREEN_PIXMAPS) &&
screen->off_screen_base < screen->memory_size)
{
- if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex,
- sizeof (KaaPixmapPrivRec)))
+ if (!dixRequestPrivate(kaaPixmapPrivateKey, sizeof (KaaPixmapPrivRec)))
return FALSE;
pScreen->CreatePixmap = kaaCreatePixmap;
pScreen->DestroyPixmap = kaaDestroyPixmap;
}
- else
- {
- if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex, 0))
- return FALSE;
- }
return TRUE;
}
diff --git a/hw/kdrive/src/kaa.h b/hw/kdrive/src/kaa.h
index db890a75b..90b963b10 100644
--- a/hw/kdrive/src/kaa.h
+++ b/hw/kdrive/src/kaa.h
@@ -27,11 +27,14 @@
#include "picturestr.h"
-#define KaaGetScreenPriv(s) ((KaaScreenPrivPtr)(s)->devPrivates[kaaScreenPrivateIndex].ptr)
+#define KaaGetScreenPriv(s) ((KaaScreenPrivPtr) \
+ dixLookupPrivate(&(s)->devPrivates, kaaScreenPrivateKey))
#define KaaScreenPriv(s) KaaScreenPrivPtr pKaaScr = KaaGetScreenPriv(s)
-#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr)(p)->devPrivates[kaaPixmapPrivateIndex].ptr)
-#define KaaSetPixmapPriv(p,a) ((p)->devPrivates[kaaPixmapPrivateIndex].ptr = (pointer) (a))
+#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr) \
+ dixLookupPrivate(&(p)->devPrivates, kaaPixmapPrivateKey))
+#define KaaSetPixmapPriv(p,a) \
+ dixSetPrivate(&(p)->devPrivates, kaaPixmapPrivateKey, a)
#define KaaPixmapPriv(p) KaaPixmapPrivPtr pKaaPixmap = KaaGetPixmapPriv(p)
typedef struct {
@@ -46,8 +49,8 @@ typedef struct {
Bool dirty;
} KaaPixmapPrivRec, *KaaPixmapPrivPtr;
-extern int kaaScreenPrivateIndex;
-extern int kaaPixmapPrivateIndex;
+extern DevPrivateKey kaaScreenPrivateKey;
+extern DevPrivateKey kaaPixmapPrivateKey;
void
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 2fde66c4d..8722ba303 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -498,7 +498,7 @@ typedef struct _KaaScreenInfo {
(PixmapWidthPaddingInfo[d].padRoundUp+1)))
#endif
-extern int kdScreenPrivateIndex;
+extern DevPrivateKey kdScreenPrivateKey;
extern unsigned long kdGeneration;
extern Bool kdEnabled;
extern Bool kdSwitchPending;
@@ -510,9 +510,9 @@ extern char *kdSwitchCmd;
extern KdOsFuncs *kdOsFuncs;
#define KdGetScreenPriv(pScreen) ((KdPrivScreenPtr) \
- (pScreen)->devPrivates[kdScreenPrivateIndex].ptr)
-#define KdSetScreenPriv(pScreen,v) ((pScreen)->devPrivates[kdScreenPrivateIndex].ptr = \
- (pointer) v)
+ dixLookupPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey))
+#define KdSetScreenPriv(pScreen,v) \
+ dixSetPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey, v)
#define KdScreenPriv(pScreen) KdPrivScreenPtr pScreenPriv = KdGetScreenPriv(pScreen)
/* kaa.c */
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index 046ab27b3..b6ff4f831 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -104,23 +104,22 @@ static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr*, int);
-int KdXVWindowIndex = -1;
-int KdXvScreenIndex = -1;
-static unsigned long KdXVGeneration = 0;
+DevPrivateKey KdXVWindowKey = &KdXVWindowKey;
+DevPrivateKey KdXvScreenKey = &KdXvScreenKey;
static unsigned long PortResource = 0;
-int (*XvGetScreenIndexProc)(void) = XvGetScreenIndex;
+int (*XvGetScreenKeyProc)(void) = XvGetScreenKey;
unsigned long (*XvGetRTPortProc)(void) = XvGetRTPort;
int (*XvScreenInitProc)(ScreenPtr) = XvScreenInit;
-#define GET_XV_SCREEN(pScreen) \
- ((XvScreenPtr)((pScreen)->devPrivates[KdXvScreenIndex].ptr))
+#define GET_XV_SCREEN(pScreen) ((XvScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, KdXvScreenKey))
#define GET_KDXV_SCREEN(pScreen) \
((KdXVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr))
-#define GET_KDXV_WINDOW(pWin) \
- ((KdXVWindowPtr)((pWin)->devPrivates[KdXVWindowIndex].ptr))
+#define GET_KDXV_WINDOW(pWin) ((KdXVWindowPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, KdXVWindowKey))
static KdXVInitGenericAdaptorPtr *GenDrivers = NULL;
static int NumGenDrivers = 0;
@@ -192,21 +191,12 @@ KdXVScreenInit(
/* fprintf(stderr,"KdXVScreenInit initializing %d adaptors\n",num); */
- if(KdXVGeneration != serverGeneration) {
- if((KdXVWindowIndex = AllocateWindowPrivateIndex()) < 0)
- return FALSE;
- KdXVGeneration = serverGeneration;
- }
-
- if(!AllocateWindowPrivate(pScreen,KdXVWindowIndex,0))
- return FALSE;
-
- if(!XvGetScreenIndexProc || !XvGetRTPortProc || !XvScreenInitProc)
+ if(!XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
return FALSE;
if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
- KdXvScreenIndex = (*XvGetScreenIndexProc)();
+ KdXvScreenIndex = (*XvGetScreenKeyProc)();
PortResource = (*XvGetRTPortProc)();
pxvs = GET_XV_SCREEN(pScreen);
@@ -938,7 +928,7 @@ KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
if(!winPriv) return BadAlloc;
winPriv->PortRec = portPriv;
winPriv->next = PrivRoot;
- pWin->devPrivates[KdXVWindowIndex].ptr = (pointer)winPriv;
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv);
}
return Success;
}
@@ -956,8 +946,7 @@ KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
if(prevPriv)
prevPriv->next = winPriv->next;
else
- pWin->devPrivates[KdXVWindowIndex].ptr =
- (pointer)winPriv->next;
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv->next);
xfree(winPriv);
break;
}
@@ -981,7 +970,8 @@ KdXVCreateWindow(WindowPtr pWin)
ret = (*pScreen->CreateWindow)(pWin);
pScreen->CreateWindow = KdXVCreateWindow;
- if(ret) pWin->devPrivates[KdXVWindowIndex].ptr = NULL;
+ if (ret)
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL);
return ret;
}
@@ -1010,7 +1000,7 @@ KdXVDestroyWindow(WindowPtr pWin)
xfree(tmp);
}
- pWin->devPrivates[KdXVWindowIndex].ptr = NULL;
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL);
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
ret = (*pScreen->DestroyWindow)(pWin);
@@ -1067,8 +1057,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
pPriv->pDraw = NULL;
if(!pPrev)
- pWin->devPrivates[KdXVWindowIndex].ptr =
- (pointer)(WinPriv->next);
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next);
else
pPrev->next = WinPriv->next;
tmp = WinPriv;
@@ -1117,8 +1106,7 @@ KdXVClipNotify(WindowPtr pWin, int dx, int dy)
pPriv->pDraw = NULL;
if(!pPrev)
- pWin->devPrivates[KdXVWindowIndex].ptr =
- (pointer)(WinPriv->next);
+ dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv->next);
else
pPrev->next = WinPriv->next;
tmp = WinPriv;
diff --git a/hw/kdrive/vxworks/vxkbd.c b/hw/kdrive/vxworks/vxkbd.c
index be528c78a..ac83ef729 100644
--- a/hw/kdrive/vxworks/vxkbd.c
+++ b/hw/kdrive/vxworks/vxkbd.c
@@ -232,7 +232,7 @@ VxWorksKeyboardRead (int fd)
void
VxWorksKeyboardLeds (int leds)
{
- DeviceIntPtr pKeyboard = (DeviceIntPtr) LookupKeyboardDevice ();
+ DeviceIntPtr pKeyboard = inputInfo.keyboard;
KeyboardCtrl *ctrl = &pKeyboard->kbdfeed->ctrl;
led_ioctl_info led_info;
int i;
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 064107428..183c3cdb3 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -57,9 +57,9 @@
/* General parameters */
extern int xf86DoConfigure;
extern Bool xf86DoConfigurePass1;
-extern int xf86ScreenIndex; /* Index into pScreen.devPrivates */
-extern int xf86CreateRootWindowIndex; /* Index into pScreen.devPrivates */
-extern int xf86PixmapIndex;
+extern DevPrivateKey xf86ScreenKey;
+extern DevPrivateKey xf86CreateRootWindowKey;
+extern DevPrivateKey xf86PixmapKey;
extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */
extern const unsigned char byte_reversed[256];
extern ScrnInfoPtr xf86CurrentScreen;
@@ -72,8 +72,8 @@ extern Bool sbusSlotClaimed;
extern confDRIRec xf86ConfigDRI;
extern Bool xf86inSuspend;
-#define XF86SCRNINFO(p) ((ScrnInfoPtr)((p)->devPrivates[xf86ScreenIndex].ptr))
-
+#define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \
+ xf86ScreenKey))
#define XF86FLIP_PIXELS() \
do { \
if (xf86GetFlipPixels()) { \
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 85d4b2ea0..0daf1de44 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -49,8 +49,7 @@
#include "mi.h"
-static unsigned long DGAGeneration = 0;
-static int DGAScreenIndex = -1;
+static DevPrivateKey DGAScreenKey = NULL;
static int mieq_installed = 0;
static Bool DGACloseScreen(int i, ScreenPtr pScreen);
@@ -68,8 +67,8 @@ DGACopyModeInfo(
_X_EXPORT int *XDGAEventBase = NULL;
-#define DGA_GET_SCREEN_PRIV(pScreen) \
- ((DGAScreenPtr)((pScreen)->devPrivates[DGAScreenIndex].ptr))
+#define DGA_GET_SCREEN_PRIV(pScreen) ((DGAScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, DGAScreenKey))
typedef struct _FakedVisualList{
@@ -116,11 +115,7 @@ DGAInit(
if(!modes || num <= 0)
return FALSE;
- if(DGAGeneration != serverGeneration) {
- if((DGAScreenIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- DGAGeneration = serverGeneration;
- }
+ DGAScreenKey = &DGAScreenKey;
if(!(pScreenPriv = (DGAScreenPtr)xalloc(sizeof(DGAScreenRec))))
return FALSE;
@@ -148,7 +143,7 @@ DGAInit(
modes[i].flags &= ~DGA_PIXMAP_AVAILABLE;
#endif
- pScreen->devPrivates[DGAScreenIndex].ptr = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, DGAScreenKey, pScreenPriv);
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = DGACloseScreen;
pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
@@ -176,7 +171,7 @@ DGAReInitModes(
int i;
/* No DGA? Ignore call (but don't make it look like it failed) */
- if(DGAScreenIndex < 0)
+ if(DGAScreenKey == NULL)
return TRUE;
pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
@@ -350,7 +345,7 @@ xf86SetDGAMode(
DGAModePtr pMode = NULL;
/* First check if DGAInit was successful on this screen */
- if (DGAScreenIndex < 0)
+ if (DGAScreenKey == NULL)
return BadValue;
pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
if (!pScreenPriv)
@@ -485,7 +480,7 @@ DGAChangePixmapMode(int index, int *x, int *y, int mode)
DGAModePtr pMode;
PixmapPtr pPix;
- if(DGAScreenIndex < 0)
+ if(DGAScreenKey == NULL)
return FALSE;
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
@@ -535,11 +530,12 @@ DGAChangePixmapMode(int index, int *x, int *y, int mode)
_X_EXPORT Bool
DGAAvailable(int index)
{
- if(DGAScreenIndex < 0)
+ if(DGAScreenKey == NULL)
return FALSE;
- if (!xf86NoSharedResources(((ScrnInfoPtr)screenInfo.screens[index]->
- devPrivates[xf86ScreenIndex].ptr)->scrnIndex,MEM))
+ if (!xf86NoSharedResources(((ScrnInfoPtr)dixLookupPrivate(
+ &screenInfo.screens[index]->devPrivates,
+ xf86ScreenKey))->scrnIndex, MEM))
return FALSE;
if(DGA_GET_SCREEN_PRIV(screenInfo.screens[index]))
@@ -553,7 +549,7 @@ DGAActive(int index)
{
DGAScreenPtr pScreenPriv;
- if(DGAScreenIndex < 0)
+ if(DGAScreenKey == NULL)
return FALSE;
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
@@ -574,7 +570,7 @@ DGAShutdown()
ScrnInfoPtr pScrn;
int i;
- if(DGAScreenIndex < 0)
+ if(DGAScreenKey == NULL)
return;
for(i = 0; i < screenInfo.numScreens; i++) {
@@ -904,7 +900,7 @@ DGAVTSwitch(void)
/* Alternatively, this could send events to DGA clients */
- if(DGAScreenIndex >= 0) {
+ if(DGAScreenKey) {
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
if(pScreenPriv && pScreenPriv->current)
@@ -921,7 +917,7 @@ DGAStealKeyEvent(int index, int key_code, int is_down)
DGAScreenPtr pScreenPriv;
dgaEvent de;
- if(DGAScreenIndex < 0) /* no DGA */
+ if(DGAScreenKey == NULL) /* no DGA */
return FALSE;
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
@@ -945,7 +941,7 @@ DGAStealMotionEvent(int index, int dx, int dy)
DGAScreenPtr pScreenPriv;
dgaEvent de;
- if(DGAScreenIndex < 0) /* no DGA */
+ if(DGAScreenKey == NULL) /* no DGA */
return FALSE;
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
@@ -980,7 +976,7 @@ DGAStealButtonEvent(int index, int button, int is_down)
DGAScreenPtr pScreenPriv;
dgaEvent de;
- if (DGAScreenIndex < 0)
+ if (DGAScreenKey == NULL)
return FALSE;
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
@@ -1006,7 +1002,7 @@ Bool
DGAIsDgaEvent (xEvent *e)
{
int coreEquiv;
- if (DGAScreenIndex < 0 || XDGAEventBase == 0)
+ if (DGAScreenKey == NULL || XDGAEventBase == 0)
return FALSE;
coreEquiv = e->u.u.type - *XDGAEventBase;
if (KeyPress <= coreEquiv && coreEquiv <= MotionNotify)
@@ -1275,7 +1271,7 @@ DGAHandleEvent(int screen_num, xEvent *event, DeviceIntPtr device, int nevents)
int coreEquiv;
/* no DGA */
- if (DGAScreenIndex < 0 || XDGAEventBase == 0)
+ if (DGAScreenKey == NULL || XDGAEventBase == 0)
return;
pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
diff --git a/hw/xfree86/common/xf86DPMS.c b/hw/xfree86/common/xf86DPMS.c
index 3aa83e882..536d38e8f 100644
--- a/hw/xfree86/common/xf86DPMS.c
+++ b/hw/xfree86/common/xf86DPMS.c
@@ -47,8 +47,7 @@
#ifdef DPMSExtension
-static int DPMSGeneration = 0;
-static int DPMSIndex = -1;
+static DevPrivateKey DPMSKey = NULL;
static Bool DPMSClose(int i, ScreenPtr pScreen);
static int DPMSCount = 0;
#endif
@@ -62,18 +61,15 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
DPMSPtr pDPMS;
pointer DPMSOpt;
- if (serverGeneration != DPMSGeneration) {
- if ((DPMSIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- DPMSGeneration = serverGeneration;
- }
+ DPMSKey = &DPMSKey;
if (DPMSDisabledSwitch)
DPMSEnabled = FALSE;
- if (!(pScreen->devPrivates[DPMSIndex].ptr = xcalloc(sizeof(DPMSRec), 1)))
+ if (!dixSetPrivate(&pScreen->devPrivates, DPMSKey,
+ xcalloc(sizeof(DPMSRec), 1)))
return FALSE;
- pDPMS = (DPMSPtr)pScreen->devPrivates[DPMSIndex].ptr;
+ pDPMS = (DPMSPtr)dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
pScrn->DPMSSet = set;
pDPMS->Flags = flags;
DPMSOpt = xf86FindOption(pScrn->options, "dpms");
@@ -110,10 +106,10 @@ DPMSClose(int i, ScreenPtr pScreen)
DPMSPtr pDPMS;
/* This shouldn't happen */
- if (DPMSIndex < 0)
+ if (DPMSKey == NULL)
return FALSE;
- pDPMS = (DPMSPtr)pScreen->devPrivates[DPMSIndex].ptr;
+ pDPMS = (DPMSPtr)dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
/* This shouldn't happen */
if (!pDPMS)
@@ -132,9 +128,9 @@ DPMSClose(int i, ScreenPtr pScreen)
}
xfree((pointer)pDPMS);
- pScreen->devPrivates[DPMSIndex].ptr = NULL;
+ dixSetPrivate(&pScreen->devPrivates, DPMSKey, NULL);
if (--DPMSCount == 0)
- DPMSIndex = -1;
+ DPMSKey = NULL;
return pScreen->CloseScreen(i, pScreen);
}
@@ -144,30 +140,35 @@ DPMSClose(int i, ScreenPtr pScreen)
* Device dependent DPMS mode setting hook. This is called whenever
* the DPMS mode is to be changed.
*/
-_X_EXPORT void
-DPMSSet(int level)
+_X_EXPORT int
+DPMSSet(ClientPtr client, int level)
{
- int i;
+ int rc, i;
DPMSPtr pDPMS;
ScrnInfoPtr pScrn;
DPMSPowerLevel = level;
- if (DPMSIndex < 0)
- return;
+ if (DPMSKey == NULL)
+ return Success;
- if (level != DPMSModeOn)
- SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverActive);
+ if (level != DPMSModeOn) {
+ rc = SaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverActive);
+ if (rc != Success)
+ return rc;
+ }
/* For each screen, set the DPMS level */
for (i = 0; i < xf86NumScreens; i++) {
pScrn = xf86Screens[i];
- pDPMS = (DPMSPtr)screenInfo.screens[i]->devPrivates[DPMSIndex].ptr;
+ pDPMS = (DPMSPtr)dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
+ DPMSKey);
if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) {
xf86EnableAccess(pScrn);
pScrn->DPMSSet(pScrn, level, 0);
}
}
+ return Success;
}
@@ -182,14 +183,15 @@ DPMSSupported(void)
DPMSPtr pDPMS;
ScrnInfoPtr pScrn;
- if (DPMSIndex < 0) {
+ if (DPMSKey == NULL) {
return FALSE;
}
/* For each screen, check if DPMS is supported */
for (i = 0; i < xf86NumScreens; i++) {
pScrn = xf86Screens[i];
- pDPMS = (DPMSPtr)screenInfo.screens[i]->devPrivates[DPMSIndex].ptr;
+ pDPMS = (DPMSPtr)dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
+ DPMSKey);
if (pDPMS && pScrn->DPMSSet)
return TRUE;
}
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index e88fc3b3e..bc2fe0912 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -857,7 +857,7 @@ xf86VTSwitch()
#endif
#ifdef DPMSExtension
if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(DPMSModeOn);
+ DPMSSet(serverClient, DPMSModeOn);
#endif
for (i = 0; i < xf86NumScreens; i++) {
if (!(dispatchException & DE_TERMINATE))
@@ -906,7 +906,7 @@ xf86VTSwitch()
(*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
}
}
- SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
+ SaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
pInfo = xf86InputDevs;
while (pInfo) {
@@ -970,7 +970,7 @@ xf86VTSwitch()
}
/* Turn screen saver off when switching back */
- SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset);
+ SaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
pInfo = xf86InputDevs;
while (pInfo) {
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index b3969b102..d796d627c 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -46,10 +46,12 @@
/* Globals that video drivers may access */
-_X_EXPORT int xf86ScreenIndex = -1; /* Index of ScrnInfo in pScreen.devPrivates */
-int xf86CreateRootWindowIndex = -1; /* Index into pScreen.devPrivates */
+/* Index into pScreen.devPrivates */
+DevPrivateKey xf86CreateRootWindowKey = &xf86CreateRootWindowKey;
+/* Index of ScrnInfo in pScreen.devPrivates */
+_X_EXPORT DevPrivateKey xf86ScreenKey = &xf86ScreenKey;
+_X_EXPORT DevPrivateKey xf86PixmapKey = &xf86PixmapKey;
_X_EXPORT ScrnInfoPtr *xf86Screens = NULL; /* List of ScrnInfos */
-_X_EXPORT int xf86PixmapIndex = 0;
_X_EXPORT const unsigned char byte_reversed[256] =
{
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index bf577e6ad..b3cae2707 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -139,8 +139,8 @@ xf86CreateRootWindow(WindowPtr pWin)
int err = Success;
ScreenPtr pScreen = pWin->drawable.pScreen;
RootWinPropPtr pProp;
- CreateWindowProcPtr CreateWindow =
- (CreateWindowProcPtr)(pScreen->devPrivates[xf86CreateRootWindowIndex].ptr);
+ CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr)
+ dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey);
#ifdef DEBUG
ErrorF("xf86CreateRootWindow(%p)\n", pWin);
@@ -156,7 +156,7 @@ xf86CreateRootWindow(WindowPtr pWin)
/* Unhook this function ... */
pScreen->CreateWindow = CreateWindow;
- pScreen->devPrivates[xf86CreateRootWindowIndex].ptr = NULL;
+ dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL);
/* ... and call the previous CreateWindow fuction, if any */
if (NULL!=pScreen->CreateWindow) {
@@ -476,7 +476,6 @@ void
InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
{
int i, j, k, scr_index;
- static unsigned long generation = 0;
char **modulelist;
pointer *optionlist;
screenLayoutPtr layout;
@@ -487,14 +486,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
xf86Initialising = TRUE;
- /* Do this early? */
- if (generation != serverGeneration) {
- xf86ScreenIndex = AllocateScreenPrivateIndex();
- xf86CreateRootWindowIndex = AllocateScreenPrivateIndex();
- xf86PixmapIndex = AllocatePixmapPrivateIndex();
- generation = serverGeneration;
- }
-
if (serverGeneration == 1) {
pScreenInfo->numScreens = 0;
@@ -1070,8 +1061,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
* Hook in our ScrnInfoRec, and initialise some other pScreen
* fields.
*/
- screenInfo.screens[scr_index]->devPrivates[xf86ScreenIndex].ptr
- = (pointer)xf86Screens[i];
+ dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
+ xf86ScreenKey, xf86Screens[i]);
xf86Screens[i]->pScreen = screenInfo.screens[scr_index];
/* The driver should set this, but make sure it is set anyway */
xf86Screens[i]->vtSema = TRUE;
@@ -1087,8 +1078,9 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
i, xf86Screens[i]->pScreen->CreateWindow );
#endif
- screenInfo.screens[scr_index]->devPrivates[xf86CreateRootWindowIndex].ptr
- = (void*)(xf86Screens[i]->pScreen->CreateWindow);
+ dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
+ xf86CreateRootWindowKey,
+ xf86Screens[i]->pScreen->CreateWindow);
xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow;
#ifdef RENDER
@@ -1313,7 +1305,7 @@ AbortDDX()
#endif
#ifdef DPMSExtension /* Turn screens back on */
if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(DPMSModeOn);
+ DPMSSet(serverClient, DPMSModeOn);
#endif
if (xf86Screens) {
if (xf86Screens[0]->vtSema)
diff --git a/hw/xfree86/common/xf86PM.c b/hw/xfree86/common/xf86PM.c
index a6bcc3421..278a51474 100644
--- a/hw/xfree86/common/xf86PM.c
+++ b/hw/xfree86/common/xf86PM.c
@@ -116,7 +116,7 @@ resume(pmEvent event, Bool undo)
if (xf86Screens[i]->EnableDisableFBAccess)
(*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
}
- SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
+ SaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
pInfo = xf86InputDevs;
while (pInfo) {
EnableDevice(pInfo->dev);
diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c
index 288d72193..4432ad96b 100644
--- a/hw/xfree86/common/xf86RandR.c
+++ b/hw/xfree86/common/xf86RandR.c
@@ -45,10 +45,9 @@ typedef struct _xf86RandRInfo {
Rotation rotation;
} XF86RandRInfoRec, *XF86RandRInfoPtr;
-static int xf86RandRIndex = -1;
-static int xf86RandRGeneration;
+static DevPrivateKey xf86RandRKey = NULL;
-#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) (p)->devPrivates[xf86RandRIndex].ptr)
+#define XF86RANDRINFO(p) ((XF86RandRInfoPtr)dixLookupPrivate(&(p)->devPrivates, xf86RandRKey))
static int
xf86RandRModeRefresh (DisplayModePtr mode)
@@ -338,14 +337,14 @@ xf86RandRCloseScreen (int index, ScreenPtr pScreen)
scrp->currentMode = scrp->modes;
pScreen->CloseScreen = randrp->CloseScreen;
xfree (randrp);
- pScreen->devPrivates[xf86RandRIndex].ptr = 0;
+ dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, NULL);
return (*pScreen->CloseScreen) (index, pScreen);
}
_X_EXPORT Rotation
xf86GetRotation(ScreenPtr pScreen)
{
- if (xf86RandRIndex == -1)
+ if (xf86RandRKey == NULL)
return RR_Rotate_0;
return XF86RANDRINFO(pScreen)->rotation;
@@ -359,7 +358,7 @@ xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
{
XF86RandRInfoPtr randrp;
- if (xf86RandRIndex == -1)
+ if (xf86RandRKey == NULL)
return FALSE;
randrp = XF86RANDRINFO(pScreen);
@@ -401,11 +400,8 @@ xf86RandRInit (ScreenPtr pScreen)
if (!noPanoramiXExtension)
return TRUE;
#endif
- if (xf86RandRGeneration != serverGeneration)
- {
- xf86RandRIndex = AllocateScreenPrivateIndex();
- xf86RandRGeneration = serverGeneration;
- }
+
+ xf86RandRKey = &xf86RandRKey;
randrp = xalloc (sizeof (XF86RandRInfoRec));
if (!randrp)
@@ -433,7 +429,7 @@ xf86RandRInit (ScreenPtr pScreen)
randrp->rotation = RR_Rotate_0;
- pScreen->devPrivates[xf86RandRIndex].ptr = randrp;
+ dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, randrp);
return TRUE;
}
diff --git a/hw/xfree86/common/xf86VidMode.c b/hw/xfree86/common/xf86VidMode.c
index 16a4d824c..38d605c88 100644
--- a/hw/xfree86/common/xf86VidMode.c
+++ b/hw/xfree86/common/xf86VidMode.c
@@ -47,12 +47,11 @@
#include "vidmodeproc.h"
#include "xf86cmap.h"
-static int VidModeGeneration = 0;
-static int VidModeIndex = -1;
+static DevPrivateKey VidModeKey = NULL;
static int VidModeCount = 0;
static Bool VidModeClose(int i, ScreenPtr pScreen);
-#define VMPTR(p) ((VidModePtr)(p)->devPrivates[VidModeIndex].ptr)
+#define VMPTR(p) ((VidModePtr)dixLookupPrivate(&(p)->devPrivates, VidModeKey))
#endif
@@ -73,15 +72,10 @@ VidModeExtensionInit(ScreenPtr pScreen)
return FALSE;
}
- if (serverGeneration != VidModeGeneration) {
- if ((VidModeIndex = AllocateScreenPrivateIndex()) < 0) {
- DEBUG_P("AllocateScreenPrivateIndex() failed");
- return FALSE;
- }
- VidModeGeneration = serverGeneration;
- }
+ VidModeKey = &VidModeKey;
- if (!(pScreen->devPrivates[VidModeIndex].ptr = xcalloc(sizeof(VidModeRec), 1))) {
+ if (!dixSetPrivate(&pScreen->devPrivates, VidModeKey,
+ xcalloc(sizeof(VidModeRec), 1))) {
DEBUG_P("xcalloc failed");
return FALSE;
}
@@ -114,10 +108,9 @@ VidModeClose(int i, ScreenPtr pScreen)
pScreen->CloseScreen = pVidMode->CloseScreen;
if (--VidModeCount == 0) {
- if (pScreen->devPrivates[VidModeIndex].ptr)
- xfree(pScreen->devPrivates[VidModeIndex].ptr);
- pScreen->devPrivates[VidModeIndex].ptr = NULL;
- VidModeIndex = -1;
+ xfree(dixLookupPrivate(&pScreen->devPrivates, VidModeKey));
+ dixSetPrivate(&pScreen->devPrivates, VidModeKey, NULL);
+ VidModeKey = NULL;
}
return pScreen->CloseScreen(i, pScreen);
}
@@ -128,8 +121,8 @@ VidModeAvailable(int scrnIndex)
ScrnInfoPtr pScrn;
VidModePtr pVidMode;
- if (VidModeIndex < 0) {
- DEBUG_P("VidModeIndex < 0");
+ if (VidModeKey == NULL) {
+ DEBUG_P("VidModeKey == NULL");
return FALSE;
}
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index b939fb763..cd0c30ac1 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -77,7 +77,6 @@
#define EXTENSION_PROC_ARGS void *
#include "extnsionst.h"
-#include "extinit.h" /* LookupDeviceIntRec */
#include "windowstr.h" /* screenIsSaved */
diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c
index ea6a26dcd..764647ee4 100644
--- a/hw/xfree86/common/xf86cmap.c
+++ b/hw/xfree86/common/xf86cmap.c
@@ -60,7 +60,7 @@
#include "xf86cmap.h"
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \
- ((CMapScreenPtr) (pScreen)->devPrivates[CMapScreenIndex].ptr)->field)
+ ((CMapScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, CMapScreenKey))->field)
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
((pScreen)->field = wrapper)
@@ -102,9 +102,8 @@ typedef struct {
int overscan;
} CMapColormapRec, *CMapColormapPtr;
-static unsigned long CMapGeneration = 0;
-static int CMapScreenIndex = -1;
-static int CMapColormapIndex = -1;
+static DevPrivateKey CMapScreenKey = NULL;
+static DevPrivateKey CMapColormapKey = &CMapColormapKey;
static void CMapInstallColormap(ColormapPtr);
static void CMapStoreColors(ColormapPtr, int, xColorItem *);
@@ -119,7 +118,6 @@ static int CMapChangeGamma(int, Gamma);
static void ComputeGamma(CMapScreenPtr);
static Bool CMapAllocateColormapPrivate(ColormapPtr);
-static Bool CMapInitDefMap(ColormapPtr,int);
static void CMapRefreshColors(ColormapPtr, int, int*);
static void CMapSetOverscan(ColormapPtr, int, int *);
static void CMapReinstallMap(ColormapPtr);
@@ -145,13 +143,7 @@ _X_EXPORT Bool xf86HandleColormaps(
if(!maxColors || !sigRGBbits || !loadPalette)
return FALSE;
- if(CMapGeneration != serverGeneration) {
- if(((CMapScreenIndex = AllocateScreenPrivateIndex()) < 0) ||
- ((CMapColormapIndex = AllocateColormapPrivateIndex(
- CMapInitDefMap)) < 0))
- return FALSE;
- CMapGeneration = serverGeneration;
- }
+ CMapScreenKey = &CMapScreenKey;
elements = 1 << sigRGBbits;
@@ -169,7 +161,7 @@ _X_EXPORT Bool xf86HandleColormaps(
return FALSE;
}
- pScreen->devPrivates[CMapScreenIndex].ptr = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, CMapScreenKey, pScreenPriv);
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreenPriv->CreateColormap = pScreen->CreateColormap;
@@ -225,12 +217,6 @@ _X_EXPORT Bool xf86HandleColormaps(
return TRUE;
}
-static Bool
-CMapInitDefMap(ColormapPtr cmap, int index)
-{
- return TRUE;
-}
-
/**** Screen functions ****/
@@ -254,8 +240,8 @@ CMapColormapUseMax(VisualPtr pVisual, CMapScreenPtr pScreenPriv)
static Bool
CMapAllocateColormapPrivate(ColormapPtr pmap)
{
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pmap->pScreen->devPrivates, CMapScreenKey);
CMapColormapPtr pColPriv;
CMapLinkPtr pLink;
int numColors;
@@ -274,7 +260,7 @@ CMapAllocateColormapPrivate(ColormapPtr pmap)
return FALSE;
}
- pmap->devPrivates[CMapColormapIndex].ptr = (pointer)pColPriv;
+ dixSetPrivate(&pmap->devPrivates, CMapColormapKey, pColPriv);
pColPriv->numColors = numColors;
pColPriv->colors = colors;
@@ -296,8 +282,8 @@ static Bool
CMapCreateColormap (ColormapPtr pmap)
{
ScreenPtr pScreen = pmap->pScreen;
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
Bool ret = FALSE;
pScreen->CreateColormap = pScreenPriv->CreateColormap;
@@ -314,10 +300,10 @@ static void
CMapDestroyColormap (ColormapPtr cmap)
{
ScreenPtr pScreen = cmap->pScreen;
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
- CMapColormapPtr pColPriv =
- (CMapColormapPtr) cmap->devPrivates[CMapColormapIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
+ &cmap->devPrivates, CMapColormapKey);
CMapLinkPtr prevLink = NULL, pLink = pScreenPriv->maps;
if(pColPriv) {
@@ -356,8 +342,8 @@ CMapStoreColors(
){
ScreenPtr pScreen = pmap->pScreen;
VisualPtr pVisual = pmap->pVisual;
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
int *indices = pScreenPriv->PreAllocIndices;
int num = ndef;
@@ -373,8 +359,8 @@ CMapStoreColors(
return;
if(pVisual->class == DirectColor) {
- CMapColormapPtr pColPriv =
- (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr;
+ CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
+ &pmap->devPrivates, CMapColormapKey);
int i;
if (CMapColormapUseMax(pVisual, pScreenPriv)) {
@@ -431,8 +417,8 @@ CMapInstallColormap(ColormapPtr pmap)
{
ScreenPtr pScreen = pmap->pScreen;
int index = pScreen->myNum;
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
if (pmap == miInstalledMaps[index])
return;
@@ -462,8 +448,8 @@ static Bool
CMapEnterVT(int index, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
if((*pScreenPriv->EnterVT)(index, flags)) {
if(miInstalledMaps[index])
@@ -478,8 +464,8 @@ static Bool
CMapSwitchMode(int index, DisplayModePtr mode, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
if((*pScreenPriv->SwitchMode)(index, mode, flags)) {
if(miInstalledMaps[index])
@@ -494,8 +480,8 @@ static int
CMapSetDGAMode(int index, int num, DGADevicePtr dev)
{
ScreenPtr pScreen = screenInfo.screens[index];
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
int ret;
ret = (*pScreenPriv->SetDGAMode)(index, num, dev);
@@ -516,10 +502,10 @@ CMapSetDGAMode(int index, int num, DGADevicePtr dev)
static void
CMapReinstallMap(ColormapPtr pmap)
{
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr;
- CMapColormapPtr cmapPriv =
- (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pmap->pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr cmapPriv = (CMapColormapPtr)dixLookupPrivate(
+ &pmap->devPrivates, CMapColormapKey);
ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
int i = cmapPriv->numColors;
int *indices = pScreenPriv->PreAllocIndices;
@@ -547,10 +533,10 @@ CMapReinstallMap(ColormapPtr pmap)
static void
CMapRefreshColors(ColormapPtr pmap, int defs, int* indices)
{
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr;
- CMapColormapPtr pColPriv =
- (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pmap->pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
+ &pmap->devPrivates, CMapColormapKey);
VisualPtr pVisual = pmap->pVisual;
ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
int numColors, i;
@@ -681,10 +667,10 @@ CMapCompareColors(LOCO *color1, LOCO *color2)
static void
CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
{
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr;
- CMapColormapPtr pColPriv =
- (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pmap->pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
+ &pmap->devPrivates, CMapColormapKey);
ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
VisualPtr pVisual = pmap->pVisual;
int i;
@@ -819,8 +805,8 @@ CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
static void
CMapUnwrapScreen(ScreenPtr pScreen)
{
- CMapScreenPtr pScreenPriv =
- (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
pScreen->CloseScreen = pScreenPriv->CloseScreen;
@@ -904,10 +890,11 @@ CMapChangeGamma(
CMapLinkPtr pLink;
/* Is this sufficient checking ? */
- if(CMapScreenIndex == -1)
+ if(CMapScreenKey == NULL)
return BadImplementation;
- pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr;
+ pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
if(!pScreenPriv)
return BadImplementation;
@@ -925,8 +912,8 @@ CMapChangeGamma(
/* mark all colormaps on this screen */
pLink = pScreenPriv->maps;
while(pLink) {
- pColPriv =
- (CMapColormapPtr) pLink->cmap->devPrivates[CMapColormapIndex].ptr;
+ pColPriv = (CMapColormapPtr)dixLookupPrivate(&pLink->cmap->devPrivates,
+ CMapColormapKey);
pColPriv->recalculate = TRUE;
pLink = pLink->next;
}
@@ -997,10 +984,11 @@ xf86ChangeGammaRamp(
CMapScreenPtr pScreenPriv;
CMapLinkPtr pLink;
- if(CMapScreenIndex == -1)
+ if(CMapScreenKey == NULL)
return BadImplementation;
- pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr;
+ pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
if(!pScreenPriv)
return BadImplementation;
@@ -1012,8 +1000,8 @@ xf86ChangeGammaRamp(
/* mark all colormaps on this screen */
pLink = pScreenPriv->maps;
while(pLink) {
- pColPriv =
- (CMapColormapPtr) pLink->cmap->devPrivates[CMapColormapIndex].ptr;
+ pColPriv = (CMapColormapPtr)dixLookupPrivate(&pLink->cmap->devPrivates,
+ CMapColormapKey);
pColPriv->recalculate = TRUE;
pLink = pLink->next;
}
@@ -1056,9 +1044,10 @@ xf86GetGammaRampSize(ScreenPtr pScreen)
{
CMapScreenPtr pScreenPriv;
- if(CMapScreenIndex == -1) return 0;
+ if(CMapScreenKey == NULL) return 0;
- pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr;
+ pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
if(!pScreenPriv) return 0;
return pScreenPriv->gammaElements;
@@ -1076,10 +1065,11 @@ xf86GetGammaRamp(
LOCO *entry;
int shift, sigbits;
- if(CMapScreenIndex == -1)
+ if(CMapScreenKey == NULL)
return BadImplementation;
- pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr;
+ pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
if(!pScreenPriv)
return BadImplementation;
diff --git a/hw/xfree86/common/xf86fbman.c b/hw/xfree86/common/xf86fbman.c
index 537d53d7d..9fd2e6c70 100644
--- a/hw/xfree86/common/xf86fbman.c
+++ b/hw/xfree86/common/xf86fbman.c
@@ -42,21 +42,15 @@
#define DEBUG
*/
-static int xf86FBMangerIndex = -1;
-static unsigned long xf86ManagerGeneration = 0;
+static DevPrivateKey xf86FBManagerKey = NULL;
_X_EXPORT Bool xf86RegisterOffscreenManager(
ScreenPtr pScreen,
FBManagerFuncsPtr funcs
){
- if(xf86ManagerGeneration != serverGeneration) {
- if((xf86FBMangerIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- xf86ManagerGeneration = serverGeneration;
- }
-
- pScreen->devPrivates[xf86FBMangerIndex].ptr = (pointer)funcs;
+ xf86FBManagerKey = &xf86FBManagerKey;
+ dixSetPrivate(&pScreen->devPrivates, xf86FBManagerKey, funcs);
return TRUE;
}
@@ -65,9 +59,9 @@ _X_EXPORT Bool xf86RegisterOffscreenManager(
_X_EXPORT Bool
xf86FBManagerRunning(ScreenPtr pScreen)
{
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return FALSE;
- if(!pScreen->devPrivates[xf86FBMangerIndex].ptr)
+ if(!dixLookupPrivate(&pScreen->devPrivates, xf86FBManagerKey))
return FALSE;
return TRUE;
@@ -81,9 +75,10 @@ xf86RegisterFreeBoxCallback(
){
FBManagerFuncsPtr funcs;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return FALSE;
- if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
return FALSE;
return (*funcs->RegisterFreeBoxCallback)(pScreen, FreeBoxCallback, devPriv);
@@ -101,9 +96,10 @@ xf86AllocateOffscreenArea(
){
FBManagerFuncsPtr funcs;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return NULL;
- if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
return NULL;
return (*funcs->AllocateOffscreenArea)(
@@ -122,9 +118,10 @@ xf86AllocateOffscreenLinear(
){
FBManagerFuncsPtr funcs;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return NULL;
- if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
return NULL;
return (*funcs->AllocateOffscreenLinear)(
@@ -139,10 +136,10 @@ xf86FreeOffscreenArea(FBAreaPtr area)
if(!area) return;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return;
- if(!(funcs =
- (FBManagerFuncsPtr)area->pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(
+ &area->pScreen->devPrivates, xf86FBManagerKey)))
return;
(*funcs->FreeOffscreenArea)(area);
@@ -158,10 +155,10 @@ xf86FreeOffscreenLinear(FBLinearPtr linear)
if(!linear) return;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return;
- if(!(funcs =
- (FBManagerFuncsPtr)linear->pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(
+ &linear->pScreen->devPrivates, xf86FBManagerKey)))
return;
(*funcs->FreeOffscreenLinear)(linear);
@@ -179,10 +176,10 @@ xf86ResizeOffscreenArea(
if(!resize) return FALSE;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return FALSE;
- if(!(funcs =
- (FBManagerFuncsPtr)resize->pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(
+ &resize->pScreen->devPrivates, xf86FBManagerKey)))
return FALSE;
return (*funcs->ResizeOffscreenArea)(resize, w, h);
@@ -197,10 +194,10 @@ xf86ResizeOffscreenLinear(
if(!resize) return FALSE;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return FALSE;
- if(!(funcs =
- (FBManagerFuncsPtr)resize->pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(
+ &resize->pScreen->devPrivates, xf86FBManagerKey)))
return FALSE;
return (*funcs->ResizeOffscreenLinear)(resize, size);
@@ -220,9 +217,10 @@ xf86QueryLargestOffscreenArea(
*w = 0;
*h = 0;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return FALSE;
- if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
return FALSE;
return (*funcs->QueryLargestOffscreenArea)(
@@ -240,9 +238,10 @@ xf86QueryLargestOffscreenLinear(
*size = 0;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return FALSE;
- if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
return FALSE;
return (*funcs->QueryLargestOffscreenLinear)(
@@ -255,9 +254,10 @@ xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
{
FBManagerFuncsPtr funcs;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return FALSE;
- if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
return FALSE;
return (*funcs->PurgeOffscreenAreas)(pScreen);
@@ -269,8 +269,7 @@ xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
\************************************************************/
-static unsigned long xf86FBGeneration = 0;
-static int xf86FBScreenIndex = -1;
+static DevPrivateKey xf86FBScreenKey = &xf86FBScreenKey;
typedef struct _FBLink {
FBArea area;
@@ -320,8 +319,8 @@ localRegisterFreeBoxCallback(
FreeBoxCallbackProcPtr *newCallbacks;
DevUnion *newPrivates;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
newCallbacks = xrealloc( offman->FreeBoxesUpdateCallback,
sizeof(FreeBoxCallbackProcPtr) * (offman->NumCallbacks + 1));
@@ -446,8 +445,8 @@ localAllocateOffscreenArea(
FBManagerPtr offman;
FBAreaPtr area = NULL;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
if((area = AllocateArea(offman, w, h, gran, moveCB, removeCB, privData)))
SendCallFreeBoxCallbacks(offman);
@@ -464,8 +463,8 @@ localFreeOffscreenArea(FBAreaPtr area)
ScreenPtr pScreen;
pScreen = area->pScreen;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
pLink = offman->UsedAreas;
if(!pLink) return;
@@ -505,8 +504,8 @@ localResizeOffscreenArea(
FBLinkPtr pLink, newLink, pLinkPrev = NULL;
pScreen = resize->pScreen;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
/* find this link */
if(!(pLink = offman->UsedAreas))
return FALSE;
@@ -625,8 +624,8 @@ localQueryLargestOffscreenArea(
if((preferences < 0) || (preferences > 3))
return FALSE;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
if(severity < 0) severity = 0;
if(severity > 2) severity = 2;
@@ -731,8 +730,8 @@ localPurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
RegionRec FreedRegion;
Bool anyUsed = FALSE;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
pLink = offman->UsedAreas;
if(!pLink) return TRUE;
@@ -780,8 +779,8 @@ LinearRemoveCBWrapper(FBAreaPtr area)
FBLinearLinkPtr pLink, pLinkPrev = NULL;
ScreenPtr pScreen = area->pScreen;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
pLink = offman->LinearAreas;
if(!pLink) return;
@@ -911,7 +910,8 @@ localAllocateOffscreenLinear(
BoxPtr extents;
int w, h, pitch;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
/* Try to allocate from linear memory first...... */
#ifdef DEBUG
@@ -991,8 +991,8 @@ localFreeOffscreenLinear(FBLinearPtr linear)
FBLinearLinkPtr pLink, pLinkPrev = NULL;
ScreenPtr pScreen = linear->pScreen;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
pLink = offman->LinearAreas;
if(!pLink) return;
@@ -1049,8 +1049,8 @@ localResizeOffscreenLinear(FBLinearPtr resize, int length)
FBLinearLinkPtr pLink;
ScreenPtr pScreen = resize->pScreen;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
pLink = offman->LinearAreas;
if(!pLink) return FALSE;
@@ -1099,7 +1099,8 @@ localQueryLargestOffscreenLinear(
int priority
)
{
- FBManagerPtr offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
+ FBManagerPtr offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
FBLinearLinkPtr pLink;
FBLinearLinkPtr pLinkRet;
@@ -1130,7 +1131,8 @@ localQueryLargestOffscreenLinear(
FBManagerPtr offman;
BoxPtr extents;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
extents = REGION_EXTENTS(pScreen, offman->InitialBoxes);
if((extents->x2 - extents->x1) == w)
*size = w * h;
@@ -1162,9 +1164,8 @@ xf86FBCloseScreen (int i, ScreenPtr pScreen)
{
FBLinkPtr pLink, tmp;
FBLinearLinkPtr pLinearLink, tmp2;
- FBManagerPtr offman =
- (FBManagerPtr) pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ FBManagerPtr offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
pScreen->CloseScreen = offman->CloseScreen;
@@ -1188,7 +1189,7 @@ xf86FBCloseScreen (int i, ScreenPtr pScreen)
xfree(offman->FreeBoxesUpdateCallback);
xfree(offman->devPrivates);
xfree(offman);
- pScreen->devPrivates[xf86FBScreenIndex].ptr = NULL;
+ dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, NULL);
return (*pScreen->CloseScreen) (i, pScreen);
}
@@ -1332,19 +1333,13 @@ xf86InitFBManagerRegion(
if(REGION_NIL(FullRegion))
return FALSE;
- if(xf86FBGeneration != serverGeneration) {
- if((xf86FBScreenIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- xf86FBGeneration = serverGeneration;
- }
-
if(!xf86RegisterOffscreenManager(pScreen, &xf86FBManFuncs))
return FALSE;
offman = xalloc(sizeof(FBManager));
if(!offman) return FALSE;
- pScreen->devPrivates[xf86FBScreenIndex].ptr = (pointer)offman;
+ dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, offman);
offman->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xf86FBCloseScreen;
@@ -1380,11 +1375,11 @@ xf86InitFBManagerLinear(
return FALSE;
/* we expect people to have called the Area setup first for pixmap cache */
- if (!pScreen->devPrivates[xf86FBScreenIndex].ptr)
+ if (!dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey))
return FALSE;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
offman->LinearAreas = xalloc(sizeof(FBLinearLink));
if (!offman->LinearAreas)
return FALSE;
@@ -1424,13 +1419,14 @@ xf86AllocateLinearOffscreenArea (
BoxPtr extents;
int w, h;
- if(xf86FBMangerIndex < 0)
+ if(xf86FBManagerKey == NULL)
return NULL;
- if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr))
+ if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBManagerKey)))
return NULL;
- offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;
-
+ offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
+ xf86FBScreenKey);
extents = REGION_EXTENTS(pScreen, offman->InitialBoxes);
w = extents->x2 - extents->x1;
diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c
index af2cd4a4c..63d1cb31c 100644
--- a/hw/xfree86/common/xf86sbusBus.c
+++ b/hw/xfree86/common/xf86sbusBus.c
@@ -602,8 +602,7 @@ xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp)
pScrn->virtualY = psdp->height;
}
-static int sbusPaletteIndex = -1;
-static unsigned long sbusPaletteGeneration = 0;
+static DevPrivateKey sbusPaletteKey = &sbusPaletteKey;
typedef struct _sbusCmap {
sbusDevicePtr psdp;
CloseScreenProcPtr CloseScreen;
@@ -613,7 +612,8 @@ typedef struct _sbusCmap {
unsigned char origBlue[16];
} sbusCmapRec, *sbusCmapPtr;
-#define SBUSCMAPPTR(pScreen) ((sbusCmapPtr)((pScreen)->devPrivates[sbusPaletteIndex].ptr))
+#define SBUSCMAPPTR(pScreen) ((sbusCmapPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, sbusPaletteKey))
static void
xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
@@ -673,13 +673,8 @@ xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp)
struct fbcmap fbcmap;
unsigned char data[2];
- if(sbusPaletteGeneration != serverGeneration) {
- if((sbusPaletteIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- sbusPaletteGeneration = serverGeneration;
- }
cmap = xnfcalloc(1, sizeof(sbusCmapRec));
- pScreen->devPrivates[sbusPaletteIndex].ptr = cmap;
+ dixSetPrivate(&pScreen->devPrivates, sbusPaletteKey, cmap);
cmap->psdp = psdp;
fbcmap.index = 0;
fbcmap.count = 16;
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index eac0d7e2c..7483e20d2 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -110,23 +110,22 @@ static void xf86XVAdjustFrame(int index, int x, int y, int flags);
static Bool xf86XVInitAdaptors(ScreenPtr, XF86VideoAdaptorPtr*, int);
-static int XF86XVWindowIndex = -1;
-int XF86XvScreenIndex = -1;
-static unsigned long XF86XVGeneration = 0;
+static DevPrivateKey XF86XVWindowKey = &XF86XVWindowKey;
+DevPrivateKey XF86XvScreenKey;
static unsigned long PortResource = 0;
-int (*XvGetScreenIndexProc)(void) = NULL;
+DevPrivateKey (*XvGetScreenKeyProc)(void) = NULL;
unsigned long (*XvGetRTPortProc)(void) = NULL;
int (*XvScreenInitProc)(ScreenPtr) = NULL;
#define GET_XV_SCREEN(pScreen) \
- ((XvScreenPtr)((pScreen)->devPrivates[XF86XvScreenIndex].ptr))
+ ((XvScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XF86XvScreenKey))
#define GET_XF86XV_SCREEN(pScreen) \
- ((XF86XVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr))
+ ((XF86XVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr))
#define GET_XF86XV_WINDOW(pWin) \
- ((XF86XVWindowPtr)((pWin)->devPrivates[XF86XVWindowIndex].ptr))
+ ((XF86XVWindowPtr)dixLookupPrivate(&(pWin)->devPrivates, XF86XVWindowKey))
static xf86XVInitGenericAdaptorPtr *GenDrivers = NULL;
static int NumGenDrivers = 0;
@@ -233,21 +232,12 @@ xf86XVScreenInit(
XvScreenPtr pxvs;
if(num <= 0 ||
- !XvGetScreenIndexProc || !XvGetRTPortProc || !XvScreenInitProc)
- return FALSE;
-
- if(XF86XVGeneration != serverGeneration) {
- if((XF86XVWindowIndex = AllocateWindowPrivateIndex()) < 0)
- return FALSE;
- XF86XVGeneration = serverGeneration;
- }
-
- if(!AllocateWindowPrivate(pScreen,XF86XVWindowIndex,0))
+ !XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
return FALSE;
if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
- XF86XvScreenIndex = (*XvGetScreenIndexProc)();
+ XF86XvScreenKey = (*XvGetScreenKeyProc)();
PortResource = (*XvGetRTPortProc)();
pxvs = GET_XV_SCREEN(pScreen);
@@ -977,7 +967,7 @@ xf86XVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
memset(winPriv, 0, sizeof(XF86XVWindowRec));
winPriv->PortRec = portPriv;
winPriv->next = PrivRoot;
- pWin->devPrivates[XF86XVWindowIndex].ptr = (pointer)winPriv;
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, winPriv);
}
portPriv->pDraw = (DrawablePtr)pWin;
@@ -998,8 +988,8 @@ xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
if(prevPriv)
prevPriv->next = winPriv->next;
else
- pWin->devPrivates[XF86XVWindowIndex].ptr =
- (pointer)winPriv->next;
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
+ winPriv->next);
xfree(winPriv);
break;
}
@@ -1037,7 +1027,7 @@ xf86XVDestroyWindow(WindowPtr pWin)
xfree(tmp);
}
- pWin->devPrivates[XF86XVWindowIndex].ptr = NULL;
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, NULL);
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
ret = (*pScreen->DestroyWindow)(pWin);
@@ -1094,8 +1084,8 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
pPriv->pDraw = NULL;
if(!pPrev)
- pWin->devPrivates[XF86XVWindowIndex].ptr =
- (pointer)(WinPriv->next);
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
+ WinPriv->next);
else
pPrev->next = WinPriv->next;
tmp = WinPriv;
@@ -1146,8 +1136,8 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
pPriv->pDraw = NULL;
if(!pPrev)
- pWin->devPrivates[XF86XVWindowIndex].ptr =
- (pointer)(WinPriv->next);
+ dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
+ WinPriv->next);
else
pPrev->next = WinPriv->next;
tmp = WinPriv;
@@ -1844,7 +1834,8 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
int status;
pval[0] = key;
pval[1] = IncludeInferiors;
- pGC = CreateGC(pDraw, GCForeground | GCSubwindowMode, pval, &status);
+ pGC = CreateGC(pDraw, GCForeground | GCSubwindowMode, pval, &status,
+ (XID)0, serverClient);
if(!pGC) return;
ValidateGC(pDraw, pGC);
if (pPriv) pPriv->pGC = pGC;
diff --git a/hw/xfree86/common/xf86xvmc.c b/hw/xfree86/common/xf86xvmc.c
index f8ff0bed4..05267a240 100644
--- a/hw/xfree86/common/xf86xvmc.c
+++ b/hw/xfree86/common/xf86xvmc.c
@@ -56,11 +56,10 @@ typedef struct {
XvMCAdaptorPtr dixinfo;
} xf86XvMCScreenRec, *xf86XvMCScreenPtr;
-static unsigned long XF86XvMCGeneration = 0;
-static int XF86XvMCScreenIndex = -1;
+static DevPrivateKey XF86XvMCScreenKey = &XF86XvMCScreenKey;
-#define XF86XVMC_GET_PRIVATE(pScreen) \
- (xf86XvMCScreenPtr)((pScreen)->devPrivates[XF86XvMCScreenIndex].ptr)
+#define XF86XVMC_GET_PRIVATE(pScreen) (xf86XvMCScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, XF86XvMCScreenKey)
static int
@@ -164,19 +163,12 @@ _X_EXPORT Bool xf86XvMCScreenInit(
{
XvMCAdaptorPtr pAdapt;
xf86XvMCScreenPtr pScreenPriv;
- XvScreenPtr pxvs =
- (XvScreenPtr)(pScreen->devPrivates[XF86XvScreenIndex].ptr);
-
+ XvScreenPtr pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ XF86XvScreenKey);
int i, j;
if(!XvMCScreenInitProc) return FALSE;
- if(XF86XvMCGeneration != serverGeneration) {
- if((XF86XvMCScreenIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- XF86XvMCGeneration = serverGeneration;
- }
-
if(!(pAdapt = xalloc(sizeof(XvMCAdaptorRec) * num_adaptors)))
return FALSE;
@@ -185,7 +177,7 @@ _X_EXPORT Bool xf86XvMCScreenInit(
return FALSE;
}
- pScreen->devPrivates[XF86XvMCScreenIndex].ptr = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, XF86XvMCScreenKey, pScreenPriv);
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xf86XvMCCloseScreen;
diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
index e716c9c6a..4200dac80 100644
--- a/hw/xfree86/common/xf86xvpriv.h
+++ b/hw/xfree86/common/xf86xvpriv.h
@@ -30,10 +30,11 @@
#define _XF86XVPRIV_H_
#include "xf86xv.h"
+#include "privates.h"
/*** These are DDX layer privates ***/
-extern int XF86XvScreenIndex;
+extern DevPrivateKey XF86XvScreenKey;
typedef struct {
DestroyWindowProcPtr DestroyWindow;
diff --git a/hw/xfree86/dixmods/extmod/modinit.h b/hw/xfree86/dixmods/extmod/modinit.h
index 41f060b2a..191b3ef89 100644
--- a/hw/xfree86/dixmods/extmod/modinit.h
+++ b/hw/xfree86/dixmods/extmod/modinit.h
@@ -129,8 +129,11 @@ extern void ShmRegisterFuncs(
extern void XaceExtensionInit(INITARGS);
#endif
+#ifdef XSELINUX
+extern void XSELinuxExtensionInit(INITARGS);
+#endif
+
#if 1
-extern void SecurityExtensionSetup(INITARGS);
extern void SecurityExtensionInit(INITARGS);
#endif
diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c
index fa9530860..3b866c798 100644
--- a/hw/xfree86/dixmods/extmod/xf86dga2.c
+++ b/hw/xfree86/dixmods/extmod/xf86dga2.c
@@ -22,6 +22,7 @@
#include "cursorstr.h"
#include "scrnintstr.h"
#include "servermd.h"
+#include "registry.h"
#define _XF86DGA_SERVER_
#include <X11/extensions/xf86dga.h>
#include <X11/extensions/xf86dgastr.h>
@@ -62,8 +63,7 @@ unsigned char DGAReqCode = 0;
int DGAErrorBase;
int DGAEventBase;
-static int DGAGeneration = 0;
-static int DGAClientPrivateIndex;
+static DevPrivateKey DGAClientPrivateKey = &DGAClientPrivateKey;
static int DGACallbackRefCount = 0;
/* This holds the client's version information */
@@ -72,7 +72,11 @@ typedef struct {
int minor;
} DGAPrivRec, *DGAPrivPtr;
-#define DGAPRIV(c) ((c)->devPrivates[DGAClientPrivateIndex].ptr)
+#define DGA_GETPRIV(c) ((DGAPrivPtr) \
+ dixLookupPrivate(&(c)->devPrivates, DGAClientPrivateKey))
+#define DGA_SETPRIV(c,p) \
+ dixSetPrivate(&(c)->devPrivates, DGAClientPrivateKey, p)
+
void
XFree86DGAExtensionInit(INITARGS)
@@ -96,24 +100,72 @@ XFree86DGAExtensionInit(INITARGS)
DGAEventBase = extEntry->eventBase;
for (i = KeyPress; i <= MotionNotify; i++)
SetCriticalEvent (DGAEventBase + i);
- }
-
- /*
- * Allocate a client private index to hold the client's version
- * information.
- */
- if (DGAGeneration != serverGeneration) {
- DGAClientPrivateIndex = AllocateClientPrivateIndex();
- /*
- * Allocate 0 length, and use the private to hold a pointer to
- * our DGAPrivRec.
- */
- if (!AllocateClientPrivate(DGAClientPrivateIndex, 0)) {
- ErrorF("XFree86DGAExtensionInit: AllocateClientPrivate failed\n");
- return;
- }
- DGAGeneration = serverGeneration;
- }
+ } else
+ return;
+
+ RegisterRequestName(DGAReqCode, X_XF86DGAQueryVersion,
+ XF86DGANAME ":QueryVersion");
+ RegisterRequestName(DGAReqCode, X_XF86DGAGetVideoLL,
+ XF86DGANAME ":GetVideoLL");
+ RegisterRequestName(DGAReqCode, X_XF86DGADirectVideo,
+ XF86DGANAME ":DirectVideo");
+ RegisterRequestName(DGAReqCode, X_XF86DGAGetViewPortSize,
+ XF86DGANAME ":GetViewPortSize");
+ RegisterRequestName(DGAReqCode, X_XF86DGASetViewPort,
+ XF86DGANAME ":SetViewPort");
+ RegisterRequestName(DGAReqCode, X_XF86DGAGetVidPage,
+ XF86DGANAME ":GetVidPage");
+ RegisterRequestName(DGAReqCode, X_XF86DGASetVidPage,
+ XF86DGANAME ":SetVidPage");
+ RegisterRequestName(DGAReqCode, X_XF86DGAInstallColormap,
+ XF86DGANAME ":InstallColormap");
+ RegisterRequestName(DGAReqCode, X_XF86DGAQueryDirectVideo,
+ XF86DGANAME ":QueryDirectVideo");
+ RegisterRequestName(DGAReqCode, X_XF86DGAViewPortChanged,
+ XF86DGANAME ":ViewPortChanged");
+ RegisterRequestName(DGAReqCode, X_XDGAQueryModes,
+ XF86DGANAME ":QueryModes");
+ RegisterRequestName(DGAReqCode, X_XDGASetMode,
+ XF86DGANAME ":SetMode");
+ RegisterRequestName(DGAReqCode, X_XDGASetViewport,
+ XF86DGANAME ":SetViewport");
+ RegisterRequestName(DGAReqCode, X_XDGAInstallColormap,
+ XF86DGANAME ":InstallColormap");
+ RegisterRequestName(DGAReqCode, X_XDGASelectInput,
+ XF86DGANAME ":SelectInput");
+ RegisterRequestName(DGAReqCode, X_XDGAFillRectangle,
+ XF86DGANAME ":FillRectangle");
+ RegisterRequestName(DGAReqCode, X_XDGACopyArea,
+ XF86DGANAME ":CopyArea");
+ RegisterRequestName(DGAReqCode, X_XDGACopyTransparentArea,
+ XF86DGANAME ":CopyTransparentArea");
+ RegisterRequestName(DGAReqCode, X_XDGAGetViewportStatus,
+ XF86DGANAME ":GetViewportStatus");
+ RegisterRequestName(DGAReqCode, X_XDGASync,
+ XF86DGANAME ":Sync");
+ RegisterRequestName(DGAReqCode, X_XDGAOpenFramebuffer,
+ XF86DGANAME ":OpenFramebuffer");
+ RegisterRequestName(DGAReqCode, X_XDGACloseFramebuffer,
+ XF86DGANAME ":CloseFramebuffer");
+ RegisterRequestName(DGAReqCode, X_XDGASetClientVersion,
+ XF86DGANAME ":SetClientVersion");
+ RegisterRequestName(DGAReqCode, X_XDGAChangePixmapMode,
+ XF86DGANAME ":ChangePixmapMode");
+ RegisterRequestName(DGAReqCode, X_XDGACreateColormap,
+ XF86DGANAME ":CreateColormap");
+
+ /* 7 Events: Don't know where they are defined. EFW */
+
+ RegisterErrorName(extEntry->errorBase + XF86DGAClientNotLocal,
+ XF86DGANAME ":ClientNotLocal");
+ RegisterErrorName(extEntry->errorBase + XF86DGANoDirectVideoMode,
+ XF86DGANAME ":NoDirectVideoMode");
+ RegisterErrorName(extEntry->errorBase + XF86DGAScreenNotActive,
+ XF86DGANAME ":ScreenNotActive");
+ RegisterErrorName(extEntry->errorBase + XF86DGADirectNotActivated,
+ XF86DGANAME ":DirectNotActivated");
+ RegisterErrorName(extEntry->errorBase + XF86DGAOperationNotSupported,
+ XF86DGANAME ":OperationNotSupported");
}
@@ -590,12 +642,12 @@ ProcXDGASetClientVersion(ClientPtr client)
DGAPrivPtr pPriv;
REQUEST_SIZE_MATCH(xXDGASetClientVersionReq);
- if ((pPriv = DGAPRIV(client)) == NULL) {
+ if ((pPriv = DGA_GETPRIV(client)) == NULL) {
pPriv = xalloc(sizeof(DGAPrivRec));
/* XXX Need to look into freeing this */
if (!pPriv)
return BadAlloc;
- DGAPRIV(client) = pPriv;
+ DGA_SETPRIV(client, pPriv);
}
pPriv->major = stuff->major;
pPriv->minor = stuff->minor;
diff --git a/hw/xfree86/dixmods/extmod/xf86misc.c b/hw/xfree86/dixmods/extmod/xf86misc.c
index 3a6f83eca..274b1d3f1 100644
--- a/hw/xfree86/dixmods/extmod/xf86misc.c
+++ b/hw/xfree86/dixmods/extmod/xf86misc.c
@@ -19,6 +19,7 @@
#include "scrnintstr.h"
#include "inputstr.h"
#include "servermd.h"
+#include "registry.h"
#define _XF86MISC_SERVER_
#undef _XF86MISC_SAVER_COMPAT_
#include <X11/extensions/xf86mscstr.h>
@@ -41,8 +42,7 @@
#endif
static int miscErrorBase;
-static int MiscGeneration = 0;
-static int MiscClientPrivateIndex;
+static DevPrivateKey MiscClientPrivateKey = &MiscClientPrivateKey;
/* This holds the client's version information */
typedef struct {
@@ -50,7 +50,10 @@ typedef struct {
int minor;
} MiscPrivRec, *MiscPrivPtr;
-#define MPRIV(c) ((c)->devPrivates[MiscClientPrivateIndex].ptr)
+#define M_GETPRIV(c) ((MiscPrivPtr) \
+ dixLookupPrivate(&(c)->devPrivates, MiscClientPrivateKey))
+#define M_SETPRIV(c,p) \
+ dixSetPrivate(&(c)->devPrivates, MiscClientPrivateKey, p)
static void XF86MiscResetProc(
ExtensionEntry* /* extEntry */
@@ -61,7 +64,7 @@ ClientVersion(ClientPtr client, int *major, int *minor)
{
MiscPrivPtr pPriv;
- pPriv = MPRIV(client);
+ pPriv = M_GETPRIV(client);
if (!pPriv) {
if (major) *major = 0;
if (minor) *minor = 0;
@@ -123,24 +126,6 @@ XFree86MiscExtensionInit(void)
if (!xf86GetModInDevEnabled())
return;
- /*
- * Allocate a client private index to hold the client's version
- * information.
- */
- if (MiscGeneration != serverGeneration) {
- MiscClientPrivateIndex = AllocateClientPrivateIndex();
- /*
- * Allocate 0 length, and use the private to hold a pointer to our
- * MiscPrivRec.
- */
- if (!AllocateClientPrivate(MiscClientPrivateIndex, 0)) {
- ErrorF("XFree86MiscExtensionInit: "
- "AllocateClientPrivate failed\n");
- return;
- }
- MiscGeneration = serverGeneration;
- }
-
if (
(extEntry = AddExtension(XF86MISCNAME,
XF86MiscNumberEvents,
@@ -153,7 +138,50 @@ XFree86MiscExtensionInit(void)
XF86MiscReqCode = (unsigned char)extEntry->base;
#endif
miscErrorBase = extEntry->errorBase;
- }
+ } else
+ return;
+
+ RegisterRequestName(extEntry->base, X_XF86MiscQueryVersion,
+ XF86MISCNAME ":QueryVersion");
+#ifdef _XF86MISC_SAVER_COMPAT_
+ RegisterRequestName(extEntry->base, X_XF86MiscGetSaver,
+ XF86MISCNAME ":GetSaver");
+ RegisterRequestName(extEntry->base, X_XF86MiscSetSaver,
+ XF86MISCNAME ":SetSaver");
+#endif
+ RegisterRequestName(extEntry->base, X_XF86MiscGetMouseSettings,
+ XF86MISCNAME ":GetMouseSettings");
+ RegisterRequestName(extEntry->base, X_XF86MiscGetKbdSettings,
+ XF86MISCNAME ":GetKbdSettings");
+ RegisterRequestName(extEntry->base, X_XF86MiscSetMouseSettings,
+ XF86MISCNAME ":SetMouseSettings");
+ RegisterRequestName(extEntry->base, X_XF86MiscSetKbdSettings,
+ XF86MISCNAME ":SetKbdSettings");
+ RegisterRequestName(extEntry->base, X_XF86MiscSetGrabKeysState,
+ XF86MISCNAME ":SetGrabKeysState");
+ RegisterRequestName(extEntry->base, X_XF86MiscSetClientVersion,
+ XF86MISCNAME ":SetClientVersion");
+ RegisterRequestName(extEntry->base, X_XF86MiscGetFilePaths,
+ XF86MISCNAME ":GetFilePaths");
+ RegisterRequestName(extEntry->base, X_XF86MiscPassMessage,
+ XF86MISCNAME ":PassMessage");
+
+ RegisterErrorName(extEntry->errorBase + XF86MiscBadMouseProtocol,
+ XF86MISCNAME ":BadMouseProtocol");
+ RegisterErrorName(extEntry->errorBase + XF86MiscBadMouseBaudRate,
+ XF86MISCNAME ":BadMouseBaudRate");
+ RegisterErrorName(extEntry->errorBase + XF86MiscBadMouseFlags,
+ XF86MISCNAME ":BadMouseFlags");
+ RegisterErrorName(extEntry->errorBase + XF86MiscBadMouseCombo,
+ XF86MISCNAME ":BadMouseCombo");
+ RegisterErrorName(extEntry->errorBase + XF86MiscBadKbdType,
+ XF86MISCNAME ":BadKbdType");
+ RegisterErrorName(extEntry->errorBase + XF86MiscModInDevDisabled,
+ XF86MISCNAME ":ModInDevDisabled");
+ RegisterErrorName(extEntry->errorBase + XF86MiscModInDevClientNotLocal,
+ XF86MISCNAME ":ModInDevClientNotLocal");
+ RegisterErrorName(extEntry->errorBase + XF86MiscNoModule,
+ XF86MISCNAME ":NoModule");
}
/*ARGSUSED*/
@@ -205,7 +233,9 @@ ProcXF86MiscSetSaver(client)
if (stuff->screen > screenInfo.numScreens)
return BadValue;
- vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
+ vptr = (ScrnInfoPtr)
+ dixLookupPrivate(&screenInfo.screens[stuff->screen]->devPrivates,
+ xf86ScreenKey);
REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq);
@@ -233,7 +263,9 @@ ProcXF86MiscGetSaver(client)
if (stuff->screen > screenInfo.numScreens)
return BadValue;
- vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr;
+ vptr = (ScrnInfoPtr)
+ dixLookupPrivate(&screenInfo.screens[stuff->screen]->devPrivates,
+ xf86ScreenKey);
REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq);
rep.type = X_Reply;
@@ -497,11 +529,11 @@ ProcXF86MiscSetClientVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xXF86MiscSetClientVersionReq);
- if ((pPriv = MPRIV(client)) == NULL) {
+ if ((pPriv = M_GETPRIV(client)) == NULL) {
pPriv = xalloc(sizeof(MiscPrivRec));
if (!pPriv)
return BadAlloc;
- MPRIV(client) = pPriv;
+ M_SETPRIV(client, pPriv);
}
if (xf86GetVerbosity() > 1)
ErrorF("SetClientVersion: %i %i\n",stuff->major,stuff->minor);
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 3b054a829..17ba44aba 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -43,6 +43,7 @@ from Kaleb S. KEITHLEY
#include "extnsionst.h"
#include "scrnintstr.h"
#include "servermd.h"
+#include "registry.h"
#define _XF86VIDMODE_SERVER_
#include <X11/extensions/xf86vmstr.h>
#include "swaprep.h"
@@ -52,8 +53,7 @@ from Kaleb S. KEITHLEY
#define DEFAULT_XF86VIDMODE_VERBOSITY 3
static int VidModeErrorBase;
-static int VidModeGeneration = 0;
-static int VidModeClientPrivateIndex;
+static DevPrivateKey VidModeClientPrivateKey = &VidModeClientPrivateKey;
/* This holds the client's version information */
typedef struct {
@@ -61,7 +61,10 @@ typedef struct {
int minor;
} VidModePrivRec, *VidModePrivPtr;
-#define VMPRIV(c) ((c)->devPrivates[VidModeClientPrivateIndex].ptr)
+#define VM_GETPRIV(c) ((VidModePrivPtr) \
+ dixLookupPrivate(&(c)->devPrivates, VidModeClientPrivateKey))
+#define VM_SETPRIV(c,p) \
+ dixSetPrivate(&(c)->devPrivates, VidModeClientPrivateKey, p)
static void XF86VidModeResetProc(
ExtensionEntry* /* extEntry */
@@ -145,10 +148,12 @@ typedef struct _XF86VidModeScreenPrivate {
Bool hasWindow;
} XF86VidModeScreenPrivateRec, *XF86VidModeScreenPrivatePtr;
-static int ScreenPrivateIndex;
+static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKey;
-#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr)
-#define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (pointer) v);
+#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \
+ dixLookupPrivate(&(s)->devPrivates, ScreenPrivateKey))
+#define SetScreenPrivate(s,v) \
+ dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v)
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = GetScreenPrivate(s)
#define New(t) (xalloc (sizeof (t)))
@@ -172,7 +177,6 @@ XFree86VidModeExtensionInit(void)
#ifdef XF86VIDMODE_EVENTS
EventType = CreateNewResourceType(XF86VidModeFreeEvents);
- ScreenPrivateIndex = AllocateScreenPrivateIndex ();
#endif
for(i = 0; i < screenInfo.numScreens; i++) {
@@ -187,27 +191,9 @@ XFree86VidModeExtensionInit(void)
if (!enabled)
return;
- /*
- * Allocate a client private index to hold the client's version
- * information.
- */
- if (VidModeGeneration != serverGeneration) {
- VidModeClientPrivateIndex = AllocateClientPrivateIndex();
- /*
- * Allocate 0 length, and use the private to hold a pointer to our
- * VidModePrivRec.
- */
- if (!AllocateClientPrivate(VidModeClientPrivateIndex, 0)) {
- ErrorF("XFree86VidModeExtensionInit: "
- "AllocateClientPrivate failed\n");
- return;
- }
- VidModeGeneration = serverGeneration;
- }
-
if (
#ifdef XF86VIDMODE_EVENTS
- EventType && ScreenPrivateIndex != -1 &&
+ EventType &&
#endif
(extEntry = AddExtension(XF86VIDMODENAME,
XF86VidModeNumberEvents,
@@ -224,7 +210,71 @@ XFree86VidModeExtensionInit(void)
XF86VidModeEventBase = extEntry->eventBase;
EventSwapVector[XF86VidModeEventBase] = (EventSwapPtr)SXF86VidModeNotifyEvent;
#endif
- }
+ } else
+ return;
+
+ RegisterRequestName(extEntry->base, X_XF86VidModeQueryVersion,
+ XF86VIDMODENAME ":QueryVersion");
+ RegisterRequestName(extEntry->base, X_XF86VidModeGetModeLine,
+ XF86VIDMODENAME ":GetModeLine");
+ RegisterRequestName(extEntry->base, X_XF86VidModeModModeLine,
+ XF86VIDMODENAME ":ModModeLine");
+ RegisterRequestName(extEntry->base, X_XF86VidModeSwitchMode,
+ XF86VIDMODENAME ":SwitchMode");
+ RegisterRequestName(extEntry->base, X_XF86VidModeGetMonitor,
+ XF86VIDMODENAME ":GetMonitor");
+ RegisterRequestName(extEntry->base, X_XF86VidModeLockModeSwitch,
+ XF86VIDMODENAME ":LockModeSwitch");
+ RegisterRequestName(extEntry->base, X_XF86VidModeGetAllModeLines,
+ XF86VIDMODENAME ":GetAllModeLines");
+ RegisterRequestName(extEntry->base, X_XF86VidModeAddModeLine,
+ XF86VIDMODENAME ":AddModeLine");
+ RegisterRequestName(extEntry->base, X_XF86VidModeDeleteModeLine,
+ XF86VIDMODENAME ":DeleteModeLine");
+ RegisterRequestName(extEntry->base, X_XF86VidModeValidateModeLine,
+ XF86VIDMODENAME ":ValidateModeLine");
+ RegisterRequestName(extEntry->base, X_XF86VidModeSwitchToMode,
+ XF86VIDMODENAME ":SwitchToMode");
+ RegisterRequestName(extEntry->base, X_XF86VidModeGetViewPort,
+ XF86VIDMODENAME ":GetViewPort");
+ RegisterRequestName(extEntry->base, X_XF86VidModeSetViewPort,
+ XF86VIDMODENAME ":SetViewPort");
+ RegisterRequestName(extEntry->base, X_XF86VidModeGetDotClocks,
+ XF86VIDMODENAME ":GetDotClocks");
+ RegisterRequestName(extEntry->base, X_XF86VidModeSetClientVersion,
+ XF86VIDMODENAME ":SetClientVersion");
+ RegisterRequestName(extEntry->base, X_XF86VidModeSetGamma,
+ XF86VIDMODENAME ":SetGamma");
+ RegisterRequestName(extEntry->base, X_XF86VidModeGetGamma,
+ XF86VIDMODENAME ":GetGamma");
+ RegisterRequestName(extEntry->base, X_XF86VidModeGetGammaRamp,
+ XF86VIDMODENAME ":GetGammaRamp");
+ RegisterRequestName(extEntry->base, X_XF86VidModeSetGammaRamp,
+ XF86VIDMODENAME ":SetGammaRamp");
+ RegisterRequestName(extEntry->base, X_XF86VidModeGetGammaRampSize,
+ XF86VIDMODENAME ":GetGammaRampSize");
+ RegisterRequestName(extEntry->base, X_XF86VidModeGetPermissions,
+ XF86VIDMODENAME ":GetPermissions");
+
+#ifdef XF86VIDMODE_EVENTS
+ RegisterEventName(extEntry->eventBase + XF86VidModeNotify,
+ XF86VIDMODENAME ":Notify");
+#endif
+
+ RegisterErrorName(extEntry->errorBase + XF86VidModeBadClock,
+ XF86VIDMODENAME ":BadClock");
+ RegisterErrorName(extEntry->errorBase + XF86VidModeBadHTimings,
+ XF86VIDMODENAME ":BadHTimings");
+ RegisterErrorName(extEntry->errorBase + XF86VidModeBadVTimings,
+ XF86VIDMODENAME ":BadVTimings");
+ RegisterErrorName(extEntry->errorBase + XF86VidModeModeUnsuitable,
+ XF86VIDMODENAME ":ModeUnsuitable");
+ RegisterErrorName(extEntry->errorBase + XF86VidModeExtensionDisabled,
+ XF86VIDMODENAME ":ExtensionDisabled");
+ RegisterErrorName(extEntry->errorBase + XF86VidModeClientNotLocal,
+ XF86VIDMODENAME ":ClientNotLocal");
+ RegisterErrorName(extEntry->errorBase + XF86VidModeZoomLocked,
+ XF86VIDMODENAME ":ZoomLocked");
}
/*ARGSUSED*/
@@ -239,7 +289,7 @@ ClientMajorVersion(ClientPtr client)
{
VidModePrivPtr pPriv;
- pPriv = VMPRIV(client);
+ pPriv = VM_GETPRIV(client);
if (!pPriv)
return 0;
else
@@ -1682,11 +1732,11 @@ ProcXF86VidModeSetClientVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
- if ((pPriv = VMPRIV(client)) == NULL) {
+ if ((pPriv = VM_GETPRIV(client)) == NULL) {
pPriv = xalloc(sizeof(VidModePrivRec));
if (!pPriv)
return BadAlloc;
- VMPRIV(client) = pPriv;
+ VM_SETPRIV(client, pPriv);
}
pPriv->major = stuff->major;
pPriv->minor = stuff->minor;
diff --git a/hw/xfree86/dixmods/extmod/xvmod.c b/hw/xfree86/dixmods/extmod/xvmod.c
index 7c1450c7a..6b3f1149a 100644
--- a/hw/xfree86/dixmods/extmod/xvmod.c
+++ b/hw/xfree86/dixmods/extmod/xvmod.c
@@ -16,7 +16,7 @@ void
XvRegister()
{
XvScreenInitProc = XvScreenInit;
- XvGetScreenIndexProc = XvGetScreenIndex;
+ XvGetScreenKeyProc = XvGetScreenKey;
XvGetRTPortProc = XvGetRTPort;
XvMCScreenInitProc = XvMCScreenInit;
}
diff --git a/hw/xfree86/dixmods/extmod/xvmodproc.h b/hw/xfree86/dixmods/extmod/xvmodproc.h
index 81356a149..b39c915b4 100644
--- a/hw/xfree86/dixmods/extmod/xvmodproc.h
+++ b/hw/xfree86/dixmods/extmod/xvmodproc.h
@@ -5,7 +5,7 @@
#include "xvmcext.h"
-extern int (*XvGetScreenIndexProc)(void);
+extern DevPrivateKey (*XvGetScreenKeyProc)(void);
extern unsigned long (*XvGetRTPortProc)(void);
extern int (*XvScreenInitProc)(ScreenPtr);
extern int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr);
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 2408357e5..b736c6ae0 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -78,8 +78,8 @@ extern Bool noPanoramiXExtension;
#endif
static int DRIEntPrivIndex = -1;
-static int DRIScreenPrivIndex = -1;
-static int DRIWindowPrivIndex = -1;
+static DevPrivateKey DRIScreenPrivKey = &DRIScreenPrivKey;
+static DevPrivateKey DRIWindowPrivKey = &DRIWindowPrivKey;
static unsigned long DRIGeneration = 0;
static unsigned int DRIDrawableValidationStamp = 0;
@@ -342,20 +342,18 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
pDRIEntPriv = DRI_ENT_PRIV(pScrn);
- if (DRIGeneration != serverGeneration) {
- if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
+ DRIScreenPrivKey = &DRIScreenPrivKey;
+ if (DRIGeneration != serverGeneration)
DRIGeneration = serverGeneration;
- }
pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec));
if (!pDRIPriv) {
- pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
- DRIScreenPrivIndex = -1;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ DRIScreenPrivKey = NULL;
return FALSE;
}
- pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer) pDRIPriv;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, pDRIPriv);
pDRIPriv->drmFD = pDRIEntPriv->drmFD;
pDRIPriv->directRenderingSupport = TRUE;
pDRIPriv->pDriverInfo = pDRIInfo;
@@ -380,7 +378,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
&pDRIPriv->hSAREA) < 0)
{
pDRIPriv->directRenderingSupport = FALSE;
- pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
drmClose(pDRIPriv->drmFD);
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] drmAddMap failed\n");
@@ -397,7 +395,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
(drmAddressPtr)(&pDRIPriv->pSAREA)) < 0)
{
pDRIPriv->directRenderingSupport = FALSE;
- pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
drmClose(pDRIPriv->drmFD);
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] drmMap failed\n");
@@ -427,7 +425,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
&pDRIPriv->pDriverInfo->hFrameBuffer) < 0)
{
pDRIPriv->directRenderingSupport = FALSE;
- pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
drmUnmap(pDRIPriv->pSAREA, pDRIPriv->pDriverInfo->SAREASize);
drmClose(pDRIPriv->drmFD);
DRIDrvMsg(pScreen->myNum, X_INFO,
@@ -743,8 +741,8 @@ DRICloseScreen(ScreenPtr pScreen)
}
xfree(pDRIPriv);
- pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
- DRIScreenPrivIndex = -1;
+ dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
+ DRIScreenPrivKey = NULL;
}
}
@@ -771,30 +769,13 @@ drmServerInfo DRIDRMServerInfo = {
Bool
DRIExtensionInit(void)
{
- int i;
- ScreenPtr pScreen;
-
- if (DRIScreenPrivIndex < 0 || DRIGeneration != serverGeneration) {
+ if (!DRIScreenPrivKey || DRIGeneration != serverGeneration) {
return FALSE;
}
- /* Allocate a window private index with a zero sized private area for
- * each window, then should a window become a DRI window, we'll hang
- * a DRIWindowPrivateRec off of this private index.
- */
- if ((DRIWindowPrivIndex = AllocateWindowPrivateIndex()) < 0)
- return FALSE;
-
DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete);
DRIContextPrivResType = CreateNewResourceType(DRIContextPrivDelete);
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- pScreen = screenInfo.screens[i];
- if (!AllocateWindowPrivate(pScreen, DRIWindowPrivIndex, 0))
- return FALSE;
- }
-
RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL);
return TRUE;
@@ -1270,9 +1251,8 @@ DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable,
pDRIDrawablePriv->nrects = REGION_NUM_RECTS(&pWin->clipList);
/* save private off of preallocated index */
- pWin->devPrivates[DRIWindowPrivIndex].ptr =
- (pointer)pDRIDrawablePriv;
-
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey,
+ pDRIDrawablePriv);
pDRIPriv->nrWindows++;
if (pDRIDrawablePriv->nrects)
@@ -1330,7 +1310,7 @@ DRIDrawablePrivDestroy(WindowPtr pWin)
drmDestroyDrawable(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable);
xfree(pDRIDrawablePriv);
- pWin->devPrivates[DRIWindowPrivIndex].ptr = NULL;
+ dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL);
}
static Bool
diff --git a/hw/xfree86/dri/dristruct.h b/hw/xfree86/dri/dristruct.h
index c3b0aeede..ae970d834 100644
--- a/hw/xfree86/dri/dristruct.h
+++ b/hw/xfree86/dri/dristruct.h
@@ -37,15 +37,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xf86drm.h"
-#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) \
- ((DRIWindowPrivIndex < 0) ? \
- NULL : \
- ((DRIDrawablePrivPtr)((pWin)->devPrivates[DRIWindowPrivIndex].ptr)))
-
-#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) \
- ((DRIPixmapPrivIndex < 0) ? \
- NULL : \
- ((DRIDrawablePrivPtr)((pPix)->devPrivates[DRIWindowPrivIndex].ptr)))
+#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey))
+#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \
+ dixLookupPrivate(&(pPix)->devPrivates, DRIWindowPrivKey))
typedef struct _DRIDrawablePrivRec
{
@@ -65,13 +60,12 @@ struct _DRIContextPrivRec
void** pContextStore;
};
-#define DRI_SCREEN_PRIV(pScreen) \
- ((DRIScreenPrivIndex < 0) ? \
- NULL : \
- ((DRIScreenPrivPtr)((pScreen)->devPrivates[DRIScreenPrivIndex].ptr)))
+#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey))
#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
- (screenInfo.screens[screenIndex]->devPrivates[DRIScreenPrivIndex].ptr))
+ dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \
+ DRIScreenPrivKey))
#define DRI_ENT_PRIV(pScrn) \
((DRIEntPrivIndex < 0) ? \
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index ea11b38ee..d16910f33 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -53,6 +53,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "cursorstr.h"
#include "scrnintstr.h"
#include "servermd.h"
+#include "registry.h"
#define _XF86DRI_SERVER_
#include "xf86dristr.h"
#include "swaprep.h"
@@ -112,7 +113,42 @@ XFree86DRIExtensionInit(void)
StandardMinorOpcode))) {
DRIReqCode = (unsigned char)extEntry->base;
DRIErrorBase = extEntry->errorBase;
- }
+ } else
+ return;
+
+ RegisterRequestName(DRIReqCode, X_XF86DRIQueryVersion,
+ XF86DRINAME ":QueryVersion");
+ RegisterRequestName(DRIReqCode, X_XF86DRIQueryDirectRenderingCapable,
+ XF86DRINAME ":QueryDirectRenderingCapable");
+ RegisterRequestName(DRIReqCode, X_XF86DRIOpenConnection,
+ XF86DRINAME ":OpenConnection");
+ RegisterRequestName(DRIReqCode, X_XF86DRICloseConnection,
+ XF86DRINAME ":CloseConnection");
+ RegisterRequestName(DRIReqCode, X_XF86DRIGetClientDriverName,
+ XF86DRINAME ":GetClientDriverName");
+ RegisterRequestName(DRIReqCode, X_XF86DRICreateContext,
+ XF86DRINAME ":CreateContext");
+ RegisterRequestName(DRIReqCode, X_XF86DRIDestroyContext,
+ XF86DRINAME ":DestroyContext");
+ RegisterRequestName(DRIReqCode, X_XF86DRICreateDrawable,
+ XF86DRINAME ":CreateDrawable");
+ RegisterRequestName(DRIReqCode, X_XF86DRIDestroyDrawable,
+ XF86DRINAME ":DestroyDrawable");
+ RegisterRequestName(DRIReqCode, X_XF86DRIGetDrawableInfo,
+ XF86DRINAME ":GetDrawableInfo");
+ RegisterRequestName(DRIReqCode, X_XF86DRIGetDeviceInfo,
+ XF86DRINAME ":GetDeviceInfo");
+ RegisterRequestName(DRIReqCode, X_XF86DRIAuthConnection,
+ XF86DRINAME ":AuthConnection");
+ RegisterRequestName(DRIReqCode, X_XF86DRIOpenFullScreen,
+ XF86DRINAME ":OpenFullScreen");
+ RegisterRequestName(DRIReqCode, X_XF86DRICloseFullScreen,
+ XF86DRINAME ":CloseFullScreen");
+
+ RegisterErrorName(DRIErrorBase + XF86DRIClientNotLocal,
+ XF86DRINAME ":ClientNotLocal");
+ RegisterErrorName(DRIErrorBase + XF86DRIOperationNotSupported,
+ XF86DRINAME ":OperationNotSupported");
}
/*ARGSUSED*/
diff --git a/hw/xfree86/exa/examodule.c b/hw/xfree86/exa/examodule.c
index ceead8219..b8d306eb4 100644
--- a/hw/xfree86/exa/examodule.c
+++ b/hw/xfree86/exa/examodule.c
@@ -42,8 +42,7 @@ typedef struct _ExaXorgScreenPrivRec {
OptionInfoPtr options;
} ExaXorgScreenPrivRec, *ExaXorgScreenPrivPtr;
-static int exaXorgServerGeneration;
-static int exaXorgScreenPrivateIndex;
+static DevPrivateKey exaXorgScreenPrivateKey = &exaXorgScreenPrivateKey;
typedef enum {
EXAOPT_MIGRATION_HEURISTIC,
@@ -72,8 +71,8 @@ static Bool
exaXorgCloseScreen (int i, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
- ExaXorgScreenPrivPtr pScreenPriv =
- pScreen->devPrivates[exaXorgScreenPrivateIndex].ptr;
+ ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey);
pScreen->CloseScreen = pScreenPriv->SavedCloseScreen;
@@ -89,8 +88,8 @@ static void
exaXorgEnableDisableFBAccess (int index, Bool enable)
{
ScreenPtr pScreen = screenInfo.screens[index];
- ExaXorgScreenPrivPtr pScreenPriv =
- pScreen->devPrivates[exaXorgScreenPrivateIndex].ptr;
+ ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey);
if (!enable)
exaEnableDisableFBAccess (index, enable);
@@ -114,11 +113,6 @@ exaDDXDriverInit(ScreenPtr pScreen)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ExaXorgScreenPrivPtr pScreenPriv;
- if (exaXorgServerGeneration != serverGeneration) {
- exaXorgScreenPrivateIndex = AllocateScreenPrivateIndex();
- exaXorgServerGeneration = serverGeneration;
- }
-
pScreenPriv = xcalloc (1, sizeof(ExaXorgScreenPrivRec));
if (pScreenPriv == NULL)
return;
@@ -174,7 +168,7 @@ exaDDXDriverInit(ScreenPtr pScreen)
pExaScr->info->DownloadFromScreen = NULL;
}
- pScreen->devPrivates[exaXorgScreenPrivateIndex].ptr = pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey, pScreenPriv);
pScreenPriv->SavedEnableDisableFBAccess = pScrn->EnableDisableFBAccess;
pScrn->EnableDisableFBAccess = exaXorgEnableDisableFBAccess;
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index 5d06b05c7..139e23c6e 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -63,7 +63,9 @@
#include "globals.h"
#include "os.h"
#include "osdep.h"
+#include "privates.h"
#include "resource.h"
+#include "registry.h"
#include "servermd.h"
#include "scrnintstr.h"
#include "windowstr.h"
@@ -113,6 +115,16 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMFUNC(QueryColors)
/* cursor.c */
SYMFUNC(FreeCursor)
+ /* deprecated.c */
+ SYMFUNC(LookupClient)
+ SYMFUNC(LookupDrawable)
+ SYMFUNC(LookupWindow)
+ SYMFUNC(SecurityLookupDrawable)
+ SYMFUNC(SecurityLookupWindow)
+ SYMFUNC(LookupIDByType)
+ SYMFUNC(LookupIDByClass)
+ SYMFUNC(SecurityLookupIDByClass)
+ SYMFUNC(SecurityLookupIDByType)
/* devices.c */
SYMFUNC(Ones)
SYMFUNC(InitButtonClassDeviceStruct)
@@ -128,8 +140,6 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMFUNC(InitKeyboardDeviceStruct)
SYMFUNC(SendMappingNotify)
SYMFUNC(InitPointerDeviceStruct)
- SYMFUNC(LookupKeyboardDevice)
- SYMFUNC(LookupPointerDevice)
/* dispatch.c */
SYMFUNC(SetInputCheck)
SYMFUNC(SendErrorToClient)
@@ -159,13 +169,6 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMFUNC(dixLookupWindow)
SYMFUNC(dixLookupClient)
SYMFUNC(dixLookupGC)
- /* following are deprecated */
- SYMFUNC(LookupClient)
- SYMFUNC(LookupDrawable)
- SYMFUNC(LookupWindow)
- SYMFUNC(SecurityLookupDrawable)
- SYMFUNC(SecurityLookupWindow)
- /* end deprecated */
SYMFUNC(NoopDDA)
SYMFUNC(QueueWorkProc)
SYMFUNC(RegisterBlockAndWakeupHandlers)
@@ -191,11 +194,11 @@ _X_HIDDEN void *dixLookupTab[] = {
#endif
/* property.c */
SYMFUNC(ChangeWindowProperty)
+ SYMFUNC(dixChangeWindowProperty)
/* extension.c */
SYMFUNC(AddExtension)
SYMFUNC(AddExtensionAlias)
SYMFUNC(CheckExtension)
- SYMFUNC(DeclareExtensionSecurity)
SYMFUNC(MinorOpcodeOfRequest)
SYMFUNC(StandardMinorOpcode)
#ifdef XEVIE
@@ -234,7 +237,7 @@ _X_HIDDEN void *dixLookupTab[] = {
#ifdef XV
/* XXX These are exported from the DDX, not DIX. */
SYMVAR(XvScreenInitProc)
- SYMVAR(XvGetScreenIndexProc)
+ SYMVAR(XvGetScreenKeyProc)
SYMVAR(XvGetRTPortProc)
SYMVAR(XvMCScreenInitProc)
#endif
@@ -259,42 +262,36 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMFUNC(GetScratchPixmapHeader)
SYMFUNC(FreeScratchPixmapHeader)
/* privates.c */
- SYMFUNC(AllocateExtensionPrivate)
- SYMFUNC(AllocateExtensionPrivateIndex)
- SYMFUNC(AllocateClientPrivate)
- SYMFUNC(AllocateClientPrivateIndex)
- SYMFUNC(AllocateGCPrivate)
- SYMFUNC(AllocateGCPrivateIndex)
- SYMFUNC(AllocateWindowPrivate)
- SYMFUNC(AllocateWindowPrivateIndex)
- SYMFUNC(AllocateScreenPrivateIndex)
- SYMFUNC(AllocateColormapPrivateIndex)
- SYMFUNC(AllocateDevicePrivateIndex)
- SYMFUNC(AllocateDevicePrivate)
- SYMFUNC(AllocatePixmapPrivateIndex)
- SYMFUNC(AllocatePixmapPrivate)
+ SYMFUNC(dixRequestPrivate)
+ SYMFUNC(dixRegisterPrivateInitFunc)
+ SYMFUNC(dixRegisterPrivateDeleteFunc)
+ SYMFUNC(dixAllocatePrivate)
+ SYMFUNC(dixFreePrivates)
+ SYMFUNC(dixRegisterPrivateOffset)
+ SYMFUNC(dixLookupPrivateOffset)
/* resource.c */
SYMFUNC(AddResource)
SYMFUNC(ChangeResourceValue)
SYMFUNC(CreateNewResourceClass)
SYMFUNC(CreateNewResourceType)
+ SYMFUNC(dixLookupResource)
SYMFUNC(FakeClientID)
SYMFUNC(FreeResource)
SYMFUNC(FreeResourceByType)
SYMFUNC(GetXIDList)
SYMFUNC(GetXIDRange)
- SYMFUNC(LookupIDByType)
- SYMFUNC(LookupIDByClass)
SYMFUNC(LegalNewID)
- SYMFUNC(SecurityLookupIDByClass)
- SYMFUNC(SecurityLookupIDByType)
SYMFUNC(FindClientResourcesByType)
SYMFUNC(FindAllClientResources)
SYMVAR(lastResourceType)
SYMVAR(TypeMask)
-#ifdef RES
+ SYMVAR(ResourceStateCallback)
+ /* registry.c */
+#ifdef XREGISTRY
+ SYMFUNC(RegisterRequestName)
+ SYMFUNC(RegisterEventName)
+ SYMFUNC(RegisterErrorName)
SYMFUNC(RegisterResourceName)
- SYMVAR(ResourceNames)
#endif
/* swaprep.c */
SYMFUNC(CopySwap32Write)
@@ -512,7 +509,7 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMFUNC(PictureTransformPoint3d)
SYMFUNC(PictureGetSubpixelOrder)
SYMFUNC(PictureSetSubpixelOrder)
- SYMVAR(PictureScreenPrivateIndex)
+ SYMVAR(PictureScreenPrivateKey)
/* mipict.c */
SYMFUNC(miPictureInit)
SYMFUNC(miComputeCompositeRegion)
diff --git a/hw/xfree86/loader/misym.c b/hw/xfree86/loader/misym.c
index 025983b09..aa712c03a 100644
--- a/hw/xfree86/loader/misym.c
+++ b/hw/xfree86/loader/misym.c
@@ -200,9 +200,9 @@ _X_HIDDEN void *miLookupTab[] = {
SYMFUNC(miOverlaySetRootClip)
SYMVAR(miEmptyBox)
SYMVAR(miEmptyData)
- SYMVAR(miZeroLineScreenIndex)
+ SYMVAR(miZeroLineScreenKey)
SYMVAR(miSpritePointerFuncs)
- SYMVAR(miPointerScreenIndex)
+ SYMVAR(miPointerScreenKey)
SYMVAR(miInstalledMaps)
SYMVAR(miInitVisualsProc)
#ifdef DAMAGE
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index 7c46e0266..67a2fe784 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -1097,8 +1097,8 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMVAR(xf86HUGE_VAL)
/* General variables (from xf86.h) */
- SYMVAR(xf86ScreenIndex)
- SYMVAR(xf86PixmapIndex)
+ SYMVAR(xf86ScreenKey)
+ SYMVAR(xf86PixmapKey)
SYMVAR(xf86Screens)
SYMVAR(byte_reversed)
SYMVAR(xf86inSuspend)
diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index b5101642b..acf34c1d1 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -226,7 +226,8 @@ xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
CursorPtr cursor = xf86_config->cursor;
int c;
- CARD8 *bits = cursor ? cursor->devPriv[screen->myNum] : NULL;
+ CARD8 *bits = cursor ? dixLookupPrivate(&cursor->devPrivates,
+ screen) : NULL;
/* Save ARGB versions of these colors */
xf86_config->cursor_fg = (CARD32) fg | 0xff000000;
@@ -612,7 +613,7 @@ xf86_reload_cursors (ScreenPtr screen)
else
#endif
(*cursor_info->LoadCursorImage)(cursor_info->pScrn,
- cursor->devPriv[screen->myNum]);
+ dixLookupPrivate(&cursor->devPrivates, screen));
(*cursor_info->SetCursorPosition)(cursor_info->pScrn, x, y);
(*cursor_info->ShowCursor)(cursor_info->pScrn);
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index fe21717f1..d4a88f736 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -59,11 +59,11 @@ static Bool xf86RandR12Init12 (ScreenPtr pScreen);
static Bool xf86RandR12CreateScreenResources12 (ScreenPtr pScreen);
#endif
-static int xf86RandR12Index;
-static int xf86RandR12Generation;
+static int xf86RandR12Generation;
+static DevPrivateKey xf86RandR12Key = &xf86RandR12Key;
-#define XF86RANDRINFO(p) \
- ((XF86RandRInfoPtr)(p)->devPrivates[xf86RandR12Index].ptr)
+#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \
+ dixLookupPrivate(&(p)->devPrivates, xf86RandR12Key))
static int
xf86RandR12ModeRefresh (DisplayModePtr mode)
@@ -492,10 +492,7 @@ xf86RandR12Init (ScreenPtr pScreen)
return TRUE;
#endif
if (xf86RandR12Generation != serverGeneration)
- {
- xf86RandR12Index = AllocateScreenPrivateIndex();
xf86RandR12Generation = serverGeneration;
- }
randrp = xalloc (sizeof (XF86RandRInfoRec));
if (!randrp)
@@ -521,7 +518,7 @@ xf86RandR12Init (ScreenPtr pScreen)
randrp->maxX = randrp->maxY = 0;
- pScreen->devPrivates[xf86RandR12Index].ptr = randrp;
+ dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp);
#if RANDR_12_INTERFACE
if (!xf86RandR12Init12 (pScreen))
diff --git a/hw/xfree86/os-support/solaris/sun_mouse.c b/hw/xfree86/os-support/solaris/sun_mouse.c
index aa509d08b..b1b7797f1 100644
--- a/hw/xfree86/os-support/solaris/sun_mouse.c
+++ b/hw/xfree86/os-support/solaris/sun_mouse.c
@@ -121,8 +121,11 @@ static void vuidMouseSendScreenSize(ScreenPtr pScreen, VuidMsePtr pVuidMse);
static void vuidMouseAdjustFrame(int index, int x, int y, int flags);
static int vuidMouseGeneration = 0;
-static int vuidMouseScreenIndex;
-#define vuidMouseScreenPrivate(s) ((s)->devPrivates[vuidMouseScreenIndex].ptr)
+static DevPrivateKey vuidMouseScreenKey = &vuidMouseScreenKey;
+#define vuidGetMouseScreenPrivate(s) ((VuidMsePtr) \
+ dixLookupPrivate(&(s)->devPrivates, vuidMouseScreenKey))
+#define vuidSetMouseScreenPrivate(s,p) \
+ dixSetPrivate(&(s)->devPrivates, vuidMouseScreenKey, p)
#endif /* HAVE_ABSOLUTE_MOUSE_SCALING */
static inline
@@ -455,7 +458,7 @@ static void vuidMouseAdjustFrame(int index, int x, int y, int flags)
ScrnInfoPtr pScrn = xf86Screens[index];
ScreenPtr pScreen = pScrn->pScreen;
xf86AdjustFrameProc *wrappedAdjustFrame
- = (xf86AdjustFrameProc *) vuidMouseScreenPrivate(pScreen);
+ = (xf86AdjustFrameProc *) vuidMouseGetScreenPrivate(pScreen);
VuidMsePtr m;
if(wrappedAdjustFrame) {
@@ -496,15 +499,12 @@ vuidMouseProc(DeviceIntPtr pPointer, int what)
case DEVICE_INIT:
#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
if (vuidMouseGeneration != serverGeneration) {
- if ((vuidMouseScreenIndex = AllocateScreenPrivateIndex()) >= 0) {
for (i = 0; i < screenInfo.numScreens; i++) {
ScreenPtr pScreen = screenInfo.screens[i];
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
- vuidMouseScreenPrivate(pScreen)
- = (pointer) pScrn->AdjustFrame;
+ vuidMouseSetScreenPrivate(pScreen, pScrn->AdjustFrame);
pScrn->AdjustFrame = vuidMouseAdjustFrame;
}
- }
vuidMouseGeneration = serverGeneration;
}
#endif
diff --git a/hw/xfree86/rac/xf86RAC.c b/hw/xfree86/rac/xf86RAC.c
index 0d41599b1..8985f38b0 100644
--- a/hw/xfree86/rac/xf86RAC.c
+++ b/hw/xfree86/rac/xf86RAC.c
@@ -39,9 +39,8 @@
pScreen->x = y;}
#define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x
-#define SCREEN_PROLOG(x) \
- pScreen->x = \
- ((RACScreenPtr) (pScreen)->devPrivates[RACScreenIndex].ptr)->x
+#define SCREEN_PROLOG(x) pScreen->x = ((RACScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, RACScreenKey))->x
#define SCREEN_EPILOG(x,y) pScreen->x = y;
#define WRAP_PICT_COND(x,y,cond) if (ps)\
@@ -50,9 +49,8 @@
ps->x = y;}
#define UNWRAP_PICT(x) if (ps) {ps->x = pScreenPriv->x;}
-#define PICTURE_PROLOGUE(field) \
- ps->field = \
- ((RACScreenPtr) (pScreen)->devPrivates[RACScreenIndex].ptr)->field
+#define PICTURE_PROLOGUE(field) ps->field = \
+ ((RACScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, RACScreenKey))->field
#define PICTURE_EPILOGUE(field, wrap) \
ps->field = wrap
@@ -65,9 +63,9 @@
#define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x
#define SPRITE_PROLOG miPointerScreenPtr PointPriv = \
-(miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr;\
- RACScreenPtr pScreenPriv = \
-((RACScreenPtr) (pScreen)->devPrivates[RACScreenIndex].ptr);\
+ (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); \
+ RACScreenPtr pScreenPriv = \
+ ((RACScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, RACScreenKey));\
PointPriv->spriteFuncs = pScreenPriv->miSprite;
#define SPRITE_EPILOG pScreenPriv->miSprite = PointPriv->spriteFuncs;\
PointPriv->spriteFuncs = &RACSpriteFuncs;
@@ -82,7 +80,7 @@
(x)->ops = &RACGCOps;\
(x)->funcs = &RACGCFuncs;
#define GC_UNWRAP(x)\
- RACGCPtr pGCPriv = (RACGCPtr) (x)->devPrivates[RACGCIndex].ptr;\
+ RACGCPtr pGCPriv = (RACGCPtr)dixLookupPrivate(&(x)->devPrivates, RACGCKey);\
(x)->ops = pGCPriv->wrapOps;\
(x)->funcs = pGCPriv->wrapFuncs;
@@ -252,9 +250,8 @@ static miPointerSpriteFuncRec RACSpriteFuncs = {
RACSpriteMoveCursor
};
-static int RACScreenIndex = -1;
-static int RACGCIndex = -1;
-static unsigned long RACGeneration = 0;
+static DevPrivateKey RACScreenKey = &RACScreenKey;
+static DevPrivateKey RACGCKey = &RACGCKey;
Bool
@@ -268,24 +265,17 @@ xf86RACInit(ScreenPtr pScreen, unsigned int flag)
#endif
pScrn = xf86Screens[pScreen->myNum];
- PointPriv = (miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr;
-
+ PointPriv = (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miPointerScreenKey);
DPRINT_S("RACInit",pScreen->myNum);
- if (RACGeneration != serverGeneration) {
- if ( ((RACScreenIndex = AllocateScreenPrivateIndex()) < 0) ||
- ((RACGCIndex = AllocateGCPrivateIndex()) < 0))
- return FALSE;
-
- RACGeneration = serverGeneration;
- }
- if (!AllocateGCPrivate(pScreen, RACGCIndex, sizeof(RACGCRec)))
+ if (!dixRequestPrivate(RACGCKey, sizeof(RACGCRec)))
return FALSE;
if (!(pScreenPriv = xalloc(sizeof(RACScreenRec))))
return FALSE;
- pScreen->devPrivates[RACScreenIndex].ptr = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, RACScreenKey, pScreenPriv);
WRAP_SCREEN(CloseScreen, RACCloseScreen);
WRAP_SCREEN(SaveScreen, RACSaveScreen);
@@ -322,10 +312,10 @@ static Bool
RACCloseScreen (int i, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- RACScreenPtr pScreenPriv =
- (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
- miPointerScreenPtr PointPriv
- = (miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr;
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
+ miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, miPointerScreenKey);
#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif
@@ -581,8 +571,8 @@ static void
RACAdjustFrame(int index, int x, int y, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
- RACScreenPtr pScreenPriv =
- (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
DPRINT_S("RACAdjustFrame",index);
xf86EnableAccess(xf86Screens[index]);
@@ -594,8 +584,8 @@ static Bool
RACSwitchMode(int index, DisplayModePtr mode, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
- RACScreenPtr pScreenPriv =
- (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
DPRINT_S("RACSwitchMode",index);
xf86EnableAccess(xf86Screens[index]);
@@ -607,8 +597,8 @@ static Bool
RACEnterVT(int index, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
- RACScreenPtr pScreenPriv =
- (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
DPRINT_S("RACEnterVT",index);
xf86EnableAccess(xf86Screens[index]);
@@ -620,8 +610,8 @@ static void
RACLeaveVT(int index, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
- RACScreenPtr pScreenPriv =
- (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
DPRINT_S("RACLeaveVT",index);
xf86EnableAccess(xf86Screens[index]);
@@ -633,8 +623,8 @@ static void
RACFreeScreen(int index, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
- RACScreenPtr pScreenPriv =
- (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr;
+ RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, RACScreenKey);
DPRINT_S("RACFreeScreen",index);
xf86EnableAccess(xf86Screens[index]);
@@ -646,7 +636,7 @@ static Bool
RACCreateGC(GCPtr pGC)
{
ScreenPtr pScreen = pGC->pScreen;
- RACGCPtr pGCPriv = (RACGCPtr) (pGC)->devPrivates[RACGCIndex].ptr;
+ RACGCPtr pGCPriv = (RACGCPtr)dixLookupPrivate(&pGC->devPrivates, RACGCKey);
Bool ret;
DPRINT_S("RACCreateGC",pScreen->myNum);
diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
index 457807698..5b1ce5e1f 100644
--- a/hw/xfree86/ramdac/xf86Cursor.c
+++ b/hw/xfree86/ramdac/xf86Cursor.c
@@ -8,8 +8,7 @@
#include "colormapst.h"
#include "cursorstr.h"
-int xf86CursorScreenIndex = -1;
-static unsigned long xf86CursorGeneration = 0;
+DevPrivateKey xf86CursorScreenKey = &xf86CursorScreenKey;
/* sprite functions */
@@ -48,12 +47,6 @@ xf86InitCursor(
xf86CursorScreenPtr ScreenPriv;
miPointerScreenPtr PointPriv;
- if (xf86CursorGeneration != serverGeneration) {
- if ((xf86CursorScreenIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
- xf86CursorGeneration = serverGeneration;
- }
-
if (!xf86InitHardwareCursor(pScreen, infoPtr))
return FALSE;
@@ -61,7 +54,7 @@ xf86InitCursor(
if (!ScreenPriv)
return FALSE;
- pScreen->devPrivates[xf86CursorScreenIndex].ptr = ScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, xf86CursorScreenKey, ScreenPriv);
ScreenPriv->SWCursor = TRUE;
ScreenPriv->isUp = FALSE;
@@ -84,7 +77,7 @@ xf86InitCursor(
ScreenPriv->PalettedCursor = TRUE;
}
- PointPriv = pScreen->devPrivates[miPointerScreenIndex].ptr;
+ PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
ScreenPriv->showTransparent = PointPriv->showTransparent;
if (infoPtr->Flags & HARDWARE_CURSOR_SHOW_TRANSPARENT)
@@ -113,10 +106,10 @@ static Bool
xf86CursorCloseScreen(int i, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- miPointerScreenPtr PointPriv =
- pScreen->devPrivates[miPointerScreenIndex].ptr;
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, miPointerScreenKey);
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
if (ScreenPriv->isUp && pScrn->vtSema)
xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y);
@@ -146,8 +139,8 @@ xf86CursorQueryBestSize(
unsigned short *height,
ScreenPtr pScreen)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
if (class == CursorShape) {
if(*width > ScreenPriv->CursorInfoPtr->MaxWidth)
@@ -161,8 +154,8 @@ xf86CursorQueryBestSize(
static void
xf86CursorInstallColormap(ColormapPtr pMap)
{
- xf86CursorScreenPtr ScreenPriv =
- pMap->pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pMap->pScreen->devPrivates, xf86CursorScreenKey);
ScreenPriv->pInstalledMap = pMap;
@@ -175,8 +168,8 @@ xf86CursorRecolorCursor(
CursorPtr pCurs,
Bool displayed)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
if (!displayed)
return;
@@ -195,8 +188,8 @@ xf86CursorEnableDisableFBAccess(
Bool enable)
{
ScreenPtr pScreen = screenInfo.screens[index];
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
if (!enable && ScreenPriv->CurrentCursor != NullCursor) {
CursorPtr currentCursor = ScreenPriv->CurrentCursor;
@@ -226,10 +219,10 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags)
{
Bool ret;
ScreenPtr pScreen = screenInfo.screens[index];
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
- miPointerScreenPtr PointPriv =
- pScreen->devPrivates[miPointerScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
+ miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, miPointerScreenKey);
if (ScreenPriv->isUp) {
xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y);
@@ -254,11 +247,11 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags)
static Bool
xf86CursorRealizeCursor(ScreenPtr pScreen, CursorPtr pCurs)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
if (pCurs->refcnt <= 1)
- pCurs->devPriv[pScreen->myNum] = NULL;
+ dixSetPrivate(&pCurs->devPrivates, pScreen, NULL);
return (*ScreenPriv->spriteFuncs->RealizeCursor)(pScreen, pCurs);
}
@@ -266,12 +259,12 @@ xf86CursorRealizeCursor(ScreenPtr pScreen, CursorPtr pCurs)
static Bool
xf86CursorUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCurs)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
if (pCurs->refcnt <= 1) {
- xfree(pCurs->devPriv[pScreen->myNum]);
- pCurs->devPriv[pScreen->myNum] = NULL;
+ xfree(dixLookupPrivate(&pCurs->devPrivates, pScreen));
+ dixSetPrivate(&pCurs->devPrivates, pScreen, NULL);
}
return (*ScreenPriv->spriteFuncs->UnrealizeCursor)(pScreen, pCurs);
@@ -280,8 +273,8 @@ xf86CursorUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCurs)
static void
xf86CursorSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
miPointerScreenPtr PointPriv;
@@ -306,8 +299,8 @@ xf86CursorSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
ScreenPriv->HotX = pCurs->bits->xhot;
ScreenPriv->HotY = pCurs->bits->yhot;
- PointPriv = pScreen->devPrivates[miPointerScreenIndex].ptr;
-
+ PointPriv = (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miPointerScreenKey);
if (infoPtr->pScrn->vtSema && (ScreenPriv->ForceHWCursorCount || ((
#ifdef ARGB_CURSOR
pCurs->bits->argb && infoPtr->UseHWCursorARGB &&
@@ -351,8 +344,8 @@ xf86CursorSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
static void
xf86CursorMoveCursor(ScreenPtr pScreen, int x, int y)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
ScreenPriv->x = x;
ScreenPriv->y = y;
@@ -369,8 +362,8 @@ xf86CursorMoveCursor(ScreenPtr pScreen, int x, int y)
void
xf86ForceHWCursor (ScreenPtr pScreen, Bool on)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
if (on)
{
diff --git a/hw/xfree86/ramdac/xf86CursorPriv.h b/hw/xfree86/ramdac/xf86CursorPriv.h
index 472e2b06b..f82be2edc 100644
--- a/hw/xfree86/ramdac/xf86CursorPriv.h
+++ b/hw/xfree86/ramdac/xf86CursorPriv.h
@@ -45,6 +45,6 @@ Bool xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr);
CARD32 xf86ReverseBitOrder(CARD32 data);
-extern int xf86CursorScreenIndex;
+extern DevPrivateKey xf86CursorScreenKey;
#endif /* _XF86CURSORPRIV_H */
diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
index 91caea047..d10e283d7 100644
--- a/hw/xfree86/ramdac/xf86HWCurs.c
+++ b/hw/xfree86/ramdac/xf86HWCurs.c
@@ -113,8 +113,8 @@ xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr)
void
xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
unsigned char *bits;
@@ -123,7 +123,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
return;
}
- bits = pCurs->devPriv[pScreen->myNum];
+ bits = (unsigned char *)dixLookupPrivate(&pCurs->devPrivates, pScreen);
x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX;
y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY;
@@ -133,7 +133,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
#endif
if (!bits) {
bits = (*infoPtr->RealizeCursor)(infoPtr, pCurs);
- pCurs->devPriv[pScreen->myNum] = bits;
+ dixSetPrivate(&pCurs->devPrivates, pScreen, bits);
}
if (!(infoPtr->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN))
@@ -157,8 +157,8 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
void
xf86SetTransparentCursor(ScreenPtr pScreen)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
if (!ScreenPriv->transparentData)
@@ -178,8 +178,8 @@ xf86SetTransparentCursor(ScreenPtr pScreen)
void
xf86MoveCursor(ScreenPtr pScreen, int x, int y)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX;
@@ -191,8 +191,8 @@ xf86MoveCursor(ScreenPtr pScreen, int x, int y)
void
xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
{
- xf86CursorScreenPtr ScreenPriv =
- pScreen->devPrivates[xf86CursorScreenIndex].ptr;
+ xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, xf86CursorScreenKey);
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
#ifdef ARGB_CURSOR
diff --git a/hw/xfree86/shadowfb/shadow.c b/hw/xfree86/shadowfb/shadow.c
index 52fdcbef6..74beefb67 100644
--- a/hw/xfree86/shadowfb/shadow.c
+++ b/hw/xfree86/shadowfb/shadow.c
@@ -94,14 +94,13 @@ typedef struct {
} ShadowGCRec, *ShadowGCPtr;
-static int ShadowScreenIndex = -1;
-static int ShadowGCIndex = -1;
-static unsigned long ShadowGeneration = 0;
+static DevPrivateKey ShadowScreenKey = &ShadowScreenKey;
+static DevPrivateKey ShadowGCKey = &ShadowGCKey;
#define GET_SCREEN_PRIVATE(pScreen) \
- (ShadowScreenPtr)((pScreen)->devPrivates[ShadowScreenIndex].ptr)
+ (ShadowScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, ShadowScreenKey)
#define GET_GC_PRIVATE(pGC) \
- (ShadowGCPtr)((pGC)->devPrivates[ShadowGCIndex].ptr)
+ (ShadowGCPtr)dixLookupPrivate(&(pGC)->devPrivates, ShadowGCKey);
#define SHADOW_GC_FUNC_PROLOGUE(pGC)\
ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
@@ -172,20 +171,13 @@ ShadowFBInit2 (
if(!preRefreshArea && !postRefreshArea) return FALSE;
- if (ShadowGeneration != serverGeneration) {
- if(((ShadowScreenIndex = AllocateScreenPrivateIndex ()) < 0) ||
- ((ShadowGCIndex = AllocateGCPrivateIndex()) < 0))
- return FALSE;
- ShadowGeneration = serverGeneration;
- }
-
- if(!AllocateGCPrivate(pScreen, ShadowGCIndex, sizeof(ShadowGCRec)))
+ if(!dixRequestPrivate(ShadowGCKey, sizeof(ShadowGCRec)))
return FALSE;
if(!(pPriv = (ShadowScreenPtr)xalloc(sizeof(ShadowScreenRec))))
return FALSE;
- pScreen->devPrivates[ShadowScreenIndex].ptr = (pointer)pPriv;
+ dixSetPrivate(&pScreen->devPrivates, ShadowScreenKey, pPriv);
pPriv->pScrn = pScrn;
pPriv->preRefresh = preRefreshArea;
diff --git a/hw/xfree86/xaa/xaaDashLine.c b/hw/xfree86/xaa/xaaDashLine.c
index 1a4732baa..63233e05d 100644
--- a/hw/xfree86/xaa/xaaDashLine.c
+++ b/hw/xfree86/xaa/xaaDashLine.c
@@ -35,7 +35,8 @@ XAAPolyLinesDashed(
#endif
){
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr;
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
BoxPtr pboxInit = REGION_RECTS(pGC->pCompositeClip);
int nboxInit = REGION_NUM_RECTS(pGC->pCompositeClip);
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
diff --git a/hw/xfree86/xaa/xaaGC.c b/hw/xfree86/xaa/xaaGC.c
index b3dc83ada..e6083d529 100644
--- a/hw/xfree86/xaa/xaaGC.c
+++ b/hw/xfree86/xaa/xaaGC.c
@@ -38,7 +38,8 @@ Bool
XAACreateGC(GCPtr pGC)
{
ScreenPtr pScreen = pGC->pScreen;
- XAAGCPtr pGCPriv = (XAAGCPtr)(pGC->devPrivates[XAAGetGCIndex()].ptr);
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
Bool ret;
XAA_SCREEN_PROLOGUE(pScreen,CreateGC);
diff --git a/hw/xfree86/xaa/xaaGCmisc.c b/hw/xfree86/xaa/xaaGCmisc.c
index a7a3f4081..5823cc064 100644
--- a/hw/xfree86/xaa/xaaGCmisc.c
+++ b/hw/xfree86/xaa/xaaGCmisc.c
@@ -305,7 +305,8 @@ XAAValidatePolylines(
DrawablePtr pDraw )
{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr;
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
if(pGC->lineStyle == LineSolid) changes &= ~GCDashList;
if(!changes) return;
diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c
index 196569278..892cbcfc3 100644
--- a/hw/xfree86/xaa/xaaInit.c
+++ b/hw/xfree86/xaa/xaaInit.c
@@ -39,22 +39,20 @@ static int XAASetDGAMode(int index, int num, DGADevicePtr devRet);
static void XAAEnableDisableFBAccess (int index, Bool enable);
static Bool XAAChangeWindowAttributes (WindowPtr pWin, unsigned long mask);
-static int XAAScreenIndex = -1;
-static int XAAGCIndex = -1;
-static int XAAPixmapIndex = -1;
+static DevPrivateKey XAAScreenKey = &XAAScreenKey;
+static DevPrivateKey XAAGCKey = &XAAGCKey;
+static DevPrivateKey XAAPixmapKey = &XAAPixmapKey;
-static unsigned long XAAGeneration = 0;
-
-int XAAGetScreenIndex(void) {
- return XAAScreenIndex;
+DevPrivateKey XAAGetScreenKey(void) {
+ return XAAScreenKey;
}
-int XAAGetGCIndex(void) {
- return XAAGCIndex;
+DevPrivateKey XAAGetGCKey(void) {
+ return XAAGCKey;
}
-int XAAGetPixmapIndex(void) {
- return XAAPixmapIndex;
+DevPrivateKey XAAGetPixmapKey(void) {
+ return XAAPixmapKey;
}
/* temp kludge */
@@ -104,25 +102,16 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
if (!infoRec)
return TRUE;
- if (XAAGeneration != serverGeneration) {
- if ( ((XAAScreenIndex = AllocateScreenPrivateIndex()) < 0) ||
- ((XAAGCIndex = AllocateGCPrivateIndex()) < 0) ||
- ((XAAPixmapIndex = AllocatePixmapPrivateIndex()) < 0))
- return FALSE;
-
- XAAGeneration = serverGeneration;
- }
-
- if (!AllocateGCPrivate(pScreen, XAAGCIndex, sizeof(XAAGCRec)))
+ if (!dixRequestPrivate(XAAGCKey, sizeof(XAAGCRec)))
return FALSE;
- if (!AllocatePixmapPrivate(pScreen, XAAPixmapIndex, sizeof(XAAPixmapRec)))
+ if (!dixRequestPrivate(XAAPixmapKey, sizeof(XAAPixmapRec)))
return FALSE;
if (!(pScreenPriv = xalloc(sizeof(XAAScreenRec))))
return FALSE;
- pScreen->devPrivates[XAAScreenIndex].ptr = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, XAAScreenKey, pScreenPriv);
if(!xf86FBManagerRunning(pScreen))
infoRec->Flags &= ~(PIXMAP_CACHE | OFFSCREEN_PIXMAPS);
@@ -219,7 +208,7 @@ XAACloseScreen (int i, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
XAAScreenPtr pScreenPriv =
- (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr;
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
pScrn->EnterVT = pScreenPriv->EnterVT;
pScrn->LeaveVT = pScreenPriv->LeaveVT;
@@ -516,7 +505,7 @@ XAAEnterVT(int index, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
XAAScreenPtr pScreenPriv =
- (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr;
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
return((*pScreenPriv->EnterVT)(index, flags));
}
@@ -526,7 +515,7 @@ XAALeaveVT(int index, int flags)
{
ScreenPtr pScreen = screenInfo.screens[index];
XAAScreenPtr pScreenPriv =
- (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr;
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec;
if(infoRec->NeedToSync) {
@@ -549,7 +538,7 @@ XAASetDGAMode(int index, int num, DGADevicePtr devRet)
ScreenPtr pScreen = screenInfo.screens[index];
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
XAAScreenPtr pScreenPriv =
- (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr;
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
int ret;
if (!num && infoRec->dgaSaves) { /* restore old pixmap cache state */
@@ -611,7 +600,7 @@ XAAEnableDisableFBAccess (int index, Bool enable)
ScreenPtr pScreen = screenInfo.screens[index];
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
XAAScreenPtr pScreenPriv =
- (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr;
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
if(!enable) {
if((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
diff --git a/hw/xfree86/xaa/xaaLineMisc.c b/hw/xfree86/xaa/xaaLineMisc.c
index 537b08b97..cefb59a8e 100644
--- a/hw/xfree86/xaa/xaaLineMisc.c
+++ b/hw/xfree86/xaa/xaaLineMisc.c
@@ -64,7 +64,8 @@ void
XAAComputeDash(GCPtr pGC)
{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr;
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
Bool EvenDash = (pGC->numInDashList & 0x01) ? FALSE : TRUE;
int PatternLength = 0;
unsigned char* DashPtr = (unsigned char*)pGC->dash;
diff --git a/hw/xfree86/xaa/xaaOverlayDF.c b/hw/xfree86/xaa/xaaOverlayDF.c
index 47599d7d3..64ca998ee 100644
--- a/hw/xfree86/xaa/xaaOverlayDF.c
+++ b/hw/xfree86/xaa/xaaOverlayDF.c
@@ -151,11 +151,10 @@ typedef struct {
int (*TiledFillChooser)(GCPtr);
} XAAOverlayRec, *XAAOverlayPtr;
-static int XAAOverlayIndex = -1;
-static unsigned long XAAOverlayGeneration = 0;
+static DevPrivateKey XAAOverlayKey = &XAAOverlayKey;
#define GET_OVERLAY_PRIV(pScreen) \
- ((XAAOverlayPtr)((pScreen)->devPrivates[XAAOverlayIndex].ptr))
+ (XAAOverlayPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAOverlayKey)
#define SWITCH_DEPTH(d) \
if(pOverPriv->currentDepth != d) { \
@@ -173,18 +172,10 @@ XAAInitDualFramebufferOverlay(
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
XAAOverlayPtr pOverPriv;
- if (XAAOverlayGeneration != serverGeneration) {
- if((XAAOverlayIndex = AllocateScreenPrivateIndex()) < 0)
- return FALSE;
-
- XAAOverlayGeneration = serverGeneration;
- }
-
-
if(!(pOverPriv = xalloc(sizeof(XAAOverlayRec))))
return FALSE;
- pScreen->devPrivates[XAAOverlayIndex].ptr = (pointer)pOverPriv;
+ dixSetPrivate(&pScreen->devPrivates, XAAOverlayKey, pOverPriv);
pOverPriv->pScrn = pScrn;
pOverPriv->callback = callback;
diff --git a/hw/xfree86/xaa/xaaStateChange.c b/hw/xfree86/xaa/xaaStateChange.c
index 02c556b33..443bda628 100644
--- a/hw/xfree86/xaa/xaaStateChange.c
+++ b/hw/xfree86/xaa/xaaStateChange.c
@@ -274,18 +274,17 @@ typedef struct _XAAStateWrapRec {
#endif
} XAAStateWrapRec, *XAAStateWrapPtr;
-static int XAAStateIndex = -1;
-static unsigned long XAAStateGeneration = 0;
+static DevPrivateKey XAAStateKey = &XAAStateKey;
/* Wrap functions start here */
#define GET_STATEPRIV_GC(pGC) XAAStateWrapPtr pStatePriv =\
-(XAAStateWrapPtr)(pGC->pScreen->devPrivates[XAAStateIndex].ptr)
+(XAAStateWrapPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAStateKey)
#define GET_STATEPRIV_SCREEN(pScreen) XAAStateWrapPtr pStatePriv =\
-(XAAStateWrapPtr)(pScreen->devPrivates[XAAStateIndex].ptr)
+(XAAStateWrapPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAStateKey)
#define GET_STATEPRIV_PSCRN(pScrn) XAAStateWrapPtr pStatePriv =\
-(XAAStateWrapPtr)(pScrn->pScreen->devPrivates[XAAStateIndex].ptr)
+(XAAStateWrapPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAStateKey)
#define STATE_CHECK_SP(pStatePriv) {\
ScrnInfoPtr pScrn = pStatePriv->pScrn;\
@@ -1504,12 +1503,8 @@ XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
XAAStateWrapPtr pStatePriv;
int i = 0;
- if (XAAStateGeneration != serverGeneration) {
- if((XAAStateIndex = AllocateScreenPrivateIndex()) < 0) return FALSE;
- XAAStateGeneration = serverGeneration;
- }
if(!(pStatePriv = xalloc(sizeof(XAAStateWrapRec)))) return FALSE;
- pScreen->devPrivates[XAAStateIndex].ptr = (pointer)pStatePriv;
+ dixSetPrivate(&pScreen->devPrivates, XAAStateKey, pStatePriv);
pStatePriv->RestoreAccelState = infoRec->RestoreAccelState;
pStatePriv->pScrn = pScrn;
diff --git a/hw/xfree86/xaa/xaaWrapper.c b/hw/xfree86/xaa/xaaWrapper.c
index b0176f03f..5d6ea05cf 100644
--- a/hw/xfree86/xaa/xaaWrapper.c
+++ b/hw/xfree86/xaa/xaaWrapper.c
@@ -86,10 +86,8 @@ typedef struct {
int depth;
} xaaWrapperScrPrivRec, *xaaWrapperScrPrivPtr;
-#define xaaWrapperGetScrPriv(s) ((xaaWrapperScrPrivPtr)( \
- (xaaWrapperScrPrivateIndex != -1) \
- ? (s)->devPrivates[xaaWrapperScrPrivateIndex].ptr\
- : NULL))
+#define xaaWrapperGetScrPriv(s) ((xaaWrapperScrPrivPtr) \
+ dixLookupPrivate(&(s)->devPrivates, xaaWrapperScrPrivateKey))
#define xaaWrapperScrPriv(s) xaaWrapperScrPrivPtr pScrPriv = xaaWrapperGetScrPriv(s)
#define wrap(priv,real,mem,func) {\
@@ -127,13 +125,12 @@ typedef struct _xaaWrapperGCPriv {
} xaaWrapperGCPrivRec, *xaaWrapperGCPrivPtr;
#define xaaWrapperGetGCPriv(pGC) ((xaaWrapperGCPrivPtr) \
- (pGC)->devPrivates[xaaWrapperGCPrivateIndex].ptr)
+ dixLookupPrivate(&(pGC)->devPrivates, xaaWrapperGCPrivateKey))
#define xaaWrapperGCPriv(pGC) xaaWrapperGCPrivPtr pGCPriv = xaaWrapperGetGCPriv(pGC)
-static int xaaWrapperScrPrivateIndex = -1;
-static int xaaWrapperGCPrivateIndex = -1;
-static int xaaWrapperGeneration = -1;
+static DevPrivateKey xaaWrapperScrPrivateKey = &xaaWrapperScrPrivateKey;
+static DevPrivateKey xaaWrapperGCPrivateKey = &xaaWrapperGCPrivateKey;
static Bool
xaaWrapperCreateScreenResources(ScreenPtr pScreen)
@@ -274,18 +271,8 @@ xaaSetupWrapper(ScreenPtr pScreen, XAAInfoRecPtr infoPtr, int depth, SyncFunc *f
#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif
- if (xaaWrapperGeneration != serverGeneration) {
- xaaWrapperScrPrivateIndex = AllocateScreenPrivateIndex ();
- if (xaaWrapperScrPrivateIndex == -1)
- return FALSE;
- xaaWrapperGCPrivateIndex = AllocateGCPrivateIndex ();
- if (xaaWrapperGCPrivateIndex == -1)
- return FALSE;
- xaaWrapperGeneration = serverGeneration;
- }
- if (!AllocateGCPrivate (pScreen, xaaWrapperGCPrivateIndex,
- sizeof (xaaWrapperGCPrivRec)))
+ if (!dixRequestPrivate(xaaWrapperGCPrivateKey, sizeof(xaaWrapperGCPrivRec)))
return FALSE;
pScrPriv = (xaaWrapperScrPrivPtr) xalloc (sizeof (xaaWrapperScrPrivRec));
@@ -335,7 +322,7 @@ xaaSetupWrapper(ScreenPtr pScreen, XAAInfoRecPtr infoPtr, int depth, SyncFunc *f
}
#endif
pScrPriv->depth = depth;
- pScreen->devPrivates[xaaWrapperScrPrivateIndex].ptr = (pointer) pScrPriv;
+ dixSetPrivate(&pScreen->devPrivates, xaaWrapperScrPrivateKey, pScrPriv);
*func = XAASync;
@@ -486,8 +473,8 @@ xaaWrapperGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
void
XAASync(ScreenPtr pScreen)
{
- XAAScreenPtr pScreenPriv =
- (XAAScreenPtr) pScreen->devPrivates[XAAGetScreenIndex()].ptr;
+ XAAScreenPtr pScreenPriv = (XAAScreenPtr)
+ dixLookupPrivate(&pScreen->devPrivates, XAAGetScreenKey());
XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec;
if(infoRec->NeedToSync) {
diff --git a/hw/xfree86/xaa/xaalocal.h b/hw/xfree86/xaa/xaalocal.h
index 686cc876d..e25b9df52 100644
--- a/hw/xfree86/xaa/xaalocal.h
+++ b/hw/xfree86/xaa/xaalocal.h
@@ -1629,9 +1629,9 @@ XAAGetPixelFromRGBA (
extern GCOps XAAFallbackOps;
extern GCOps *XAAGetFallbackOps(void);
extern GCFuncs XAAGCFuncs;
-extern int XAAGetScreenIndex(void);
-extern int XAAGetGCIndex(void);
-extern int XAAGetPixmapIndex(void);
+extern DevPrivateKey XAAGetScreenKey(void);
+extern DevPrivateKey XAAGetGCKey(void);
+extern DevPrivateKey XAAGetPixmapKey(void);
extern unsigned int XAAShiftMasks[32];
@@ -1640,28 +1640,28 @@ extern unsigned int byte_expand3[256], byte_reversed_expand3[256];
CARD32 XAAReverseBitOrder(CARD32 data);
#define GET_XAASCREENPTR_FROM_SCREEN(pScreen)\
- (pScreen)->devPrivates[XAAGetScreenIndex()].ptr
+ dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey())
#define GET_XAASCREENPTR_FROM_GC(pGC)\
- (pGC)->pScreen->devPrivates[XAAGetScreenIndex()].ptr
+ dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey())
#define GET_XAASCREENPTR_FROM_DRAWABLE(pDraw)\
- (pDraw)->pScreen->devPrivates[XAAGetScreenIndex()].ptr
+ dixLookupPrivate(&(pDraw)->pScreen->devPrivates, XAAGetScreenKey())
#define GET_XAAINFORECPTR_FROM_SCREEN(pScreen)\
- ((XAAScreenPtr)((pScreen)->devPrivates[XAAGetScreenIndex()].ptr))->AccelInfoRec
+((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->AccelInfoRec
#define GET_XAAINFORECPTR_FROM_GC(pGC)\
-((XAAScreenPtr)((pGC)->pScreen->devPrivates[XAAGetScreenIndex()].ptr))->AccelInfoRec
+((XAAScreenPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
#define GET_XAAINFORECPTR_FROM_DRAWABLE(pDraw)\
-((XAAScreenPtr)((pDraw)->pScreen->devPrivates[XAAGetScreenIndex()].ptr))->AccelInfoRec
+((XAAScreenPtr)dixLookupPrivate(&(pDraw)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
#define GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn)\
-((XAAScreenPtr)((pScrn)->pScreen->devPrivates[XAAGetScreenIndex()].ptr))->AccelInfoRec
+((XAAScreenPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
#define XAA_GET_PIXMAP_PRIVATE(pix)\
- (XAAPixmapPtr)((pix)->devPrivates[XAAGetPixmapIndex()].ptr)
+ (XAAPixmapPtr)dixLookupPrivate(&(pix)->devPrivates, XAAGetPixmapKey())
#define CHECK_RGB_EQUAL(c) (!((((c) >> 8) ^ (c)) & 0xffff))
diff --git a/hw/xfree86/xaa/xaawrap.h b/hw/xfree86/xaa/xaawrap.h
index 32c17a60c..38c97d70b 100644
--- a/hw/xfree86/xaa/xaawrap.h
+++ b/hw/xfree86/xaa/xaawrap.h
@@ -1,14 +1,14 @@
#define XAA_SCREEN_PROLOGUE(pScreen, field)\
((pScreen)->field = \
- ((XAAScreenPtr) (pScreen)->devPrivates[XAAGetScreenIndex()].ptr)->field)
+ ((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->field)
#define XAA_SCREEN_EPILOGUE(pScreen, field, wrapper)\
((pScreen)->field = wrapper)
#define XAA_GC_FUNC_PROLOGUE(pGC)\
- XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr;\
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
(pGC)->funcs = pGCPriv->wrapFuncs;\
if(pGCPriv->flags)\
(pGC)->ops = pGCPriv->wrapOps
@@ -24,13 +24,13 @@
#define XAA_GC_OP_PROLOGUE(pGC)\
- XAAGCPtr pGCPriv = (XAAGCPtr)(pGC->devPrivates[XAAGetGCIndex()].ptr);\
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
GCFuncs *oldFuncs = pGC->funcs;\
pGC->funcs = pGCPriv->wrapFuncs;\
pGC->ops = pGCPriv->wrapOps
#define XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC)\
- XAAGCPtr pGCPriv = (XAAGCPtr)(pGC->devPrivates[XAAGetGCIndex()].ptr);\
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
GCFuncs *oldFuncs = pGC->funcs;\
if(!REGION_NUM_RECTS(pGC->pCompositeClip)) return; \
pGC->funcs = pGCPriv->wrapFuncs;\
@@ -44,7 +44,7 @@
#define XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw)\
- XAAGCPtr pGCPriv = (XAAGCPtr)(pGC->devPrivates[XAAGetGCIndex()].ptr);\
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDraw));\
GCFuncs *oldFuncs = pGC->funcs;\
pGC->funcs = pGCPriv->wrapFuncs;\
@@ -64,7 +64,7 @@
#ifdef RENDER
#define XAA_RENDER_PROLOGUE(pScreen,field)\
(GetPictureScreen(pScreen)->field = \
- ((XAAScreenPtr) (pScreen)->devPrivates[XAAGetScreenIndex()].ptr)->field)
+ ((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->field)
#define XAA_RENDER_EPILOGUE(pScreen, field, wrapper)\
(GetPictureScreen(pScreen)->field = wrapper)
@@ -74,7 +74,7 @@
#define SYNC_CHECK(pGC) {\
XAAInfoRecPtr infoRec =\
-((XAAScreenPtr)((pGC)->pScreen->devPrivates[XAAGetScreenIndex()].ptr))->AccelInfoRec;\
+((XAAScreenPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec; \
if(infoRec->NeedToSync) {\
(*infoRec->Sync)(infoRec->pScrn);\
infoRec->NeedToSync = FALSE;\
diff --git a/hw/xfree86/xf4bpp/mfbfillarc.c b/hw/xfree86/xf4bpp/mfbfillarc.c
index d5b5372f5..89aeadd2b 100644
--- a/hw/xfree86/xf4bpp/mfbfillarc.c
+++ b/hw/xfree86/xf4bpp/mfbfillarc.c
@@ -253,7 +253,8 @@ xf4bppPolyFillArcSolid
mfbPrivGC *priv;
int rop;
- priv = (mfbPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr;
+ priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey());
rop = priv->rop;
if ((rop == RROP_NOP) || !(pGC->planemask & 1))
#else
diff --git a/hw/xfree86/xf4bpp/mfbimggblt.c b/hw/xfree86/xf4bpp/mfbimggblt.c
index 73e7ce064..4f9561161 100644
--- a/hw/xfree86/xf4bpp/mfbimggblt.c
+++ b/hw/xfree86/xf4bpp/mfbimggblt.c
@@ -149,7 +149,8 @@ xf4bppImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
- pPrivGC = pGC->devPrivates[mfbGetGCPrivateIndex()].ptr;
+ pPrivGC = (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey());
oldfillStyle = pPrivGC->colorRrop.fillStyle; /* GJA */
oldfg = pPrivGC->colorRrop.fgPixel; /* GJA */
oldalu = pPrivGC->colorRrop.alu; /* GJA */
diff --git a/hw/xfree86/xf4bpp/mfbzerarc.c b/hw/xfree86/xf4bpp/mfbzerarc.c
index c7a8c4d56..61fc7b184 100644
--- a/hw/xfree86/xf4bpp/mfbzerarc.c
+++ b/hw/xfree86/xf4bpp/mfbzerarc.c
@@ -108,7 +108,8 @@ v16ZeroArcSS
int pmask;
register int *paddr;
- if (((mfbPrivGC *)(pGC->devPrivates[mfbGetGCPrivateIndex()].ptr))->rop ==
+ if (((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey()))->rop ==
RROP_BLACK)
pixel = 0;
else
diff --git a/hw/xfree86/xf4bpp/ppcArea.c b/hw/xfree86/xf4bpp/ppcArea.c
index e95696260..df7856a35 100644
--- a/hw/xfree86/xf4bpp/ppcArea.c
+++ b/hw/xfree86/xf4bpp/ppcArea.c
@@ -49,7 +49,7 @@ int alu ;
unsigned long int fg, bg, pm ;
int xSrc, ySrc ;
PixmapPtr pPixmap ;
-ppcPrivGC *pPrivGC = pGC->devPrivates[mfbGetGCPrivateIndex()].ptr;
+ppcPrivGC *pPrivGC = dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
TRACE( ( "xf4bppFillArea(0x%x,%d,0x%x,0x%x)\n", pWin, nboxes, pBox, pGC ) ) ;
diff --git a/hw/xfree86/xf4bpp/ppcGC.c b/hw/xfree86/xf4bpp/ppcGC.c
index 674a38b78..7ef312d39 100644
--- a/hw/xfree86/xf4bpp/ppcGC.c
+++ b/hw/xfree86/xf4bpp/ppcGC.c
@@ -182,7 +182,7 @@ register GCPtr pGC ;
* a pointer to a ppcPrivGC in its slot.
*/
*pPriv = vgaPrototypeGCPriv;
- (pGC->devPrivates[mfbGetGCPrivateIndex()].ptr) = (pointer) pPriv;
+ dixSetPrivate(&pGC->devPrivates, mfbGetGCPrivateKey(), pPriv);
/* Set the vgaGCOps */
*pOps = vgaGCOps;
@@ -202,7 +202,7 @@ xf4bppDestroyGC( pGC )
if ( pGC->freeCompClip && pGC->pCompositeClip )
REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
if(pGC->ops->devPrivate.val) xfree( pGC->ops );
- xfree( pGC->devPrivates[mfbGetGCPrivateIndex()].ptr ) ;
+ xfree(dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()));
return ;
}
@@ -213,7 +213,7 @@ ppcChangePixmapGC
register Mask changes
)
{
-register ppcPrivGCPtr devPriv = (ppcPrivGCPtr) (pGC->devPrivates[mfbGetGCPrivateIndex()].ptr ) ;
+register ppcPrivGCPtr devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
register unsigned long int idx ; /* used for stepping through bitfields */
#define LOWBIT( x ) ( x & - x ) /* Two's complement */
@@ -291,8 +291,8 @@ xf4bppValidateGC( pGC, changes, pDrawable )
register ppcPrivGCPtr devPriv ;
WindowPtr pWin ;
- devPriv = (ppcPrivGCPtr) (pGC->devPrivates[mfbGetGCPrivateIndex()].ptr ) ;
-
+ devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ mfbGetGCPrivateKey());
if ( pDrawable->type != devPriv->lastDrawableType ) {
devPriv->lastDrawableType = pDrawable->type ;
xf4bppChangeGCtype( pGC, devPriv ) ;
diff --git a/hw/xfree86/xf4bpp/ppcPixFS.c b/hw/xfree86/xf4bpp/ppcPixFS.c
index dfc648660..9fd29efce 100644
--- a/hw/xfree86/xf4bpp/ppcPixFS.c
+++ b/hw/xfree86/xf4bpp/ppcPixFS.c
@@ -124,7 +124,7 @@ xf4bppSolidPixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
return ;
}
- if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop )
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()))->colorRrop.alu ) == GXnoop )
return ;
n = nInit * miFindMaxBand(pGC->pCompositeClip) ;
@@ -142,8 +142,8 @@ xf4bppSolidPixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
n = miClipSpans( pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted ) ;
- pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ;
- fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
for ( ; n-- ; ppt++, pwidth++ ) {
@@ -258,14 +258,14 @@ int fSorted ;
return ;
}
- if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop )
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
pptFree, pwidth, ppt, fSorted ) ;
- pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ;
- fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
pTile = pGC->stipple ;
tlwidth = pTile->devKind ;
@@ -356,15 +356,15 @@ int fSorted ;
return ;
}
- if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop )
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
pptFree, pwidth, ppt, fSorted ) ;
- fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ;
- bg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.bgPixel ;
- pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
+ bg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.bgPixel ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
pTile = pGC->stipple ;
@@ -459,14 +459,14 @@ int fSorted ;
return ;
}
- if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop )
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
pptFree, pwidth, ppt, fSorted ) ;
/* the following code is for 8 bits per pixel addressable memory only */
- pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
pTile = pGC->tile.pixmap ;
tileWidth = pTile->drawable.width ;
diff --git a/hw/xfree86/xf4bpp/ppcPixmap.c b/hw/xfree86/xf4bpp/ppcPixmap.c
index 241217bf4..d9a0ccae4 100644
--- a/hw/xfree86/xf4bpp/ppcPixmap.c
+++ b/hw/xfree86/xf4bpp/ppcPixmap.c
@@ -138,6 +138,7 @@ xf4bppCopyPixmap(pSrc)
pDst = xalloc(sizeof(PixmapRec) + size);
if (!pDst)
return NullPixmap;
+ pDst->devPrivates = NULL;
pDst->drawable = pSrc->drawable;
pDst->drawable.id = 0;
pDst->drawable.serialNumber = NEXT_SERIAL_NUMBER;
diff --git a/hw/xfree86/xf4bpp/ppcPolyPnt.c b/hw/xfree86/xf4bpp/ppcPolyPnt.c
index 1d6905563..c61fd6d26 100644
--- a/hw/xfree86/xf4bpp/ppcPolyPnt.c
+++ b/hw/xfree86/xf4bpp/ppcPolyPnt.c
@@ -102,7 +102,7 @@ if ( pDrawable->type == DRAWABLE_PIXMAP ) {
return ;
}
-devPriv = (ppcPrivGC *) ( pGC->devPrivates[mfbGetGCPrivateIndex()].ptr ) ;
+devPriv = (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
if ( ( alu = devPriv->colorRrop.alu ) == GXnoop )
return ;
diff --git a/hw/xfree86/xf4bpp/ppcWinFS.c b/hw/xfree86/xf4bpp/ppcWinFS.c
index 78001d793..1522afd9e 100644
--- a/hw/xfree86/xf4bpp/ppcWinFS.c
+++ b/hw/xfree86/xf4bpp/ppcWinFS.c
@@ -96,7 +96,7 @@ xf4bppSolidWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
return ;
}
- if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop )
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
n = nInit * miFindMaxBand( pGC->pCompositeClip ) ;
@@ -114,8 +114,8 @@ xf4bppSolidWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
n = miClipSpans( pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted ) ;
- pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ;
- fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
for ( ; n-- ; ppt++, pwidth++ )
if ( *pwidth )
@@ -163,14 +163,14 @@ int fSorted ;
return ;
}
- if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop )
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
pptFree, pwidth, ppt, fSorted ) ;
- pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ;
- fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
xSrc = pGC->patOrg.x + pDrawable->x ;
ySrc = pGC->patOrg.y + pDrawable->y ;
@@ -215,15 +215,15 @@ int fSorted ;
return ;
}
- if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop )
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
pptFree, pwidth, ppt, fSorted ) ;
- pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ;
- fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ;
- bg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.bgPixel ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
+ fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
+ bg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.bgPixel ;
xSrc = pGC->patOrg.x + pDrawable->x ;
ySrc = pGC->patOrg.y + pDrawable->y ;
@@ -260,7 +260,7 @@ int fSorted ;
TRACE( ( "xf4bppTileWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
- if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop )
+ if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
@@ -268,7 +268,7 @@ int fSorted ;
xSrc = pGC->patOrg.x + pDrawable->x ;
ySrc = pGC->patOrg.y + pDrawable->y ;
- pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ;
+ pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
for ( ; n-- ; ppt++, pwidth++ )
xf4bppTileRect( (WindowPtr)pDrawable, pGC->tile.pixmap, alu, pm,
diff --git a/hw/xfree86/xf4bpp/vgaGC.c b/hw/xfree86/xf4bpp/vgaGC.c
index 5a8604090..6495e5638 100644
--- a/hw/xfree86/xf4bpp/vgaGC.c
+++ b/hw/xfree86/xf4bpp/vgaGC.c
@@ -107,7 +107,7 @@ xf4bppChangeWindowGC( pGC, changes )
register GC *pGC ;
register Mask changes ;
{
-register ppcPrivGCPtr devPriv = (ppcPrivGCPtr) (pGC->devPrivates[mfbGetGCPrivateIndex()].ptr) ;
+register ppcPrivGCPtr devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
register unsigned long int idx ; /* used for stepping through bitfields */
#define LOWBIT( x ) ( x & - x ) /* Two's complement */
diff --git a/hw/xfree86/xf8_32bpp/cfb8_32.h b/hw/xfree86/xf8_32bpp/cfb8_32.h
index e14096568..6e985da20 100644
--- a/hw/xfree86/xf8_32bpp/cfb8_32.h
+++ b/hw/xfree86/xf8_32bpp/cfb8_32.h
@@ -22,10 +22,8 @@ typedef struct {
} cfb8_32ScreenRec, *cfb8_32ScreenPtr;
-extern int cfb8_32GCPrivateIndex; /* XXX */
-extern int cfb8_32GetGCPrivateIndex(void);
-extern int cfb8_32ScreenPrivateIndex; /* XXX */
-extern int cfb8_32GetScreenPrivateIndex(void);
+extern DevPrivateKey cfb8_32GetGCPrivateKey(void);
+extern DevPrivateKey cfb8_32GetScreenPrivateKey(void);
RegionPtr
cfb8_32CopyArea(
@@ -182,11 +180,11 @@ cfb8_32ChangeWindowAttributes(
);
-#define CFB8_32_GET_GC_PRIVATE(pGC)\
- (cfb8_32GCPtr)((pGC)->devPrivates[cfb8_32GetGCPrivateIndex()].ptr)
+#define CFB8_32_GET_GC_PRIVATE(pGC) ((cfb8_32GCPtr) \
+ dixLookupPrivate(&(pGC)->devPrivates, cfb8_32GetGCPrivateKey()))
-#define CFB8_32_GET_SCREEN_PRIVATE(pScreen)\
- (cfb8_32ScreenPtr)((pScreen)->devPrivates[cfb8_32GetScreenPrivateIndex()].ptr)
+#define CFB8_32_GET_SCREEN_PRIVATE(pScreen) ((cfb8_32ScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, cfb8_32GetScreenPrivateKey()))
Bool xf86Overlay8Plus32Init (ScreenPtr pScreen);
diff --git a/hw/xfree86/xf8_32bpp/cfbscrinit.c b/hw/xfree86/xf8_32bpp/cfbscrinit.c
index 5e2657f2b..c3432b803 100644
--- a/hw/xfree86/xf8_32bpp/cfbscrinit.c
+++ b/hw/xfree86/xf8_32bpp/cfbscrinit.c
@@ -31,38 +31,37 @@
/* CAUTION: We require that cfb8 and cfb32 were NOT
compiled with CFB_NEED_SCREEN_PRIVATE */
-int cfb8_32GCPrivateIndex;
-int cfb8_32GetGCPrivateIndex(void) { return cfb8_32GCPrivateIndex; }
-int cfb8_32ScreenPrivateIndex;
-int cfb8_32GetScreenPrivateIndex(void) { return cfb8_32ScreenPrivateIndex; }
-static unsigned long cfb8_32Generation = 0;
+static DevPrivateKey cfb8_32GCPrivateKey = &cfb8_32GCPrivateKey;
+DevPrivateKey cfb8_32GetGCPrivateKey(void)
+{
+ return cfb8_32GCPrivateKey;
+}
+
+static DevPrivateKey cfb8_32ScreenPrivateKey = &cfb8_32ScreenPrivateKey;
+DevPrivateKey cfb8_32GetScreenPrivateKey(void)
+{
+ return cfb8_32ScreenPrivateKey;
+}
static Bool
cfb8_32AllocatePrivates(ScreenPtr pScreen)
{
cfb8_32ScreenPtr pScreenPriv;
- if(cfb8_32Generation != serverGeneration) {
- if(((cfb8_32GCPrivateIndex = AllocateGCPrivateIndex()) < 0) ||
- ((cfb8_32ScreenPrivateIndex = AllocateScreenPrivateIndex()) < 0))
- return FALSE;
- cfb8_32Generation = serverGeneration;
- }
-
if (!(pScreenPriv = xalloc(sizeof(cfb8_32ScreenRec))))
return FALSE;
- pScreen->devPrivates[cfb8_32ScreenPrivateIndex].ptr = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, cfb8_32ScreenPrivateKey, pScreenPriv);
/* All cfb will have the same GC and Window private indicies */
- if(!mfbAllocatePrivates(pScreen, &cfbGCPrivateIndex))
+ if(!mfbAllocatePrivates(pScreen, &cfbGCPrivateKey))
return FALSE;
- if(!AllocateGCPrivate(pScreen, cfbGCPrivateIndex, sizeof(cfbPrivGC)))
+ if(!dixRequestPrivate(cfbGCPrivateKey, sizeof(cfbPrivGC)))
return FALSE;
- if(!AllocateGCPrivate(pScreen, cfb8_32GCPrivateIndex, sizeof(cfb8_32GCRec)))
+ if(!dixRequestPrivate(cfb8_32GCPrivateKey, sizeof(cfb8_32GCRec)))
return FALSE;
return TRUE;
@@ -160,7 +159,7 @@ cfb8_32CloseScreen (int i, ScreenPtr pScreen)
xfree(pScreenPriv->visualData);
xfree((pointer) pScreenPriv);
- pScreen->devPrivates[cfb8_32ScreenPrivateIndex].ptr = NULL;
+ dixSetPrivate(&pScreen->devPrivates, cfb8_32ScreenPrivateKey, NULL);
return(cfb32CloseScreen(i, pScreen));
}
diff --git a/hw/xfree86/xf8_32bpp/xf86overlay.c b/hw/xfree86/xf8_32bpp/xf86overlay.c
index 47b2b52db..c63b3cfd1 100644
--- a/hw/xfree86/xf8_32bpp/xf86overlay.c
+++ b/hw/xfree86/xf8_32bpp/xf86overlay.c
@@ -177,23 +177,22 @@ typedef struct {
} OverlayPixmapRec, *OverlayPixmapPtr;
-static int OverlayScreenIndex = -1;
-static int OverlayGCIndex = -1;
-static int OverlayPixmapIndex = -1;
-static unsigned long OverlayGeneration = 0;
+static DevPrivateKey OverlayScreenKey = &OverlayScreenKey;
+static DevPrivateKey OverlayGCKey = &OverlayGCKey;
+static DevPrivateKey OverlayPixmapKey = &OverlayPixmapKey;
/** Macros **/
#define TILE_EXISTS(pGC) (!(pGC)->tileIsPixel && (pGC)->tile.pixmap)
-#define OVERLAY_GET_PIXMAP_PRIVATE(pPix) \
- (OverlayPixmapPtr)((pPix)->devPrivates[OverlayPixmapIndex].ptr)
+#define OVERLAY_GET_PIXMAP_PRIVATE(pPix) ((OverlayPixmapPtr) \
+ dixLookupPrivate(&(pPix)->devPrivates, OverlayPixmapKey))
-#define OVERLAY_GET_SCREEN_PRIVATE(pScreen) \
- (OverlayScreenPtr)((pScreen)->devPrivates[OverlayScreenIndex].ptr)
+#define OVERLAY_GET_SCREEN_PRIVATE(pScreen) ((OverlayScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, OverlayScreenKey))
-#define OVERLAY_GET_GC_PRIVATE(pGC) \
- (OverlayGCPtr)((pGC)->devPrivates[OverlayGCIndex].ptr)
+#define OVERLAY_GET_GC_PRIVATE(pGC) ((OverlayGCPtr) \
+ dixLookupPrivate(&(pGC)->devPrivates, OverlayGCKey))
#define OVERLAY_GC_FUNC_PROLOGUE(pGC)\
OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\
@@ -255,26 +254,16 @@ xf86Overlay8Plus32Init (ScreenPtr pScreen)
{
OverlayScreenPtr pScreenPriv;
- if(OverlayGeneration != serverGeneration) {
- if(((OverlayScreenIndex = AllocateScreenPrivateIndex()) < 0) ||
- ((OverlayGCIndex = AllocateGCPrivateIndex()) < 0) ||
- ((OverlayPixmapIndex = AllocatePixmapPrivateIndex()) < 0))
- return FALSE;
-
- OverlayGeneration = serverGeneration;
- }
-
- if (!AllocateGCPrivate(pScreen, OverlayGCIndex, sizeof(OverlayGCRec)))
+ if (!dixRequestPrivate(OverlayGCKey, sizeof(OverlayGCRec)))
return FALSE;
- if (!AllocatePixmapPrivate(pScreen, OverlayPixmapIndex,
- sizeof(OverlayPixmapRec)))
+ if (!dixRequestPrivate(OverlayPixmapKey, sizeof(OverlayPixmapRec)))
return FALSE;
if (!(pScreenPriv = xalloc(sizeof(OverlayScreenRec))))
return FALSE;
- pScreen->devPrivates[OverlayScreenIndex].ptr = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, OverlayScreenKey, pScreenPriv);
pScreenPriv->CreateGC = pScreen->CreateGC;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
diff --git a/hw/xgl/egl/kinput.c b/hw/xgl/egl/kinput.c
index 981cffcfa..774e00eb5 100644
--- a/hw/xgl/egl/kinput.c
+++ b/hw/xgl/egl/kinput.c
@@ -439,7 +439,7 @@ KdKeybdProc(DeviceIntPtr pDevice, int onoff)
switch (onoff)
{
case DEVICE_INIT:
- if (pDev != LookupKeyboardDevice())
+ if (pDev != (DevicePtr)inputInfo.keyboard)
{
return !Success;
}
diff --git a/hw/xgl/egl/xegl.c b/hw/xgl/egl/xegl.c
index c671dbe7c..1cf615bb6 100644
--- a/hw/xgl/egl/xegl.c
+++ b/hw/xgl/egl/xegl.c
@@ -42,14 +42,13 @@
#define XEGL_DEFAULT_SCREEN_WIDTH 800
#define XEGL_DEFAULT_SCREEN_HEIGHT 600
-int xeglScreenGeneration = -1;
-int xeglScreenPrivateIndex;
+DevPrivateKey xeglScreenPrivateKey = &xeglScreenPrivateKey;
-#define XEGL_GET_SCREEN_PRIV(pScreen) \
- ((xeglScreenPtr) (pScreen)->devPrivates[xeglScreenPrivateIndex].ptr)
+#define XEGL_GET_SCREEN_PRIV(pScreen) ((xeglScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey))
-#define XEGL_SET_SCREEN_PRIV(pScreen, v) \
- ((pScreen)->devPrivates[xeglScreenPrivateIndex].ptr = (pointer) v)
+#define XEGL_SET_SCREEN_PRIV(pScreen, v) \
+ dixSetPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey, v)
#define XEGL_SCREEN_PRIV(pScreen) \
xeglScreenPtr pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen)
@@ -66,15 +65,6 @@ xeglAllocatePrivates (ScreenPtr pScreen)
{
xeglScreenPtr pScreenPriv;
- if (xeglScreenGeneration != serverGeneration)
- {
- xeglScreenPrivateIndex = AllocateScreenPrivateIndex ();
- if (xeglScreenPrivateIndex < 0)
- return FALSE;
-
- xeglScreenGeneration = serverGeneration;
- }
-
pScreenPriv = xalloc (sizeof (xeglScreenRec));
if (!pScreenPriv)
return FALSE;
diff --git a/hw/xgl/egl/xegl.h b/hw/xgl/egl/xegl.h
index be9b48c9c..0a07397bf 100644
--- a/hw/xgl/egl/xegl.h
+++ b/hw/xgl/egl/xegl.h
@@ -109,7 +109,7 @@ extern KdMouseInfo *kdMouseInfo;
extern KdOsFuncs *kdOsFuncs;
extern Bool kdDontZap;
extern Bool kdDisableZaphod;
-extern int xeglScreenPrivateIndex;
+extern DevPrivateKey xeglScreenPrivateKey;
extern KdMouseFuncs LinuxEvdevMouseFuncs;
extern KdKeyboardFuncs LinuxEvdevKeyboardFuncs;
@@ -117,8 +117,8 @@ extern KdKeyboardFuncs LinuxEvdevKeyboardFuncs;
(RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270)
#define RR_Reflect_All (RR_Reflect_X | RR_Reflect_Y)
-#define KdGetScreenPriv(pScreen) \
- ((xeglScreenPtr) ((pScreen)->devPrivates[xeglScreenPrivateIndex].ptr))
+#define KdGetScreenPriv(pScreen) ((xeglScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey))
#define KdScreenPriv(pScreen) \
xeglScreenPtr pScreenPriv = KdGetScreenPriv (pScreen)
diff --git a/hw/xgl/glx/xglx.c b/hw/xgl/glx/xglx.c
index 87d8a4ea8..33b276b74 100644
--- a/hw/xgl/glx/xglx.c
+++ b/hw/xgl/glx/xglx.c
@@ -105,14 +105,13 @@ typedef struct _xglxScreen {
CloseScreenProcPtr CloseScreen;
} xglxScreenRec, *xglxScreenPtr;
-int xglxScreenGeneration = -1;
-int xglxScreenPrivateIndex;
+DevPrivateKey xglxScreenPrivateKey = &xglxScreenPrivateKey;
-#define XGLX_GET_SCREEN_PRIV(pScreen) \
- ((xglxScreenPtr) (pScreen)->devPrivates[xglxScreenPrivateIndex].ptr)
+#define XGLX_GET_SCREEN_PRIV(pScreen) ((xglxScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, xglxScreenPrivateKey))
-#define XGLX_SET_SCREEN_PRIV(pScreen, v) \
- ((pScreen)->devPrivates[xglxScreenPrivateIndex].ptr = (pointer) v)
+#define XGLX_SET_SCREEN_PRIV(pScreen, v) \
+ dixSetPrivate(&(pScreen)->devPrivates, xglxScreenPrivateKey, v)
#define XGLX_SCREEN_PRIV(pScreen) \
xglxScreenPtr pScreenPriv = XGLX_GET_SCREEN_PRIV (pScreen)
@@ -122,10 +121,10 @@ typedef struct _xglxCursor {
} xglxCursorRec, *xglxCursorPtr;
#define XGLX_GET_CURSOR_PRIV(pCursor, pScreen) \
- ((xglxCursorPtr) (pCursor)->devPriv[(pScreen)->myNum])
+ ((xglxCursorPtr)dixLookupPrivate(&(pCursor)->devPrivates, pScreen))
#define XGLX_SET_CURSOR_PRIV(pCursor, pScreen, v) \
- ((pCursor)->devPriv[(pScreen)->myNum] = (pointer) v)
+ dixSetPrivate(&(pCursor)->devPrivates, pScreen, v)
#define XGLX_CURSOR_PRIV(pCursor, pScreen) \
xglxCursorPtr pCursorPriv = XGLX_GET_CURSOR_PRIV (pCursor, pScreen)
@@ -148,15 +147,6 @@ xglxAllocatePrivates (ScreenPtr pScreen)
{
xglxScreenPtr pScreenPriv;
- if (xglxScreenGeneration != serverGeneration)
- {
- xglxScreenPrivateIndex = AllocateScreenPrivateIndex ();
- if (xglxScreenPrivateIndex < 0)
- return FALSE;
-
- xglxScreenGeneration = serverGeneration;
- }
-
pScreenPriv = xalloc (sizeof (xglxScreenRec));
if (!pScreenPriv)
return FALSE;
@@ -1110,7 +1100,7 @@ xglxKeybdProc (DeviceIntPtr pDevice,
int xkbOp, xkbEvent, xkbError, xkbMajor, xkbMinor;
#endif
- if (pDev != LookupKeyboardDevice ())
+ if (pDev != (DevicePtr)inputInfo.keyboard)
return !Success;
xmodMap = XGetModifierMapping (xdisplay);
diff --git a/hw/xgl/xgl.h b/hw/xgl/xgl.h
index 80fa69577..03dc90c70 100644
--- a/hw/xgl/xgl.h
+++ b/hw/xgl/xgl.h
@@ -224,10 +224,11 @@ typedef struct _xglGlyph {
xglAreaPtr pArea;
} xglGlyphRec, *xglGlyphPtr;
-extern int xglGlyphPrivateIndex;
+extern DevPrivateKey xglGlyphPrivateKey;
#define XGL_GET_GLYPH_PRIV(pScreen, pGlyph) ((xglGlyphPtr) \
- (GetGlyphPrivatesForScreen (pGlyph, pScreen))[xglGlyphPrivateIndex].ptr)
+ dixLookupPrivate(GetGlyphPrivatesForScreen (pGlyph, pScreen), \
+ xglGlyphPrivateKey))
#define XGL_GLYPH_PRIV(pScreen, pGlyph) \
xglGlyphPtr pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, pGlyph)
@@ -293,13 +294,13 @@ typedef struct _xglScreen {
#endif
} xglScreenRec, *xglScreenPtr;
-extern int xglScreenPrivateIndex;
+extern DevPrivateKey xglScreenPrivateKey;
-#define XGL_GET_SCREEN_PRIV(pScreen) \
- ((xglScreenPtr) (pScreen)->devPrivates[xglScreenPrivateIndex].ptr)
+#define XGL_GET_SCREEN_PRIV(pScreen) ((xglScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, xglScreenPrivateKey))
-#define XGL_SET_SCREEN_PRIV(pScreen, v) \
- ((pScreen)->devPrivates[xglScreenPrivateIndex].ptr = (pointer) v)
+#define XGL_SET_SCREEN_PRIV(pScreen, v) \
+ dixSetPrivate(&(pScreen)->devPrivates, xglScreenPrivateKey, v)
#define XGL_SCREEN_PRIV(pScreen) \
xglScreenPtr pScreenPriv = XGL_GET_SCREEN_PRIV (pScreen)
@@ -334,10 +335,10 @@ typedef struct _xglGC {
GCOpsPtr ops;
} xglGCRec, *xglGCPtr;
-extern int xglGCPrivateIndex;
+extern DevPrivateKey xglGCPrivateKey;
-#define XGL_GET_GC_PRIV(pGC) \
- ((xglGCPtr) (pGC)->devPrivates[xglGCPrivateIndex].ptr)
+#define XGL_GET_GC_PRIV(pGC) ((xglGCPtr) \
+ dixLookupPrivate(&(pGC)->devPrivates, xglGCPrivateKey))
#define XGL_GC_PRIV(pGC) \
xglGCPtr pGCPriv = XGL_GET_GC_PRIV (pGC)
@@ -394,10 +395,10 @@ typedef struct _xglPixmap {
} xglPixmapRec, *xglPixmapPtr;
-extern int xglPixmapPrivateIndex;
+extern DevPrivateKey xglPixmapPrivateKey;
-#define XGL_GET_PIXMAP_PRIV(pPixmap) \
- ((xglPixmapPtr) (pPixmap)->devPrivates[xglPixmapPrivateIndex].ptr)
+#define XGL_GET_PIXMAP_PRIV(pPixmap) ((xglPixmapPtr) \
+ dixLookupPrivate(&(pPixmap)->devPrivates, xglPixmapPrivateKey))
#define XGL_PIXMAP_PRIV(pPixmap) \
xglPixmapPtr pPixmapPriv = XGL_GET_PIXMAP_PRIV (pPixmap)
@@ -409,10 +410,10 @@ typedef struct _xglWin {
PixmapPtr pPixmap;
} xglWinRec, *xglWinPtr;
-extern int xglWinPrivateIndex;
+extern DevPrivateKey xglWinPrivateKey;
-#define XGL_GET_WINDOW_PRIV(pWin) \
- ((xglWinPtr) (pWin)->devPrivates[xglWinPrivateIndex].ptr)
+#define XGL_GET_WINDOW_PRIV(pWin) ((xglWinPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, xglWinPrivateKey))
#define XGL_WINDOW_PRIV(pWin) \
xglWinPtr pWinPriv = XGL_GET_WINDOW_PRIV (pWin)
diff --git a/hw/xgl/xglinput.c b/hw/xgl/xglinput.c
index cda21ad49..9499fcf1f 100644
--- a/hw/xgl/xglinput.c
+++ b/hw/xgl/xglinput.c
@@ -224,7 +224,7 @@ xglKeybdProc (DeviceIntPtr pDevice,
switch (onoff) {
case DEVICE_INIT:
- if (pDev != LookupKeyboardDevice ())
+ if (pDev != (DevicePtr)inputInfo.keyboard)
return !Success;
ret = InitKeyboardDeviceStruct (pDev,
diff --git a/hw/xgl/xglpixmap.c b/hw/xgl/xglpixmap.c
index 8c54d64fc..fefd3ef97 100644
--- a/hw/xgl/xglpixmap.c
+++ b/hw/xgl/xglpixmap.c
@@ -311,6 +311,7 @@ xglDestroyPixmap (PixmapPtr pPixmap)
xglFiniPixmap (pPixmap);
+ dixFreePrivates(pPixmap->devPrivates);
xfree (pPixmap);
return TRUE;
diff --git a/hw/xgl/xglscreen.c b/hw/xgl/xglscreen.c
index cd3b59a34..47ed34508 100644
--- a/hw/xgl/xglscreen.c
+++ b/hw/xgl/xglscreen.c
@@ -463,7 +463,8 @@ xglCreateSolidAlphaPicture (ScreenPtr pScreen)
tmpval[0] = xTrue;
pScreenPriv->pSolidAlpha = CreatePicture (0, &pPixmap->drawable, pFormat,
- CPRepeat, tmpval, 0, &error);
+ CPRepeat, tmpval,
+ serverClient, &error);
(*pScreen->DestroyPixmap) (pPixmap);
if (pScreenPriv->pSolidAlpha)
diff --git a/hw/xgl/xglxv.c b/hw/xgl/xglxv.c
index 8138a0cbb..353f9b3bb 100644
--- a/hw/xgl/xglxv.c
+++ b/hw/xgl/xglxv.c
@@ -35,11 +35,11 @@
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
-static unsigned int xglXvScreenIndex = 0;
+static DevPrivateKey xglXvScreenKey;
static unsigned long portResource = 0;
-#define XGL_GET_XV_SCREEN(pScreen) \
- ((XvScreenPtr) ((pScreen)->devPrivates[xglXvScreenIndex].ptr))
+#define XGL_GET_XV_SCREEN(pScreen) ((XvScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, xglXvScreenKey))
#define XGL_XV_SCREEN(pScreen) \
XvScreenPtr pXvScreen = XGL_GET_XV_SCREEN (pScreen)
@@ -591,7 +591,7 @@ xglXvScreenInit (ScreenPtr pScreen)
if (status != Success)
return FALSE;
- xglXvScreenIndex = XvGetScreenIndex ();
+ xglXvScreenKey = XvGetScreenKey ();
portResource = XvGetRTPort ();
pXvScreen = XGL_GET_XV_SCREEN (pScreen);
diff --git a/hw/xnest/Cursor.c b/hw/xnest/Cursor.c
index 134276e7b..138698068 100644
--- a/hw/xnest/Cursor.c
+++ b/hw/xnest/Cursor.c
@@ -104,8 +104,8 @@ xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
bg_color.green = pCursor->backGreen;
bg_color.blue = pCursor->backBlue;
- pCursor->devPriv[pScreen->myNum] = (pointer)xalloc(sizeof(xnestPrivCursor));
- xnestCursorPriv(pCursor, pScreen)->cursor =
+ xnestSetCursorPriv(pCursor, pScreen, xalloc(sizeof(xnestPrivCursor)));
+ xnestCursor(pCursor, pScreen) =
XCreatePixmapCursor(xnestDisplay, source, mask, &fg_color, &bg_color,
pCursor->bits->xhot, pCursor->bits->yhot);
@@ -119,7 +119,7 @@ Bool
xnestUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
{
XFreeCursor(xnestDisplay, xnestCursor(pCursor, pScreen));
- xfree(xnestCursorPriv(pCursor, pScreen));
+ xfree(xnestGetCursorPriv(pCursor, pScreen));
return True;
}
diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c
index a52ce1f35..06e6e0205 100644
--- a/hw/xnest/GC.c
+++ b/hw/xnest/GC.c
@@ -35,7 +35,7 @@ is" without express or implied warranty.
#include "XNFont.h"
#include "Color.h"
-int xnestGCPrivateIndex;
+DevPrivateKey xnestGCPrivateKey = &xnestGCPrivateKey;
static GCFuncs xnestFuncs = {
xnestValidateGC,
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index 4699111b9..a5f6c55af 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -74,8 +74,6 @@ InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
break;
}
- xnestWindowPrivateIndex = AllocateWindowPrivateIndex();
- xnestGCPrivateIndex = AllocateGCPrivateIndex();
xnestFontPrivateIndex = AllocateFontPrivateIndex();
if (!xnestNumScreens) xnestNumScreens = 1;
diff --git a/hw/xnest/Pixmap.c b/hw/xnest/Pixmap.c
index 1f420015a..57bebc639 100644
--- a/hw/xnest/Pixmap.c
+++ b/hw/xnest/Pixmap.c
@@ -24,6 +24,7 @@ is" without express or implied warranty.
#include "regionstr.h"
#include "gc.h"
#include "servermd.h"
+#include "privates.h"
#include "mi.h"
#include "Xnest.h"
@@ -32,7 +33,7 @@ is" without express or implied warranty.
#include "Screen.h"
#include "XNPixmap.h"
-int xnestPixmapPrivateIndex;
+DevPrivateKey xnestPixmapPrivateKey = &xnestPixmapPrivateKey;
PixmapPtr
xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
@@ -56,8 +57,8 @@ xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pPixmap->refcnt = 1;
pPixmap->devKind = PixmapBytePad(width, depth);
- pPixmap->devPrivates[xnestPixmapPrivateIndex].ptr =
- (pointer)((char *)pPixmap + pScreen->totalPixmapSize);
+ dixSetPrivate(&pPixmap->devPrivates, xnestPixmapPrivateKey,
+ (char *)pPixmap + pScreen->totalPixmapSize);
if (width && height)
xnestPixmapPriv(pPixmap)->pixmap =
XCreatePixmap(xnestDisplay,
@@ -75,6 +76,7 @@ xnestDestroyPixmap(PixmapPtr pPixmap)
if(--pPixmap->refcnt)
return TRUE;
XFreePixmap(xnestDisplay, xnestPixmap(pPixmap));
+ dixFreePrivates(pPixmap->devPrivates);
xfree(pPixmap);
return TRUE;
}
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index 02e82d193..61a325f3c 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -45,8 +45,6 @@ is" without express or implied warranty.
Window xnestDefaultWindows[MAXSCREENS];
Window xnestScreenSaverWindows[MAXSCREENS];
-static int xnestScreenGeneration = -1;
-
ScreenPtr
xnestScreen(Window window)
{
@@ -142,21 +140,13 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
VisualID defaultVisual;
int rootDepth;
- if (!(AllocateWindowPrivate(pScreen, xnestWindowPrivateIndex,
- sizeof(xnestPrivWin)) &&
- AllocateGCPrivate(pScreen, xnestGCPrivateIndex,
- sizeof(xnestPrivGC))))
+ if (!dixRequestPrivate(xnestWindowPrivateKey, sizeof(xnestPrivWin)))
+ return False;
+ if (!dixRequestPrivate(xnestGCPrivateKey, sizeof(xnestPrivGC)))
return False;
-
- if (xnestScreenGeneration != serverGeneration) {
- if ((xnestPixmapPrivateIndex = AllocatePixmapPrivateIndex()) < 0)
- return False;
- xnestScreenGeneration = serverGeneration;
- }
-
- if (!AllocatePixmapPrivate(pScreen,xnestPixmapPrivateIndex,
- sizeof (xnestPrivPixmap)))
+ if (!dixRequestPrivate(xnestPixmapPrivateKey, sizeof (xnestPrivPixmap)))
return False;
+
visuals = (VisualPtr)xalloc(xnestNumVisuals * sizeof(VisualRec));
numVisuals = 0;
diff --git a/hw/xnest/Window.c b/hw/xnest/Window.c
index e83fb90d5..bc9d8bed2 100644
--- a/hw/xnest/Window.c
+++ b/hw/xnest/Window.c
@@ -39,7 +39,7 @@ is" without express or implied warranty.
#include "Events.h"
#include "Args.h"
-int xnestWindowPrivateIndex;
+DevPrivateKey xnestWindowPrivateKey = &xnestWindowPrivateKey;
static int
xnestFindWindowMatch(WindowPtr pWin, pointer ptr)
diff --git a/hw/xnest/XNCursor.h b/hw/xnest/XNCursor.h
index ffec9eb0a..9705f6bea 100644
--- a/hw/xnest/XNCursor.h
+++ b/hw/xnest/XNCursor.h
@@ -19,11 +19,14 @@ typedef struct {
Cursor cursor;
} xnestPrivCursor;
-#define xnestCursorPriv(pCursor, pScreen) \
- ((xnestPrivCursor *)((pCursor)->devPriv[pScreen->myNum]))
+#define xnestGetCursorPriv(pCursor, pScreen) \
+ ((xnestPrivCursor *)dixLookupPrivate(&(pCursor)->devPrivates, pScreen))
+
+#define xnestSetCursorPriv(pCursor, pScreen, v) \
+ dixSetPrivate(&(pCursor)->devPrivates, pScreen, v)
#define xnestCursor(pCursor, pScreen) \
- (xnestCursorPriv(pCursor, pScreen)->cursor)
+ (xnestGetCursorPriv(pCursor, pScreen)->cursor)
Bool xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
Bool xnestUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
diff --git a/hw/xnest/XNGC.h b/hw/xnest/XNGC.h
index d3ac3df0b..19535fe3a 100644
--- a/hw/xnest/XNGC.h
+++ b/hw/xnest/XNGC.h
@@ -22,10 +22,10 @@ typedef struct {
int nClipRects;
} xnestPrivGC;
-extern int xnestGCPrivateIndex;
+extern DevPrivateKey xnestGCPrivateKey;
-#define xnestGCPriv(pGC) \
- ((xnestPrivGC *)((pGC)->devPrivates[xnestGCPrivateIndex].ptr))
+#define xnestGCPriv(pGC) ((xnestPrivGC *) \
+ dixLookupPrivate(&(pGC)->devPrivates, xnestGCPrivateKey))
#define xnestGC(pGC) (xnestGCPriv(pGC)->gc)
diff --git a/hw/xnest/XNPixmap.h b/hw/xnest/XNPixmap.h
index 9eb2a3c70..614827587 100644
--- a/hw/xnest/XNPixmap.h
+++ b/hw/xnest/XNPixmap.h
@@ -15,14 +15,14 @@ is" without express or implied warranty.
#ifndef XNESTPIXMAP_H
#define XNESTPIXMAP_H
-extern int xnestPixmapPrivateIndex;
+extern DevPrivateKey xnestPixmapPrivateKey;
typedef struct {
Pixmap pixmap;
} xnestPrivPixmap;
-#define xnestPixmapPriv(pPixmap) \
- ((xnestPrivPixmap *)((pPixmap)->devPrivates[xnestPixmapPrivateIndex].ptr))
+#define xnestPixmapPriv(pPixmap) ((xnestPrivPixmap *) \
+ dixLookupPrivate(&(pPixmap)->devPrivates, xnestPixmapPrivateKey))
#define xnestPixmap(pPixmap) (xnestPixmapPriv(pPixmap)->pixmap)
diff --git a/hw/xnest/XNWindow.h b/hw/xnest/XNWindow.h
index 6c63f1f76..4cb66c8ce 100644
--- a/hw/xnest/XNWindow.h
+++ b/hw/xnest/XNWindow.h
@@ -35,10 +35,10 @@ typedef struct {
Window window;
} xnestWindowMatch;
-extern int xnestWindowPrivateIndex;
+extern DevPrivateKey xnestWindowPrivateKey;
-#define xnestWindowPriv(pWin) \
- ((xnestPrivWin *)((pWin)->devPrivates[xnestWindowPrivateIndex].ptr))
+#define xnestWindowPriv(pWin) ((xnestPrivWin *) \
+ dixLookupPrivate(&(pWin)->devPrivates, xnestWindowPrivateKey))
#define xnestWindow(pWin) (xnestWindowPriv(pWin)->window)
diff --git a/hw/xprint/attributes.c b/hw/xprint/attributes.c
index d8ee5adf8..9756e281d 100644
--- a/hw/xprint/attributes.c
+++ b/hw/xprint/attributes.c
@@ -124,7 +124,7 @@ SysAttrs systemAttributes;
* attrCtxtPrivIndex hold the attribute store's context private index.
* This index is allocated at the time the attribute store is initialized.
*/
-static int attrCtxtPrivIndex;
+static DevPrivateKey attrCtxtPrivKey = &attrCtxtPrivKey;
/*
* The ContextAttrs structure descibes the context private space reserved
@@ -521,8 +521,7 @@ XpBuildAttributeStore(
{
if(attrList != (PrAttrPtr)NULL)
FreeAttrList();
- attrCtxtPrivIndex = XpAllocateContextPrivateIndex();
- XpAllocateContextPrivate(attrCtxtPrivIndex, sizeof(ContextAttrs));
+ dixRequestPrivate(attrCtxtPrivKey, sizeof(ContextAttrs));
BuildSystemAttributes();
attrGeneration = serverGeneration;
@@ -592,7 +591,8 @@ XpInitAttributes(XpContextPtr pContext)
PrAttrPtr pPrAttr = attrList;
/* Initialize all the pointers to NULL */
- pCtxtAttrs = (ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr;
+ pCtxtAttrs = (ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates,
+ attrCtxtPrivKey);
(void)memset((void *)pCtxtAttrs, 0, (size_t) sizeof(ContextAttrs));
for(pPrAttr = attrList; pPrAttr != (PrAttrPtr)NULL; pPrAttr = pPrAttr->next)
@@ -612,8 +612,8 @@ XpDestroyAttributes(
{
ContextAttrPtr pCtxtAttrs;
- pCtxtAttrs = (ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr;
-
+ pCtxtAttrs = (ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates,
+ attrCtxtPrivKey);
if(pCtxtAttrs->printerAttrs != (XrmDatabase)NULL)
XrmDestroyDatabase(pCtxtAttrs->printerAttrs);
if(pCtxtAttrs->docAttrs != (XrmDatabase)NULL)
@@ -661,7 +661,8 @@ XpGetOneAttribute(
}
else
{
- pCtxtAttrs=(ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr;
+ pCtxtAttrs=(ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates,
+ attrCtxtPrivKey);
switch(class)
{
case XPPrinterAttr:
@@ -714,7 +715,8 @@ XpPutOneAttribute(
XrmBinding bindings[1];
XrmQuark quarks[2];
- pCtxtAttrs = (ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr;
+ pCtxtAttrs = (ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates,
+ attrCtxtPrivKey);
switch(class)
{
case XPPrinterAttr:
@@ -900,7 +902,8 @@ XpGetAttributes(
db = systemAttributes.server;
else
{
- pCtxtAttrs=(ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr;
+ pCtxtAttrs=(ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates,
+ attrCtxtPrivKey);
switch(class)
{
case XPServerAttr:
@@ -952,7 +955,8 @@ XpAugmentAttributes(
db = XrmGetStringDatabase(attributes);
if(db == (XrmDatabase)NULL) return BadAlloc;
- pCtxtAttrs = (ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr;
+ pCtxtAttrs = (ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates,
+ attrCtxtPrivKey);
switch(class)
{
case XPPrinterAttr:
@@ -988,7 +992,8 @@ XpSetAttributes(
db = XrmGetStringDatabase(attributes);
if(db == (XrmDatabase)NULL) return BadAlloc;
- pCtxtAttrs=(ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr;
+ pCtxtAttrs=(ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates,
+ attrCtxtPrivKey);
switch(class)
{
case XPPrinterAttr:
diff --git a/hw/xprint/pcl/Pcl.h b/hw/xprint/pcl/Pcl.h
index 0c50ed241..d46a03401 100644
--- a/hw/xprint/pcl/Pcl.h
+++ b/hw/xprint/pcl/Pcl.h
@@ -83,10 +83,10 @@ typedef char *XPointer;
/******
* externally visible variables from PclInit.c
******/
-extern int PclScreenPrivateIndex, PclWindowPrivateIndex;
-extern int PclContextPrivateIndex;
-extern int PclPixmapPrivateIndex;
-extern int PclGCPrivateIndex;
+extern DevPrivateKey PclScreenPrivateKey, PclWindowPrivateKey;
+extern DevPrivateKey PclContextPrivateKey;
+extern DevPrivateKey PclPixmapPrivateKey;
+extern DevPrivateKey PclGCPrivateKey;
/******
* externally visible variables from PclAttVal.c
diff --git a/hw/xprint/pcl/PclArc.c b/hw/xprint/pcl/PclArc.c
index 0d8289e33..20d3f723d 100644
--- a/hw/xprint/pcl/PclArc.c
+++ b/hw/xprint/pcl/PclArc.c
@@ -85,7 +85,7 @@ PclDoArc(
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr)
- pCon->devPrivates[PclContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
XpGetReproductionArea( pCon, &repro );
/*
diff --git a/hw/xprint/pcl/PclColor.c b/hw/xprint/pcl/PclColor.c
index 8b05da056..5e8ffa63c 100644
--- a/hw/xprint/pcl/PclColor.c
+++ b/hw/xprint/pcl/PclColor.c
@@ -129,8 +129,8 @@ PclCreateColormap(ColormapPtr pColor)
PclCmapToContexts *new;
PclScreenPrivPtr sPriv;
- sPriv = (PclScreenPrivPtr)pColor->pScreen
- ->devPrivates[PclScreenPrivateIndex].ptr;
+ sPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey);
/*
* Use existing code to initialize the values in the colormap
@@ -175,8 +175,8 @@ PclDestroyColormap(ColormapPtr pColor)
/*
* Find the colormap <-> contexts mapping
*/
- sPriv = (PclScreenPrivPtr)pColor->pScreen
- ->devPrivates[PclScreenPrivateIndex].ptr;
+ sPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey);
pCmap = sPriv->colormaps;
while( pCmap )
{
@@ -195,8 +195,8 @@ PclDestroyColormap(ColormapPtr pColor)
con = pCmap->contexts;
while( con )
{
- cPriv = con->context->devPrivates[PclContextPrivateIndex].ptr;
-
+ cPriv = dixLookupPrivate(&con->context->devPrivates,
+ PclContextPrivateKey);
pPal = cPriv->palettes;
while( pPal )
{
@@ -259,8 +259,8 @@ PclStoreColors(ColormapPtr pColor,
char t[80];
int i;
- sPriv = (PclScreenPrivPtr)pColor->pScreen
- ->devPrivates[PclScreenPrivateIndex].ptr;
+ sPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey);
p = sPriv->colormaps;
while( p )
{
@@ -278,8 +278,8 @@ PclStoreColors(ColormapPtr pColor,
* For each context, get the palette ID and update the
* appropriate palette.
*/
- cPriv = con->context
- ->devPrivates[PclContextPrivateIndex].ptr;
+ cPriv = dixLookupPrivate(&con->context->devPrivates,
+ PclContextPrivateKey);
pMap = PclFindPaletteMap( cPriv, pColor, NULL );
/*
@@ -407,7 +407,8 @@ PclUpdateColormap(DrawablePtr pDrawable,
unsigned short r, g, b, rr, gg, bb;
int i;
- cPriv = pCon->devPrivates[PclContextPrivateIndex].ptr;
+ cPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
c = wColormap( win );
cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP );
@@ -436,8 +437,9 @@ PclUpdateColormap(DrawablePtr pDrawable,
/*
* Add the colormap to the screen-level colormap<->context mapping.
*/
- sPriv = (PclScreenPrivPtr)cmap->pScreen
- ->devPrivates[PclScreenPrivateIndex].ptr;
+ sPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&cmap->pScreen->devPrivates,
+ PclScreenPrivateKey);
pCmap = sPriv->colormaps;
while( pCmap && ( pCmap->colormapId != cmap->mid ) )
pCmap = pCmap->next;
diff --git a/hw/xprint/pcl/PclGC.c b/hw/xprint/pcl/PclGC.c
index b47f2833a..fbadf5d5d 100644
--- a/hw/xprint/pcl/PclGC.c
+++ b/hw/xprint/pcl/PclGC.c
@@ -144,7 +144,8 @@ PclGetDrawablePrivateStuff(
return FALSE;
else
{
- cPriv = pCon->devPrivates[PclContextPrivateIndex].ptr;
+ cPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
*gc = cPriv->lastGC;
*valid = cPriv->validGC;
*file = cPriv->pPageFile;
@@ -171,7 +172,8 @@ PclSetDrawablePrivateGC(
{
case DRAWABLE_PIXMAP:
pix = (PixmapPtr)pDrawable;
- pixPriv = pix->devPrivates[PclPixmapPrivateIndex].ptr;
+ pixPriv = (PclPixmapPrivPtr)
+ dixLookupPrivate(&pix->devPrivates, PclPixmapPrivateKey);
pixPriv->lastGC = gc;
pixPriv->validGC = 1;
@@ -179,8 +181,8 @@ PclSetDrawablePrivateGC(
case DRAWABLE_WINDOW:
pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
- pPriv = ((PclContextPrivPtr)
- (pCon->devPrivates[PclContextPrivateIndex].ptr));
+ pPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
pPriv->validGC = 1;
pPriv->lastGC = gc;
@@ -316,13 +318,14 @@ PclUpdateDrawableGC(
XpContextPtr pCon;
PclContextPrivPtr cPriv;
PclGCPrivPtr gcPriv = (PclGCPrivPtr)
- (pGC->devPrivates[PclGCPrivateIndex].ptr);
+ dixLookupPrivate(&pGC->devPrivates, PclGCPrivateKey);
if( !PclGetDrawablePrivateStuff( pDrawable, &dGC, &valid, outFile ) )
return FALSE;
pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
- cPriv = pCon->devPrivates[PclContextPrivateIndex].ptr;
+ cPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
/*
* Here's where we update the colormap. Since there can be
diff --git a/hw/xprint/pcl/PclInit.c b/hw/xprint/pcl/PclInit.c
index 574b481d2..e738e3e54 100644
--- a/hw/xprint/pcl/PclInit.c
+++ b/hw/xprint/pcl/PclInit.c
@@ -67,11 +67,11 @@ static void AllocatePclPrivates(ScreenPtr pScreen);
static int PclInitContext(XpContextPtr pCon);
static Bool PclDestroyContext(XpContextPtr pCon);
-int PclScreenPrivateIndex;
-int PclContextPrivateIndex;
-int PclPixmapPrivateIndex;
-int PclWindowPrivateIndex;
-int PclGCPrivateIndex;
+DevPrivateKey PclScreenPrivateKey = &PclScreenPrivateKey;
+DevPrivateKey PclContextPrivateKey = &PclContextPrivateKey;
+DevPrivateKey PclPixmapPrivateKey = &PclPixmapPrivateKey;
+DevPrivateKey PclWindowPrivateKey = &PclWindowPrivateKey;
+DevPrivateKey PclGCPrivateKey = &PclGCPrivateKey;
#ifdef XP_PCL_COLOR
/*
@@ -119,7 +119,8 @@ Bool
PclCloseScreen(int index,
ScreenPtr pScreen)
{
- PclScreenPrivPtr pPriv = pScreen->devPrivates[PclScreenPrivateIndex].ptr;
+ PclScreenPrivPtr pPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey);
pScreen->CloseScreen = pPriv->CloseScreen;
xfree( pPriv );
@@ -157,8 +158,8 @@ InitializePclDriver(
*/
AllocatePclPrivates(pScreen);
- pPriv =
- (PclScreenPrivPtr)pScreen->devPrivates[PclScreenPrivateIndex].ptr;
+ pPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey);
maxDim = MAX( pScreen->height, pScreen->width );
xRes = pScreen->width / ( pScreen->mmWidth / 25.4 );
@@ -258,33 +259,13 @@ InitializePclDriver(
static void
AllocatePclPrivates(ScreenPtr pScreen)
{
- static unsigned long PclGeneration = 0;
+ dixRequestPrivate(PclWindowPrivateKey, sizeof( PclWindowPrivRec ) );
+ dixRequestPrivate(PclContextPrivateKey, sizeof( PclContextPrivRec ) );
+ dixRequestPrivate(PclGCPrivateKey, sizeof( PclGCPrivRec ) );
+ dixRequestPrivate(PclPixmapPrivateKey, sizeof( PclPixmapPrivRec ) );
- if((unsigned long) PclGeneration != serverGeneration)
- {
- PclScreenPrivateIndex = AllocateScreenPrivateIndex();
-
- PclWindowPrivateIndex = AllocateWindowPrivateIndex();
- AllocateWindowPrivate( pScreen, PclWindowPrivateIndex,
- sizeof( PclWindowPrivRec ) );
-
- PclContextPrivateIndex = XpAllocateContextPrivateIndex();
- XpAllocateContextPrivate( PclContextPrivateIndex,
- sizeof( PclContextPrivRec ) );
-
- PclGCPrivateIndex = AllocateGCPrivateIndex();
- AllocateGCPrivate( pScreen, PclGCPrivateIndex,
- sizeof( PclGCPrivRec ) );
-
- PclPixmapPrivateIndex = AllocatePixmapPrivateIndex();
- AllocatePixmapPrivate( pScreen, PclPixmapPrivateIndex,
- sizeof( PclPixmapPrivRec ) );
-
- PclGeneration = serverGeneration;
- }
-
- pScreen->devPrivates[PclScreenPrivateIndex].ptr = (pointer)xalloc(
- sizeof(PclScreenPrivRec));
+ dixSetPrivate(&pScreen->devPrivates, PclScreenPrivateKey,
+ xalloc(sizeof(PclScreenPrivRec)));
}
/*
@@ -347,8 +328,8 @@ PclInitContext(XpContextPtr pCon)
/*
* Set up the context privates
*/
- pConPriv =
- (PclContextPrivPtr)pCon->devPrivates[PclContextPrivateIndex].ptr;
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
pConPriv->jobFileName = (char *)NULL;
pConPriv->pageFileName = (char *)NULL;
@@ -481,7 +462,7 @@ static Bool
PclDestroyContext(XpContextPtr pCon)
{
PclContextPrivPtr pConPriv = (PclContextPrivPtr)
- pCon->devPrivates[PclContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
PclPaletteMapPtr p, t;
PclCmapToContexts *pCmap;
ScreenPtr screen;
@@ -539,7 +520,8 @@ PclDestroyContext(XpContextPtr pCon)
* Remove the context from the screen-level colormap<->contexts mappings
*/
screen = screenInfo.screens[pCon->screenNum];
- sPriv = (PclScreenPrivPtr)screen->devPrivates[PclScreenPrivateIndex].ptr;
+ sPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&screen->devPrivates, PclScreenPrivateKey);
pCmap = sPriv->colormaps;
while( pCmap )
{
@@ -581,8 +563,8 @@ PclGetContextFromWindow(WindowPtr win)
while( win )
{
- pPriv =
- (PclWindowPrivPtr)win->devPrivates[PclWindowPrivateIndex].ptr;
+ pPriv = (PclWindowPrivPtr)
+ dixLookupPrivate(&win->devPrivates, PclWindowPrivateKey);
if( pPriv->validContext )
return pPriv->context;
diff --git a/hw/xprint/pcl/PclLine.c b/hw/xprint/pcl/PclLine.c
index 52a586d17..68d55a525 100644
--- a/hw/xprint/pcl/PclLine.c
+++ b/hw/xprint/pcl/PclLine.c
@@ -107,7 +107,7 @@ PclPolyLine(
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr)
- pCon->devPrivates[PclContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
/*
* Allocate the storage required to deal with the clipping
@@ -223,7 +223,7 @@ PclPolySegment(
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr)
- pCon->devPrivates[PclContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
/*
* Allocate the storage for the temporary regions.
diff --git a/hw/xprint/pcl/PclPixel.c b/hw/xprint/pcl/PclPixel.c
index f41af272f..d219838f0 100644
--- a/hw/xprint/pcl/PclPixel.c
+++ b/hw/xprint/pcl/PclPixel.c
@@ -125,13 +125,15 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints )
if( pDrawable->type == DRAWABLE_WINDOW )
{
pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
- cPriv = pCon->devPrivates[PclContextPrivateIndex].ptr;
+ cPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
cPriv->changeMask = GCLineWidth | GCLineStyle;
}
else
{
- pPriv =
- ((PixmapPtr)pDrawable)->devPrivates[PclPixmapPrivateIndex].ptr;
+ pPriv = (PclPixmapPrivPtr)
+ dixLookupPrivate(&((PixmapPtr)pDrawable)->devPrivates,
+ PclPixmapPrivateKey);
pPriv->changeMask = GCLineWidth | GCLineStyle;
}
#endif
diff --git a/hw/xprint/pcl/PclPolygon.c b/hw/xprint/pcl/PclPolygon.c
index 9867758bb..7d95d6484 100644
--- a/hw/xprint/pcl/PclPolygon.c
+++ b/hw/xprint/pcl/PclPolygon.c
@@ -76,7 +76,7 @@ PclPolyRectangle(
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr)
- pCon->devPrivates[PclContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
/*
* Allocate the storage required to deal with the clipping
@@ -170,7 +170,7 @@ PclFillPolygon(
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr)
- pCon->devPrivates[PclContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
/*
* Generate the PCL code to draw the filled polygon, by defining
@@ -283,7 +283,7 @@ PclPolyFillRect(
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr)
- pCon->devPrivates[PclContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
/*
* Allocate the storage required to deal with the clipping
diff --git a/hw/xprint/pcl/PclPrint.c b/hw/xprint/pcl/PclPrint.c
index 176a0025a..ac8ea1537 100644
--- a/hw/xprint/pcl/PclPrint.c
+++ b/hw/xprint/pcl/PclPrint.c
@@ -72,8 +72,8 @@ PclStartJob(
Bool sendClientData,
ClientPtr client)
{
- PclContextPrivPtr pConPriv =
- (PclContextPrivPtr)pCon->devPrivates[PclContextPrivateIndex].ptr;
+ PclContextPrivPtr pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
PclPaletteMap *pal;
/*
@@ -130,7 +130,7 @@ PclEndJob(
Bool cancel)
{
PclContextPrivPtr priv = (PclContextPrivPtr)
- pCon->devPrivates[PclContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
#ifdef CCP_DEBUG
FILE *xpoutput;
@@ -250,9 +250,9 @@ PclStartPage(
WindowPtr pWin)
{
PclContextPrivPtr pConPriv = (PclContextPrivPtr)
- pCon->devPrivates[PclContextPrivateIndex].ptr;
- PclWindowPrivPtr pWinPriv =
- (PclWindowPrivPtr)pWin->devPrivates[PclWindowPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ PclWindowPrivPtr pWinPriv = (PclWindowPrivPtr)
+ dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey);
xRectangle repro;
char t[80];
XpOid orient, plex, tray, medium;
@@ -488,7 +488,7 @@ PclEndPage(
WindowPtr pWin)
{
PclContextPrivPtr pConPriv = (PclContextPrivPtr)
- pCon->devPrivates[PclContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
struct stat statBuf;
@@ -532,7 +532,7 @@ PclStartDoc(XpContextPtr pCon,
XPDocumentType type)
{
PclContextPrivPtr pConPriv = (PclContextPrivPtr)
- pCon->devPrivates[PclContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
#ifndef XP_PCL_LJ3
/*
@@ -592,7 +592,7 @@ PclDocumentData(
{
int type = 0;
PclContextPrivPtr pPriv = (PclContextPrivPtr)
- pCon->devPrivates[PclContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
XpOidDocFmtList *formats;
XpOidDocFmt *f;
char t[80];
@@ -700,7 +700,7 @@ PclGetDocumentData(
int maxBufferSize)
{
PclContextPrivPtr pPriv = (PclContextPrivPtr)
- pCon->devPrivates[PclContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
pPriv->getDocClient = client;
pPriv->getDocBufSize = maxBufferSize;
diff --git a/hw/xprint/pcl/PclText.c b/hw/xprint/pcl/PclText.c
index 246c0195b..324de3014 100644
--- a/hw/xprint/pcl/PclText.c
+++ b/hw/xprint/pcl/PclText.c
@@ -123,7 +123,7 @@ char font_type;
pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
pConPriv = (PclContextPrivPtr)
- pCon->devPrivates[PclContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
pSoftFontInfo = pConPriv->pSoftFontInfo;
font_type = isInternal(pGC->font);
if ( font_type == DOWNLOAD_FONT ) {
@@ -293,7 +293,7 @@ char font_type;
pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
pConPriv = (PclContextPrivPtr)
- pCon->devPrivates[PclContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
pSoftFontInfo = pConPriv->pSoftFontInfo;
font_type = isInternal(pGC->font);
diff --git a/hw/xprint/pcl/PclWindow.c b/hw/xprint/pcl/PclWindow.c
index f34ad7feb..a87dc0e7a 100644
--- a/hw/xprint/pcl/PclWindow.c
+++ b/hw/xprint/pcl/PclWindow.c
@@ -97,9 +97,9 @@ PclCreateWindow(
Bool status = Success;
ScreenPtr pScreen = pWin->drawable.pScreen;
PclScreenPrivPtr pScreenPriv = (PclScreenPrivPtr)
- pScreen->devPrivates[PclScreenPrivateIndex].ptr;
+ dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey);
PclWindowPrivPtr pWinPriv = (PclWindowPrivPtr)
- pWin->devPrivates[PclWindowPrivateIndex].ptr;
+ dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey);
/*
* Initialize this window's private struct.
@@ -142,7 +142,8 @@ PclCreateWindow(
/*
* Invalidate the window's private print context.
*/
- pPriv = (PclWindowPrivPtr)pWin->devPrivates[PclWindowPrivateIndex].ptr;
+ pPriv = (PclWindowPrivPtr)
+ dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey);
pPriv->validContext = 0;
return TRUE;
diff --git a/hw/xprint/pcl/Pclmap.h b/hw/xprint/pcl/Pclmap.h
index 3990ab294..18ac31d90 100644
--- a/hw/xprint/pcl/Pclmap.h
+++ b/hw/xprint/pcl/Pclmap.h
@@ -82,11 +82,11 @@ copyright holders.
#define InitializePclDriver CATNAME(Initialize, PclDriver)
#define PclCloseScreen PCLNAME(CloseScreen)
#define PclGetContextFromWindow PCLNAME(GetContextFromWindow)
-#define PclScreenPrivateIndex PCLNAME(ScreenPrivateIndex)
-#define PclWindowPrivateIndex PCLNAME(WindowPrivateIndex)
-#define PclContextPrivateIndex PCLNAME(ContextPrivateIndex)
-#define PclPixmapPrivateIndex PCLNAME(PixmapPrivateIndex)
-#define PclGCPrivateIndex PCLNAME(GCPrivateIndex)
+#define PclScreenPrivateKey PCLNAME(ScreenPrivateKey)
+#define PclWindowPrivateKey PCLNAME(WindowPrivateKey)
+#define PclContextPrivateKey PCLNAME(ContextPrivateKey)
+#define PclPixmapPrivateKey PCLNAME(PixmapPrivateKey)
+#define PclGCPrivateKey PCLNAME(GCPrivateKey)
/* PclPrint.c */
#define PclStartJob PCLNAME(StartJob)
diff --git a/hw/xprint/ps/Ps.h b/hw/xprint/ps/Ps.h
index 5e77d9a0a..a25e9891a 100644
--- a/hw/xprint/ps/Ps.h
+++ b/hw/xprint/ps/Ps.h
@@ -121,10 +121,10 @@ typedef char *XPointer;
* Public index variables from PsInit.c
*/
-extern int PsScreenPrivateIndex;
-extern int PsWindowPrivateIndex;
-extern int PsContextPrivateIndex;
-extern int PsPixmapPrivateIndex;
+extern DevPrivateKey PsScreenPrivateKey;
+extern DevPrivateKey PsWindowPrivateKey;
+extern DevPrivateKey PsContextPrivateKey;
+extern DevPrivateKey PsPixmapPrivateKey;
extern XpValidatePoolsRec PsValidatePoolsRec;
/*
diff --git a/hw/xprint/ps/PsGC.c b/hw/xprint/ps/PsGC.c
index 3ec07a77a..19898c90e 100644
--- a/hw/xprint/ps/PsGC.c
+++ b/hw/xprint/ps/PsGC.c
@@ -162,9 +162,11 @@ PsGetDrawablePrivateStuff(
c = wColormap((WindowPtr)pDrawable);
cmap = (ColormapPtr)LookupIDByType(c, RT_COLORMAP);
- cPriv = pCon->devPrivates[PsContextPrivateIndex].ptr;
+ cPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
sPriv = (PsScreenPrivPtr)
- pDrawable->pScreen->devPrivates[PsScreenPrivateIndex].ptr;
+ dixLookupPrivate(&pDrawable->pScreen->devPrivates,
+ PsScreenPrivateKey);
*gc = cPriv->lastGC;
*valid = cPriv->validGC;
*psOut = cPriv->pPsOut;
@@ -189,7 +191,8 @@ PsGetPsContextPriv( DrawablePtr pDrawable )
pCon = PsGetContextFromWindow((WindowPtr)pDrawable);
if (pCon != NULL)
{
- return pCon->devPrivates[PsContextPrivateIndex].ptr;
+ return (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
}
}
return NULL;
@@ -257,8 +260,9 @@ PsUpdateDrawableGC(
PsOut_Offset(*psOut, pDrawable->x, pDrawable->y);
PsOut_Clip(*psOut, pGC->clientClipType, (PsClipPtr)pGC->clientClip);
}
- cPriv = ( PsGetContextFromWindow( (WindowPtr)pDrawable ) )
- ->devPrivates[PsContextPrivateIndex].ptr;
+ cPriv = (PsContextPrivPtr)dixLookupPrivate(
+ &PsGetContextFromWindow((WindowPtr)pDrawable)->devPrivates,
+ PsContextPrivateKey);
break;
}
return TRUE;
diff --git a/hw/xprint/ps/PsInit.c b/hw/xprint/ps/PsInit.c
index 6d4bd06f3..72bd7bd7c 100644
--- a/hw/xprint/ps/PsInit.c
+++ b/hw/xprint/ps/PsInit.c
@@ -97,10 +97,10 @@ static void AllocatePsPrivates(ScreenPtr pScreen);
static int PsInitContext(XpContextPtr pCon);
static int PsDestroyContext(XpContextPtr pCon);
-int PsScreenPrivateIndex;
-int PsContextPrivateIndex;
-int PsPixmapPrivateIndex;
-int PsWindowPrivateIndex;
+DevPrivateKey PsScreenPrivateKey = &PsScreenPrivateKey;
+DevPrivateKey PsContextPrivateKey = &PsContextPrivateKey;
+DevPrivateKey PsPixmapPrivateKey = &PsPixmapPrivateKey;
+DevPrivateKey PsWindowPrivateKey = &PsWindowPrivateKey;
#ifdef GLXEXT
extern void GlxWrapInitVisuals(miInitVisualsProcPtr *);
@@ -152,7 +152,8 @@ InitializePsDriver(ndx, pScreen, argc, argv)
AllocatePsPrivates(pScreen);
#if 0
- pPriv = (PsScreenPrivPtr)pScreen->devPrivates[PsScreenPrivateIndex].ptr;
+ pPriv = (PsScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, PsScreenPrivateKey);
pPriv->resDB = rmdb;
#endif
@@ -474,28 +475,12 @@ InitializePsDriver(ndx, pScreen, argc, argv)
static void
AllocatePsPrivates(ScreenPtr pScreen)
{
- static unsigned long PsGeneration = 0;
+ dixRequestPrivate(PsWindowPrivateKey, sizeof(PsWindowPrivRec));
+ dixRequestPrivate(PsContextPrivateKey, sizeof(PsContextPrivRec));
+ dixRequestPrivate(PsPixmapPrivateKey, sizeof(PsPixmapPrivRec));
- if((unsigned long)PsGeneration != serverGeneration)
- {
- PsScreenPrivateIndex = AllocateScreenPrivateIndex();
-
- PsWindowPrivateIndex = AllocateWindowPrivateIndex();
- AllocateWindowPrivate(pScreen, PsWindowPrivateIndex,
- sizeof(PsWindowPrivRec));
-
- PsContextPrivateIndex = XpAllocateContextPrivateIndex();
- XpAllocateContextPrivate(PsContextPrivateIndex,
- sizeof(PsContextPrivRec));
-
- PsPixmapPrivateIndex = AllocatePixmapPrivateIndex();
- AllocatePixmapPrivate(pScreen, PsPixmapPrivateIndex,
- sizeof(PsPixmapPrivRec));
-
- PsGeneration = serverGeneration;
- }
- pScreen->devPrivates[PsScreenPrivateIndex].ptr =
- (pointer)xalloc(sizeof(PsScreenPrivRec));
+ dixSetPrivate(&pScreen->devPrivates, PsScreenPrivateKey,
+ xalloc(sizeof(PsScreenPrivRec)));
}
/*
@@ -550,8 +535,8 @@ PsInitContext(pCon)
/*
* Set up the context privates
*/
- pConPriv =
- (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
+ pConPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
memset(pConPriv, 0, sizeof(PsContextPrivRec));
pConPriv->jobFileName = (char *)NULL;
@@ -620,8 +605,8 @@ static Bool
PsDestroyContext(pCon)
XpContextPtr pCon;
{
- PsContextPrivPtr pConPriv =
- (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
+ PsContextPrivPtr pConPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
if( pConPriv->pJobFile!=(FILE *)NULL )
{
@@ -653,7 +638,8 @@ PsGetContextFromWindow(win)
while( win )
{
- pPriv = (PsWindowPrivPtr)win->devPrivates[PsWindowPrivateIndex].ptr;
+ pPriv = (PsWindowPrivPtr)
+ dixLookupPrivate(&win->devPrivates, PsWindowPrivateKey);
if( pPriv->validContext ) return pPriv->context;
win = win->parent;
}
diff --git a/hw/xprint/ps/PsPixmap.c b/hw/xprint/ps/PsPixmap.c
index d3ab198f8..a588f4276 100644
--- a/hw/xprint/ps/PsPixmap.c
+++ b/hw/xprint/ps/PsPixmap.c
@@ -79,6 +79,7 @@ in this Software without prior written authorization from The Open Group.
#include "windowstr.h"
#include "gcstruct.h"
+#include "privates.h"
#include "Ps.h"
@@ -111,6 +112,7 @@ PsCreatePixmap(
pPixmap->drawable.height = height;
pPixmap->devKind = 0;
pPixmap->refcnt = 1;
+ pPixmap->devPrivates = NULL;
pPixmap->devPrivate.ptr = (PsPixmapPrivPtr)xcalloc(1, sizeof(PsPixmapPrivRec));
if( !pPixmap->devPrivate.ptr )
@@ -197,6 +199,7 @@ PsDestroyPixmap(PixmapPtr pPixmap)
PsScrubPixmap(pPixmap);
xfree(priv);
+ dixFreePrivates(pPixmap->devPrivates);
xfree(pPixmap);
return TRUE;
}
diff --git a/hw/xprint/ps/PsPrint.c b/hw/xprint/ps/PsPrint.c
index 4571c07d7..386646858 100644
--- a/hw/xprint/ps/PsPrint.c
+++ b/hw/xprint/ps/PsPrint.c
@@ -165,8 +165,8 @@ PsStartJob(
Bool sendClientData,
ClientPtr client)
{
- PsContextPrivPtr pConPriv =
- (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
+ PsContextPrivPtr pConPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
/*
* Create a temporary file to store the printer output.
@@ -191,8 +191,8 @@ PsEndJob(
struct stat buffer;
int error;
- PsContextPrivPtr priv =
- (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
+ PsContextPrivPtr priv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
if (cancel == True) {
if (priv->getDocClient != (ClientPtr) NULL) {
@@ -291,10 +291,10 @@ PsStartPage(
{
int iorient, iplex, icount, ires;
unsigned short iwd, iht;
- PsContextPrivPtr pConPriv =
- (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
- PsWindowPrivPtr pWinPriv =
- (PsWindowPrivPtr)pWin->devPrivates[PsWindowPrivateIndex].ptr;
+ PsContextPrivPtr pConPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
+ PsWindowPrivPtr pWinPriv = (PsWindowPrivPtr)
+ dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey);
/*
* Put a pointer to the context in the window private structure
@@ -337,10 +337,10 @@ PsEndPage(
XpContextPtr pCon,
WindowPtr pWin)
{
- PsWindowPrivPtr pWinPriv =
- (PsWindowPrivPtr)pWin->devPrivates[PsWindowPrivateIndex].ptr;
- PsContextPrivPtr pConPriv =
- (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
+ PsWindowPrivPtr pWinPriv = (PsWindowPrivPtr)
+ dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey);
+ PsContextPrivPtr pConPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
PsOut_EndPage(pConPriv->pPsOut);
@@ -366,8 +366,8 @@ PsStartDoc(XpContextPtr pCon, XPDocumentType type)
int iorient, iplex, icount, ires;
unsigned short iwd, iht;
char *title;
- PsContextPrivPtr pConPriv =
- (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
+ PsContextPrivPtr pConPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
/* get job level attributes */
title = XpGetOneAttribute(pCon, XPJobAttr, "job-name");
@@ -420,7 +420,8 @@ PsDocumentData(
len_opt)
return BadValue;
- cPriv = pCon->devPrivates[PsContextPrivateIndex].ptr;
+ cPriv = (PsContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
psOut = cPriv->pPsOut;
if (pDraw)
@@ -448,7 +449,7 @@ PsGetDocumentData(
int maxBufferSize)
{
PsContextPrivPtr pPriv = (PsContextPrivPtr)
- pCon->devPrivates[PsContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey);
pPriv->getDocClient = client;
pPriv->getDocBufSize = maxBufferSize;
diff --git a/hw/xprint/ps/PsWindow.c b/hw/xprint/ps/PsWindow.c
index ded7dd638..d17cf8ce0 100644
--- a/hw/xprint/ps/PsWindow.c
+++ b/hw/xprint/ps/PsWindow.c
@@ -123,9 +123,9 @@ PsCreateWindow(WindowPtr pWin)
Bool status = Success;
ScreenPtr pScreen = pWin->drawable.pScreen;
PsScreenPrivPtr pScreenPriv = (PsScreenPrivPtr)
- pScreen->devPrivates[PsScreenPrivateIndex].ptr;
+ dixLookupPrivate(&pScreen->devPrivates, PsScreenPrivateKey);
PsWindowPrivPtr pWinPriv = (PsWindowPrivPtr)
- pWin->devPrivates[PsWindowPrivateIndex].ptr;
+ dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey);
/*
* Initialize this window's private struct.
@@ -165,7 +165,8 @@ PsCreateWindow(WindowPtr pWin)
return status;
#endif
- pPriv = (PsWindowPrivPtr)pWin->devPrivates[PsWindowPrivateIndex].ptr;
+ pPriv = (PsWindowPrivPtr)
+ dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey);
pPriv->validContext = 0;
return TRUE;
diff --git a/hw/xprint/raster/Raster.c b/hw/xprint/raster/Raster.c
index 0286a18fa..dccef613c 100644
--- a/hw/xprint/raster/Raster.c
+++ b/hw/xprint/raster/Raster.c
@@ -151,8 +151,8 @@ static int RasterReproducibleArea(XpContextPtr pCon,
#define DOC_PCL 1
#define DOC_RASTER 2
-static int RasterScreenPrivateIndex, RasterContextPrivateIndex;
-static int RasterGeneration = 0;
+static DevPrivateKey RasterScreenPrivateKey = &RasterScreenPrivateKey;
+static DevPrivateKey RasterContextPrivateKey = &RasterContextPrivateKey;
static char RASTER_DRIV_NAME[] = "XP-RASTER";
static int doc_type = DOC_RASTER;
@@ -205,7 +205,7 @@ InitializeRasterDriver(
AllocateRasterPrivates(pScreen);
pPriv = (RasterScreenPrivPtr)
- pScreen->devPrivates[RasterScreenPrivateIndex].ptr;
+ dixLookupPrivate(&pScreen->devPrivates, RasterScreenPrivateKey);
maxDim = MAX( pScreen->height, pScreen->width );
numBytes = maxDim + BITMAP_SCANLINE_PAD - 1; /* pixels per row */
@@ -252,7 +252,7 @@ GetPropString(
char *propName)
{
RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
- pCon->devPrivates[RasterContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
char *type;
XrmValue val;
struct stat status;
@@ -371,7 +371,7 @@ StartJob(
ClientPtr client)
{
RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
- pCon->devPrivates[RasterContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
SetDocumentType( pCon );
@@ -488,7 +488,7 @@ EndJob(
Bool cancel)
{
RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
- pCon->devPrivates[RasterContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
if( cancel == True )
{
@@ -549,7 +549,7 @@ StartPage(
WindowPtr pWin)
{
RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
- pCon->devPrivates[RasterContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
if(pConPriv->pPageFile != (FILE *)NULL)
{
@@ -830,7 +830,7 @@ SendPage( XpContextPtr pCon )
{
struct stat statBuf;
RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
- pCon->devPrivates[RasterContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
if(stat(pConPriv->pageFileName, &statBuf) < 0)
return BadAlloc;
@@ -872,7 +872,7 @@ EndPage(
WindowPtr pWin)
{
RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
- pCon->devPrivates[RasterContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
struct stat statBuf;
char *rasterFileName = (char *)NULL, *pCommand = (char *)NULL;
FILE *pRasterFile = (FILE *)NULL;
@@ -1068,7 +1068,7 @@ DocumentData(
ClientPtr client)
{
RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
- pCon->devPrivates[RasterContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
char *preRasterStr = PRE_RASTER, *postRasterStr = POST_RASTER,
*noRasterStr = NO_RASTER;
@@ -1135,7 +1135,7 @@ GetDocumentData(
int maxBufferSize)
{
RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
- pContext->devPrivates[RasterContextPrivateIndex].ptr;
+ dixLookupPrivate(&pContext->devPrivates, RasterContextPrivateKey);
pConPriv->getDocClient = client;
pConPriv->getDocBufSize = maxBufferSize;
@@ -1146,17 +1146,9 @@ static void
AllocateRasterPrivates(
ScreenPtr pScreen)
{
- if(RasterGeneration != serverGeneration)
- {
- RasterScreenPrivateIndex = AllocateScreenPrivateIndex();
- RasterContextPrivateIndex = XpAllocateContextPrivateIndex();
- XpAllocateContextPrivate( RasterContextPrivateIndex,
- sizeof( RasterContextPrivRec ) );
-
- RasterGeneration = serverGeneration;
- }
- pScreen->devPrivates[RasterScreenPrivateIndex].ptr = (pointer)Xalloc(
- sizeof(RasterScreenPrivRec));
+ dixRequestPrivate(RasterContextPrivateKey, sizeof( RasterContextPrivRec ) );
+ dixSetPrivate(&pScreen->devPrivates, RasterScreenPrivateKey,
+ Xalloc(sizeof(RasterScreenPrivRec)));
}
/*
@@ -1171,7 +1163,7 @@ RasterChangeWindowAttributes(
Bool status = Success;
ScreenPtr pScreen = pWin->drawable.pScreen;
RasterScreenPrivPtr pScreenPriv = (RasterScreenPrivPtr)
- pScreen->devPrivates[RasterScreenPrivateIndex].ptr;
+ dixLookupPrivate(&pScreen->devPrivates, RasterScreenPrivateKey);
if(pWin->backingStore == NotUseful)
{
@@ -1270,7 +1262,7 @@ RasterInitContext(
* Set up the context privates
*/
pConPriv = (RasterContextPrivPtr)
- pCon->devPrivates[RasterContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
pConPriv->jobFileName = (char *)NULL;
pConPriv->pageFileName = (char *)NULL;
@@ -1355,7 +1347,7 @@ RasterDestroyContext(
XpContextPtr pCon)
{
RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
- pCon->devPrivates[RasterContextPrivateIndex].ptr;
+ dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey);
/*
* Clean up the temporary files
@@ -1477,7 +1469,7 @@ RasterCloseScreen(
{
Bool status = Success;
RasterScreenPrivPtr pScreenPriv = (RasterScreenPrivPtr)
- pScreen->devPrivates[RasterScreenPrivateIndex].ptr;
+ dixLookupPrivate(&pScreen->devPrivates, RasterScreenPrivateKey);
/*
* Call any wrapped CloseScreen proc.
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 754666090..3ab324931 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -629,11 +629,11 @@ extern DWORD g_dwEvents;
#ifdef HAS_DEVWINDOWS
extern int g_fdMessageQueue;
#endif
-extern int g_iScreenPrivateIndex;
-extern int g_iCmapPrivateIndex;
-extern int g_iGCPrivateIndex;
-extern int g_iPixmapPrivateIndex;
-extern int g_iWindowPrivateIndex;
+extern DevPrivateKey g_iScreenPrivateKey;
+extern DevPrivateKey g_iCmapPrivateKey;
+extern DevPrivateKey g_iGCPrivateKey;
+extern DevPrivateKey g_iPixmapPrivateKey;
+extern DevPrivateKey g_iWindowPrivateKey;
extern unsigned long g_ulServerGeneration;
extern CARD32 g_c32LastInputEventTime;
extern DWORD g_dwEnginesSupported;
@@ -659,11 +659,11 @@ extern FARPROC g_fpTrackMouseEvent;
* Screen privates macros
*/
-#define winGetScreenPriv(pScreen) \
- ((winPrivScreenPtr) (pScreen)->devPrivates[g_iScreenPrivateIndex].ptr)
+#define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey))
#define winSetScreenPriv(pScreen,v) \
- ((pScreen)->devPrivates[g_iScreenPrivateIndex].ptr = (pointer) v)
+ dixSetPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey, v)
#define winScreenPriv(pScreen) \
winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen)
@@ -673,11 +673,11 @@ extern FARPROC g_fpTrackMouseEvent;
* Colormap privates macros
*/
-#define winGetCmapPriv(pCmap) \
- ((winPrivCmapPtr) (pCmap)->devPrivates[g_iCmapPrivateIndex].ptr)
+#define winGetCmapPriv(pCmap) ((winPrivCmapPtr) \
+ dixLookupPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey))
#define winSetCmapPriv(pCmap,v) \
- ((pCmap)->devPrivates[g_iCmapPrivateIndex].ptr = (pointer) v)
+ dixSetPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey, v)
#define winCmapPriv(pCmap) \
winPrivCmapPtr pCmapPriv = winGetCmapPriv(pCmap)
@@ -687,11 +687,11 @@ extern FARPROC g_fpTrackMouseEvent;
* GC privates macros
*/
-#define winGetGCPriv(pGC) \
- ((winPrivGCPtr) (pGC)->devPrivates[g_iGCPrivateIndex].ptr)
+#define winGetGCPriv(pGC) ((winPrivGCPtr) \
+ dixLookupPrivate(&(pGC)->devPrivates, g_iGCPrivateKey))
#define winSetGCPriv(pGC,v) \
- ((pGC)->devPrivates[g_iGCPrivateIndex].ptr = (pointer) v)
+ dixSetPrivate(&(pGC)->devPrivates, g_iGCPrivateKey, v)
#define winGCPriv(pGC) \
winPrivGCPtr pGCPriv = winGetGCPriv(pGC)
@@ -701,11 +701,11 @@ extern FARPROC g_fpTrackMouseEvent;
* Pixmap privates macros
*/
-#define winGetPixmapPriv(pPixmap) \
- ((winPrivPixmapPtr) (pPixmap)->devPrivates[g_iPixmapPrivateIndex].ptr)
+#define winGetPixmapPriv(pPixmap) ((winPrivPixmapPtr) \
+ dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey))
#define winSetPixmapPriv(pPixmap,v) \
- ((pPixmap)->devPrivates[g_iPixmapPrivateIndex].ptr = (pointer) v)
+ dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey, v)
#define winPixmapPriv(pPixmap) \
winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap)
@@ -715,11 +715,11 @@ extern FARPROC g_fpTrackMouseEvent;
* Window privates macros
*/
-#define winGetWindowPriv(pWin) \
- ((winPrivWinPtr) (pWin)->devPrivates[g_iWindowPrivateIndex].ptr)
+#define winGetWindowPriv(pWin) ((winPrivWinPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey))
#define winSetWindowPriv(pWin,v) \
- ((pWin)->devPrivates[g_iWindowPrivateIndex].ptr = (pointer) v)
+ dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey, v)
#define winWindowPriv(pWin) \
winPrivWinPtr pWinPriv = winGetWindowPriv(pWin)
diff --git a/hw/xwin/winallpriv.c b/hw/xwin/winallpriv.c
index f4decfb59..21ccd9b3b 100644
--- a/hw/xwin/winallpriv.c
+++ b/hw/xwin/winallpriv.c
@@ -57,12 +57,6 @@ winAllocatePrivates (ScreenPtr pScreen)
/* We need a new slot for our privates if the screen gen has changed */
if (g_ulServerGeneration != serverGeneration)
{
- /* Get an index that we can store our privates at */
- g_iScreenPrivateIndex = AllocateScreenPrivateIndex ();
- g_iGCPrivateIndex = AllocateGCPrivateIndex ();
- g_iPixmapPrivateIndex = AllocatePixmapPrivateIndex ();
- g_iWindowPrivateIndex = AllocateWindowPrivateIndex ();
-
g_ulServerGeneration = serverGeneration;
}
@@ -84,24 +78,21 @@ winAllocatePrivates (ScreenPtr pScreen)
winSetScreenPriv (pScreen, pScreenPriv);
/* Reserve GC memory for our privates */
- if (!AllocateGCPrivate (pScreen, g_iGCPrivateIndex,
- sizeof (winPrivGCRec)))
+ if (!dixRequestPrivate(g_iGCPrivateKey, sizeof (winPrivGCRec)))
{
ErrorF ("winAllocatePrivates - AllocateGCPrivate () failed\n");
return FALSE;
}
/* Reserve Pixmap memory for our privates */
- if (!AllocatePixmapPrivate (pScreen, g_iPixmapPrivateIndex,
- sizeof (winPrivPixmapRec)))
+ if (!dixRequestPrivate(g_iPixmapPrivateKey, sizeof (winPrivPixmapRec)))
{
ErrorF ("winAllocatePrivates - AllocatePixmapPrivates () failed\n");
return FALSE;
}
/* Reserve Window memory for our privates */
- if (!AllocateWindowPrivate (pScreen, g_iWindowPrivateIndex,
- sizeof (winPrivWinRec)))
+ if (!dixRequestPrivate(g_iWindowPrivateKey, sizeof (winPrivWinRec)))
{
ErrorF ("winAllocatePrivates () - AllocateWindowPrivates () failed\n");
return FALSE;
@@ -155,9 +146,6 @@ winAllocateCmapPrivates (ColormapPtr pCmap)
/* Get a new privates index when the server generation changes */
if (s_ulPrivateGeneration != serverGeneration)
{
- /* Get an index that we can store our privates at */
- g_iCmapPrivateIndex = AllocateColormapPrivateIndex (winInitCmapPrivates);
-
/* Save the new server generation */
s_ulPrivateGeneration = serverGeneration;
}
diff --git a/hw/xwin/winclipboardwrappers.c b/hw/xwin/winclipboardwrappers.c
index 825d3dc70..2cfe0ffce 100755
--- a/hw/xwin/winclipboardwrappers.c
+++ b/hw/xwin/winclipboardwrappers.c
@@ -431,7 +431,6 @@ winProcSetSelectionOwner (ClientPtr client)
* and we currently own the Win32 clipboard.
*/
if (None == stuff->window
- && g_iClipboardWindow != client->lastDrawableID
&& (None == s_iOwners[CLIP_OWN_PRIMARY]
|| g_iClipboardWindow == s_iOwners[CLIP_OWN_PRIMARY])
&& (None == s_iOwners[CLIP_OWN_CLIPBOARD]
diff --git a/hw/xwin/wincursor.c b/hw/xwin/wincursor.c
index c1e619bf8..021b8b82c 100644
--- a/hw/xwin/wincursor.c
+++ b/hw/xwin/wincursor.c
@@ -598,7 +598,8 @@ winInitCursor (ScreenPtr pScreen)
pScreenPriv->cursor.QueryBestSize = pScreen->QueryBestSize;
pScreen->QueryBestSize = winCursorQueryBestSize;
- pPointPriv = (miPointerScreenPtr) pScreen->devPrivates[miPointerScreenIndex].ptr;
+ pPointPriv = (miPointerScreenPtr)
+ dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
pScreenPriv->cursor.spriteFuncs = pPointPriv->spriteFuncs;
pPointPriv->spriteFuncs = &winSpriteFuncsRec;
diff --git a/hw/xwin/winfillsp.c b/hw/xwin/winfillsp.c
index 7e3966965..702f34f96 100644
--- a/hw/xwin/winfillsp.c
+++ b/hw/xwin/winfillsp.c
@@ -35,15 +35,6 @@
#include "win.h"
-/*
- * References to external symbols
- */
-
-extern int g_iPixmapPrivateIndex;
-extern int g_iGCPrivateIndex;
-extern int g_copyROP[];
-
-
extern void ROP16(HDC hdc, int rop);
#define TRANSLATE_COLOR(color) \
diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c
index af8190d3f..fddada39e 100644
--- a/hw/xwin/winglobals.c
+++ b/hw/xwin/winglobals.c
@@ -44,11 +44,11 @@ int g_iLastScreen = -1;
#ifdef HAS_DEVWINDOWS
int g_fdMessageQueue = WIN_FD_INVALID;
#endif
-int g_iScreenPrivateIndex = -1;
-int g_iCmapPrivateIndex = -1;
-int g_iGCPrivateIndex = -1;
-int g_iPixmapPrivateIndex = -1;
-int g_iWindowPrivateIndex = -1;
+DevPrivateKey g_iScreenPrivateKey = &g_iScreenPrivateKey;
+DevPrivateKey g_iCmapPrivateKey = &g_iCmapPrivateKey;
+DevPrivateKey g_iGCPrivateKey = &g_iGCPrivateKey;
+DevPrivateKey g_iPixmapPrivateKey = &g_iPixmapPrivateKey;
+DevPrivateKey g_iWindowPrivateKey = &g_iWindowPrivateKey;
unsigned long g_ulServerGeneration = 0;
Bool g_fInitializedDefaultScreens = FALSE;
DWORD g_dwEnginesSupported = 0;
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index 0a7579b61..20ff9f7db 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -365,7 +365,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
ErrorF ("\thenght %08X\n", pWin->drawable.height);
ErrorF ("\tpScreen %08X\n", pWin->drawable.pScreen);
ErrorF ("\tserialNumber %08X\n", pWin->drawable.serialNumber);
- ErrorF ("g_iWindowPrivateIndex %d\n", g_iWindowPrivateIndex);
+ ErrorF ("g_iWindowPrivateKey %p\n", g_iWindowPrivateKey);
ErrorF ("pWinPriv %08X\n", pWinPriv);
ErrorF ("s_pScreenPriv %08X\n", s_pScreenPriv);
ErrorF ("s_pScreenInfo %08X\n", s_pScreenInfo);
diff --git a/hw/xwin/winpixmap.c b/hw/xwin/winpixmap.c
index 994eeb89a..6687ebf00 100644
--- a/hw/xwin/winpixmap.c
+++ b/hw/xwin/winpixmap.c
@@ -36,13 +36,6 @@
/*
- * References to external symbols
- */
-
-extern int g_iPixmapPrivateIndex;
-
-
-/*
* Local prototypes
*/
diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c
index a49f68f7e..9dc4c3da5 100644
--- a/hw/xwin/winscrinit.c
+++ b/hw/xwin/winscrinit.c
@@ -73,9 +73,6 @@ winMWExtWMProcs = {
* References to external symbols
*/
-extern winScreenInfo g_ScreenInfo[];
-extern miPointerScreenFuncRec g_winPointerCursorFuncs;
-extern int g_iScreenPrivateIndex;
extern Bool g_fSoftwareCursor;
diff --git a/hw/xwin/winsetsp.c b/hw/xwin/winsetsp.c
index 8a3faee93..f894d6cda 100644
--- a/hw/xwin/winsetsp.c
+++ b/hw/xwin/winsetsp.c
@@ -35,15 +35,6 @@
#include "win.h"
-/*
- * References to external symbols
- */
-
-extern int g_iPixmapPrivateIndex;
-extern int g_iGCPrivateIndex;
-extern int g_copyROP[];
-
-
/* See Porting Layer Definition - p. 55 */
void
winSetSpansNativeGDI (DrawablePtr pDrawable,
diff --git a/hw/xwin/winwin32rootless.c b/hw/xwin/winwin32rootless.c
index 832e36d44..4b4cd3ded 100755
--- a/hw/xwin/winwin32rootless.c
+++ b/hw/xwin/winwin32rootless.c
@@ -971,7 +971,7 @@ winMWExtWMRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin)
SetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE,
WS_POPUP | WS_CLIPCHILDREN);
- DeleteProperty (oldWin, AtmWindowsWmNativeHwnd ());
+ DeleteProperty (serverClient, oldWin, AtmWindowsWmNativeHwnd ());
winMWExtWMSetNativeProperty (pFrame);
#if CYGMULTIWINDOW_DEBUG
#if 0
diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c
index e1994de84..1356465d9 100755
--- a/hw/xwin/winwindowswm.c
+++ b/hw/xwin/winwindowswm.c
@@ -41,6 +41,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "scrnintstr.h"
#include "servermd.h"
#include "swaprep.h"
+#include "registry.h"
#define _WINDOWSWM_SERVER_
#include "windowswmstr.h"
@@ -105,7 +106,35 @@ winWindowsWMExtensionInit ()
WMErrorBase = extEntry->errorBase;
WMEventBase = extEntry->eventBase;
EventSwapVector[WMEventBase] = (EventSwapPtr) SNotifyEvent;
- }
+ } else
+ return;
+
+ RegisterRequestName(WMReqCode, X_WindowsWMQueryVersion,
+ WINDOWSWMNAME ":QueryVersion");
+ RegisterRequestName(WMReqCode, X_WindowsWMFrameGetRect,
+ WINDOWSWMNAME ":FrameGetRect");
+ RegisterRequestName(WMReqCode, X_WindowsWMFrameDraw,
+ WINDOWSWMNAME ":FrameDraw");
+ RegisterRequestName(WMReqCode, X_WindowsWMFrameSetTitle,
+ WINDOWSWMNAME ":FrameSetTitle");
+ RegisterRequestName(WMReqCode, X_WindowsWMDisableUpdate,
+ WINDOWSWMNAME ":DisableUpdate");
+ RegisterRequestName(WMReqCode, X_WindowsWMReenableUpdate,
+ WINDOWSWMNAME ":ReenableUpdate");
+ RegisterRequestName(WMReqCode, X_WindowsWMSelectInput,
+ WINDOWSWMNAME ":SelectInput");
+ RegisterRequestName(WMReqCode, X_WindowsWMSetFrontProcess,
+ WINDOWSWMNAME ":SetFrontProcess");
+
+ RegisterEventName(WMEventBase + WindowsWMControllerNotify,
+ WINDOWSWMNAME ":ControllerNotify");
+ RegisterEventName(WMEventBase + WindowsWMActivationNotify,
+ WINDOWSWMNAME ":ActivationNotify");
+
+ RegisterErrorName(WMErrorBase + WindowsWMClientNotLocal,
+ WINDOWSWMNAME ":ClientNotLocal");
+ RegisterErrorName(WMErrorBase + WindowsWMOperationNotSupported,
+ WINDOWSWMNAME ":OperationNotSupported");
}
/*ARGSUSED*/