[PATCH 31/54] Move DRI1 from external module to built-in

Daniel Stone daniel at fooishbar.org
Mon Jul 9 18:03:15 PDT 2012


Rather than building the tiny amount of code required for XFree86-DRI as
an external module, build it in if it's enabled at configure time.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 configure.ac                       |    7 ++-
 glx/Makefile.am                    |    2 -
 hw/kdrive/ephyr/Makefile.am        |    1 -
 hw/xfree86/Makefile.am             |    9 ++--
 hw/xfree86/common/xf86Config.c     |    3 --
 hw/xfree86/common/xf86Extensions.c |    9 ++++
 hw/xfree86/dri/Makefile.am         |   10 +---
 hw/xfree86/dri/dri.c               |    2 +
 hw/xfree86/dri/dri.h               |    2 +-
 hw/xfree86/dri/drimodule.c         |   92 ------------------------------------
 hw/xfree86/dri2/Makefile.am        |    1 -
 hw/xfree86/loader/Makefile.am      |    2 +-
 hw/xfree86/loader/loadmod.c        |    1 +
 hw/xfree86/sdksyms.sh              |    2 -
 test/Makefile.am                   |    4 +-
 15 files changed, 28 insertions(+), 119 deletions(-)
 delete mode 100644 hw/xfree86/dri/drimodule.c

diff --git a/configure.ac b/configure.ac
index beeb5fd..b225632 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1087,9 +1087,8 @@ AC_SUBST([GLX_SYS_LIBS])
 AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
 if test "x$DRI" = xyes; then
 	AC_DEFINE(XF86DRI, 1, [Build DRI extension])
-	PKG_CHECK_MODULES([DRIPROTO], [$DRIPROTO])
-	PKG_CHECK_MODULES([DRI], $GLPROTO $LIBDRI)
-	AC_SUBST(DRIPROTO_CFLAGS)
+	REQUIRED_MODULES="$REQUIRED_MODULES $DRIPROTO $GLPROTO $LIBDRI"
+	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRIPROTO $GLPROTO $LIBDRI"
 fi
 
 PKG_CHECK_MODULES([DRI2PROTO], $DRI2PROTO,
@@ -1659,7 +1658,7 @@ if test "x$XORG" = xyes; then
 	PKG_CHECK_MODULES([PCIACCESS], $LIBPCIACCESS)
 	SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $LIBPCIACCESS"
 	XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS $LIBDRM_LIBS"
-	XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
+	XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS $LIBDRM_CFLAGS"
 
 	AC_DEFINE(XSERVER_LIBPCIACCESS, 1, [Use libpciaccess for all pci manipulation])
 	AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path])
diff --git a/glx/Makefile.am b/glx/Makefile.am
index ced78b7..591c4ac 100644
--- a/glx/Makefile.am
+++ b/glx/Makefile.am
@@ -7,10 +7,8 @@ noinst_LTLIBRARIES = libglx.la $(GLXDRI_LIBRARY)
 AM_CFLAGS = \
 	@DIX_CFLAGS@ \
 	@GL_CFLAGS@ \
-	@DRI_CFLAGS@ \
 	@XLIB_CFLAGS@ \
 	@LIBDRM_CFLAGS@ \
-	@DRIPROTO_CFLAGS@ \
 	@GLX_DEFINES@ \
 	@GLX_ARCH_DEFINES@
 
diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index 9d9b64e..2e0613a 100644
--- a/hw/kdrive/ephyr/Makefile.am
+++ b/hw/kdrive/ephyr/Makefile.am
@@ -5,7 +5,6 @@ INCLUDES = 			\
 	@KDRIVE_CFLAGS@		\
 	@XEPHYR_INCS@		\
 	@XEPHYR_CFLAGS@		\
-	@DRIPROTO_CFLAGS@	\
 	-I$(top_srcdir)		\
 	-I$(top_srcdir)/exa
 
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index f74691b..0c3801d 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -1,6 +1,7 @@
 
 if DRI
 DRI_SUBDIR = dri
+DRI_LIB = dri/libdri.la
 endif
 
 if DRI2
@@ -26,8 +27,8 @@ INT10_SUBDIR = int10
 endif
 
 SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \
-	  ramdac $(VGAHW_SUBDIR) loader modes . $(VBE_SUBDIR) \
-	  $(XAA_SUBDIR) $(DRI_SUBDIR) $(DRI2_SUBDIR) i2c dixmods \
+	  ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) . \
+	  $(VBE_SUBDIR) $(XAA_SUBDIR) $(DRI2_SUBDIR) i2c dixmods \
 	  fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man
 
 DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
@@ -40,7 +41,8 @@ nodist_Xorg_SOURCES = sdksyms.c
 
 AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 INCLUDES = $(XORG_INCS) -I$(srcdir)/parser -I$(top_srcdir)/miext/cw \
