From c5b184a02a542067ecdc4566e44d8c0186b2c2d4 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 Part-of: --- .../frontends/mediafoundation/codecapi.cpp | 4 +++ .../frontends/mediafoundation/meson.build | 29 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/gallium/frontends/mediafoundation/codecapi.cpp b/src/gallium/frontends/mediafoundation/codecapi.cpp index 512df11fd08..5bfea700e45 100644 --- a/src/gallium/frontends/mediafoundation/codecapi.cpp +++ b/src/gallium/frontends/mediafoundation/codecapi.cpp @@ -958,7 +958,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',