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

Dylan Baker dylan at pnwbakers.com
Wed Nov 1 22:49:45 UTC 2017


---
 meson.build                                 | 34 +++++++++++++-
 meson_options.txt                           | 13 ++++++
 src/gallium/meson.build                     |  7 ++-
 src/gallium/state_trackers/xvmc/meson.build | 52 +++++++++++++++++++++
 src/gallium/targets/xvmc/meson.build        | 70 +++++++++++++++++++++++++++++
 5 files changed, 174 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 d269047308c..48fa4ca5e5e 100644
--- a/meson.build
+++ b/meson.build
@@ -333,6 +333,38 @@ 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')
+else
+  with_gallium_xvmc = false
+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')
@@ -840,7 +872,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 6cb27301bb1..3b60a0ecf97 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 89c74ee23a6..81a6670830e 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/meson.build
@@ -98,6 +98,9 @@ endif
 if with_gallium_vdpau
   subdir('state_trackers/vdpau')
 endif
+if with_gallium_xvmc
+  subdir('state_trackers/xvmc')
+endif
 # TODO: SWR
 # TODO: virgl
 # TODO: winsys/sw/xlib
@@ -111,10 +114,12 @@ endif
 if with_gallium_vdpau
   subdir('targets/vdpau')
 endif
+if with_gallium_xvmc
+  subdir('targets/xvmc')
+endif
 # TODO: xlib-glx
 # 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..141b38f7d3f
--- /dev/null
+++ b/src/gallium/state_trackers/xvmc/meson.build
@@ -0,0 +1,52 @@
+# 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')
+  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_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_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..702ce2a1f76
--- /dev/null
+++ b/src/gallium/targets/xvmc/meson.build
@@ -0,0 +1,70 @@
+# 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 = []
+
+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]
+endif
+if with_gallium_nouveau
+  xvmc_c_args += '-DGALLIUM_NOUVEAU'
+  xvmc_link_with += [libnouveau, libnouveauwinsys]
+  xvmc_deps += dep_libdrm_nouveau
+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,
+  version : '1.0',
+  install : true,
+  install_dir : xvmc_drivers_path,
+)
-- 
2.14.3



More information about the mesa-dev mailing list