-	-I$(srcdir)/ddc -I$(srcdir)/i2c -I$(srcdir)/modes -I$(srcdir)/ramdac
+	-I$(srcdir)/ddc -I$(srcdir)/i2c -I$(srcdir)/modes -I$(srcdir)/ramdac \
+	-I$(srcdir)/dri
 
 LOCAL_LIBS = \
             $(MAIN_LIB) \
@@ -56,6 +58,7 @@ LOCAL_LIBS = \
             i2c/libi2c.la \
             $(XORG_LIBS) \
             dixmods/libxorgxkb.la \
+            $(DRI_LIB) \
             $(top_builddir)/mi/libmi.la \
             $(top_builddir)/os/libos.la
 Xorg_LDADD = \
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index a701d87..0dbfa98 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -112,9 +112,6 @@ static ModuleDefault ModuleDefaults[] = {
 #ifdef GLXEXT
     {.name = "glx",.toLoad = TRUE,.load_opt = NULL},
 #endif
-#ifdef XF86DRI
-    {.name = "dri",.toLoad = TRUE,.load_opt = NULL},
-#endif
 #ifdef DRI2
     {.name = "dri2",.toLoad = TRUE,.load_opt = NULL},
 #endif
diff --git a/hw/xfree86/common/xf86Extensions.c b/hw/xfree86/common/xf86Extensions.c
index 63950e6..b38ecf2 100644
--- a/hw/xfree86/common/xf86Extensions.c
+++ b/hw/xfree86/common/xf86Extensions.c
@@ -72,6 +72,15 @@ static ExtensionModule extensionModules[] = {
 	NULL
     },
 #endif
+#ifdef XF86DRI
+    {
+        XFree86DRIExtensionInit,
+        "XFree86-DRI",
+        &noXFree86DRIExtension,
+        NULL,
+        NULL
+    },
+#endif
 };
 
 static void
diff --git a/hw/xfree86/dri/Makefile.am b/hw/xfree86/dri/Makefile.am
index 9528d53..7c2026f 100644
--- a/hw/xfree86/dri/Makefile.am
+++ b/hw/xfree86/dri/Makefile.am
@@ -1,4 +1,4 @@
-libdri_la_LTLIBRARIES = libdri.la
+noinst_LTLIBRARIES = libdri.la
 libdri_la_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \
                    -I$(top_srcdir)/hw/xfree86/os-support \
                    -I$(top_srcdir)/hw/xfree86/modes \
@@ -9,16 +9,10 @@ libdri_la_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \
                    -I$(top_srcdir)/hw/xfree86/os-support/bus \
                    -I$(top_srcdir)/glx \
                    -DHAVE_XORG_CONFIG_H \
-                   @DIX_CFLAGS@ @XORG_CFLAGS@ @DRIPROTO_CFLAGS@ \
-                   @LIBDRM_CFLAGS@ \
-                   @DRI_CFLAGS@
-libdri_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
-libdri_la_LIBADD = @LIBDRM_LIBS@ $(PIXMAN_LIBS)
-libdri_ladir = $(moduledir)/extensions
+                   @DIX_CFLAGS@ @XORG_CFLAGS@
 libdri_la_SOURCES = \
 	dri.c \
 	dri.h \
-	drimodule.c \
 	dristruct.h \
 	sarea.h \
 	xf86dri.c
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index a3e7870..398178e 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -791,6 +791,8 @@ DRIExtensionInit(void)
 
     RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL);
 
+    drmSetServerInfo(&DRIDRMServerInfo);
+
     return TRUE;
 }
 
