summaryrefslogtreecommitdiff
path: root/fb
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-04-26 17:22:21 -0700
committerKeith Packard <keithp@keithp.com>2010-06-05 19:23:03 -0700
commitfaeebead7bfcc78535757ca7acc1faf7554c03b7 (patch)
tree1a8f13a3b1ae968011efb9679bc3ed79a29020be /fb
parentc865a24401f06bcf1347d8b41f736a066ab25693 (diff)
Change the devPrivates API to require dixRegisterPrivateKey
This patch only changes the API, not the implementation of the devPrivates infrastructure. This will permit a new devPrivates implementation to be layed into the server without requiring simultaneous changes in every devPrivates user. Signed-off-by: Keith Packard <keithp@keithp.com> Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Diffstat (limited to 'fb')
-rw-r--r--fb/fb.h19
-rw-r--r--fb/fballpriv.c44
-rw-r--r--fb/fbcmap.c4
-rw-r--r--fb/fboverlay.c8
-rw-r--r--fb/fbpixmap.c4
-rw-r--r--fb/fbscreen.c3
-rw-r--r--fb/wfbrename.h8
7 files changed, 40 insertions, 50 deletions
diff --git a/fb/fb.h b/fb/fb.h
index 7ab4adf69..4fde42647 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -603,8 +603,12 @@ extern _X_EXPORT void fbSetBits (FbStip *bits, int stride, FbStip data);
} \
}
-extern _X_EXPORT DevPrivateKey fbGetGCPrivateKey(void);
-extern _X_EXPORT DevPrivateKey fbGetWinPrivateKey(void);
+extern _X_EXPORT DevPrivateKey
+fbGetGCPrivateKey (void);
+
+extern _X_EXPORT DevPrivateKey
+fbGetWinPrivateKey (void);
+
extern _X_EXPORT const GCOps fbGCOps;
extern _X_EXPORT const GCFuncs fbGCFuncs;
@@ -639,7 +643,8 @@ typedef void (*FinishWrapProcPtr)(DrawablePtr pDraw);
#ifdef FB_SCREEN_PRIVATE
-extern _X_EXPORT DevPrivateKey fbGetScreenPrivateKey(void);
+extern _X_EXPORT DevPrivateKey
+fbGetScreenPrivateKey(void);
/* private field of a screen */
typedef struct {
@@ -652,7 +657,7 @@ typedef struct {
} FbScreenPrivRec, *FbScreenPrivPtr;
#define fbGetScreenPrivate(pScreen) ((FbScreenPrivPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, fbGetScreenPrivateKey()))
+ dixLookupPrivate(&(pScreen)->devPrivates, fbGetScreenPrivateKey()))
#endif
/* private field of GC */
@@ -667,7 +672,7 @@ typedef struct {
} FbGCPrivRec, *FbGCPrivPtr;
#define fbGetGCPrivate(pGC) ((FbGCPrivPtr)\
- dixLookupPrivate(&(pGC)->devPrivates, fbGetGCPrivateKey()))
+ dixLookupPrivate(&(pGC)->devPrivates, fbGetGCPrivateKey()))
#define fbGetCompositeClip(pGC) ((pGC)->pCompositeClip)
#define fbGetExpose(pGC) ((pGC)->fExpose)
@@ -676,7 +681,7 @@ typedef struct {
#define fbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate)
#define fbGetWindowPixmap(pWin) ((PixmapPtr)\
- dixLookupPrivate(&((WindowPtr)(pWin))->devPrivates, fbGetWinPrivateKey()))
+ dixLookupPrivate(&((WindowPtr)(pWin))->devPrivates, fbGetWinPrivateKey()))
#ifdef ROOTLESS
#define __fbPixDrawableX(pPix) ((pPix)->drawable.x)
@@ -830,8 +835,6 @@ fb24_32ModifyPixmapHeader (PixmapPtr pPixmap,
/*
* fballpriv.c
*/
-extern _X_EXPORT DevPrivateKey fbGetWinPrivateKey(void);
-
extern _X_EXPORT Bool
fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCIndex);
diff --git a/fb/fballpriv.c b/fb/fballpriv.c
index 569391b93..efeb26880 100644
--- a/fb/fballpriv.c
+++ b/fb/fballpriv.c
@@ -27,46 +27,34 @@
#include "fb.h"
#ifdef FB_SCREEN_PRIVATE
-static int fbScreenPrivateKeyIndex;
-static DevPrivateKey fbScreenPrivateKey = &fbScreenPrivateKeyIndex;
-DevPrivateKey fbGetScreenPrivateKey(void)
-{
- return fbScreenPrivateKey;
-}
+static DevPrivateKeyRec fbScreenPrivateKeyRec;
+DevPrivateKey
+fbGetScreenPrivateKey(void) { return &fbScreenPrivateKeyRec; }
#endif
-static int fbGCPrivateKeyIndex;
-static DevPrivateKey fbGCPrivateKey = &fbGCPrivateKeyIndex;
-DevPrivateKey fbGetGCPrivateKey(void)
-{
- return fbGCPrivateKey;
-}
+static DevPrivateKeyRec fbGCPrivateKeyRec;
+DevPrivateKey
+fbGetGCPrivateKey (void) { return &fbGCPrivateKeyRec; }
-static int fbWinPrivateKeyIndex;
-static DevPrivateKey fbWinPrivateKey = &fbWinPrivateKeyIndex;
-DevPrivateKey fbGetWinPrivateKey(void)
-{
- return fbWinPrivateKey;
-}
+static DevPrivateKeyRec fbWinPrivateKeyRec;
+DevPrivateKey
+fbGetWinPrivateKey (void) { return &fbWinPrivateKeyRec; }
Bool
fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey)
{
if (pGCKey)
- *pGCKey = fbGCPrivateKey;
+ *pGCKey = &fbGCPrivateKeyRec;
- if (!dixRequestPrivate(fbGCPrivateKey, sizeof(FbGCPrivRec)))
+ if (!dixRegisterPrivateKey(&fbGCPrivateKeyRec, PRIVATE_GC, sizeof(FbGCPrivRec)))
return FALSE;
#ifdef FB_SCREEN_PRIVATE
- {
- FbScreenPrivPtr pScreenPriv;
-
- pScreenPriv = (FbScreenPrivPtr) malloc(sizeof (FbScreenPrivRec));
- if (!pScreenPriv)
- return FALSE;
- dixSetPrivate(&pScreen->devPrivates, fbScreenPrivateKey, pScreenPriv);
- }
+ if (!dixRegisterPrivateKey(&fbScreenPrivateKeyRec, PRIVATE_SCREEN, sizeof (FbScreenPrivRec)))
+ return FALSE;
#endif
+ if (!dixRegisterPrivateKey(&fbWinPrivateKeyRec, PRIVATE_WINDOW, 0))
+ return FALSE;
+
return TRUE;
}
diff --git a/fb/fbcmap.c b/fb/fbcmap.c
index ce6fcd53d..02b72683d 100644
--- a/fb/fbcmap.c
+++ b/fb/fbcmap.c
@@ -36,8 +36,8 @@
#error "You should be compiling fbcmap_mi.c instead of fbcmap.c!"
#endif
-static int cmapScrPrivateKeyIndex;
-static DevPrivateKey cmapScrPrivateKey = &cmapScrPrivateKeyIndex;
+static DevPrivateKeyRec cmapScrPrivateKeyRec;
+#define cmapScrPrivateKey (&cmapScrPrivateKeyRec)
#define GetInstalledColormap(s) ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, cmapScrPrivateKey))
#define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c))
diff --git a/fb/fboverlay.c b/fb/fboverlay.c
index 392e27f39..cda7fc793 100644
--- a/fb/fboverlay.c
+++ b/fb/fboverlay.c
@@ -33,8 +33,8 @@
#include "fboverlay.h"
#include "shmint.h"
-static int fbOverlayScreenPrivateKeyIndex;
-static DevPrivateKey fbOverlayScreenPrivateKey = &fbOverlayScreenPrivateKeyIndex;
+static DevPrivateKeyRec fbOverlayScreenPrivateKeyRec;
+#define fbOverlayScreenPrivateKey (&fbOverlayScreenPrivateKeyRec)
DevPrivateKey fbOverlayGetScreenPrivateKey(void)
{
@@ -348,6 +348,9 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
VisualID defaultVisual;
FbOverlayScrPrivPtr pScrPriv;
+ if (!dixRegisterPrivateKey(&fbOverlayScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+
pScrPriv = malloc(sizeof (FbOverlayScrPrivRec));
if (!pScrPriv)
return FALSE;
@@ -416,7 +419,6 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
pScrPriv->layer[1].u.init.pbits = pbits2;
pScrPriv->layer[1].u.init.width = width2;
pScrPriv->layer[1].u.init.depth = depth2;
-
dixSetPrivate(&pScreen->devPrivates, fbOverlayScreenPrivateKey, pScrPriv);
/* overwrite miCloseScreen with our own */
diff --git a/fb/fbpixmap.c b/fb/fbpixmap.c
index 625ce715b..15eedcdb9 100644
--- a/fb/fbpixmap.c
+++ b/fb/fbpixmap.c
@@ -67,6 +67,7 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp,
pPixmap->devKind = paddedWidth;
pPixmap->refcnt = 1;
pPixmap->devPrivate.ptr = (pointer) ((char *)pPixmap + base + adjust);
+
#ifdef FB_DEBUG
pPixmap->devPrivate.ptr = (void *) ((char *) pPixmap->devPrivate.ptr + paddedWidth);
fbInitializeDrawable (&pPixmap->drawable);
@@ -100,8 +101,7 @@ fbDestroyPixmap (PixmapPtr pPixmap)
{
if(--pPixmap->refcnt)
return TRUE;
- dixFreePrivates(pPixmap->devPrivates);
- free(pPixmap);
+ FreePixmap(pPixmap);
return TRUE;
}
diff --git a/fb/fbscreen.c b/fb/fbscreen.c
index 9b789b0a8..f4311aedf 100644
--- a/fb/fbscreen.c
+++ b/fb/fbscreen.c
@@ -37,9 +37,6 @@ fbCloseScreen (int index, ScreenPtr pScreen)
free(depths);
free(pScreen->visuals);
free(pScreen->devPrivate);
-#ifdef FB_SCREEN_PRIVATE
- free(dixLookupPrivate(&pScreen->devPrivates, fbGetScreenPrivateKey()));
-#endif
return TRUE;
}
diff --git a/fb/wfbrename.h b/fb/wfbrename.h
index 73ee510b9..433f286e0 100644
--- a/fb/wfbrename.h
+++ b/fb/wfbrename.h
@@ -83,13 +83,14 @@
#define fbFixCoordModePrevious wfbFixCoordModePrevious
#define fbGCFuncs wfbGCFuncs
#define fbGCOps wfbGCOps
-#define fbGCPrivateKey wfbGCPrivateKey
+#define fbGCPrivateKeyRec wfbGCPrivateKeyRec
#define fbGeneration wfbGeneration
#define fbGetGCPrivateKey wfbGetGCPrivateKey
#define fbGetImage wfbGetImage
#define fbGetScreenPrivateKey wfbGetScreenPrivateKey
#define fbGetSpans wfbGetSpans
#define _fbGetWindowPixmap _wfbGetWindowPixmap
+#define fbWinPrivateKeyRec wfbWinPrivateKeyRec
#define fbGetWinPrivateKey wfbGetWinPrivateKey
#define fbGlyph16 wfbGlyph16
#define fbGlyph24 wfbGlyph24
@@ -118,7 +119,6 @@
#define fbOverlayGeneration wfbOverlayGeneration
#define fbOverlayGetScreenPrivateKey wfbOverlayGetScreenPrivateKey
#define fbOverlayPaintKey wfbOverlayPaintKey
-#define fbOverlayScreenPrivateKey wfbOverlayScreenPrivateKey
#define fbOverlaySetupScreen wfbOverlaySetupScreen
#define fbOverlayUpdateLayerRegion wfbOverlayUpdateLayerRegion
#define fbOverlayWindowExposures wfbOverlayWindowExposures
@@ -157,7 +157,7 @@
#define fbResolveColor wfbResolveColor
#define fbRestoreAreas wfbRestoreAreas
#define fbSaveAreas wfbSaveAreas
-#define fbScreenPrivateKey wfbScreenPrivateKey
+#define fbScreenPrivateKeyRec wfbScreenPrivateKeyRec
#define fbSegment wfbSegment
#define fbSelectBres wfbSelectBres
#define fbSetSpans wfbSetSpans
@@ -182,7 +182,7 @@
#define fbUnrealizeFont wfbUnrealizeFont
#define fbValidateGC wfbValidateGC
#define fbWalkCompositeRegion wfbWalkCompositeRegion
-#define fbWinPrivateKey wfbWinPrivateKey
+#define fbWinPrivateKeyRec wfbWinPrivateKeyRec
#define fbZeroLine wfbZeroLine
#define fbZeroSegment wfbZeroSegment
#define free_pixman_pict wfb_free_pixman_pict