From a44df654b7e05e0d8e5cea722e406d1d8a3d3dc4 Mon Sep 17 00:00:00 2001 From: Rohit Athavale Date: Mon, 27 Apr 2026 14:58:01 -0700 Subject: [PATCH] mediafoundation: Test compile steps v/s step , and set build flag Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15244 Backport-to: * Reviewed-by: Pohsiang (John) Hsu (cherry picked from commit c5b184a02a542067ecdc4566e44d8c0186b2c2d4) Part-of: --- .pick_status.json | 2 +- .../frontends/mediafoundation/codecapi.cpp | 4 +++ .../frontends/mediafoundation/meson.build | 29 +++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 11a1ab4c97a..d6657cab75b 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -6444,7 +6444,7 @@ "description": "mediafoundation: Test compile steps v/s step , and set build flag", "nominated": true, "nomination_type": 4, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/frontends/mediafoundation/codecapi.cpp b/src/gallium/frontends/mediafoundation/codecapi.cpp index 816ec5ad7c6..7226f95076c 100644 --- a/src/gallium/frontends/mediafoundation/codecapi.cpp +++ b/src/gallium/frontends/mediafoundation/codecapi.cpp @@ -985,7 +985,11 @@ CDX12EncHMFT::GetValue( const GUID *Api, VARIANT *Value ) hevcDeltaQPSettings.dataType = CODEC_API_QP_MAP_INT8; hevcDeltaQPSettings.minValue = static_cast( m_uiMinQP ); hevcDeltaQPSettings.maxValue = static_cast( m_uiMaxQP ); +#if defined(INPUTQPSETTINGS_HAS_STEPS) + hevcDeltaQPSettings.steps = 1; +#else hevcDeltaQPSettings.step = 1; +#endif SAFEARRAYBOUND bound = { static_cast( sizeof( hevcDeltaQPSettings ) ), static_cast( 0 ) }; // cElements , lower bound diff --git a/src/gallium/frontends/mediafoundation/meson.build b/src/gallium/frontends/mediafoundation/meson.build index 54c0e03978d..acbfbdd2d06 100644 --- a/src/gallium/frontends/mediafoundation/meson.build +++ b/src/gallium/frontends/mediafoundation/meson.build @@ -47,6 +47,35 @@ if get_option('mediafoundation-store-dll') mf_cpp_args += '-DBUILD_FOR_MSDK' # Can use #if BUILD_FOR_MSDK in .cpp code endif +# InputQPSettings::step was renamed to ::steps in BR (Bromine) SDK +# Probe which field name the installed SDK exposes. +_inputqp_has_steps = cc.compiles( + ''' + #include + #include + void test() { InputQPSettings s; (void)s.steps; } + ''', + name : 'InputQPSettings::steps present', +) +if _inputqp_has_steps + message('InputQPSettings: using field "steps"') + mf_cpp_args += '-DINPUTQPSETTINGS_HAS_STEPS' +else + _inputqp_has_step = cc.compiles( + ''' + #include + #include + void test() { InputQPSettings s; (void)s.step; } + ''', + name : 'InputQPSettings::step present', + ) + if _inputqp_has_step + message('InputQPSettings: using field "step"') + else + error('InputQPSettings has neither "steps" nor "step" — unsupported Windows SDK version') + endif +endif + mediafoundation_files = files( 'codecapi.cpp', 'encode.cpp',