summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/Makefile.am
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-06-26 13:04:51 -0700
committerEric Anholt <eric@anholt.net>2013-10-24 14:12:58 -0700
commit1925a9aebd64b2e08574118891394d9d56db25ae (patch)
tree45bbbf5e0456b9bec210e08c3be349c82fa987c6 /src/mesa/drivers/dri/Makefile.am
parent4e54751624db7cb07cb4d36c3e683d9ed0a30016 (diff)
i965: Build the driver into a shared mesa_dri_drivers.so .
Previously, we've split things such that mesa core is in libdricore, exposing the whole Mesa core interface in the global namespace, and the i965_dri.so code all links against that. Along with polluting application namespace terribly, it requires extra PLT indirections and prevents LTO. Instead, we can build all of the driver contents into the same .so with just a few symbols exposed to be referenced from the actual driver .so file, allowing LTO and reducing our exposed symbol count massively. FPS improvement on GLB2.7 with INTEL_NO_HW=1: 2.61061% +/- 1.16957% (n=50) (without LTO, just the PLT reductions from this commit) Note that the X Server requires commit 7ecfab47eb221dbb996ea6c033348b8eceaeb893 to successfully load this driver! v2: Set a global driverAPI variable so loaders don't have to update to createNewScreen2() (though they may want to for thread safety). v3: Drop AM_CPPFLAGS addition (Emil pointed out I'd missed some cflags that would be necessary, though only if we actually relied on them). v4: Fix install with DESTDIR set. Reviewed-by: Matt Turner <mattst88@gmail.com> (v1) Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> (v2)
Diffstat (limited to 'src/mesa/drivers/dri/Makefile.am')
-rw-r--r--src/mesa/drivers/dri/Makefile.am47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/Makefile.am b/src/mesa/drivers/dri/Makefile.am
index 7fa0ad73d01..7c573566898 100644
--- a/src/mesa/drivers/dri/Makefile.am
+++ b/src/mesa/drivers/dri/Makefile.am
@@ -1,4 +1,8 @@
+dridir = $(DRI_DRIVER_INSTALL_DIR)
+
SUBDIRS =
+MEGADRIVERS =
+MEGADRIVERS_DEPS =
SUBDIRS+=common
@@ -7,7 +11,9 @@ SUBDIRS+=i915
endif
if HAVE_I965_DRI
-SUBDIRS+=i965
+SUBDIRS += i965
+MEGADRIVERS_DEPS += i965/libi965_dri.la
+MEGADRIVERS += i965_dri.so
endif
if HAVE_NOUVEAU_DRI
@@ -31,3 +37,42 @@ pkgconfig_DATA = dri.pc
driincludedir = $(includedir)/GL/internal
driinclude_HEADERS = $(top_srcdir)/include/GL/internal/dri_interface.h
+
+nodist_EXTRA_mesa_dri_drivers_la_SOURCES = dummy.cpp
+mesa_dri_drivers_la_SOURCES =
+mesa_dri_drivers_la_LDFLAGS = \
+ -module -avoid-version -shared \
+ -Wl,-Bsymbolic \
+ $()
+mesa_dri_drivers_la_LIBADD = \
+ ../../libmesa.la \
+ common/libmegadriver_stub.la \
+ common/libdricommon.la \
+ $(MEGADRIVERS_DEPS) \
+ $(MEGADRIVER_DRI_LIB_DEPS) \
+ $()
+
+if NEED_MEGADRIVER
+dri_LTLIBRARIES = mesa_dri_drivers.la
+
+# Add a link to allow setting LD_LIBRARY_PATH/LIBGL_DRIVERS_PATH to /lib of the build tree.
+all-local: mesa_dri_drivers.la
+ $(MKDIR_P) $(top_builddir)/$(LIB_DIR);
+ $(AM_V_GEN)ln -f .libs/mesa_dri_drivers.so \
+ $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so;
+ $(AM_V_GEN)for i in $(MEGADRIVERS); do \
+ ln -f $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so \
+ $(top_builddir)/$(LIB_DIR)/$$i; \
+ done;
+
+# hardlink each megadriver instance, but don't actually have
+# mesa_dri_drivers.so in the set of final installed files.
+install-data-hook:
+ for i in $(MEGADRIVERS); do \
+ ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so \
+ $(DESTDIR)$(dridir)/$$i; \
+ done;
+ $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so
+ $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.la
+
+endif