[Mesa-dev] [PATCH 5/5] auxiliary/vl: rework the build of the VL code

Emil Velikov emil.l.velikov at gmail.com
Sat Nov 8 20:44:17 PST 2014


Rather than shoving all the VL code for non-VL targets, increasing
their size, just split it out and use it when needed. This gives us
the side effect of building vl_winsys_dri.c once, dropping a few
automake warnings, and reducing the size of the dri modules as below

   text    data     bss     dec     hex filename
5850573  187549 1977928 8016050  7a50b2 before/nouveau_dri.so
5508486  187100  391240 6086826  5ce0aa after/nouveau_dri.so

The above data is for a nouveau + swrast + kms_swrast 'megadriver'.

Cc: Christian K├Ânig <christian.koenig at amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/gallium/auxiliary/Android.mk            |  2 +-
 src/gallium/auxiliary/Makefile.am           | 22 ++++++++++++++++++++++
 src/gallium/auxiliary/Makefile.sources      |  6 ++----
 src/gallium/auxiliary/SConscript            |  2 +-
 src/gallium/targets/dri/Makefile.am         |  1 +
 src/gallium/targets/egl-static/Makefile.am  |  1 +
 src/gallium/targets/gbm/Makefile.am         |  1 +
 src/gallium/targets/omx/Makefile.am         | 11 +++--------
 src/gallium/targets/pipe-loader/Makefile.am | 14 ++++++++++++--
 src/gallium/targets/va/Makefile.am          | 11 +++--------
 src/gallium/targets/vdpau/Makefile.am       | 11 +++--------
 src/gallium/targets/xa/Makefile.am          |  1 +
 src/gallium/targets/xvmc/Makefile.am        | 11 +++--------
 13 files changed, 54 insertions(+), 40 deletions(-)

diff --git a/src/gallium/auxiliary/Android.mk b/src/gallium/auxiliary/Android.mk
index 2e7d7a8..0bc1831 100644
--- a/src/gallium/auxiliary/Android.mk
+++ b/src/gallium/auxiliary/Android.mk
@@ -30,7 +30,7 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := \
 	$(C_SOURCES) \
-	$(VL_SOURCES)
+	$(VL_STUB_SOURCES)
 
 LOCAL_C_INCLUDES := \
 	$(GALLIUM_TOP)/auxiliary/util \
diff --git a/src/gallium/auxiliary/Makefile.am b/src/gallium/auxiliary/Makefile.am
index 1e18e6e..69ae31f 100644
--- a/src/gallium/auxiliary/Makefile.am
+++ b/src/gallium/auxiliary/Makefile.am
@@ -52,3 +52,25 @@ util/u_format_table.c: $(srcdir)/util/u_format_table.py $(srcdir)/util/u_format_
 noinst_LTLIBRARIES += libgalliumvl_stub.la
 libgalliumvl_stub_la_SOURCES = \
 	$(VL_STUB_SOURCES)
+
+if NEED_GALLIUM_VL
+
+noinst_LTLIBRARIES += libgalliumvl.la
+
+libgalliumvl_la_CFLAGS = \
+	$(AM_CFLAGS) \
+	$(VL_CFLAGS) \
+	$(LIBDRM_CFLAGS) \
+	$(GALLIUM_PIPE_LOADER_DEFINES) \
+	-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
+
+if HAVE_GALLIUM_STATIC_TARGETS
+libgalliumvl_la_CFLAGS += \
+	-DGALLIUM_STATIC_TARGETS=1
+
+endif # HAVE_GALLIUM_STATIC_TARGETS
+
+libgalliumvl_la_SOURCES = \
+	$(VL_SOURCES)
+
+endif
diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources
index 66edb4d..f3b95b9 100644
--- a/src/gallium/auxiliary/Makefile.sources
+++ b/src/gallium/auxiliary/Makefile.sources
@@ -175,13 +175,11 @@ VL_SOURCES := \
 	vl/vl_video_buffer.c \
 	vl/vl_video_buffer.h \
 	vl/vl_vlc.h \
+	vl/vl_winsys.h \
+	vl/vl_winsys_dri.c \
 	vl/vl_zscan.c \
 	vl/vl_zscan.h
 
-# XXX: Add those to VL_SOURCES once we've split it out of libgallium
-#	vl/vl_winsys_dri.c \
-#	vl/vl_winsys.h \
-
 VL_STUB_SOURCES := \
 	vl/vl_stubs.c
 
diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript
index 81c4f4c..4984434 100644
--- a/src/gallium/auxiliary/SConscript
+++ b/src/gallium/auxiliary/SConscript
@@ -36,7 +36,7 @@ env.Depends('util/u_format_table.c', [
 
 source = env.ParseSourceList('Makefile.sources', [
     'C_SOURCES',
-    'VL_SOURCES',
+    'VL_STUB_SOURCES',
     'GENERATED_SOURCES'
 ])
 
diff --git a/src/gallium/targets/dri/Makefile.am b/src/gallium/targets/dri/Makefile.am
index 1094ffd..898ab46 100644
--- a/src/gallium/targets/dri/Makefile.am
+++ b/src/gallium/targets/dri/Makefile.am
@@ -43,6 +43,7 @@ gallium_dri_la_LIBADD = \
 	$(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \
 	$(top_builddir)/src/mesa/drivers/dri/common/libmegadriver_stub.la \
 	$(top_builddir)/src/gallium/state_trackers/dri/libdri.la \
+	$(top_builddir)/src/gallium/auxiliary/libgalliumvl_stub.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
 	$(top_builddir)/src/gallium/drivers/galahad/libgalahad.la \
 	$(top_builddir)/src/gallium/drivers/noop/libnoop.la \
diff --git a/src/gallium/targets/egl-static/Makefile.am b/src/gallium/targets/egl-static/Makefile.am
index 3f0e650..b188f82 100644
--- a/src/gallium/targets/egl-static/Makefile.am
+++ b/src/gallium/targets/egl-static/Makefile.am
@@ -63,6 +63,7 @@ egl_gallium_la_SOURCES = \
 
 egl_gallium_la_LIBADD = \
 	$(top_builddir)/src/loader/libloader.la \
+	$(top_builddir)/src/gallium/auxiliary/libgalliumvl_stub.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
 	$(top_builddir)/src/gallium/drivers/identity/libidentity.la \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
diff --git a/src/gallium/targets/gbm/Makefile.am b/src/gallium/targets/gbm/Makefile.am
index 2c9b425..999c84c 100644
--- a/src/gallium/targets/gbm/Makefile.am
+++ b/src/gallium/targets/gbm/Makefile.am
@@ -33,6 +33,7 @@ gbm_gallium_drm_la_SOURCES =
 
 gbm_gallium_drm_la_LIBADD = \
 	$(top_builddir)/src/gallium/state_trackers/gbm/libgbm.la \
+	$(top_builddir)/src/gallium/auxiliary/libgalliumvl_stub.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
 	$(top_builddir)/src/util/libmesautil.la \
 	$(LIBDRM_LIBS) \
diff --git a/src/gallium/targets/omx/Makefile.am b/src/gallium/targets/omx/Makefile.am
index 5f4106c..e25779e 100644
--- a/src/gallium/targets/omx/Makefile.am
+++ b/src/gallium/targets/omx/Makefile.am
@@ -1,15 +1,13 @@
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-	$(VL_CFLAGS) \
 	$(GALLIUM_TARGET_CFLAGS)
 
 omxdir = $(OMX_LIB_INSTALL_DIR)
 omx_LTLIBRARIES = libomx_mesa.la
 
 nodist_EXTRA_libomx_mesa_la_SOURCES = dummy.cpp
-libomx_mesa_la_SOURCES = \
-	$(top_srcdir)/src/gallium/auxiliary/vl/vl_winsys_dri.c
+libomx_mesa_la_SOURCES =
 
 libomx_mesa_la_LDFLAGS = \
 	-shared \
@@ -26,6 +24,7 @@ endif # HAVE_LD_VERSION_SCRIPT
 
 libomx_mesa_la_LIBADD = \
 	$(top_builddir)/src/gallium/state_trackers/omx/libomxtracker.la \
+	$(top_builddir)/src/gallium/auxiliary/libgalliumvl.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
 	$(top_builddir)/src/util/libmesautil.la \
 	$(OMX_LIBS) \
@@ -46,16 +45,12 @@ include $(top_srcdir)/src/gallium/drivers/r600/Automake.inc
 include $(top_srcdir)/src/gallium/drivers/radeonsi/Automake.inc
 
 libomx_mesa_la_SOURCES += target.c
-libomx_mesa_la_CPPFLAGS = $(TARGET_CPPFLAGS) -DGALLIUM_STATIC_TARGETS=1
+libomx_mesa_la_CPPFLAGS = $(TARGET_CPPFLAGS)
 libomx_mesa_la_LIBADD += $(TARGET_LIB_DEPS) \
 	$(TARGET_RADEON_WINSYS) $(TARGET_RADEON_COMMON)
 
 else # HAVE_GALLIUM_STATIC_TARGETS
 
-libomx_mesa_la_CPPFLAGS = \
-	$(GALLIUM_PIPE_LOADER_DEFINES) \
-	-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
-
 libomx_mesa_la_LIBADD += \
 	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
 	$(GALLIUM_PIPE_LOADER_WINSYS_LIBS) \
diff --git a/src/gallium/targets/pipe-loader/Makefile.am b/src/gallium/targets/pipe-loader/Makefile.am
index f122017..bdf508b 100644
--- a/src/gallium/targets/pipe-loader/Makefile.am
+++ b/src/gallium/targets/pipe-loader/Makefile.am
@@ -36,9 +36,19 @@ AM_CPPFLAGS = \
 pipedir = $(libdir)/gallium-pipe
 pipe_LTLIBRARIES =
 
-PIPE_LIBS = \
+PIPE_LIBS =
+
+if NEED_GALLIUM_VL
+PIPE_LIBS += \
+	$(top_builddir)/src/gallium/auxiliary/libgalliumvl.la
+else
+PIPE_LIBS += \
+	$(top_builddir)/src/gallium/auxiliary/libgalliumvl_stub.la
+endif
+
+PIPE_LIBS += \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
-        $(top_builddir)/src/util/libmesautil.la \
+	$(top_builddir)/src/util/libmesautil.la \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/drivers/galahad/libgalahad.la \
diff --git a/src/gallium/targets/va/Makefile.am b/src/gallium/targets/va/Makefile.am
index 9fbdc58..ccf2f37 100644
--- a/src/gallium/targets/va/Makefile.am
+++ b/src/gallium/targets/va/Makefile.am
@@ -1,15 +1,13 @@
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-	$(VL_CFLAGS) \
 	$(GALLIUM_TARGET_CFLAGS)
 
 vadir = $(VA_LIB_INSTALL_DIR)
 va_LTLIBRARIES = gallium_drv_video.la
 
 nodist_EXTRA_gallium_drv_video_la_SOURCES = dummy.cpp
-gallium_drv_video_la_SOURCES = \
-	$(top_srcdir)/src/gallium/auxiliary/vl/vl_winsys_dri.c
+gallium_drv_video_la_SOURCES =
 
 gallium_drv_video_la_LDFLAGS = \
 	-shared \
@@ -27,6 +25,7 @@ endif # HAVE_LD_VERSION_SCRIPT
 # NOTE: gallium_drv_video does not use(link against) libva
 gallium_drv_video_la_LIBADD = \
 	$(top_builddir)/src/gallium/state_trackers/va/libvatracker.la \
+	$(top_builddir)/src/gallium/auxiliary/libgalliumvl.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
 	$(top_builddir)/src/util/libmesautil.la \
 	$(VL_LIBS) \
@@ -43,16 +42,12 @@ include $(top_srcdir)/src/gallium/drivers/r600/Automake.inc
 include $(top_srcdir)/src/gallium/drivers/radeonsi/Automake.inc
 
 gallium_drv_video_la_SOURCES += target.c
-gallium_drv_video_la_CPPFLAGS = $(TARGET_CPPFLAGS) -DGALLIUM_STATIC_TARGETS=1
+gallium_drv_video_la_CPPFLAGS = $(TARGET_CPPFLAGS)
 gallium_drv_video_la_LIBADD += $(TARGET_LIB_DEPS) \
 	$(TARGET_RADEON_WINSYS) $(TARGET_RADEON_COMMON)
 
 else # HAVE_GALLIUM_STATIC_TARGETS
 
-gallium_drv_video_la_CPPFLAGS = \
-	$(GALLIUM_PIPE_LOADER_DEFINES) \
-	-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
-
 gallium_drv_video_la_LIBADD += \
 	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
 	$(GALLIUM_PIPE_LOADER_WINSYS_LIBS) \
diff --git a/src/gallium/targets/vdpau/Makefile.am b/src/gallium/targets/vdpau/Makefile.am
index 7059306..2ee6a69 100644
--- a/src/gallium/targets/vdpau/Makefile.am
+++ b/src/gallium/targets/vdpau/Makefile.am
@@ -1,15 +1,13 @@
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-	$(VL_CFLAGS) \
 	$(GALLIUM_TARGET_CFLAGS)
 
 vdpaudir = $(VDPAU_LIB_INSTALL_DIR)
 vdpau_LTLIBRARIES = libvdpau_gallium.la
 
 nodist_EXTRA_libvdpau_gallium_la_SOURCES = dummy.cpp
-libvdpau_gallium_la_SOURCES = \
-	$(top_srcdir)/src/gallium/auxiliary/vl/vl_winsys_dri.c
+libvdpau_gallium_la_SOURCES =
 
 libvdpau_gallium_la_LDFLAGS = \
 	-shared \
@@ -32,6 +30,7 @@ endif # HAVE_LD_DYNAMIC_LIST
 # NOTE: libvdpau_gallium does not use(link against) libvdpau
 libvdpau_gallium_la_LIBADD = \
 	$(top_builddir)/src/gallium/state_trackers/vdpau/libvdpautracker.la \
+	$(top_builddir)/src/gallium/auxiliary/libgalliumvl.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
 	$(top_builddir)/src/util/libmesautil.la \
 	$(VL_LIBS) \
@@ -51,16 +50,12 @@ include $(top_srcdir)/src/gallium/drivers/radeonsi/Automake.inc
 if HAVE_GALLIUM_STATIC_TARGETS
 
 libvdpau_gallium_la_SOURCES += target.c
-libvdpau_gallium_la_CPPFLAGS = $(TARGET_CPPFLAGS) -DGALLIUM_STATIC_TARGETS=1
+libvdpau_gallium_la_CPPFLAGS = $(TARGET_CPPFLAGS)
 libvdpau_gallium_la_LIBADD += $(TARGET_LIB_DEPS) \
 	$(TARGET_RADEON_WINSYS) $(TARGET_RADEON_COMMON)
 
 else # HAVE_GALLIUM_STATIC_TARGETS
 
-libvdpau_gallium_la_CPPFLAGS = \
-	$(GALLIUM_PIPE_LOADER_DEFINES) \
-	-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
-
 libvdpau_gallium_la_LIBADD += \
 	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
 	$(GALLIUM_PIPE_LOADER_WINSYS_LIBS) \
diff --git a/src/gallium/targets/xa/Makefile.am b/src/gallium/targets/xa/Makefile.am
index 77d9fa6..052fa35 100644
--- a/src/gallium/targets/xa/Makefile.am
+++ b/src/gallium/targets/xa/Makefile.am
@@ -35,6 +35,7 @@ libxatracker_la_SOURCES =
 
 libxatracker_la_LIBADD = \
 	$(top_builddir)/src/gallium/state_trackers/xa/libxatracker.la \
+	$(top_builddir)/src/gallium/auxiliary/libgalliumvl_stub.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
 	$(top_builddir)/src/util/libmesautil.la \
 	$(LIBDRM_LIBS) \
diff --git a/src/gallium/targets/xvmc/Makefile.am b/src/gallium/targets/xvmc/Makefile.am
index 49cb75e..178dfa9 100644
--- a/src/gallium/targets/xvmc/Makefile.am
+++ b/src/gallium/targets/xvmc/Makefile.am
@@ -1,15 +1,13 @@
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-	$(VL_CFLAGS) \
 	$(GALLIUM_TARGET_CFLAGS)
 
 xvmcdir = $(XVMC_LIB_INSTALL_DIR)
 xvmc_LTLIBRARIES = libXvMCgallium.la
 
 nodist_EXTRA_libXvMCgallium_la_SOURCES = dummy.cpp
-libXvMCgallium_la_SOURCES = \
-	$(top_srcdir)/src/gallium/auxiliary/vl/vl_winsys_dri.c
+libXvMCgallium_la_SOURCES =
 
 libXvMCgallium_la_LDFLAGS = \
 	-shared \
@@ -26,6 +24,7 @@ endif # HAVE_LD_VERSION_SCRIPT
 
 libXvMCgallium_la_LIBADD = \
 	$(top_builddir)/src/gallium/state_trackers/xvmc/libxvmctracker.la \
+	$(top_builddir)/src/gallium/auxiliary/libgalliumvl.la \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
 	$(top_builddir)/src/util/libmesautil.la \
 	$(XVMC_LIBS) \
@@ -45,16 +44,12 @@ include $(top_srcdir)/src/gallium/drivers/r600/Automake.inc
 if HAVE_GALLIUM_STATIC_TARGETS
 
 libXvMCgallium_la_SOURCES += target.c
-libXvMCgallium_la_CPPFLAGS = $(TARGET_CPPFLAGS) -DGALLIUM_STATIC_TARGETS=1
+libXvMCgallium_la_CPPFLAGS = $(TARGET_CPPFLAGS)
 libXvMCgallium_la_LIBADD += $(TARGET_LIB_DEPS) \
 	$(TARGET_RADEON_WINSYS) $(TARGET_RADEON_COMMON)
 
 else # HAVE_GALLIUM_STATIC_TARGETS
 
-libXvMCgallium_la_CPPFLAGS = \
-	$(GALLIUM_PIPE_LOADER_DEFINES) \
-	-DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
-
 # XXX: Use the pipe-loader-client over pipe-loader ?
 libXvMCgallium_la_LIBADD += \
 	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
-- 
2.1.3



More information about the mesa-dev mailing list