[PATCH 34/54] Move DRI2 from external module to built-in
Daniel Stone
daniel at fooishbar.org
Mon Jul 9 18:03:18 PDT 2012
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>
Reviewed-by: Jamey Sharp <jamey at minilop.net>
---
hw/xfree86/Makefile.am | 8 +++++---
hw/xfree86/common/Makefile.am | 2 +-
hw/xfree86/common/xf86Config.c | 3 ---
hw/xfree86/common/xf86Extensions.c | 9 +++++++++
hw/xfree86/common/xf86Extensions.h | 1 +
hw/xfree86/dri2/Makefile.am | 12 +++++-------
hw/xfree86/dri2/dri2.c | 38 +++---------------------------------
hw/xfree86/dri2/dri2.h | 2 --
hw/xfree86/dri2/dri2ext.c | 24 ++++++++---------------
hw/xfree86/dri2/dri2int.h | 26 ++++++++++++++++++++++++
hw/xfree86/loader/Makefile.am | 2 +-
hw/xfree86/loader/loadmod.c | 1 +
hw/xfree86/sdksyms.sh | 2 --
test/Makefile.am | 4 +++-
14 files changed, 63 insertions(+), 71 deletions(-)
create mode 100644 hw/xfree86/dri2/dri2int.h
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 0c3801d..cd699ee 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
@@ -27,8 +28,8 @@ INT10_SUBDIR = int10
endif
SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \
- ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) . \
- $(VBE_SUBDIR) $(XAA_SUBDIR) $(DRI2_SUBDIR) i2c dixmods \
+ ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \
+ $(DRI2_SUBDIR) . $(VBE_SUBDIR) $(XAA_SUBDIR) i2c dixmods \
fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man
DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
@@ -42,7 +43,7 @@ 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)/dri
+ -I$(srcdir)/dri -I$(srcdir)/dri2
LOCAL_LIBS = \
$(MAIN_LIB) \
@@ -59,6 +60,7 @@ LOCAL_LIBS = \
$(XORG_LIBS) \
dixmods/libxorgxkb.la \
$(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 cb6d0d4..325875d 100644
--- a/hw/xfree86/common/Makefile.am
+++ b/hw/xfree86/common/Makefile.am
@@ -56,7 +56,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 0dbfa98..486752b 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
#ifdef __CYGWIN__
/* load DIX modules used by drivers first */
{.name = "fb",.toLoad = TRUE,.load_opt = NULL},
diff --git a/hw/xfree86/common/xf86Extensions.c b/hw/xfree86/common/xf86Extensions.c
index b38ecf2..15bab42 100644
--- a/hw/xfree86/common/xf86Extensions.c
+++ b/hw/xfree86/common/xf86Extensions.c
@@ -81,6 +81,15 @@ static ExtensionModule extensionModules[] = {
NULL
},
#endif
+#ifdef DRI2
+ {
+ DRI2ExtensionInit,
+ DRI2_NAME,
+ &noDRI2Extension,
+ NULL,
+ NULL
+ }
+#endif
};
static void
diff --git a/hw/xfree86/common/xf86Extensions.h b/hw/xfree86/common/xf86Extensions.h
index f86a421..9b8448d 100644
--- a/hw/xfree86/common/xf86Extensions.h
+++ b/hw/xfree86/common/xf86Extensions.h
@@ -35,6 +35,7 @@ extern void XFree86DRIExtensionInit(void);
#ifdef DRI2
#include <X11/extensions/dri2proto.h>
+extern Bool noDRI2Extension;
extern void DRI2ExtensionInit(void);
#endif
diff --git a/hw/xfree86/dri2/Makefile.am b/hw/xfree86/dri2/Makefile.am
index ad3419b..502a2ee 100644
--- a/hw/xfree86/dri2/Makefile.am
+++ b/hw/xfree86/dri2/Makefile.am
@@ -1,16 +1,14 @@
-libdri2_la_LTLIBRARIES = libdri2.la
-libdri2_la_CFLAGS = \
+noinst_LTLIBRARIES = libdri2.la
+AM_CFLAGS = \
-DHAVE_XORG_CONFIG_H \
- @DIX_CFLAGS@ @XORG_CFLAGS@ @DRI2PROTO_CFLAGS@ @LIBDRM_CFLAGS@ \
+ @DIX_CFLAGS@ @XORG_CFLAGS@ \
-I$(top_srcdir)/hw/xfree86/common \
-I$(top_srcdir)/hw/xfree86/os-support/bus
-libdri2_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
-libdri2_la_LIBADD = @LIBDRM_LIBS@ $(PIXMAN_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 887ce46..2ea0c33 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 "damage.h"
#include "xf86.h"
@@ -1552,7 +1553,6 @@ DRI2CloseScreen(ScreenPtr pScreen)
dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL);
}
-extern ExtensionModule dri2ExtensionModule;
extern Bool DRI2ModuleSetup(void);
/* Called by InitExtensions() */
@@ -1566,46 +1566,14 @@ DRI2ModuleSetup(void)
return TRUE;
}
-static pointer
-DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
- static Bool setupDone = FALSE;
-
- 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;
}
int
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index 28f2d75..da7825e 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -254,8 +254,6 @@ typedef struct {
DRI2CopyRegion2ProcPtr CopyRegion2;
} DRI2InfoRec, *DRI2InfoPtr;
-extern _X_EXPORT int DRI2EventBase;
-
extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info);
extern _X_EXPORT void DRI2CloseScreen(ScreenPtr pScreen);
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 3bc3ea7..9bbd776 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -44,13 +44,15 @@
#include "extnsionst.h"
#include "xfixes.h"
#include "dri2.h"
+#include "dri2int.h"
#include "protocol-versions.h"
-/* The only xf86 include */
+/* The only xf86 includes */
#include "xf86Module.h"
+#include "xf86Extensions.h"
+
+static int DRI2EventBase;
-static ExtensionEntry *dri2Extension;
-extern Bool DRI2ModuleSetup(void);
static Bool
validDrawable(ClientPtr client, XID drawable, Mask access_mode,
@@ -653,11 +655,11 @@ SProcDRI2Dispatch(ClientPtr client)
}
}
-int DRI2EventBase;
-
-static void
+void
DRI2ExtensionInit(void)
{
+ ExtensionEntry *dri2Extension;
+
dri2Extension = AddExtension(DRI2_NAME,
DRI2NumberEvents,
DRI2NumberErrors,
@@ -668,13 +670,3 @@ DRI2ExtensionInit(void)
DRI2ModuleSetup();
}
-
-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..7f53eba
--- /dev/null
+++ b/hw/xfree86/dri2/dri2int.h
@@ -0,0 +1,26 @@
+/*
+ * 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 Bool DRI2ModuleSetup(void);
diff --git a/hw/xfree86/loader/Makefile.am b/hw/xfree86/loader/Makefile.am
index 6605042..d6ddbec 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)
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 1ef8791..2347b8e 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -837,6 +837,7 @@ static const char *compiled_in_modules[] = {
"record",
"extmod",
"dri",
+ "dri2",
NULL
};
diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh
index d8a7efb..420640f 100755
--- a/hw/xfree86/sdksyms.sh
+++ b/hw/xfree86/sdksyms.sh
@@ -93,11 +93,9 @@ cat > sdksyms.c << EOF
/* hw/xfree86/dri2/Makefile.am -- module */
-/*
#if DRI2
# include "dri2.h"
#endif
- */
/* hw/xfree86/vgahw/Makefile.am -- module */
diff --git a/test/Makefile.am b/test/Makefile.am
index 4906bd8..7a24d20 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -18,7 +18,8 @@ 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/dri
+ -I$(top_srcdir)/hw/xfree86/ramdac -I$(top_srcdir)/hw/xfree86/dri \
+ -I$(top_srcdir)/hw/xfree86/dri2
endif
TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
@@ -54,6 +55,7 @@ libxservertest_la_LIBADD += \
$(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/dri2/libdri2.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