[Mesa-dev] [PATCH 04/17] auxiliary/vl: split out into a separate static library
Christian König
deathsimple at vodafone.de
Mon Sep 22 01:19:36 PDT 2014
Am 22.09.2014 um 01:44 schrieb Emil Velikov:
> Avoid building the relatively large object every time and forcing
> on the non-vl targets. This gives us the following size improvement
>
> text data bss dec hex filename
> 5898697 189212 1977864 8065773 7b12ed before/nouveau_dri.so
> 5771203 189228 391176 6351607 60eaf7 after/nouveau_dri.so
>
> Other targets (gbm, xa) are likely to exhibit similar savings.
>
> v2: Fix the 'pipe-loader' targets.
>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
That's exactly how I always wanted to do it, just never found the time
to actually look into it.
Thanks a lot for doing this, patch is Reviewed-by: Christian König
<christian.koenig at amd.com>
> ---
> configure.ac | 15 ++++++++---
> src/gallium/auxiliary/Makefile.am | 23 ++++++++++++++++
> src/gallium/auxiliary/Makefile.sources | 39 +++++++++++++++++++++-------
> src/gallium/state_trackers/omx/Makefile.am | 3 ++-
> src/gallium/state_trackers/vdpau/Makefile.am | 4 ++-
> src/gallium/state_trackers/xvmc/Makefile.am | 6 +++--
> src/gallium/targets/omx/Makefile.am | 12 ++++-----
> src/gallium/targets/pipe-loader/Makefile.am | 11 ++++++--
> src/gallium/targets/vdpau/Makefile.am | 13 ++++------
> src/gallium/targets/xvmc/Makefile.am | 11 +++-----
> 10 files changed, 96 insertions(+), 41 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 0cfe970..7e15911 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1413,23 +1413,30 @@ if test -n "$with_gallium_drivers" -a "x$with_gallium_drivers" != xswrast; then
> fi
> fi
>
> +if test "x$enable_xvmc" = xyes -o \
> + "x$enable_vdpau" = xyes -o \
> + "x$enable_omx" = xyes; then
> + PKG_CHECK_MODULES([VL], [x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED])
> + need_gallium_vl=yes
> +fi
> +AM_CONDITIONAL(NEED_GALLIUM_VL, test "x$need_gallium_vl" = xyes)
> +
> if test "x$enable_xvmc" = xyes; then
> - PKG_CHECK_MODULES([XVMC], [xvmc >= $XVMC_REQUIRED x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED])
> + PKG_CHECK_MODULES([XVMC], [xvmc >= $XVMC_REQUIRED])
> GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xvmc"
> enable_gallium_loader=$enable_shared_pipe_drivers
> fi
> AM_CONDITIONAL(HAVE_ST_XVMC, test "x$enable_xvmc" = xyes)
>
> if test "x$enable_vdpau" = xyes; then
> - PKG_CHECK_MODULES([VDPAU], [vdpau >= $VDPAU_REQUIRED x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED],
> - [VDPAU_LIBS="`$PKG_CONFIG --libs x11-xcb xcb xcb-dri2`"])
> + PKG_CHECK_MODULES([VDPAU], [vdpau >= $VDPAU_REQUIRED])
> GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vdpau"
> enable_gallium_loader=$enable_shared_pipe_drivers
> fi
> AM_CONDITIONAL(HAVE_ST_VDPAU, test "x$enable_vdpau" = xyes)
>
> if test "x$enable_omx" = xyes; then
> - PKG_CHECK_MODULES([OMX], [libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED])
> + PKG_CHECK_MODULES([OMX], [libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED])
> GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS omx"
> enable_gallium_loader=$enable_shared_pipe_drivers
> fi
> diff --git a/src/gallium/auxiliary/Makefile.am b/src/gallium/auxiliary/Makefile.am
> index 4d8ba89..e9b027a 100644
> --- a/src/gallium/auxiliary/Makefile.am
> +++ b/src/gallium/auxiliary/Makefile.am
> @@ -46,3 +46,26 @@ indices/u_unfilled_gen.c: $(srcdir)/indices/u_unfilled_gen.py
> util/u_format_table.c: $(srcdir)/util/u_format_table.py $(srcdir)/util/u_format_pack.py $(srcdir)/util/u_format_parse.py $(srcdir)/util/u_format.csv
> $(AM_V_at)$(MKDIR_P) util
> $(AM_V_GEN) $(PYTHON2) $(srcdir)/util/u_format_table.py $(srcdir)/util/u_format.csv > $@
> +
> +
> +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 58d8af7..5f99d24 100644
> --- a/src/gallium/auxiliary/Makefile.sources
> +++ b/src/gallium/auxiliary/Makefile.sources
> @@ -143,20 +143,41 @@ C_SOURCES := \
> util/u_transfer.c \
> util/u_resource.c \
> util/u_upload_mgr.c \
> - util/u_vbuf.c \
> - vl/vl_csc.c \
> + util/u_vbuf.c
> +
> +VL_SOURCES := \
> vl/vl_compositor.c \
> + vl/vl_compositor.h \
> + vl/vl_csc.c \
> + vl/vl_csc.h \
> + vl/vl_decoder.c \
> + vl/vl_decoder.h \
> + vl/vl_defines.h \
> + vl/vl_deint_filter.c \
> + vl/vl_deint_filter.h \
> + vl/vl_idct.c \
> + vl/vl_idct.h \
> vl/vl_matrix_filter.c \
> + vl/vl_matrix_filter.h \
> + vl/vl_mc.c \
> + vl/vl_mc.h \
> vl/vl_median_filter.c \
> - vl/vl_decoder.c \
> - vl/vl_mpeg12_decoder.c \
> + vl/vl_median_filter.h \
> vl/vl_mpeg12_bitstream.c \
> + vl/vl_mpeg12_bitstream.h \
> + vl/vl_mpeg12_decoder.c \
> + vl/vl_mpeg12_decoder.h \
> + vl/vl_rbsp.h \
> + vl/vl_types.h \
> + vl/vl_vertex_buffers.c \
> + vl/vl_vertex_buffers.h \
> + vl/vl_video_buffer.c \
> + vl/vl_video_buffer.h \
> + vl/vl_vlc.h \
> + vl/vl_winsys_dri.c \
> + vl/vl_winsys.h \
> vl/vl_zscan.c \
> - vl/vl_idct.c \
> - vl/vl_mc.c \
> - vl/vl_vertex_buffers.c \
> - vl/vl_video_buffer.c \
> - vl/vl_deint_filter.c
> + vl/vl_zscan.h
>
> GENERATED_SOURCES := \
> indices/u_indices_gen.c \
> diff --git a/src/gallium/state_trackers/omx/Makefile.am b/src/gallium/state_trackers/omx/Makefile.am
> index 68eed02..e039f51 100644
> --- a/src/gallium/state_trackers/omx/Makefile.am
> +++ b/src/gallium/state_trackers/omx/Makefile.am
> @@ -26,7 +26,8 @@ include $(top_srcdir)/src/gallium/Automake.inc
> AM_CFLAGS = \
> $(GALLIUM_CFLAGS) \
> $(VISIBILITY_CFLAGS) \
> - $(OMX_CFLAGS)
> + $(OMX_CFLAGS) \
> + $(VL_CFLAGS)
>
> noinst_LTLIBRARIES = libomxtracker.la
>
> diff --git a/src/gallium/state_trackers/vdpau/Makefile.am b/src/gallium/state_trackers/vdpau/Makefile.am
> index a74b5bf..3102493 100644
> --- a/src/gallium/state_trackers/vdpau/Makefile.am
> +++ b/src/gallium/state_trackers/vdpau/Makefile.am
> @@ -29,7 +29,9 @@ VDPAU_MINOR = 0
> AM_CFLAGS = \
> $(GALLIUM_CFLAGS) \
> $(VISIBILITY_CFLAGS) \
> - $(VDPAU_CFLAGS)
> + $(VDPAU_CFLAGS) \
> + $(VL_CFLAGS)
> +
> AM_CPPFLAGS = \
> -I$(top_srcdir)/include \
> -DVER_MAJOR=$(VDPAU_MAJOR) \
> diff --git a/src/gallium/state_trackers/xvmc/Makefile.am b/src/gallium/state_trackers/xvmc/Makefile.am
> index abaa88e..f6e56a6 100644
> --- a/src/gallium/state_trackers/xvmc/Makefile.am
> +++ b/src/gallium/state_trackers/xvmc/Makefile.am
> @@ -26,7 +26,9 @@ include $(top_srcdir)/src/gallium/Automake.inc
>
> AM_CFLAGS = \
> $(GALLIUM_CFLAGS) \
> - $(XVMC_CFLAGS)
> + $(VISIBILITY_CFLAGS) \
> + $(XVMC_CFLAGS) \
> + $(VL_CFLAGS)
>
> noinst_LTLIBRARIES = libxvmctracker.la
>
> @@ -44,7 +46,7 @@ noinst_PROGRAMS = \
>
> noinst_HEADERS = tests/testlib.h
>
> -TEST_LIBS = $(XVMC_LIBS) -lXvMCW
> +TEST_LIBS = $(XVMC_LIBS) $(VL_LIBS) -lXvMCW
> tests_test_context_SOURCES = tests/test_context.c tests/testlib.c
> tests_test_context_LDADD = $(TEST_LIBS)
> tests_test_surface_SOURCES = tests/test_surface.c tests/testlib.c
> diff --git a/src/gallium/targets/omx/Makefile.am b/src/gallium/targets/omx/Makefile.am
> index 4045548..2889616 100644
> --- a/src/gallium/targets/omx/Makefile.am
> +++ b/src/gallium/targets/omx/Makefile.am
> @@ -7,8 +7,7 @@ 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 \
> @@ -25,14 +24,17 @@ 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) \
> + $(VL_LIBS) \
> + $(LIBDRM_LIBS) \
> $(GALLIUM_COMMON_LIB_DEPS)
>
> if HAVE_GALLIUM_STATIC_TARGETS
>
> -STATIC_TARGET_CPPFLAGS = -DGALLIUM_STATIC_TARGETS=1
> +STATIC_TARGET_CPPFLAGS =
> STATIC_TARGET_LIB_DEPS = \
> $(top_builddir)/src/loader/libloader.la
>
> @@ -80,10 +82,6 @@ libomx_mesa_la_LIBADD += $(STATIC_TARGET_LIB_DEPS)
>
> else # HAVE_GALLIUM_STATIC_TARGETS
>
> -libomx_mesa_la_CPPFLAGS = \
> - $(GALLIUM_PIPE_LOADER_DEFINES) \
> - -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
> -
> # XXX: Use the pipe-loader-client over pipe-loader ?
> libomx_mesa_la_LIBADD += \
> $(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
> diff --git a/src/gallium/targets/pipe-loader/Makefile.am b/src/gallium/targets/pipe-loader/Makefile.am
> index ee93078..ec610e6 100644
> --- a/src/gallium/targets/pipe-loader/Makefile.am
> +++ b/src/gallium/targets/pipe-loader/Makefile.am
> @@ -36,9 +36,16 @@ 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
> +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/vdpau/Makefile.am b/src/gallium/targets/vdpau/Makefile.am
> index 440cf22..485b6e5 100644
> --- a/src/gallium/targets/vdpau/Makefile.am
> +++ b/src/gallium/targets/vdpau/Makefile.am
> @@ -7,8 +7,7 @@ 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 \
> @@ -28,11 +27,13 @@ libvdpau_gallium_la_LDFLAGS += \
> -Wl,--dynamic-list=$(top_srcdir)/src/gallium/targets/dri-vdpau.dyn
> endif # HAVE_LD_DYNAMIC_LIST
>
> +# XXX: libvdpau_gallium does _not_ 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 \
> - $(VDPAU_LIBS) \
> + $(VL_LIBS) \
> $(LIBDRM_LIBS) \
> $(GALLIUM_COMMON_LIB_DEPS)
>
> @@ -40,7 +41,7 @@ libvdpau_gallium_la_LIBADD = \
> if HAVE_GALLIUM_STATIC_TARGETS
>
> MEGADRIVERS =
> -STATIC_TARGET_CPPFLAGS = -DGALLIUM_STATIC_TARGETS=1
> +STATIC_TARGET_CPPFLAGS =
> STATIC_TARGET_LIB_DEPS = \
> $(top_builddir)/src/loader/libloader.la
>
> @@ -91,10 +92,6 @@ libvdpau_gallium_la_LIBADD += $(STATIC_TARGET_LIB_DEPS)
>
> else # HAVE_GALLIUM_STATIC_TARGETS
>
> -libvdpau_gallium_la_CPPFLAGS = \
> - $(GALLIUM_PIPE_LOADER_DEFINES) \
> - -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"
> -
> # XXX: Use the pipe-loader-client over pipe-loader ?
> libvdpau_gallium_la_LIBADD += \
> $(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
> diff --git a/src/gallium/targets/xvmc/Makefile.am b/src/gallium/targets/xvmc/Makefile.am
> index 884bccf..896b61d 100644
> --- a/src/gallium/targets/xvmc/Makefile.am
> +++ b/src/gallium/targets/xvmc/Makefile.am
> @@ -7,8 +7,7 @@ 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 \
> @@ -25,9 +24,11 @@ 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) \
> + $(VL_LIBS) \
> $(LIBDRM_LIBS) \
> $(GALLIUM_COMMON_LIB_DEPS)
>
> @@ -35,7 +36,7 @@ libXvMCgallium_la_LIBADD = \
> if HAVE_GALLIUM_STATIC_TARGETS
>
> MEGADRIVERS =
> -STATIC_TARGET_CPPFLAGS = -DGALLIUM_STATIC_TARGETS=1
> +STATIC_TARGET_CPPFLAGS =
> STATIC_TARGET_LIB_DEPS = \
> $(top_builddir)/src/loader/libloader.la
>
> @@ -64,10 +65,6 @@ libXvMCgallium_la_LIBADD += $(STATIC_TARGET_LIB_DEPS)
>
> 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 \
More information about the mesa-dev
mailing list