diff --git a/hw/xfree86/dri/dri.h b/hw/xfree86/dri/dri.h
index 0a4036c..4bfaf16 100644
--- a/hw/xfree86/dri/dri.h
+++ b/hw/xfree86/dri/dri.h
@@ -197,7 +197,7 @@ extern _X_EXPORT Bool DRIScreenInit(ScreenPtr pScreen,
 
 extern _X_EXPORT void DRICloseScreen(ScreenPtr pScreen);
 
-extern _X_EXPORT Bool DRIExtensionInit(void);
+extern Bool DRIExtensionInit(void);
 
 extern _X_EXPORT void DRIReset(void);
 
diff --git a/hw/xfree86/dri/drimodule.c b/hw/xfree86/dri/drimodule.c
deleted file mode 100644
index 6cb3bfb..0000000
--- a/hw/xfree86/dri/drimodule.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/**************************************************************************
-
-Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- *   Kevin E. Martin <kevin at precisioninsight.com>
- *   Rickard E. Faith <faith at precisioninsight.com>
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-#include "xf86Extensions.h"
-#include "globals.h"
-
-#include "xf86drm.h"
-static MODULESETUPPROTO(driSetup);
-
-drmServerInfo DRIDRMServerInfo;
-
-static XF86ModuleVersionInfo VersRec = {
-    "dri",
-    MODULEVENDORSTRING,
-    MODINFOSTRING1,
-    MODINFOSTRING2,
-    XORG_VERSION_CURRENT,
-    1, 0, 0,
-    ABI_CLASS_EXTENSION,
-    ABI_EXTENSION_VERSION,
-    MOD_CLASS_NONE,
-    {0, 0, 0, 0}
-};
-
-#define _XF86DRI_SERVER_
-#include <X11/dri/xf86driproto.h>
-
-static ExtensionModule XF86DRIExt = {
-    XFree86DRIExtensionInit,
-    XF86DRINAME,
-    &noXFree86DRIExtension,
-    NULL,
-    NULL
-};
-
-_X_EXPORT XF86ModuleData driModuleData = { &VersRec, driSetup, NULL };
-
-static pointer
-driSetup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
-    static Bool setupDone = FALSE;
-
-    if (!setupDone) {
-        setupDone = TRUE;
-        LoadExtension(&XF86DRIExt, FALSE);
-    }
-    else {
-        if (errmaj)
-            *errmaj = LDR_ONCEONLY;
-    }
-
-    drmSetServerInfo(&DRIDRMServerInfo);
-
-    /* Need a non-NULL return value to indicate success */
-    return (pointer) 1;
-}
diff --git a/hw/xfree86/dri2/Makefile.am b/hw/xfree86/dri2/Makefile.am
index 390ed12..ad3419b 100644
--- a/hw/xfree86/dri2/Makefile.am
+++ b/hw/xfree86/dri2/Makefile.am
@@ -1,7 +1,6 @@
 libdri2_la_LTLIBRARIES = libdri2.la
 libdri2_la_CFLAGS = \
 	-DHAVE_XORG_CONFIG_H \
-	@DRI_CFLAGS@ \
 	@DIX_CFLAGS@ @XORG_CFLAGS@ @DRI2PROTO_CFLAGS@ @LIBDRM_CFLAGS@ \
 	-I$(top_srcdir)/hw/xfree86/common \
 	-I$(top_srcdir)/hw/xfree86/os-support/bus
diff --git a/hw/xfree86/loader/Makefile.am b/hw/xfree86/loader/Makefile.am
index ebe0c81..6605042 100644
--- a/hw/xfree86/loader/Makefile.am
+++ b/hw/xfree86/loader/Makefile.am
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libloader.la
 
 INCLUDES = $(XORG_INCS) -I$(srcdir)/../parser -I$(top_srcdir)/miext/cw \
 	   -I$(srcdir)/../ddc -I$(srcdir)/../i2c -I$(srcdir)/../modes \
-	   -I$(srcdir)/../ramdac
+	   -I$(srcdir)/../ramdac -I$(srcdir)/../dri
 
 #AM_LDFLAGS = -r
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 1ec4ff0..1ef8791 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -836,6 +836,7 @@ static const char *compiled_in_modules[] = {
     "dbe",
     "record",
     "extmod",
+    "dri",
     NULL
 };
 
diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh
index f3d7640..d8a7efb 100755
--- a/hw/xfree86/sdksyms.sh
+++ b/hw/xfree86/sdksyms.sh
@@ -203,13 +203,11 @@ cat > sdksyms.c << EOF
 
 
 /* hw/xfree86/dri/Makefile.am -- module */
-/*
 #if XF86DRI
 # include "dri.h"
 # include "sarea.h"
 # include "dristruct.h"
 #endif
- */
 
 
 /* mi/Makefile.am */
diff --git a/test/Makefile.am b/test/Makefile.am
index 15c51ed..4906bd8 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -18,7 +18,7 @@ if XORG
 INCLUDES += -I$(top_srcdir)/hw/xfree86/parser \
 	-I$(top_srcdir)/hw/xfree86/ddc \
 	-I$(top_srcdir)/hw/xfree86/i2c -I$(top_srcdir)/hw/xfree86/modes \
-	-I$(top_srcdir)/hw/xfree86/ramdac
+	-I$(top_srcdir)/hw/xfree86/ramdac -I$(top_srcdir)/hw/xfree86/dri
 endif
 TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 
@@ -42,6 +42,7 @@ os_LDADD=$(TEST_LDADD)
 
 libxservertest_la_LIBADD = $(XSERVER_LIBS)
 if XORG
+
 nodist_libxservertest_la_SOURCES = $(top_builddir)/hw/xfree86/sdksyms.c
 libxservertest_la_LIBADD += \
             $(top_builddir)/hw/xfree86/loader/libloader.la \
@@ -52,6 +53,7 @@ libxservertest_la_LIBADD += \
             $(top_builddir)/hw/xfree86/modes/libxf86modes.la \
             $(top_builddir)/hw/xfree86/ramdac/libramdac.la \
             $(top_builddir)/hw/xfree86/ddc/libddc.la \
+            $(top_builddir)/hw/xfree86/dri/libdri.la \
             $(top_builddir)/hw/xfree86/i2c/libi2c.la \
             $(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la \
             @XORG_LIBS@
-- 
1.7.10.4



More information about the xorg-devel mailing list