[PATCH]: Fix sunleo driver build.

David Miller davem at davemloft.net
Thu Dec 27 16:08:59 PST 2007


More fallout from the recent devprivates rework.

Please apply to the xf86-video-sunleo GIT tree, thanks!

[SUNLEO]: Fix build after devprivates rework.

The screen private isn't needed, neither is the window
private, so remove those.

Convert LEO's GC private over to the new devprivate APIs.

Signed-off-by: David S. Miller <davem at davemloft.net>

diff --git a/src/leo.h b/src/leo.h
index b3454a0..94dc103 100644
--- a/src/leo.h
+++ b/src/leo.h
@@ -84,23 +84,12 @@ typedef struct {
 	OptionInfoPtr	Options;
 } LeoRec, *LeoPtr;
 
-extern int  LeoScreenPrivateIndex;
-extern int  LeoGCPrivateIndex;
-extern int  LeoWindowPrivateIndex;
+extern DevPrivateKey LeoGCPrivateKey;
 
 #define GET_LEO_FROM_SCRN(p)    ((LeoPtr)((p)->driverPrivate))
 
-#define LeoGetScreenPrivate(s)						\
-((LeoPtr) (s)->devPrivates[LeoScreenPrivateIndex].ptr)
-
 #define LeoGetGCPrivate(g)						\
-((LeoPrivGCPtr) (g)->devPrivates [LeoGCPrivateIndex].ptr)
-
-#define LeoGetWindowPrivate(w)						\
-((LeoStipplePtr) (w)->devPrivates[LeoWindowPrivateIndex].ptr)
-                            
-#define LeoSetWindowPrivate(w,p) 					\
-((w)->devPrivates[LeoWindowPrivateIndex].ptr = (pointer) p)
+	((LeoPrivGCPtr) dixLookupPrivate(&(g)->devPrivates, LeoGCPrivateKey))
 
 extern int leoRopTable[];
 
diff --git a/src/leo_accel.c b/src/leo_accel.c
index 149c6c8..20f58c0 100644
--- a/src/leo_accel.c
+++ b/src/leo_accel.c
@@ -42,9 +42,7 @@
 
 #include	"leo.h"
 
-int	LeoScreenPrivateIndex;
-int	LeoGCPrivateIndex;
-int	LeoWindowPrivateIndex;
+DevPrivateKey LeoGCPrivateKey;
 int	LeoGeneration;
 
 int	leoRopTable[16] = {
@@ -68,7 +66,8 @@ int	leoRopTable[16] = {
 
 void LeoVtChange (ScreenPtr pScreen, int enter)
 {
-	LeoPtr pLeo = LeoGetScreenPrivate (pScreen); 
+	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+	LeoPtr pLeo = GET_LEO_FROM_SCRN (pScrn); 
 	LeoCommand0 *lc0 = pLeo->lc0;
 	LeoDraw *ld0 = pLeo->ld0;
 
@@ -100,19 +99,12 @@ Bool LeoAccelInit (ScreenPtr pScreen, LeoPtr pLeo)
 	LeoDraw *ld0;
 
 	if (serverGeneration != LeoGeneration) {
-		LeoScreenPrivateIndex = AllocateScreenPrivateIndex ();
-		if (LeoScreenPrivateIndex == -1) return FALSE;
-		LeoGCPrivateIndex = AllocateGCPrivateIndex ();
-		LeoWindowPrivateIndex = AllocateWindowPrivateIndex ();
+		if (!dixRequestPrivate(LeoGCPrivateKey,
+				       sizeof(LeoPrivGCRec)))
+			return FALSE;
 		LeoGeneration = serverGeneration;
 	}
 	
-	/* Allocate private structures holding pointer to both videoRAM and control registers.
-	   We do not have to map these by ourselves, because the XServer did it for us; we
-	   only copy the pointers to out structures. */
-	if (!AllocateGCPrivate(pScreen, LeoGCPrivateIndex, sizeof(LeoPrivGCRec))) return FALSE;
-	if (!AllocateWindowPrivate(pScreen, LeoWindowPrivateIndex, 0)) return FALSE;
-	pScreen->devPrivates[LeoScreenPrivateIndex].ptr = pLeo;
 	pLeo->lc0 = lc0 = (LeoCommand0 *) ((char *)pLeo->fb + LEO_LC0_VOFF);
 	pLeo->ld0 = ld0 = (LeoDraw *) ((char *)pLeo->fb + LEO_LD0_VOFF);
 
diff --git a/src/leo_checks.c b/src/leo_checks.c
index 27e80a8..e2565b2 100644
--- a/src/leo_checks.c
+++ b/src/leo_checks.c
@@ -129,7 +129,9 @@ int
 LeoCheckFill (GCPtr pGC, DrawablePtr pDrawable)
 {
 	LeoPrivGCPtr gcPriv = LeoGetGCPrivate (pGC);
-	LeoPtr pLeo = LeoGetScreenPrivate(pDrawable->pScreen);
+	ScreenPtr pScreen = pDrawable->pScreen;
+	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+	LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn);
 	LeoStipplePtr stipple;
 	unsigned int alu;
 	int xrot, yrot;
diff --git a/src/leo_frect.c b/src/leo_frect.c
index e3a65fb..dc5a17a 100644
--- a/src/leo_frect.c
+++ b/src/leo_frect.c
@@ -39,7 +39,9 @@
 void
 LeoPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *prectInit)
 {
-	LeoPtr pLeo = LeoGetScreenPrivate (pDrawable->pScreen);
+	ScreenPtr pScreen = pDrawable->pScreen;
+	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+	LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn);
 	LeoCommand0 	*lc0 = pLeo->lc0;
 	LeoDraw		*ld0 = pLeo->ld0;
 	xRectangle	*prect;
@@ -166,7 +168,9 @@ LeoPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *pre
 void
 LeoPolyFillRect1Rect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *prectInit)
 {
-	LeoPtr pLeo = LeoGetScreenPrivate (pDrawable->pScreen);
+	ScreenPtr pScreen = pDrawable->pScreen;
+	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+	LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn);
 	LeoCommand0 	*lc0 = pLeo->lc0;
 	LeoDraw		*ld0 = pLeo->ld0;
 	xRectangle	*prect;
diff --git a/src/leo_frectsp.c b/src/leo_frectsp.c
index c860a26..f0e55c4 100644
--- a/src/leo_frectsp.c
+++ b/src/leo_frectsp.c
@@ -39,7 +39,9 @@
 void
 LeoPolyFillStippledRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *prectInit)
 {
-	LeoPtr pLeo = LeoGetScreenPrivate (pDrawable->pScreen);
+	ScreenPtr pScreen = pDrawable->pScreen;
+	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+	LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn);
 	LeoPrivGCPtr	gcPriv = LeoGetGCPrivate (pGC);
 	LeoCommand0 	*lc0 = pLeo->lc0;
 	LeoDraw		*ld0 = pLeo->ld0;
