v2: - set with_gallium_xvmc when -Dgallium-xvmc=true - Install megadrivers properly - only use cflags from pkg-config, don't add linker flags. v4: - make use of the install_megadrivers.py changes v5: - adapt for install_megadrivers changes
Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com> --- meson.build | 40 ++++++++++++++- meson_options.txt | 13 +++++ src/gallium/meson.build | 7 ++- src/gallium/state_trackers/xvmc/meson.build | 53 ++++++++++++++++++++ src/gallium/targets/xvmc/meson.build | 77 +++++++++++++++++++++++++++++ 5 files changed, 188 insertions(+), 2 deletions(-) create mode 100644 src/gallium/state_trackers/xvmc/meson.build create mode 100644 src/gallium/targets/xvmc/meson.build diff --git a/meson.build b/meson.build index 0f8733f7651..9e4460e15c5 100644 --- a/meson.build +++ b/meson.build @@ -391,6 +391,44 @@ if vdpau_drivers_path == '' vdpau_drivers_path = join_paths(get_option('libdir'), 'vdpau') endif +dep_xvmc = [] +_xvmc = get_option('gallium-xvmc') +if _xvmc == 'auto' + if not ['linux', 'bsd'].contains(host_machine.system()) + with_gallium_xvmc = false + elif not with_platform_x11 + with_gallium_xvmc = false + elif not (with_gallium_r600 or with_gallium_nouveau) + with_gallium_xvmc = false + else + dep_xvmc = dependency('xvmc', version : '>= 1.0.6', required : false) + with_gallium_xvmc = dep_xvmc.found() + endif +elif _xvmc == 'true' + if not ['linux', 'bsd'].contains(host_machine.system()) + error('XVMC state tracker can only be build on unix-like OSes.') + elif not with_platform_x11 + error('XVMC state tracker requires X11 support.') + with_gallium_xvmc = false + elif not (with_gallium_r600 or with_gallium_nouveau) + error('XVMC state tracker requires at least one of the following gallium drivers: r600, nouveau.') + endif + dep_xvmc = dependency('xvmc', version : '>= 1.0.6') + with_gallium_xvmc = true +else + with_gallium_xvmc = false +endif +if with_gallium_xvmc + dep_xvmc = declare_dependency( + compile_args : dep_xvmc.get_pkgconfig_variable('cflags').split() + ) +endif + +xvmc_drivers_path = get_option('xvmc-libs-path') +if xvmc_drivers_path == '' + xvmc_drivers_path = get_option('libdir') +endif + gl_pkgconfig_c_flags = [] if with_platform_x11 if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm') @@ -898,7 +936,7 @@ if with_platform_x11 dep_xxf86vm = dependency('xxf86vm', required : false) endif if (with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm') or - with_gallium_vdpau) + (with_gallium_vdpau or with_gallium_xvmc)) dep_xcb = dependency('xcb') dep_x11_xcb = dependency('x11-xcb') dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8') diff --git a/meson_options.txt b/meson_options.txt index 78b78a92dbf..f0de44e751b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -62,6 +62,19 @@ option( value : '', description : 'path to put vdpau libraries. defaults to $libdir/vdpau.' ) +option( + 'gallium-xvmc', + type : 'combo', + value : 'auto', + choices : ['auto', 'true', 'false'], + description : 'enable gallium xvmc state tracker.', +) +option( + 'xvmc-libs-path', + type : 'string', + value : '', + description : 'path to put xvmc libraries. defaults to $libdir.' +) option( 'vulkan-drivers', type : 'string', diff --git a/src/gallium/meson.build b/src/gallium/meson.build index 446710e1495..a8317a53552 100644 --- a/src/gallium/meson.build +++ b/src/gallium/meson.build @@ -102,6 +102,9 @@ endif if with_gallium_vdpau subdir('state_trackers/vdpau') endif +if with_gallium_xvmc + subdir('state_trackers/xvmc') +endif # TODO: SWR # TODO: clover if with_dri and with_gallium @@ -116,9 +119,11 @@ endif if with_gallium_vdpau subdir('targets/vdpau') endif +if with_gallium_xvmc + subdir('targets/xvmc') +endif # TODO: OMX # TODO: VA # TODO: xa -# TODO: xvmc # TODO: nine # TODO: tests diff --git a/src/gallium/state_trackers/xvmc/meson.build b/src/gallium/state_trackers/xvmc/meson.build new file mode 100644 index 00000000000..a1022c164b1 --- /dev/null +++ b/src/gallium/state_trackers/xvmc/meson.build @@ -0,0 +1,53 @@ +# Copyright © 2017 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +libxvmc_st = static_library( + 'xvmc_st', + files('attributes.c', 'block.c', 'context.c', 'surface.c', 'subpicture.c'), + c_args : [c_vis_args], + include_directories : [inc_common], + dependencies : [dep_xvmc, dep_x11_xcb, dep_xcb, dep_xcb_dri2, dep_xcb_dri3], +) + +# These tests will not work without a working xvmc configuration. +if with_tests + dep_xvmcw = cc.find_library('XvMCW') + dep_real_xvmc = dependency('xvmc') + foreach x : ['context', 'surface', 'subpicture', 'blocks', 'rendering'] + _name = 'xvmc_@0@'.format(x) + test(_name, executable( + _name, + files('tests/test_@0@.c'.format(x), 'tests/testlib.c'), + dependencies : [ + dep_real_xvmc, dep_x11_xcb, dep_xcb, dep_xcb_dri2, dep_xcb_dri3, dep_xvmcw, + ], + ) + ) + endforeach + + test('xbmc_bench', executable( + 'xvmc_bench', + files('tests/xvmc_bench.c', 'tests/testlib.c'), + dependencies : [ + dep_real_xvmc, dep_x11_xcb, dep_xcb, dep_xcb_dri2, dep_xcb_dri3, dep_xvmcw, + ], + ) + ) +endif diff --git a/src/gallium/targets/xvmc/meson.build b/src/gallium/targets/xvmc/meson.build new file mode 100644 index 00000000000..43191ed91a4 --- /dev/null +++ b/src/gallium/targets/xvmc/meson.build @@ -0,0 +1,77 @@ +# Copyright © 2017 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +# TODO: support non-static targets +# Static targets are always enabled in autotools (unless you modify +# configure.ac) + +xvmc_deps = [] +xvmc_c_args = [] +xvmc_link_args = [] +xvmc_link_with = [] +xvmc_link_depends = [] +xvmc_drivers = [] + +if with_llvm + xvmc_deps += dep_llvm +endif +if with_ld_version_script + xvmc_link_args += ['-Wl,--version-script', join_paths(meson.current_source_dir(), 'xvmc.sym')] + xvmc_link_depends += files('xvmc.sym') +endif + +if with_gallium_r600 + xvmc_c_args += '-DGALLIUM_R600' + xvmc_link_with += [libr600, libradeonwinsys] + xvmc_deps += [dep_elf, dep_libdrm_radeon] + xvmc_drivers += 'libXvMCr600.so.1.0.0' +endif +if with_gallium_nouveau + xvmc_c_args += '-DGALLIUM_NOUVEAU' + xvmc_link_with += [libnouveau, libnouveauwinsys] + xvmc_deps += dep_libdrm_nouveau + xvmc_drivers += 'libXvMCnouveau.so.1.0.0' +endif + +libxvmc_gallium = shared_library( + 'XvMCgallium', + 'target.c', + c_args : [c_vis_args, xvmc_c_args], + cpp_args : cpp_vis_args, + link_args : [xvmc_link_args, ld_args_gc_sections], + include_directories : [ + inc_common, inc_util, inc_gallium_winsys, inc_gallium_drivers, + ], + link_with : [ + libxvmc_st, libgalliumvlwinsys, libgalliumvl, libgallium, libmesa_util, + libpipe_loader_static, libws_null, libwsw, xvmc_link_with, + ], + dependencies : [ + dep_xcb, dep_x11_xcb, dep_xcb_dri2, dep_xcb_dri3, dep_libdrm, xvmc_deps, + ], + link_depends : xvmc_link_depends, +) + +meson.add_install_script( + join_paths(meson.source_root(), 'bin/install_megadrivers.py'), + libxvmc_gallium.full_path(), + xvmc_drivers_path, + xvmc_drivers, +) -- 2.15.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev