[PATCH] dix: Reshuffle ScreenRec to pack holes

Adam Jackson ajax at redhat.com
Wed May 19 11:31:19 PDT 2010


This eliminates the unused 'id' field (what the eff), and reorders the
other data fields to fit packed on both ILP32 and LP64.  ScreenRec
shrinks by 64 bytes on LP64 (less on ILP32), and devPrivate just
barely squeaks into the first cacheline on LP64 as a bonus.

This also marks a flags field for future expansion without needing to
break ABI.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 include/scrnintstr.h |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 3a77e0c..f0bc1a0 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -444,18 +444,22 @@ typedef    void (* DeviceCursorCleanupProcPtr)(
 
 typedef struct _Screen {
     int			myNum;	/* index of this instance in Screens[] */
-    ATOM		id;
+    unsigned int	rgf;	/* array of flags; she's -- HUNGARIAN */
+    unsigned long	whitePixel, blackPixel;
+    unsigned int      	rootVisual;
+    unsigned int	defColormap;
+    unsigned int	totalPixmapSize;
     short		width, height;
     short		mmWidth, mmHeight;
     short		numDepths;
-    unsigned char      	rootDepth;
-    DepthPtr       	allowedDepths;
-    unsigned long      	rootVisual;
-    unsigned long	defColormap;
+    short       	numVisuals;
     short		minInstalledCmaps, maxInstalledCmaps;
-    char                backingStoreSupport, saveUnderSupport;
-    unsigned long	whitePixel, blackPixel;
-    unsigned long	rgf;	/* array of flags; she's -- HUNGARIAN */
+    unsigned char      	rootDepth;
+    unsigned		backingStoreSupport:1;
+    unsigned		saveUnderSupport:1;
+    unsigned		unused_flags:22;
+
+    pointer		devPrivate;
     GCPtr		GCperDepth[MAXFORMATS+1];
 			/* next field is a stipple to use as default in
 			   a GC.  we don't build default tiles of all depths
@@ -465,8 +469,7 @@ typedef struct _Screen {
 			   a standard one.
 			*/
     PixmapPtr		PixmapPerDepth[1];
-    pointer		devPrivate;
-    short       	numVisuals;
+    DepthPtr       	allowedDepths;
     VisualPtr		visuals;
 
     /* Random screen procedures */
@@ -568,8 +571,6 @@ typedef struct _Screen {
 
     PixmapPtr pScratchPixmap;		/* scratch pixmap "pool" */
 
-    unsigned int		totalPixmapSize;
-
     MarkWindowProcPtr		MarkWindow;
     MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
     ChangeSaveUnderProcPtr	ChangeSaveUnder;
-- 
1.7.0.1



More information about the xorg-devel mailing list