[PATCH] configure: dix: support a variable number of screen structures

Tiago Vignatti tiago.vignatti at nokia.com
Wed Mar 10 10:13:49 PST 2010


Some environments don't require a big and fixed number (MAXSCREENS) of the
screen structures (ScreenInfo and bunch of others). We could improve the
memory usage by setting a smaller number when the number of physical screens
is known.

This patch implements this feature, adjusting MAXSCREENS in autoconf time.

I can see two or three pages of RSS saved in my machine when
-with-maxscreens=1.

Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
I'm not sure if I should declare it inside dix-config.h though. Is it okay to
set there?

Also, I'm afraid I might be breaking other DDXs. Jeremy, Jon Turney and
others, can you please check this? Thanks.


 configure.ac            |    5 +++++
 include/cursor.h        |    2 ++
 include/dix-config.h.in |    3 +++
 include/misc.h          |    3 ---
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index b9c7574..c2095f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -585,6 +585,11 @@ AC_ARG_ENABLE(visibility,     AC_HELP_STRING([--enable-visibility], [Enable symb
 AC_ARG_ENABLE(pc98,     	AC_HELP_STRING([--enable-pc98], [Enable PC98 support in Xorg (default: auto)]),
 				[SUPPORT_PC98=$enableval],
 				[SUPPORT_PC98=auto])
+AC_ARG_WITH(maxscreens,  AS_HELP_STRING([--with-maxscreens=PATH], [Set the max
+number of screens supported by the server (default: 16)]),
+				[ MAXSCREEN="$withval" ],
+				[ MAXSCREEN="16" ])
+AC_DEFINE_UNQUOTED(MAXSCREENS, $MAXSCREEN, [Max supported number of screens])
 
 dnl GLX build options
 AC_ARG_WITH(dri-driver-path,  AS_HELP_STRING([--with-dri-driver-path=PATH], [Path to DRI drivers (default: ${libdir}/dri)]),
diff --git a/include/cursor.h b/include/cursor.h
index acc95c3..97420e9 100644
--- a/include/cursor.h
+++ b/include/cursor.h
@@ -45,6 +45,8 @@ SOFTWARE.
 
 ******************************************************************/
 
+#include <dix-config.h> /* MAXSCREENS */
+
 #ifndef CURSOR_H
 #define CURSOR_H 
 
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 058c8fd..2c8bae4 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -446,4 +446,7 @@
 #include "dix-config-apple-verbatim.h"
 #endif
 
+/* Max supported number of screens */
+#undef MAXSCREENS
+
 #endif /* _DIX_CONFIG_H_ */
diff --git a/include/misc.h b/include/misc.h
index 62d813e..6d83714 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -80,9 +80,6 @@ OF THIS SOFTWARE.
 
 #include <stddef.h>
 
-#ifndef MAXSCREENS
-#define MAXSCREENS	16
-#endif
 #define MAXCLIENTS	256
 #define MAXEXTENSIONS   128
 #define MAXFORMATS	8
-- 
1.6.3.3


--=-lS1uFH+7NRuiQFOT5Afm--



More information about the xorg-devel mailing list