summaryrefslogtreecommitdiff
path: root/hw/dmx
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2007-08-28 09:28:25 -0400
committerEamon Walsh <ewalsh@moss-charon.epoch.ncsc.mil>2007-08-28 09:28:25 -0400
commit4017d3190234e189a0bbd33193a148d4d3c7556b (patch)
tree2ab228113d410386afde50c893f137d95974b8f3 /hw/dmx
parent85547073265ae9bc4ae3af920a6d3214fd1ca0c5 (diff)
devPrivates rework: since API is already broken, switch everything
over to new system. Need to update documentation and address some remaining vestiges of old system such as CursorRec structure, fb "offman" structure, and FontRec privates.
Diffstat (limited to 'hw/dmx')
-rw-r--r--hw/dmx/dmxcmap.c14
-rw-r--r--hw/dmx/dmxcmap.h9
-rw-r--r--hw/dmx/dmxdpms.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
14 files changed, 41 insertions, 91 deletions
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/dmxdpms.c b/hw/dmx/dmxdpms.c
index ea0d66c3c..8c745a6aa 100644
--- a/hw/dmx/dmxdpms.c
+++ b/hw/dmx/dmxdpms.c
@@ -177,7 +177,7 @@ void dmxDPMSWakeup(void)
if (screenIsSaved == SCREEN_SAVER_ON)
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/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 478542a13..f2110b534 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 323ae606a..f8d012630 100644
--- a/hw/dmx/dmxpixmap.c
+++ b/hw/dmx/dmxpixmap.c
@@ -49,8 +49,7 @@
/** 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,7 +172,7 @@ Bool dmxDestroyPixmap(PixmapPtr pPixmap)
dmxSync(dmxScreen, FALSE);
}
}
- dixFreePrivates(*DEVPRIV_PTR(pPixmap));
+ dixFreePrivates(pPixmap->devPrivates);
xfree(pPixmap);
#if 0
diff --git a/hw/dmx/dmxpixmap.h b/hw/dmx/dmxpixmap.h
index 4ecd10fd8..3cfd99e6d 100644
--- a/hw/dmx/dmxpixmap.h
+++ b/hw/dmx/dmxpixmap.h
@@ -57,10 +57,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 8ae448a5e..9b15bb38c 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 b66f2a3bb..fa6b9a279 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 f976c7954..1a984331e 100644
--- a/hw/dmx/dmxwindow.h
+++ b/hw/dmx/dmxwindow.h
@@ -107,11 +107,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