Redirected XV (proposed API change)

Keith Packard keithp at keithp.com
Thu Feb 23 11:28:58 PST 2006


On Thu, 2006-02-23 at 02:42 -0800, Aaron Plattner wrote:

> The ABI's already broken due to David Reveman's glyph private changes
> (http://webcvs.freedesktop.org/xorg/xserver/xorg/render/glyphstr.h?r1=1.7&r2=1.8)

This change should be conditional, and disabled by default.

Here's a patch which does that.

 configure.ac        |    7 +++++++
 render/glyph.c      |   41 +++++++++++++++++++++++++++--------------
 render/glyphstr.h   |    4 ++++
 render/miglyph.c    |    2 ++
 render/mipict.c     |    2 ++
 render/mipict.h     |    2 ++
 render/picture.c    |    4 ++++
 render/picturestr.h |   11 ++++++-----
 8 files changed, 54 insertions(+), 19 deletions(-)

31884224b280c16fd5d63fbaa133aae011ac12f4
diff --git a/configure.ac b/configure.ac
index 6763d55..aa96c4d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -408,6 +408,7 @@ AC_ARG_ENABLE(xegl,           AS_HELP_ST
 AC_ARG_ENABLE(kdrive,         AS_HELP_STRING([--enable-kdrive], [Build
kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
 AC_ARG_ENABLE(xephyr,         AS_HELP_STRING([--enable-xephyr], [Build
the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval],
[XEPHYR=auto])
 AC_ARG_ENABLE(xsdl,           AS_HELP_STRING([--enable-xsdl], [Build
the kdrive Xsdl server (default: auto)]), [XSDL=$enableval],
[XSDL=auto])
+AC_ARG_ENABLE(glyphprivates,  AS_HELP_STRING([--enable-glyphprivates],
[Enable glyph privates. Breaks module ABI (default: no)]), [GLYPHPRIV=
$enableval], [GLYPHPRIV=no])
 
 dnl chown/chmod to be setuid root as part of build
 dnl Replaces InstallXserverSetUID in imake
@@ -792,6 +793,12 @@ AC_DEFINE(XCMISC, 1, [Support XCMisc ext
 AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
 AC_DEFINE(PIXPRIV, 1, [Support pixmap privates])
 
+case "$GLYPHPRIV" in
+yes)
+   AC_DEFINE(GLYPHPRIV, 1, [Support glyph privates. Breaks module ABI])
+   ;;
+esac
+
 DIX_LIB='$(top_builddir)/dix/libdix.la'
 OS_LIB='$(top_builddir)/os/libos.la'
 CWRAP_LIB='$(top_builddir)/os/libcwrapper.la'
diff --git a/render/glyph.c b/render/glyph.c
index fd9bae3..5172718 100644
--- a/render/glyph.c
+++ b/render/glyph.c
@@ -82,6 +82,7 @@ const CARD8	glyphDepths[GlyphFormatNum] 
 
 GlyphHashRec	globalGlyphs[GlyphFormatNum];
 
+#ifdef GLYPHPRIV
 int		globalTotalGlyphPrivateSize = 0;
 
 static int	glyphPrivateCount = 0;
@@ -232,19 +233,6 @@ ReallocGlobalGlyphPrivate (GlyphPtr glyp
 }
 
 Bool
-GlyphInit (ScreenPtr pScreen)
-{
-    PictureScreenPtr ps = GetPictureScreen (pScreen);
-    
-    ps->totalGlyphPrivateSize = 0;
-    ps->glyphPrivateSizes = 0;
-    ps->glyphPrivateLen = 0;
-    ps->glyphPrivateOffset = -1;
-    
-    return TRUE;
-}
-
-Bool
 GlyphFinishInit (ScreenPtr pScreen)
 {
     PictureScreenPtr ps = GetPictureScreen (pScreen);
@@ -357,6 +345,23 @@ GlyphUninit (ScreenPtr pScreen)
 	xfree (ps->glyphPrivateSizes);
 }
 
+#endif /* GLYPHPRIV */
+
+Bool
+GlyphInit (ScreenPtr pScreen)
+{
+#ifdef GLYPHPRIV
+    PictureScreenPtr ps = GetPictureScreen (pScreen);
+    
+    ps->totalGlyphPrivateSize = 0;
+    ps->glyphPrivateSizes = 0;
+    ps->glyphPrivateLen = 0;
+    ps->glyphPrivateOffset = -1;
+#endif
+    
+    return TRUE;
+}
+
 GlyphHashSetPtr
 FindGlyphHashSet (CARD32 filled)
 {
@@ -533,6 +538,7 @@ FreeGlyph (GlyphPtr glyph, int format)
 	    globalGlyphs[format].tableEntries--;
 	}
 
+#ifdef GLYPHPRIV
 	for (i = 0; i < screenInfo.numScreens; i++)
 	{
 	    ps = GetPictureScreenIfSet (screenInfo.screens[i]);
@@ -542,6 +548,7 @@ FreeGlyph (GlyphPtr glyph, int format)
 	
 	if (glyph->devPrivates)
 	    xfree (glyph->devPrivates);
+#endif
 	xfree (glyph);
     }
 }
@@ -558,6 +565,7 @@ AddGlyph (GlyphSetPtr glyphSet, GlyphPtr
     gr = FindGlyphRef (&globalGlyphs[glyphSet->fdepth], hash, TRUE,
glyph);
     if (gr->glyph && gr->glyph != DeletedGlyph)
     {
+#ifdef GLYPHPRIV
 	PictureScreenPtr ps;
 	int              i;
 	
@@ -569,6 +577,7 @@ AddGlyph (GlyphSetPtr glyphSet, GlyphPtr
 	}
 	if (glyph->devPrivates)
 	    xfree (glyph->devPrivates);
+#endif
 	xfree (glyph);
 	glyph = gr->glyph;
     }
@@ -623,10 +632,12 @@ FindGlyph (GlyphSetPtr glyphSet, Glyph i
 GlyphPtr
 AllocateGlyph (xGlyphInfo *gi, int fdepth)
 {
-    PictureScreenPtr ps;
     int		     size;
     GlyphPtr	     glyph;
+#ifdef GLYPHPRIV
+    PictureScreenPtr ps;
     int		     i;
+#endif
 
     size = gi->height * PixmapBytePad (gi->width, glyphDepths[fdepth]);
     glyph = (GlyphPtr) xalloc (size + sizeof (GlyphRec));
@@ -636,6 +647,7 @@ AllocateGlyph (xGlyphInfo *gi, int fdept
     glyph->size = size + sizeof (xGlyphInfo);
     glyph->info = *gi;
 
+#ifdef GLYPHPRIV
     if (globalTotalGlyphPrivateSize)
     {
 	glyph->devPrivates = xalloc (globalTotalGlyphPrivateSize);
@@ -667,6 +679,7 @@ AllocateGlyph (xGlyphInfo *gi, int fdept
 	    }
 	}
     }
+#endif
     
     return glyph;
 }
diff --git a/render/glyphstr.h b/render/glyphstr.h
index 5f38bc9..597e988 100644
--- a/render/glyphstr.h
+++ b/render/glyphstr.h
@@ -41,7 +41,9 @@
 
 typedef struct _Glyph {
     CARD32	refcnt;
+#ifdef GLYPHPRIV
     DevUnion	*devPrivates;
+#endif
     CARD32	size;	/* info + bitmap */
     xGlyphInfo	info;
     /* bits follow */
@@ -97,6 +99,7 @@ extern GlyphHashRec	globalGlyphs[GlyphFo
 GlyphHashSetPtr
 FindGlyphHashSet (CARD32 filled);
 
+#ifdef GLYPHPRIV
 int
 AllocateGlyphSetPrivateIndex (void);
 
@@ -116,6 +119,7 @@ Bool
 AllocateGlyphPrivate (ScreenPtr pScreen,
 		      int	index2,
 		      unsigned	amount);
+#endif /* GLYPHPRIV */
 
 Bool
 GlyphInit (ScreenPtr pScreen);
diff --git a/render/miglyph.c b/render/miglyph.c
index 2a22144..539b8ef 100644
--- a/render/miglyph.c
+++ b/render/miglyph.c
@@ -35,6 +35,7 @@
 #include "picturestr.h"
 #include "mipict.h"
 
+#ifdef GLYPHPRIV
 Bool
 miRealizeGlyph (ScreenPtr pScreen,
 		GlyphPtr  glyph)
@@ -47,6 +48,7 @@ miUnrealizeGlyph (ScreenPtr pScreen,
 		  GlyphPtr  glyph)
 {
 }
+#endif
 
 _X_EXPORT void
 miGlyphExtents (int		nlist,
diff --git a/render/mipict.c b/render/mipict.c
index bbe8478..16f2cb9 100644
--- a/render/mipict.c
+++ b/render/mipict.c
@@ -629,8 +629,10 @@ miPictureInit (ScreenPtr pScreen, PictFo
     ps->UpdateIndexed = miUpdateIndexed;
     ps->ChangePictureTransform = miChangePictureTransform;
     ps->ChangePictureFilter = miChangePictureFilter;
+#ifdef GLYPHPRIV
     ps->RealizeGlyph = miRealizeGlyph;
     ps->UnrealizeGlyph = miUnrealizeGlyph;
+#endif
 
     /* MI rendering routines */
     ps->Composite	= 0;			/* requires DDX support */
diff --git a/render/mipict.h b/render/mipict.h
index 0d76aaf..16e7f9f 100644
--- a/render/mipict.h
+++ b/render/mipict.h
@@ -106,6 +106,7 @@ miComputeCompositeRegion (RegionPtr	pReg
 Bool
 miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
 
+#ifdef GLYPHPRIV
 Bool
 miRealizeGlyph (ScreenPtr pScreen,
 		GlyphPtr  glyph);
@@ -113,6 +114,7 @@ miRealizeGlyph (ScreenPtr pScreen,
 void
 miUnrealizeGlyph (ScreenPtr pScreen,
 		  GlyphPtr  glyph);
+#endif
 
 void
 miGlyphExtents (int		nlist,
diff --git a/render/picture.c b/render/picture.c
index 629f20b..bed8282 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -136,7 +136,9 @@ PictureCloseScreen (int index, ScreenPtr
     for (n = 0; n < ps->nformats; n++)
 	if (ps->formats[n].type == PictTypeIndexed)
 	    (*ps->CloseIndexed) (pScreen, &ps->formats[n]);
+#ifdef GLYPHPRIV
     GlyphUninit (pScreen);
+#endif
     SetPictureScreen(pScreen, 0);
     if (ps->PicturePrivateSizes)
 	xfree (ps->PicturePrivateSizes);
@@ -494,8 +496,10 @@ PictureFinishInit (void)
 
     for (s = 0; s < screenInfo.numScreens; s++)
     {
+#ifdef GLYPHPRIV
 	if (!GlyphFinishInit (screenInfo.screens[s]))
 	    return FALSE;
+#endif
 	if (!PictureInitIndexedFormats (screenInfo.screens[s]))
 	    return FALSE;
 	(void) AnimCurInit (screenInfo.screens[s]);
diff --git a/render/picturestr.h b/render/picturestr.h
index b9ee6f1..1cfe68c 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -305,12 +305,15 @@ typedef void	(*AddTrianglesProcPtr)	    
 					     INT16	    yOff,
 					     int	    ntri,
 					     xTriangle	    *tris);
-
+#ifdef GLYPHPRIV
 typedef Bool	(*RealizeGlyphProcPtr)	    (ScreenPtr	    pScreen,
 					     GlyphPtr	    glyph);
 
 typedef void	(*UnrealizeGlyphProcPtr)    (ScreenPtr	    pScreen,
 					     GlyphPtr	    glyph);
+#define GetGlyphPrivatesForScreen(glyph, s)				\
+    ((glyph)->devPrivates + (GetPictureScreen (s))->glyphPrivateOffset)
+#endif
 
 typedef struct _PictureScreen {
     int				totalPictureSize;
@@ -364,6 +367,7 @@ typedef struct _PictureScreen {
 
     AddTrapsProcPtr		AddTraps;
 
+#ifdef GLYPHPRIV
     int			  	totalGlyphPrivateSize;
     unsigned int	  	*glyphPrivateSizes;
     int			  	glyphPrivateLen;
@@ -371,7 +375,7 @@ typedef struct _PictureScreen {
 
     RealizeGlyphProcPtr   	RealizeGlyph;
     UnrealizeGlyphProcPtr 	UnrealizeGlyph;
-
+#endif
 } PictureScreenRec, *PictureScreenPtr;
 
 extern int		PictureScreenPrivateIndex;
@@ -386,9 +390,6 @@ extern RESTYPE		GlyphSetType;
 #define GetPictureWindow(w) ((PicturePtr)
((w)->devPrivates[PictureWindowPrivateIndex].ptr))
 #define SetPictureWindow(w,p)
((w)->devPrivates[PictureWindowPrivateIndex].ptr = (pointer) (p))
 
-#define GetGlyphPrivatesForScreen(glyph, s)				\
-    ((glyph)->devPrivates + (GetPictureScreen (s))->glyphPrivateOffset)
-
 #define VERIFY_PICTURE(pPicture, pid, client, mode, err) {\
     pPicture = SecurityLookupIDByType(client, pid, PictureType, mode);\
     if (!pPicture) { \
-- 
1.2.0.g1f82



-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg/attachments/20060223/83a24b72/attachment.pgp>


More information about the xorg mailing list