[Mesa-dev] [PATCH 13/14] swrast: Build the driver into the shared mesa_dri_drivers.so.

Eric Anholt eric at anholt.net
Mon Sep 30 13:44:50 PDT 2013


---
 configure.ac                                 | 26 +++++++++++---------------
 src/mesa/drivers/dri/Makefile.am             |  2 ++
 src/mesa/drivers/dri/swrast/Makefile.am      | 18 +++---------------
 src/mesa/drivers/dri/swrast/Makefile.sources |  6 ------
 src/mesa/drivers/dri/swrast/swrast.c         | 17 ++++++++++++++---
 5 files changed, 30 insertions(+), 39 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5649aec..81abdf9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1016,10 +1016,14 @@ 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 -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])
+            fi
+        else
+            CFLAGS="$CFLAGS -DSWRAST_NO_DRM"
         fi
         # ... and build dricommon
         HAVE_COMMON_DRI=yes
@@ -1033,14 +1037,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
@@ -1049,10 +1045,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])
@@ -1969,7 +1965,7 @@ AC_SUBST([ELF_LIB])
 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)
diff --git a/src/mesa/drivers/dri/Makefile.am b/src/mesa/drivers/dri/Makefile.am
index cc1eb2b..23ff9f7 100644
--- a/src/mesa/drivers/dri/Makefile.am
+++ b/src/mesa/drivers/dri/Makefile.am
@@ -47,6 +47,8 @@ endif
 
 if HAVE_SWRAST_DRI
 SUBDIRS+=swrast
+MEGADRIVERS_DEPS += swrast/libswrast_dri.la
+MEGADRIVERS += swrast_dri.so
 endif
 
 pkgconfigdir = $(libdir)/pkgconfig
diff --git a/src/mesa/drivers/dri/swrast/Makefile.am b/src/mesa/drivers/dri/swrast/Makefile.am
index 2034705..6373b76 100644
--- a/src/mesa/drivers/dri/swrast/Makefile.am
+++ b/src/mesa/drivers/dri/swrast/Makefile.am
@@ -30,26 +30,14 @@ AM_CFLAGS = \
 	-I$(top_srcdir)/src/mapi \
 	-I$(top_srcdir)/src/mesa/ \
 	-I$(top_srcdir)/src/mesa/drivers/dri/common \
-	-DSWRAST_NO_DRM \
 	$(DEFINES) \
 	$(VISIBILITY_CFLAGS)
 
 dridir = $(DRI_DRIVER_INSTALL_DIR)
 
 if HAVE_SWRAST_DRI
-dri_LTLIBRARIES = swrast_dri.la
+noinst_LTLIBRARIES = libswrast_dri.la
 endif
 
-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;
+libswrast_dri_la_SOURCES = $(SWRAST_C_FILES)
+libswrast_dri_la_LIBADD = $(DRI_LIB_DEPS)
diff --git a/src/mesa/drivers/dri/swrast/Makefile.sources b/src/mesa/drivers/dri/swrast/Makefile.sources
index fc7ef32..70e432f 100644
--- a/src/mesa/drivers/dri/swrast/Makefile.sources
+++ b/src/mesa/drivers/dri/swrast/Makefile.sources
@@ -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)
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index 4725a7f..166b90c 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -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,19 @@ 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)
+{
+   return swrast_driver_extensions;
+}
-- 
1.8.4.rc3



More information about the mesa-dev mailing list