[PATCH 24/37] Move DRI2 from external module to built-in

Daniel Stone daniel at fooishbar.org
Tue Jun 28 12:27:40 PDT 2011


Instead of keeping a tiny amount of code in an external module, just man
up and build it into the core server.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 hw/xfree86/Makefile.am             |    2 +
 hw/xfree86/common/Makefile.am      |    2 +-
 hw/xfree86/common/xf86Config.c     |    3 --
 hw/xfree86/common/xf86Extensions.c |   14 ++++++++++
 hw/xfree86/dri2/Makefile.am        |    9 +++---
 hw/xfree86/dri2/dri2.c             |   49 ++++-------------------------------
 hw/xfree86/dri2/dri2ext.c          |   25 ++++++++----------
 hw/xfree86/dri2/dri2int.h          |   30 ++++++++++++++++++++++
 hw/xfree86/loader/Makefile.am      |    2 +-
 hw/xfree86/sdksyms.sh              |    2 -
 10 files changed, 69 insertions(+), 69 deletions(-)
 create mode 100644 hw/xfree86/dri2/dri2int.h

diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 71b2b9e..d6204df 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -6,6 +6,7 @@ endif
 
 if DRI2
 DRI2_SUBDIR = dri2
+DRI2_LIB = dri2/libdri2.la
 endif
 
 if XF86UTILS
@@ -60,6 +61,7 @@ LOCAL_LIBS = \
             dixmods/libxorgxkb.la \
             $(XORG_LIBS) \
             $(DRI_LIB) \
+            $(DRI2_LIB) \
             $(top_builddir)/mi/libmi.la \
             $(top_builddir)/os/libos.la
 Xorg_LDADD = \
diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am
index 1d19637..9101e52 100644
--- a/hw/xfree86/common/Makefile.am
+++ b/hw/xfree86/common/Makefile.am
@@ -46,7 +46,7 @@ INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
 	   -I$(srcdir)/../loader -I$(srcdir)/../parser \
            -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
 	   -I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod \
-	   -I$(srcdir)/../modes -I$(srcdir)/../ramdac
+	   -I$(srcdir)/../modes -I$(srcdir)/../ramdac -I$(srcdir)/../dri2
 
 sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
               xf86PciInfo.h xf86Priv.h xf86Privstr.h \
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 6ccbf58..09036e9 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 DRI2
-    {.name = "dri2",     .toLoad = TRUE,    .load_opt=NULL},
-#endif
     {.name = NULL,       .toLoad = FALSE,   .load_opt=NULL}
 };
 
diff --git a/hw/xfree86/common/xf86Extensions.c b/hw/xfree86/common/xf86Extensions.c
index 0f43c6b..b18c2ab 100644
--- a/hw/xfree86/common/xf86Extensions.c
+++ b/hw/xfree86/common/xf86Extensions.c
@@ -44,6 +44,11 @@
 extern void XFree86DRIExtensionInit(void);
 #endif
 
+#ifdef DRI2
+#include <X11/extensions/dri2proto.h>
+#include "dri2int.h"
+#endif
+
 /*
  * DDX-specific extensions.
  */
@@ -75,6 +80,15 @@ static ExtensionModule extensionModules[] = {
         NULL
     },
 #endif
+#ifdef DRI2
+    {
+        DRI2ExtensionInit,
+        DRI2_NAME,
+        &noDRI2Extension,
+        NULL,
+        NULL
+    }
+#endif
 };
 
 void
diff --git a/hw/xfree86/dri2/Makefile.am b/hw/xfree86/dri2/Makefile.am
index c9fdde2..3c207b2 100644
--- a/hw/xfree86/dri2/Makefile.am
+++ b/hw/xfree86/dri2/Makefile.am
@@ -1,16 +1,15 @@
-libdri2_la_LTLIBRARIES = libdri2.la
-libdri2_la_CFLAGS = \
+noinst_LTLIBRARIES = libdri2.la
+AM_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
 
-libdri2_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@
-libdri2_ladir = $(moduledir)/extensions
 libdri2_la_SOURCES = \
 	dri2.c \
 	dri2.h \
-	dri2ext.c
+	dri2ext.c \
+	dri2int.h
 
 sdk_HEADERS = dri2.h
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index af3bcae..dd3953a 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -44,6 +44,7 @@
 #include "windowstr.h"
 #include "dixstruct.h"
 #include "dri2.h"
+#include "dri2int.h"
 #include "xf86VGAarbiter.h"
 
 #include "xf86.h"
@@ -60,7 +61,7 @@ static DevPrivateKeyRec dri2WindowPrivateKeyRec;
 static DevPrivateKeyRec dri2PixmapPrivateKeyRec;
 #define dri2PixmapPrivateKey (&dri2PixmapPrivateKeyRec)
 
