From c642e87d9f423c78bf631410e858f675292ba0c4 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Mon, 10 Nov 2014 18:59:34 +0000 Subject: auxiliary/vl: rework the build of the VL code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Emil Velikov --- src/gallium/auxiliary/Android.mk | 2 +- src/gallium/auxiliary/Makefile.am | 26 +++++++++++++++++++++++--- src/gallium/auxiliary/Makefile.sources | 1 + src/gallium/auxiliary/SConscript | 2 +- src/gallium/targets/d3dadapter9/Makefile.am | 1 + 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 | 12 +++--------- 14 files changed, 55 insertions(+), 40 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/Android.mk b/src/gallium/auxiliary/Android.mk index 2e7d7a8c701..0bc18317086 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 8010d9b2ae4..4085e510bd1 100644 --- a/src/gallium/auxiliary/Makefile.am +++ b/src/gallium/auxiliary/Makefile.am @@ -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 diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources index eefb013630f..862626461b1 100644 --- a/src/gallium/auxiliary/Makefile.sources +++ b/src/gallium/auxiliary/Makefile.sources @@ -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 diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript index 0acd3c7d285..6cb6b8c6565 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/d3dadapter9/Makefile.am b/src/gallium/targets/d3dadapter9/Makefile.am index 62312369adc..65069240d88 100644 --- a/src/gallium/targets/d3dadapter9/Makefile.am +++ b/src/gallium/targets/d3dadapter9/Makefile.am @@ -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 \ diff --git a/src/gallium/targets/dri/Makefile.am b/src/gallium/targets/dri/Makefile.am index 13c29ad93f1..3c7140d75b5 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 d5759e6ca30..fb2e570f272 100644 --- a/src/gallium/targets/egl-static/Makefile.am +++ b/src/gallium/targets/egl-static/Makefile.am @@ -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 \ diff --git a/src/gallium/targets/gbm/Makefile.am b/src/gallium/targets/gbm/Makefile.am index 77f1adb3067..412bc2b9573 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 e69b4a21cf2..1e2d239efbe 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) \ @@ -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) \ diff --git a/src/gallium/targets/pipe-loader/Makefile.am b/src/gallium/targets/pipe-loader/Makefile.am index 5022550cf67..3d73a51535a 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 fee89237699..1ade4591b76 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) \ @@ -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) \ diff --git a/src/gallium/targets/vdpau/Makefile.am b/src/gallium/targets/vdpau/Makefile.am index c363114c2bc..1c1a690ccbc 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) \ @@ -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) \ diff --git a/src/gallium/targets/xa/Makefile.am b/src/gallium/targets/xa/Makefile.am index 3ab788692c1..ab5b28e1425 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 64092f90929..573abd3b7eb 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) \ @@ -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 \ -- cgit v1.2.3