summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-06-26 13:04:51 -0700
committerEric Anholt <[email protected]>2013-10-24 14:12:58 -0700
commit1925a9aebd64b2e08574118891394d9d56db25ae (patch)
tree45bbbf5e0456b9bec210e08c3be349c82fa987c6 /src/mesa/drivers/dri/i965
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 <[email protected]> (v1) Reviewed-by: Emil Velikov <[email protected]> (v2)
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r--src/mesa/drivers/dri/i965/Makefile.am27
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c18
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.h2
3 files changed, 22 insertions, 25 deletions
diff --git a/src/mesa/drivers/dri/i965/Makefile.am b/src/mesa/drivers/dri/i965/Makefile.am
index 71442dd9a64..589a0742b1a 100644
--- a/src/mesa/drivers/dri/i965/Makefile.am
+++ b/src/mesa/drivers/dri/i965/Makefile.am
@@ -38,30 +38,19 @@ AM_CFLAGS = \
AM_CXXFLAGS = $(AM_CFLAGS)
-dridir = $(DRI_DRIVER_INSTALL_DIR)
-
noinst_LTLIBRARIES = libi965_dri.la
-dri_LTLIBRARIES = i965_dri.la
-
libi965_dri_la_SOURCES = $(i965_FILES)
+libi965_dri_la_LIBADD = $(INTEL_LIBS)
-# list of libs to be linked against by i965_dri.so and i965 test programs.
-COMMON_LIBS = \
+TEST_LIBS = \
libi965_dri.la \
../common/libdricommon.la \
- $(DRI_LIB_DEPS) \
- $(INTEL_LIBS)
-
-TEST_LIBS = \
- $(COMMON_LIBS) \
+ ../common/libmegadriver_stub.la \
+ $(MEGADRIVER_DRI_LIB_DEPS) \
+ ../../../libmesa.la \
-lrt \
../common/libdri_test_stubs.la
-i965_dri_la_SOURCES =
-nodist_EXTRA_i965_dri_la_SOURCES = dummy2.cpp
-i965_dri_la_LIBADD = $(COMMON_LIBS)
-i965_dri_la_LDFLAGS = $(DRI_DRIVER_LDFLAGS)
-
TESTS = \
test_eu_compact \
test_vec4_register_coalesce
@@ -77,9 +66,3 @@ test_eu_compact_SOURCES = \
test_eu_compact.c
nodist_EXTRA_test_eu_compact_SOURCES = dummy.cpp
test_eu_compact_LDADD = $(TEST_LIBS)
-
-# 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: i965_dri.la
- $(MKDIR_P) $(top_builddir)/$(LIB_DIR);
- ln -f .libs/i965_dri.so $(top_builddir)/$(LIB_DIR)/i965_dri.so;
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 6cec60eae43..eafafa2ccdf 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -1314,7 +1314,7 @@ intelReleaseBuffer(__DRIscreen *screen, __DRIbuffer *buffer)
}
-const struct __DriverAPIRec driDriverAPI = {
+static const struct __DriverAPIRec brw_driver_api = {
.InitScreen = intelInitScreen2,
.DestroyScreen = intelDestroyScreen,
.CreateContext = brwCreateContext,
@@ -1327,10 +1327,22 @@ const struct __DriverAPIRec driDriverAPI = {
.ReleaseBuffer = intelReleaseBuffer
};
-/* This is the table of extensions that the loader will dlsym() for. */
-PUBLIC const __DRIextension *__driDriverExtensions[] = {
+static const struct __DRIDriverVtableExtensionRec brw_vtable = {
+ .base = { __DRI_DRIVER_VTABLE, 1 },
+ .vtable = &brw_driver_api,
+};
+
+static const __DRIextension *brw_driver_extensions[] = {
&driCoreExtension.base,
&driDRI2Extension.base,
+ &brw_vtable.base,
&brw_config_options.base,
NULL
};
+
+PUBLIC const __DRIextension **__driDriverGetExtensions_i965(void)
+{
+ globalDriverAPI = &brw_driver_api;
+
+ return brw_driver_extensions;
+}
diff --git a/src/mesa/drivers/dri/i965/intel_screen.h b/src/mesa/drivers/dri/i965/intel_screen.h
index 0b75c6e6e71..eb9bfca1482 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.h
+++ b/src/mesa/drivers/dri/i965/intel_screen.h
@@ -67,6 +67,8 @@ extern void intelDestroyContext(__DRIcontext * driContextPriv);
extern GLboolean intelUnbindContext(__DRIcontext * driContextPriv);
+PUBLIC const __DRIextension **__driDriverGetExtensions_i965(void);
+
extern GLboolean
intelMakeCurrent(__DRIcontext * driContextPriv,
__DRIdrawable * driDrawPriv,