d3d12: Only call CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO when video format changes

Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37982>
This commit is contained in:
Silvio Vilerino
2025-10-18 10:27:31 -04:00
committed by Pohsiang (John) Hsu
parent ca2a1e470a
commit e3ab866fea
3 changed files with 28 additions and 28 deletions
@@ -1066,17 +1066,17 @@ d3d12_video_encoder_update_current_encoder_config_state_av1(struct d3d12_video_e
DXGI_FORMAT targetFmt = srcTextureDesc.Format.Format;
if (pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo.Format != targetFmt) {
pD3D12Enc->m_currentEncodeConfig.m_ConfigDirtyFlags |= d3d12_video_encoder_config_dirty_flag_input_format;
}
pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo = {};
pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo.Format = targetFmt;
HRESULT hr =
pD3D12Enc->m_pD3D12Screen->dev->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO,
&pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo,
sizeof(pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo));
if (FAILED(hr)) {
debug_printf("CheckFeatureSupport failed with HR 0x%x\n", (unsigned)hr);
return false;
pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo = {};
pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo.Format = targetFmt;
HRESULT hr =
pD3D12Enc->m_pD3D12Screen->dev->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO,
&pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo,
sizeof(pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo));
if (FAILED(hr)) {
debug_printf("CheckFeatureSupport failed with HR 0x%x\n", (unsigned)hr);
return false;
}
}
// Set resolution (ie. frame_size)
@@ -970,16 +970,16 @@ d3d12_video_encoder_update_current_encoder_config_state_h264(struct d3d12_video_
DXGI_FORMAT targetFmt = d3d12_convert_pipe_video_profile_to_dxgi_format(pD3D12Enc->base.profile);
if (pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo.Format != targetFmt) {
pD3D12Enc->m_currentEncodeConfig.m_ConfigDirtyFlags |= d3d12_video_encoder_config_dirty_flag_input_format;
}
pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo = {};
pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo.Format = targetFmt;
HRESULT hr = pD3D12Enc->m_pD3D12Screen->dev->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO,
&pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo,
sizeof(pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo));
if (FAILED(hr)) {
debug_printf("CheckFeatureSupport failed with HR %x\n", (unsigned)hr);
return false;
pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo = {};
pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo.Format = targetFmt;
HRESULT hr = pD3D12Enc->m_pD3D12Screen->dev->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO,
&pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo,
sizeof(pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo));
if (FAILED(hr)) {
debug_printf("CheckFeatureSupport failed with HR %x\n", (unsigned)hr);
return false;
}
}
// Set intra-refresh config
@@ -1280,16 +1280,16 @@ d3d12_video_encoder_update_current_encoder_config_state_hevc(struct d3d12_video_
DXGI_FORMAT targetFmt = d3d12_convert_pipe_video_profile_to_dxgi_format(pD3D12Enc->base.profile);
if (pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo.Format != targetFmt) {
pD3D12Enc->m_currentEncodeConfig.m_ConfigDirtyFlags |= d3d12_video_encoder_config_dirty_flag_input_format;
}
pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo = {};
pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo.Format = targetFmt;
HRESULT hr = pD3D12Enc->m_pD3D12Screen->dev->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO,
&pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo,
sizeof(pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo));
if (FAILED(hr)) {
debug_printf("CheckFeatureSupport failed with HR %x\n", (unsigned)hr);
return false;
pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo = {};
pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo.Format = targetFmt;
HRESULT hr = pD3D12Enc->m_pD3D12Screen->dev->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO,
&pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo,
sizeof(pD3D12Enc->m_currentEncodeConfig.m_encodeFormatInfo));
if (FAILED(hr)) {
debug_printf("CheckFeatureSupport failed with HR %x\n", (unsigned)hr);
return false;
}
}
// Set resolution