[PATCH xserver 7/7] xfree86: Reorganize the reserved ScrnInfoRec slots

Adam Jackson ajax at redhat.com
Tue Feb 14 20:30:56 UTC 2017


First, move them to the end of the struct, for marginally better cache
locality for the struct members that actually have meaning; move the
existing slots at the end of the struct up near some others with similar
meanings. Second, only keep four slots each of integer, data pointer,
and function pointer; we've rarely used this escape hatch so this is
still plenty.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 hw/xfree86/common/xf86str.h | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index 7f126b0..01d12ab 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -410,10 +410,9 @@ typedef struct _confdrirec {
     confDRIBufferRec *bufs;
 } confDRIRec, *confDRIPtr;
 
-/* These values should be adjusted when new fields are added to ScrnInfoRec */
-#define NUM_RESERVED_INTS		16
-#define NUM_RESERVED_POINTERS		14
-#define NUM_RESERVED_FUNCS		10
+#define NUM_RESERVED_INTS		4
+#define NUM_RESERVED_POINTERS		4
+#define NUM_RESERVED_FUNCS		4
 
 /* let clients know they can use this */
 #define XF86_SCRN_HAS_PREFER_CLONE 1
@@ -665,18 +664,12 @@ typedef struct _ScrnInfoRec {
     /* initial rightof support disable */
     int                 preferClone;
 
-    /*
-     * These can be used when the minor ABI version is incremented.
-     * The NUM_* parameters must be reduced appropriately to keep the
-     * structure size and alignment unchanged.
-     */
-    int reservedInt[NUM_RESERVED_INTS];
+    Bool is_gpu;
+    uint32_t capabilities;
 
     int *entityInstanceList;
     struct pci_device *vgaDev;
 
-    void *reservedPtr[NUM_RESERVED_POINTERS];
-
     /*
      * Driver entry points.
      *
@@ -702,15 +695,9 @@ typedef struct _ScrnInfoRec {
     xorgDriverFuncProc *DriverFunc;
     xf86ModeSetProc *ModeSet;
 
-    /*
-     * This can be used when the minor ABI version is incremented.
-     * The NUM_* parameter must be reduced appropriately to keep the
-     * structure size and alignment unchanged.
-     */
+    int reservedInt[NUM_RESERVED_INTS];
+    void *reservedPtr[NUM_RESERVED_POINTERS];
     funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
-
-    Bool is_gpu;
-    uint32_t capabilities;
 } ScrnInfoRec;
 
 typedef struct {
-- 
2.9.3



More information about the xorg-devel mailing list