Move DRI2 from external module to built-in

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

v2: Fix test/Makefile.am to only link libdri2.la if DRI2 is set

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Daniel Stone 2012-07-10 02:03:18 +01:00 committed by Keith Packard
parent b8a3267c36
commit 9a953e0e9d
14 changed files with 66 additions and 71 deletions

View File

@ -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 = \

View File

@ -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 \

View File

@ -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},

View File

@ -81,6 +81,15 @@ static ExtensionModule extensionModules[] = {
NULL
},
#endif
#ifdef DRI2
{
DRI2ExtensionInit,
DRI2_NAME,
&noDRI2Extension,
NULL,
NULL
}
#endif
};
static void

View File

@ -35,6 +35,7 @@ extern void XFree86DRIExtensionInit(void);
#ifdef DRI2
#include <X11/extensions/dri2proto.h>
extern Bool noDRI2Extension;
extern void DRI2ExtensionInit(void);
#endif

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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,
@ -664,11 +666,11 @@ SProcDRI2Dispatch(ClientPtr client)
}
}
int DRI2EventBase;
static void
void
DRI2ExtensionInit(void)
{
ExtensionEntry *dri2Extension;
dri2Extension = AddExtension(DRI2_NAME,
DRI2NumberEvents,
DRI2NumberErrors,
@ -679,13 +681,3 @@ DRI2ExtensionInit(void)
DRI2ModuleSetup();
}
extern Bool noDRI2Extension;
_X_HIDDEN ExtensionModule dri2ExtensionModule = {
DRI2ExtensionInit,
DRI2_NAME,
&noDRI2Extension,
NULL,
NULL
};

26
hw/xfree86/dri2/dri2int.h Normal file
View File

@ -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@fooishbar.org>
*/
extern Bool DRI2ModuleSetup(void);

View File

@ -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)

View File

@ -837,6 +837,7 @@ static const char *compiled_in_modules[] = {
"record",
"extmod",
"dri",
"dri2",
NULL
};

View File

@ -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 */

View File

@ -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)
@ -61,6 +62,10 @@ if DRI
libxservertest_la_LIBADD += $(top_builddir)/hw/xfree86/dri/libdri.la
endif
if DRI2
libxservertest_la_LIBADD += $(top_builddir)/hw/xfree86/dri2/libdri2.la
endif
else
nodist_libxservertest_la_SOURCES = \
ddxstubs.c \