auxiliary/vl: rework the build of the VL code
authorEmil Velikov <emil.l.velikov@gmail.com>
Mon, 10 Nov 2014 18:59:34 +0000 (18:59 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 26 Nov 2014 20:09:09 +0000 (20:09 +0000)
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'.

v2: Do not include the vl sources in the auxiliary library.
v3: Rebase. Add nine.

Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
14 files changed:
src/gallium/auxiliary/Android.mk
src/gallium/auxiliary/Makefile.am
src/gallium/auxiliary/Makefile.sources
src/gallium/auxiliary/SConscript
src/gallium/targets/d3dadapter9/Makefile.am
src/gallium/targets/dri/Makefile.am
src/gallium/targets/egl-static/Makefile.am
src/gallium/targets/gbm/Makefile.am
src/gallium/targets/omx/Makefile.am
src/gallium/targets/pipe-loader/Makefile.am
src/gallium/targets/va/Makefile.am
src/gallium/targets/vdpau/Makefile.am
src/gallium/targets/xa/Makefile.am
src/gallium/targets/xvmc/Makefile.am

index 2e7d7a8c701f16f103888b269da615ef0a16bee8..0bc183170868c7ab1d0db10d127bd340078cc4dd 100644 (file)
@@ -30,7 +30,7 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := \
        $(C_SOURCES) \
-       $(VL_SOURCES)
+       $(VL_STUB_SOURCES)
 
 LOCAL_C_INCLUDES := \
        $(GALLIUM_TOP)/auxiliary/util \
index 8010d9b2ae4dad098bb0a3882edb1ffcf564139f..4085e510bd1180df28bbafd524549f00b8d418c6 100644 (file)
@@ -18,7 +18,6 @@ AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
 
 libgallium_la_SOURCES = \
        $(C_SOURCES) \
-       $(VL_SOURCES) \
        $(GENERATED_SOURCES)
 
 if HAVE_MESA_LLVM
@@ -52,6 +51,28 @@ 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
+
 EXTRA_DIST = \
        Android.mk SConscript \
        indices/u_indices.c \
@@ -62,5 +83,4 @@ EXTRA_DIST = \
        util/u_format.csv \
        util/u_format_pack.py \
        util/u_format_parse.py \
-       util/u_format_table.py \
-       vl/vl_winsys_dri.c
+       util/u_format_table.py
index eefb013630fd6cb461a1c6cd0040b460563984c4..862626461b135c602fbb42d22e49388366f42b5c 100644 (file)
@@ -335,6 +335,7 @@ VL_SOURCES := \
        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
 
index 0acd3c7d2851fd3ff88355ebcedfcd03c6dec74d..6cb6b8c656561ed493acab0300b9c4e80203f5dd 100644 (file)
@@ -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'
 ])
 
index 62312369adcc99cf55331e62278c7e06e9b0035a..65069240d883c46cace53478c1502ab7b75f1c9e 100644 (file)
@@ -72,6 +72,7 @@ d3dadapter9_la_LDFLAGS += \
 endif # HAVE_LD_VERSION_SCRIPT
 
 d3dadapter9_la_LIBADD = \
+       $(top_builddir)/src/gallium/auxiliary/libgalliumvl_stub.la \
        $(top_builddir)/src/gallium/auxiliary/libgallium.la \
        $(top_builddir)/src/gallium/state_trackers/nine/libninetracker.la \
        $(top_builddir)/src/util/libmesautil.la \
index 13c29ad93f1f8fb00777a71ef25f84ea9194d47a..3c7140d75b5c528e73cf0e9256cf5e66e8540305 100644 (file)
@@ -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 \
index d5759e6ca3070d954a6cff42eccf206a7b64c603..fb2e570f272411689ad8eae6cc1620c79f0ed4f0 100644 (file)
@@ -65,6 +65,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 \
index 77f1adb3067cf964c06e00fe3a4a626a76dc09df..412bc2b957322374c1b68ba4522379bd3f37774d 100644 (file)
@@ -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) \
index e69b4a21cf2833472abc495cdbc05eeacb8837ee..1e2d239efbef9dbd529f52a2b7ea66ad60d3722c 100644 (file)
@@ -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) \
@@ -48,16 +47,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) \
index 5022550cf6749feda981bfc983dd6db1b5b92c0c..3d73a51535af9783230cbe74515c64c7511b63b0 100644 (file)
@@ -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 \
index fee892376994af0d3f23f94464cd8e4666b89582..1ade4591b7632396119ce921fcbe1efecb150e35 100644 (file)
@@ -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) \
@@ -45,16 +44,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) \
index c363114c2bc9319d64bb5fe7180d04aa81f47794..1c1a690ccbc37e295e2af6786d93bb2dd2a469d4 100644 (file)
@@ -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) \
@@ -55,16 +54,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) \
index 3ab788692c14005891484cbc9e8d850a2ee796b3..ab5b28e14258e47280e0afd1d3965d521831d697 100644 (file)
@@ -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) \
index 64092f90929f3d8d44c5e0334ce7ac1c531dbfb7..573abd3b7ebf658a27247d0616980676eca781d4 100644 (file)
@@ -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) \
@@ -46,16 +45,11 @@ 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 \