[PATCH 21/37] Move DRI1 from external module to built-in

Daniel Stone daniel at fooishbar.org
Tue Jun 28 12:27:37 PDT 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                       |    2 +-
 hw/xfree86/Makefile.am             |    2 +
 hw/xfree86/common/xf86Config.c     |    3 -
 hw/xfree86/common/xf86Extensions.c |   13 +++++
 hw/xfree86/dri/Makefile.am         |    5 +--
 hw/xfree86/dri/drimodule.c         |   93 ------------------------------------
 hw/xfree86/loader/Makefile.am      |    4 +-
 hw/xfree86/loader/loadmod.c        |    1 +
 hw/xfree86/sdksyms.sh              |    2 -
 9 files changed, 20 insertions(+), 105 deletions(-)
 delete mode 100644 hw/xfree86/dri/drimodule.c

diff --git a/configure.ac b/configure.ac
index a4e2ea1..33dfb2b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1569,7 +1569,7 @@ if test "x$XORG" = xyes; then
 	AC_CHECK_FUNCS([pci_device_vgaarb_init])
 	LIBS=$SAVE_LIBS
 	CFLAGS=$SAVE_CFLAGS
-	XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS"
+	XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS $LIBDRM_LIBS"
 	XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
 
 	case $host_os in
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index e3ef14f..71b2b9e 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
@@ -58,6 +59,7 @@ LOCAL_LIBS = \
             i2c/libi2c.la \
             dixmods/libxorgxkb.la \
             $(XORG_LIBS) \
+            $(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 da1a39b..6ccbf58 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 5d11e61..0f43c6b 100644
--- a/hw/xfree86/common/xf86Extensions.c
+++ b/hw/xfree86/common/xf86Extensions.c
@@ -40,6 +40,10 @@
 #include "vidmodeproc.h"
 #endif
 
+#ifdef XF86DRI
+extern void XFree86DRIExtensionInit(void);
+#endif
+
 /*
  * DDX-specific extensions.
  */
@@ -62,6 +66,15 @@ static ExtensionModule extensionModules[] = {
 	NULL
     },
 #endif
+#ifdef XF86DRI
+    {
+        XFree86DRIExtensionInit,
+        "XFree86-DRI",
+        &noXFree86DRIExtension,
+        NULL,
+        NULL
+    },
+#endif
 };
 
 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/drimodule.c b/hw/xfree86/dri/drimodule.c
deleted file mode 100644
index 40e3aca..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 "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}
-};
-
-extern void XFree86DRIExtensionInit(void);
-#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 a7d0097..dbc2dd2 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -818,6 +818,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 01fdeb7..0d6e98f 100755
--- a/hw/xfree86/sdksyms.sh
+++ b/hw/xfree86/sdksyms.sh
@@ -198,13 +198,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 */
-- 
1.7.5.4



More information about the xorg-devel mailing list