diff --git a/src/leo_fspans.c b/src/leo_fspans.c
index ad375d9..ccc9132 100644
--- a/src/leo_fspans.c
+++ b/src/leo_fspans.c
@@ -42,7 +42,9 @@ LeoFillSpansSolid (DrawablePtr pDrawable, GCPtr pGC,
 		   int n, DDXPointPtr ppt,
 		   int *pwidth, int fSorted)
 {
-	LeoPtr pLeo = LeoGetScreenPrivate (pGC->pScreen);
+	ScreenPtr pScreen = pDrawable->pScreen;
+	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+	LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn);
 	LeoCommand0 *lc0 = pLeo->lc0;
 	LeoDraw *ld0 = pLeo->ld0;
 	int numRects, *pwidthFree;
diff --git a/src/leo_fspanssp.c b/src/leo_fspanssp.c
index 26d27e4..4124337 100644
--- a/src/leo_fspanssp.c
+++ b/src/leo_fspanssp.c
@@ -43,7 +43,9 @@ LeoFillSpansStippled (DrawablePtr pDrawable, GCPtr pGC,
 		      int *pwidth, int fSorted)
 {
 	LeoPrivGCPtr gcPriv = LeoGetGCPrivate (pGC);
-	LeoPtr pLeo = LeoGetScreenPrivate (pGC->pScreen);
+	ScreenPtr pScreen = pDrawable->pScreen;
+	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+	LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn);
 	LeoCommand0 *lc0 = pLeo->lc0;
 	LeoDraw *ld0 = pLeo->ld0;
 	int numRects, *pwidthFree;
diff --git a/src/leo_glyph.c b/src/leo_glyph.c
index 9399325..21a42d0 100644
--- a/src/leo_glyph.c
+++ b/src/leo_glyph.c
@@ -42,7 +42,9 @@ void
 LeoPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y,
 		     unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase)
 {
-	LeoPtr pLeo = LeoGetScreenPrivate (pGC->pScreen);
+	ScreenPtr pScreen = pDrawable->pScreen;
+	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+	LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn);
 	LeoCommand0 *lc0 = pLeo->lc0;
 	LeoDraw *ld0 = pLeo->ld0;
 	RegionPtr clip;
@@ -167,7 +169,9 @@ void
 LeoTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y,
 		   unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase)
 {
-	LeoPtr pLeo = LeoGetScreenPrivate (pGC->pScreen);
+	ScreenPtr pScreen = pDrawable->pScreen;
+	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+	LeoPtr pLeo = GET_LEO_FROM_SCRN(pScrn);
 	LeoCommand0 *lc0 = pLeo->lc0;
 	LeoDraw *ld0 = pLeo->ld0;
 	RegionPtr clip;



More information about the xorg mailing list