[PATCH 25/42] Move DRI1 from external module to built-in

Daniel Stone daniel at fooishbar.org
Fri Dec 2 03:27:33 PST 2011


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>
---
 configure.ac                       |    6 +-
 hw/xfree86/Makefile.am             |    7 ++-
 hw/xfree86/common/xf86Config.c     |    3 -
 hw/xfree86/common/xf86Extensions.c |   13 +++++
 hw/xfree86/dri/Makefile.am         |    5 +--
 hw/xfree86/dri/dri.c               |    2 +
 hw/xfree86/dri/drimodule.c         |   93 ------------------------------------
 hw/xfree86/loader/Makefile.am      |    4 +-
 hw/xfree86/loader/loadmod.c        |    1 +
 hw/xfree86/sdksyms.sh              |    2 -
 test/Makefile.am                   |   11 +++-
 11 files changed, 35 insertions(+), 112 deletions(-)
 delete mode 100644 hw/xfree86/dri/drimodule.c

diff --git a/configure.ac b/configure.ac
index c7e0a18..daa78a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1085,7 +1085,7 @@ AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
 if test "x$DRI" = xyes || test "x$DRI2" = xyes; then
 	if test "x$DRM" = xyes; then
 		AC_DEFINE(WITH_LIBDRM, 1, [Building with libdrm support])
-		PKG_CHECK_MODULES([LIBDRM], $LIBDRM)
+                PKG_CHECK_MODULES([LIBDRM], $LIBDRM)
 	fi
 fi
 
@@ -1592,8 +1592,8 @@ 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"
-	XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
+	XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS $LIBDRM_LIBS"
+	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/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 38ac73c..0cfbaa2 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
@@ -40,9 +41,10 @@ DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
 bin_PROGRAMS = Xorg
 nodist_Xorg_SOURCES = sdksyms.c
 
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@ @DRIPROTO_CFLAGS@ @LIBDRM_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) \
@@ -58,6 +60,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 b7e8b76..8e9d220 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 80bf4e2..ed5bab8 100644
--- a/hw/xfree86/common/xf86Extensions.c
+++ b/hw/xfree86/common/xf86Extensions.c
@@ -50,6 +50,10 @@
 #include "vidmodeproc.h"
 #endif
 
+#ifdef XF86DRI
+extern void XFree86DRIExtensionInit(void);
+#endif
+
 /*
  * DDX-specific extensions.
  */
@@ -72,6 +76,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 a7b491c..d611f66 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 \
@@ -12,12 +12,9 @@ libdri_la_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \
                    @DIX_CFLAGS@ @XORG_CFLAGS@ @DRIPROTO_CFLAGS@ \
                    @LIBDRM_CFLAGS@ \
                    @DRI_CFLAGS@
-libdri_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@
-libdri_ladir = $(moduledir)/extensions
 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 ad54ed2..bef1fe4 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -799,6 +799,8 @@ DRIExtensionInit(void)
 
     RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL);
 
+    drmSetServerInfo(&DRIDRMServerInfo);
+
     return TRUE;
 }
 
diff --git a/hw/xfree86/dri/drimodule.c b/hw/xfree86/dri/drimodule.c
deleted file mode 100644
index d2acafd..0000000
--- a/hw/xfree86/dri/drimodule.c
+++ /dev/null
@@ -1,93 +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/loader/Makefile.am b/hw/xfree86/loader/Makefile.am
index ebe0c81..df1020b 100644
--- a/hw/xfree86/loader/Makefile.am
+++ b/hw/xfree86/loader/Makefile.am
@@ -2,10 +2,10 @@ 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)
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) @DRIPROTO_CFLAGS@ @LIBDRM_CFLAGS@
 
 EXTRA_DIST = \
 	loader.h \
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 4634587..b05d098 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -811,6 +811,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 c3e65db..69351a3 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 62c398c..d6317a6 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -6,12 +6,12 @@ check_LTLIBRARIES = libxservertest.la
 TESTS=$(noinst_PROGRAMS)
 TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
 
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@ @DRIPROTO_CFLAGS@ @LIBDRM_CFLAGS@
 INCLUDES = $(XORG_INCS) -I$(top_srcdir)/hw/xfree86/parser \
 	-I$(top_srcdir)/miext/cw -I$(top_srcdir)/hw/xfree86/ddc \
 	-I$(top_srcdir)/hw/xfree86/i2c -I$(top_srcdir)/hw/xfree86/modes \
-	-I$(top_srcdir)/hw/xfree86/ramdac
-TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS)
+	-I$(top_srcdir)/hw/xfree86/ramdac -I$(top_srcdir)/hw/xfree86/dri
+TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) @LIBDRM_LIBS@
 
 if SPECIAL_DTRACE_OBJECTS
 TEST_LDADD += $(OS_LIB) $(DIX_LIB)
@@ -25,6 +25,10 @@ misc_LDADD=$(TEST_LDADD)
 fixes_LDADD=$(TEST_LDADD)
 xfree86_LDADD=$(TEST_LDADD)
 
+if DRI
+DRI_LIB = $(top_builddir)/hw/xfree86/dri/libdri.la
+endif
+
 nodist_libxservertest_la_SOURCES = $(top_builddir)/hw/xfree86/sdksyms.c
 libxservertest_la_LIBADD = \
             $(XSERVER_LIBS) \
@@ -38,6 +42,7 @@ libxservertest_la_LIBADD = \
             $(top_builddir)/hw/xfree86/ddc/libddc.la \
             $(top_builddir)/hw/xfree86/i2c/libi2c.la \
             $(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la \
+            $(DRI_LIB) \
             $(top_builddir)/mi/libmi.la \
             $(top_builddir)/os/libos.la \
             @XORG_LIBS@
-- 
1.7.7.3



More information about the xorg-devel mailing list