swrast: Build the driver into the shared mesa_dri_drivers.so.

v2: drop dridir now that it's unused.
v3: Fix linking after rebase when building just swrast from classic but a
    drm-using gallium driver.
v4: Consistently put spaces around += in the updated Makefile.am block.
v5: Set a global driverAPI variable so loaders don't have to update to
    createNewScreen2() (though they may want to for thread safety).

Reviewed-by: Matt Turner <mattst88@gmail.com> (v3)
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
Eric Anholt 2013-09-27 16:57:11 -07:00
parent 86d50c2f15
commit bdcee13ca3
6 changed files with 48 additions and 42 deletions

View File

@ -1022,10 +1022,15 @@ if test "x$enable_dri" = xyes; then
LIBS="$save_LIBS"
# If we are building any DRI driver other than swrast.
if test -n "$DRI_DIRS" -a x"$DRI_DIRS" != xswrast; then
# ... libdrm is required
if test "x$have_libdrm" != xyes; then
AC_MSG_ERROR([DRI drivers requires libdrm >= $LIBDRM_REQUIRED])
if test -n "$DRI_DIRS"; then
if test x"$DRI_DIRS" != xswrast; then
# ... libdrm is required
if test "x$have_libdrm" != xyes; then
AC_MSG_ERROR([DRI drivers requires libdrm >= $LIBDRM_REQUIRED])
fi
DRICOMMON_NEED_LIBDRM=yes
else
DRICOMMON_NEED_LIBDRM=no
fi
fi
@ -1037,14 +1042,6 @@ if test "x$enable_dri" = xyes; then
fi
enable_dricore=no
enable_megadriver=no
for driver in $DRI_DIRS; do
if test $driver = "swrast"; then
enable_dricore=yes
else
enable_megadriver=yes
fi
done
# megadriver wants to use libmesa.la, while non-megadrivers want to
# automatically get libdricore. Some day hopefully we'll transition
@ -1053,10 +1050,10 @@ MEGADRIVER_DRI_LIB_DEPS=$DRI_LIB_DEPS
DRI_LIB_DEPS="\$(top_builddir)/src/mesa/libdricore/libdricore${VERSION}.la $DRI_LIB_DEPS"
AM_CONDITIONAL(NEED_LIBDRICORE, test "x$enable_dricore" = xyes)
AM_CONDITIONAL(NEED_MEGADRIVER, test "x$enable_megadriver" = xyes)
AM_CONDITIONAL(NEED_MEGADRIVER, test -n "$DRI_DIRS")
AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_xlib_glx" = xyes -o \
"x$enable_osmesa" = xyes -o \
"x$enable_megadriver" = xyes)
-n "$DRI_DIRS")
AC_SUBST([EXPAT_INCLUDES])
AC_SUBST([DRI_LIB_DEPS])
AC_SUBST([DRI_DRIVER_LDFLAGS])
@ -1777,6 +1774,7 @@ if test "x$with_gallium_drivers" != x; then
fi
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
DRICOMMON_NEED_LIBDRM=yes
;;
xilo)
HAVE_GALLIUM_ILO=yes
@ -1784,6 +1782,7 @@ if test "x$with_gallium_drivers" != x; then
gallium_require_drm_loader
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS ilo"
gallium_check_st "intel/drm" "dri-ilo"
DRICOMMON_NEED_LIBDRM=yes
;;
xr300)
HAVE_GALLIUM_R300=yes
@ -1791,6 +1790,7 @@ if test "x$with_gallium_drivers" != x; then
gallium_require_llvm "Gallium R300"
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
gallium_check_st "radeon/drm" "r300/dri" "" "" "r300/xvmc" "r300/vdpau"
DRICOMMON_NEED_LIBDRM=yes
;;
xr600)
HAVE_GALLIUM_R600=yes
@ -1808,6 +1808,7 @@ if test "x$with_gallium_drivers" != x; then
LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
fi
gallium_check_st "radeon/drm" "r600/dri" "r600/xorg" "" "r600/xvmc" "r600/vdpau"
DRICOMMON_NEED_LIBDRM=yes
;;
xradeonsi)
HAVE_GALLIUM_RADEONSI=yes
@ -1816,6 +1817,7 @@ if test "x$with_gallium_drivers" != x; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS radeonsi"
radeon_llvm_check
gallium_check_st "radeon/drm" "radeonsi/dri" "radeonsi/xorg" "" "" "radeonsi/vdpau" ""
DRICOMMON_NEED_LIBDRM=yes
;;
xnouveau)
HAVE_GALLIUM_NOUVEAU=yes
@ -1823,6 +1825,7 @@ if test "x$with_gallium_drivers" != x; then
gallium_require_drm_loader
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau"
gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau" "" "xvmc-nouveau" "vdpau-nouveau"
DRICOMMON_NEED_LIBDRM=yes
;;
xfreedreno)
HAVE_GALLIUM_FREEDRENO=yes
@ -1830,6 +1833,7 @@ if test "x$with_gallium_drivers" != x; then
gallium_require_drm_loader
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS freedreno"
gallium_check_st "freedreno/drm" "dri-freedreno" "" "" "" ""
DRICOMMON_NEED_LIBDRM=yes
;;
xswrast)
HAVE_GALLIUM_SOFTPIPE=yes
@ -1961,10 +1965,11 @@ AM_CONDITIONAL(HAVE_MESA_LLVM, test x$MESA_LLVM = x1)
AC_SUBST([ELF_LIB])
AM_CONDITIONAL(DRICOMMON_NEED_LIBDRM, test "x$DRICOMMON_NEED_LIBDRM" = xyes)
AM_CONDITIONAL(NEED_LIBPROGRAM, test "x$with_gallium_drivers" != x -o \
"x$enable_xlib_glx" = xyes -o \
"x$enable_osmesa" = xyes -o \
"x$enable_megadriver" = xyes -o \
-n "$DRI_DIRS" -o \
"x$enable_gallium_osmesa" = xyes)
AM_CONDITIONAL(HAVE_X11_DRIVER, test "x$enable_xlib_glx" = xyes)
AM_CONDITIONAL(HAVE_OSMESA, test "x$enable_osmesa" = xyes)