-static RESTYPE       dri2DrawableRes;
+RESTYPE       dri2DrawableRes;
 
 typedef struct _DRI2Screen *DRI2ScreenPtr;
 
@@ -264,7 +265,8 @@ DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id,
     return Success;
 }
 
-static int DRI2DrawableGone(pointer p, XID id)
+int
+DRI2DrawableGone(pointer p, XID id)
 {
     DRI2DrawablePtr pPriv = p;
     DRI2ScreenPtr   ds = pPriv->dri2_screen;
@@ -1192,51 +1194,12 @@ DRI2CloseScreen(ScreenPtr pScreen)
     dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL);
 }
 
-extern ExtensionModule dri2ExtensionModule;
-
-static pointer
-DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
-    static Bool setupDone = FALSE;
-
-    dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone, "DRI2Drawable");
-
-    if (!setupDone)
-    {
-	setupDone = TRUE;
-	LoadExtension(&dri2ExtensionModule, FALSE);
-    }
-    else
-    {
-	if (errmaj)
-	    *errmaj = LDR_ONCEONLY;
-    }
-
-    return (pointer) 1;
-}
-
-static XF86ModuleVersionInfo DRI2VersRec =
-{
-    "dri2",
-    MODULEVENDORSTRING,
-    MODINFOSTRING1,
-    MODINFOSTRING2,
-    XORG_VERSION_CURRENT,
-    1, 2, 0,
-    ABI_CLASS_EXTENSION,
-    ABI_EXTENSION_VERSION,
-    MOD_CLASS_NONE,
-    { 0, 0, 0, 0 }
-};
-
-_X_EXPORT XF86ModuleData dri2ModuleData = { &DRI2VersRec, DRI2Setup, NULL };
-
 void
 DRI2Version(int *major, int *minor)
 {
     if (major != NULL)
-	*major = DRI2VersRec.majorversion;
+	*major = 1;
 
     if (minor != NULL)
-	*minor = DRI2VersRec.minorversion;
+	*minor = 2;
 }
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 4e48e65..13822fd 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -44,11 +44,9 @@
 #include "extnsionst.h"
 #include "xfixes.h"
 #include "dri2.h"
+#include "dri2int.h"
 #include "protocol-versions.h"
 
-/* The only xf86 include */
-#include "xf86Module.h"
-
 static ExtensionEntry	*dri2Extension;
 
 static Bool
@@ -625,9 +623,18 @@ SProcDRI2Dispatch (ClientPtr client)
 
 int DRI2EventBase;
 
-static void
+void
 DRI2ExtensionInit(void)
 {
+    static Bool beenHere = FALSE;
+
+    if (!beenHere)
+    {
+        dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone,
+                                                "DRI2Drawable");
+        beenHere = TRUE;
+    }
+
     dri2Extension = AddExtension(DRI2_NAME,
 				 DRI2NumberEvents,
 				 DRI2NumberErrors,
@@ -638,13 +645,3 @@ DRI2ExtensionInit(void)
 
     DRI2EventBase = dri2Extension->eventBase;
 }
-
-extern Bool noDRI2Extension;
-
-_X_HIDDEN ExtensionModule dri2ExtensionModule = {
-    DRI2ExtensionInit,
-    DRI2_NAME,
-    &noDRI2Extension,
-    NULL,
-    NULL
-};
diff --git a/hw/xfree86/dri2/dri2int.h b/hw/xfree86/dri2/dri2int.h
new file mode 100644
index 0000000..37dd071
--- /dev/null
+++ b/hw/xfree86/dri2/dri2int.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright © 2011 Daniel Stone
+ *
+ * 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, sublicense,
+ * 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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Daniel Stone <daniel at fooishbar.org>
+ */
+
+extern RESTYPE dri2DrawableRes;
+
+extern void DRI2ExtensionInit(void);
+
+int DRI2DrawableGone(pointer p, XID id);
diff --git a/hw/xfree86/loader/Makefile.am b/hw/xfree86/loader/Makefile.am
index df1020b..475e3e8 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)/../dri
+	   -I$(srcdir)/../ramdac -I$(srcdir)/../dri -I$(srcdir)/../dri2
 
 #AM_LDFLAGS = -r
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) @DRIPROTO_CFLAGS@ @LIBDRM_CFLAGS@
diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh
index 0d6e98f..0837ff5 100755
--- a/hw/xfree86/sdksyms.sh
+++ b/hw/xfree86/sdksyms.sh
@@ -91,11 +91,9 @@ cat > sdksyms.c << EOF
 
 
 /* hw/xfree86/dri2/Makefile.am -- module */
-/*
 #if DRI2
 # include "dri2.h"
 #endif
- */
 
 
 /* hw/xfree86/vgahw/Makefile.am -- module */
-- 
1.7.5.4



More information about the xorg-devel mailing list