Mesa (main): meson: add a video codec support option

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 28 23:04:35 UTC 2022


Module: Mesa
Branch: main
Commit: 7d969fe9e91e39e03041cdfac69bf33337bc2c96
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7d969fe9e91e39e03041cdfac69bf33337bc2c96

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Mar  7 12:37:29 2022 +1000

meson: add a video codec support option

This allows to turn on/off all hw implementations for a specific video
codec across the tree. Patent encumbered codecs can cause problems for
distributions due to the nature of at least MPEG-LA licensing.

https://jina-liu.medium.com/settle-your-questions-about-h-264-license-cost-once-and-for-all-hopefully-a058c2149256
is probably the best explaination I can find.

>From a distro pov, codecs are a jigsaw puzzle, you only seem to become a problem well you fit all the pieces.

This patch will allow disabling the mesa piece of the puzzle.

Reviewed-by: Dylan Baker <dylan at pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15258>

---

 .gitlab-ci/meson/build.sh | 1 +
 meson.build               | 8 ++++++++
 meson_options.txt         | 9 +++++++++
 3 files changed, 18 insertions(+)

diff --git a/.gitlab-ci/meson/build.sh b/.gitlab-ci/meson/build.sh
index d052397cf00..a400213d4ee 100755
--- a/.gitlab-ci/meson/build.sh
+++ b/.gitlab-ci/meson/build.sh
@@ -71,6 +71,7 @@ meson _build --native-file=native.file \
       ${GALLIUM_ST} \
       -D gallium-drivers=${GALLIUM_DRIVERS:-[]} \
       -D vulkan-drivers=${VULKAN_DRIVERS:-[]} \
+      -D video-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec \
       -D werror=true \
       ${EXTRA_OPTION}
 cd _build
diff --git a/meson.build b/meson.build
index a544b37b7a5..0760a30d6f6 100644
--- a/meson.build
+++ b/meson.build
@@ -320,6 +320,11 @@ if with_vulkan_beta
   pre_args += '-DVK_ENABLE_BETA_EXTENSIONS'
 endif
 
+_codecs = get_option('video-codecs')
+foreach c : ['vc1dec', 'h264dec', 'h264enc', 'h265dec', 'h265enc']
+   pre_args += '-DVIDEO_CODEC_ at 0@=@1@'.format(c.to_upper(), _codecs.contains(c).to_int())
+endforeach
+
 _platforms = get_option('platforms')
 if _platforms.contains('auto')
   if system_has_kms_drm
@@ -2273,6 +2278,9 @@ if with_gbm
 endif
 
 lines += ''
+lines += 'Video Codecs: ' + ' '.join(_codecs)
+lines += ''
+
 if with_any_vk
   lines += 'Vulkan drivers:  ' + ' '.join(_vulkan_drivers)
   lines += 'Vulkan ICD dir:  ' + with_vulkan_icd_dir
diff --git a/meson_options.txt b/meson_options.txt
index 9afe105241f..4332906853f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -527,3 +527,12 @@ option(
   value : 'disabled',
   description : 'Build the intel-clc compiler (required for ray queries).'
 )
+option(
+  'video-codecs',
+  type : 'array',
+  value : [],
+  choices: [
+    'vc1dec', 'h264dec', 'h264enc', 'h265dec', 'h265enc'
+  ],
+  description : 'List of patent encumbered codecs to build support for. Distros might want to consult their legal department before enabling these. This is used for all video APIs (vaapi, vdpau, vulkan). Non-patent encumbered codecs will be enabled by default.'
+)



More information about the mesa-commit mailing list