View File

@ -37,7 +37,9 @@ MEGADRIVERS += radeon_dri.so
endif
if HAVE_SWRAST_DRI
SUBDIRS+=swrast
SUBDIRS += swrast
MEGADRIVERS_DEPS += swrast/libswrast_dri.la
MEGADRIVERS += swrast_dri.so
endif
pkgconfigdir = $(libdir)/pkgconfig

View File

@ -27,7 +27,6 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa/ \
$(DEFINES) \
$(LIBDRM_CFLAGS) \
$(VISIBILITY_CFLAGS)
noinst_LTLIBRARIES = \
@ -47,3 +46,10 @@ libdri_test_stubs_la_CFLAGS = $(AM_CFLAGS) -DNO_MAIN
libmegadriver_stub_la_SOURCES = megadriver_stub.c
sysconf_DATA = drirc
if DRICOMMON_NEED_LIBDRM
AM_CFLAGS += $(LIBDRM_CFLAGS)
libdricommon_la_LDFLAGS = $(LIBDRM_LIBS)
else
AM_CFLAGS += -D__NOT_HAVE_DRM_H
endif

View File

@ -34,19 +34,5 @@ AM_CFLAGS = \
$(DEFINES) \
$(VISIBILITY_CFLAGS)
dridir = $(DRI_DRIVER_INSTALL_DIR)
dri_LTLIBRARIES = swrast_dri.la
swrast_dri_la_SOURCES = \
$(SWRAST_C_FILES)
swrast_dri_la_LDFLAGS = $(DRI_DRIVER_LDFLAGS)
swrast_dri_la_LIBADD = \
$(DRI_LIB_DEPS)
# Provide compatibility with scripts for the old Mesa build system for
# a while by putting a link to the driver into /lib of the build tree.
all-local: swrast_dri.la
$(MKDIR_P) $(top_builddir)/$(LIB_DIR);
ln -f .libs/swrast_dri.so $(top_builddir)/$(LIB_DIR)/swrast_dri.so;
noinst_LTLIBRARIES = libswrast_dri.la
libswrast_dri_la_SOURCES = $(SWRAST_C_FILES)

View File

@ -1,11 +1,5 @@
SWRAST_DRIVER_FILES = \
swrast.c
SWRAST_COMMON_FILES = \
../common/utils.c \
../common/dri_util.c \
../common/xmlconfig.c
SWRAST_C_FILES = \
$(SWRAST_COMMON_FILES) \
$(SWRAST_DRIVER_FILES)

View File

@ -59,6 +59,7 @@
#include "swrast_priv.h"
#include "swrast/s_context.h"
const __DRIextension **__driDriverGetExtensions_swrast(void);
/**
* Screen and config-related functions
@ -819,7 +820,7 @@ dri_unbind_context(__DRIcontext * cPriv)
}
const struct __DriverAPIRec driDriverAPI = {
static const struct __DriverAPIRec swrast_driver_api = {
.InitScreen = dri_init_screen,
.DestroyScreen = dri_destroy_screen,
.CreateContext = dri_create_context,
@ -831,9 +832,21 @@ const struct __DriverAPIRec driDriverAPI = {
.UnbindContext = dri_unbind_context,
};
/* This is the table of extensions that the loader will dlsym() for. */
PUBLIC const __DRIextension *__driDriverExtensions[] = {
static const struct __DRIDriverVtableExtensionRec swrast_vtable = {
.base = { __DRI_DRIVER_VTABLE, 1 },
.vtable = &swrast_driver_api,
};
static const __DRIextension *swrast_driver_extensions[] = {
&driCoreExtension.base,
&driSWRastExtension.base,
&swrast_vtable.base,
NULL
};
PUBLIC const __DRIextension **__driDriverGetExtensions_swrast(void)
{
globalDriverAPI = &swrast_driver_api;
return swrast_driver_extensions;
}