diff --git a/meson.build b/meson.build index eeb2adc0ac8..4cf7e224e95 100644 --- a/meson.build +++ b/meson.build @@ -404,6 +404,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') @@ -933,7 +971,8 @@ if with_platform_x11 dep_xcb_glx = dependency('xcb-glx', version : '>= 1.8.1') dep_xxf86vm = dependency('xxf86vm', required : false) endif - if with_any_vk or with_glx == 'dri' or with_gallium_vdpau + if with_any_vk or with_glx == 'dri' or + (with_gallium_vdpau or with_gallium_xvmc) dep_xcb = dependency('xcb') dep_x11_xcb = dependency('x11-xcb') endif diff --git a/meson_options.txt b/meson_options.txt index 55dfa4600ce..63fa9232ea1 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -68,6 +68,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 904bf859876..584e6729966 100644 --- a/src/gallium/meson.build +++ b/src/gallium/meson.build @@ -122,6 +122,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 @@ -140,9 +143,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..76de816efed --- /dev/null +++ b/src/gallium/targets/xvmc/meson.build @@ -0,0 +1,65 @@ +# 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_link_args = [] +xvmc_link_depends = [] +xvmc_drivers = [] + +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 + +libxvmc_gallium = shared_library( + 'XvMCgallium', + 'target.c', + c_args : c_vis_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, + ], + dependencies : [ + dep_xcb, dep_x11_xcb, dep_xcb_dri2, dep_xcb_dri3, dep_libdrm, + driver_r600, driver_nouveau, + ], + link_depends : xvmc_link_depends, +) + +foreach d : [[with_gallium_r600, 'r600'], [with_gallium_nouveau, 'nouveau']] + if d[0] + xvmc_drivers += 'libXvMC@0@.so'.format(d[1]) + endif +endforeach + +meson.add_install_script( + join_paths(meson.source_root(), 'bin/install_megadrivers.py'), + libxvmc_gallium.full_path(), + xvmc_drivers_path, + xvmc_drivers, +)