[Mesa-dev] [PATCH 09/15] i965: Build the driver into a shared mesa_dri_drivers.so .
Emil Velikov
emil.l.velikov at gmail.com
Sat Oct 12 03:50:00 CEST 2013
On 12/10/13 02:03, Eric Anholt wrote:
> 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)
>
> v2: 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 at gmail.com> (v1)
> ---
> configure.ac | 29 +++++++++++---
> src/mesa/drivers/dri/Makefile.am | 54 ++++++++++++++++++++++++++-
> src/mesa/drivers/dri/common/Makefile.am | 3 ++
> src/mesa/drivers/dri/common/dri_util.c | 19 +++++++++-
> src/mesa/drivers/dri/common/dri_util.h | 2 +-
> src/mesa/drivers/dri/common/megadriver_stub.c | 41 ++++++++++++++++++++
> src/mesa/drivers/dri/i965/Makefile.am | 27 +++-----------
> src/mesa/drivers/dri/i965/intel_screen.c | 18 +++++++--
> src/mesa/drivers/dri/i965/intel_screen.h | 2 +
> 9 files changed, 162 insertions(+), 33 deletions(-)
> create mode 100644 src/mesa/drivers/dri/common/megadriver_stub.c
>
[...]
> diff --git a/src/mesa/drivers/dri/Makefile.am b/src/mesa/drivers/dri/Makefile.am
> index 48d3685..9d15c43 100644
> --- a/src/mesa/drivers/dri/Makefile.am
> +++ b/src/mesa/drivers/dri/Makefile.am
> @@ -1,4 +1,15 @@
> +dridir = $(DRI_DRIVER_INSTALL_DIR)
> +
> +AM_CPPFLAGS = \
> + -I$(top_srcdir)/src/mesa/ \
> + -I$(top_srcdir)/src/mapi/ \
> + -I$(top_srcdir)/src/mesa/drivers/dri/common \
> + $(LIBDRM_CFLAGS) \
> + $()
> +
Mixed indent - first two includes use tabs
Have you tried out of tree builds ? I'm assuming that we need
+ -I$(top_builddir)/src/mesa/drivers/dri/common \
> SUBDIRS =
> +MEGADRIVERS =
> +MEGADRIVERS_DEPS =
>
> if HAVE_COMMON_DRI
> SUBDIRS+=common
> @@ -9,7 +20,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
> @@ -33,3 +46,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 \
$(AM_V_GEN)for i....
~Emil
More information about the mesa-dev
mailing list