[Mesa-dev] [PATCH 10/14] meson: build gallium xvmc state tracker

Dylan Baker dylan at pnwbakers.com
Tue Nov 28 23:30:31 UTC 2017


Signed-off-by: Dylan Baker <dylanx.c.baker at 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        | 65 +++++++++++++++++++++++++++++
 5 files changed, 176 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 0fe23b8a192..25a653843a1 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')
@@ -921,7 +959,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 c7147ab3387..2f3b3142a55 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 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_ at 0@'.format(x)
+    test(_name, executable(
+        _name,
+        files('tests/test_ at 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 at 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,
+)
-- 
2.15.0



More information about the mesa-dev mailing list