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

Author: Sil Vilerino <sivil...@microsoft.com>
Date:   Tue Nov 21 11:08:15 2023 -0500

meson: Add all, all_free (default) options for video-codecs option.

- Adds new 'all' value to the video-codecs option
- Adds 'all_free' value to video-codecs and sets
   it as default value for non patent-encumbered
   codecs, restoring the behavior for these codecs
   before existing as options in commit 7b22dd8bfdc

Fixes: 7b22dd8bfdc ("meson: add vp9 and av1 codec support options")
Reviewed-by: Jesse Natalie <jenat...@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26320>

---

 .gitlab-ci/meson/build.sh         |  2 +-
 .gitlab-ci/windows/mesa_build.ps1 |  2 +-
 meson.build                       | 17 ++++++++++++++++-
 meson_options.txt                 |  8 ++++----
 4 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci/meson/build.sh b/.gitlab-ci/meson/build.sh
index 69657aa5607..fe62941d7c8 100755
--- a/.gitlab-ci/meson/build.sh
+++ b/.gitlab-ci/meson/build.sh
@@ -87,7 +87,7 @@ meson setup _build \
       -D gallium-opencl=disabled \
       -D gallium-drivers=${GALLIUM_DRIVERS:-[]} \
       -D vulkan-drivers=${VULKAN_DRIVERS:-[]} \
-      -D 
video-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec,av1dec,av1enc,vp9dec \
+      -D video-codecs=all \
       -D werror=true \
       ${EXTRA_OPTION}
 cd _build
diff --git a/.gitlab-ci/windows/mesa_build.ps1 
b/.gitlab-ci/windows/mesa_build.ps1
index e0c4252f87d..a54c180d853 100644
--- a/.gitlab-ci/windows/mesa_build.ps1
+++ b/.gitlab-ci/windows/mesa_build.ps1
@@ -50,7 +50,7 @@ meson setup `
 -Dvulkan-drivers="swrast,amd,microsoft-experimental" `
 -Dgallium-drivers="swrast,d3d12,zink" `
 -Dgallium-va=enabled `
--Dvideo-codecs="h264dec,h264enc,h265dec,h265enc,vc1dec,av1dec,av1enc,vp9dec" `
+-Dvideo-codecs="all" `
 -Dshared-glapi=enabled `
 -Dgles1=enabled `
 -Dgles2=enabled `
diff --git a/meson.build b/meson.build
index a69e4a7d161..552ff196aa8 100644
--- a/meson.build
+++ b/meson.build
@@ -338,7 +338,22 @@ if with_vulkan_beta
 endif
 
 _codecs = get_option('video-codecs')
-foreach c : ['vc1dec', 'h264dec', 'h264enc', 'h265dec', 'h265enc', 'av1dec', 
'av1enc', 'vp9dec']
+patent_codecs = ['vc1dec', 'h264dec', 'h264enc', 'h265dec', 'h265enc']
+free_codecs = ['av1dec', 'av1enc', 'vp9dec']
+all_codecs = patent_codecs + free_codecs
+
+if _codecs.contains('all')
+  _codecs = all_codecs
+elif _codecs.contains('all_free')
+  selected_codecs = _codecs
+  _codecs = free_codecs
+  foreach c : patent_codecs
+    if selected_codecs.contains(c)
+      _codecs += c
+    endif
+  endforeach
+endif
+foreach c : all_codecs
    pre_args += '-DVIDEO_CODEC_@0@=@1@'.format(c.to_upper(), 
_codecs.contains(c).to_int())
 endforeach
 
diff --git a/meson_options.txt b/meson_options.txt
index adf2363c0e3..c76fa6d3382 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -629,15 +629,15 @@ option(
 option(
   'video-codecs',
   type : 'array',
-  value : [],
+  value : ['all_free'],
   choices: [
-    'vc1dec', 'h264dec', 'h264enc', 'h265dec', 'h265enc', 'av1dec', 'av1enc', 
'vp9dec'
+    'all', 'all_free', 'vc1dec', 'h264dec', 'h264enc', 'h265dec', 'h265enc', 
'av1dec', 'av1enc', 'vp9dec'
   ],
-  description : 'List of patent encumbered codecs to build support for. ' +
+  description : 'List of 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.'
+                'enabled by default with the all_free default value.'
 )
 
 option(

Reply via email to