d3d12: Add missing D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE guards

Reviewed-By: Pohsiang Hsu <pohhsu@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34844>
This commit is contained in:
Sil Vilerino 2025-02-14 12:14:48 -05:00 committed by Marge Bot
parent be33edbdf1
commit e30a534f29
2 changed files with 13 additions and 3 deletions

View file

@ -425,7 +425,7 @@ d3d12_video_encoder_update_move_rects(struct d3d12_video_encoder *pD3D12Enc,
static void d3d12_video_encoder_is_gpu_qmap_input_feature_enabled(struct d3d12_video_encoder* pD3D12Enc, BOOL& isEnabled, D3D12_VIDEO_ENCODER_INPUT_MAP_SOURCE &outMapSourceEnabled)
{
isEnabled = FALSE;
#if D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE
//
// Prefer GPU QP Map over CPU QP Delta Map if both are enabled
//
@ -443,6 +443,7 @@ static void d3d12_video_encoder_is_gpu_qmap_input_feature_enabled(struct d3d12_v
outMapSourceEnabled = D3D12_VIDEO_ENCODER_INPUT_MAP_SOURCE_GPU_TEXTURE;
assert(!pD3D12Enc->m_currentEncodeConfig.m_QuantizationMatrixDesc.CPUInput.AppRequested); // When enabling GPU QP Map, CPU QP Delta must be disabled
}
#endif // D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE
}
#endif // D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE
@ -1421,6 +1422,7 @@ d3d12_video_encoder_disable_rc_minmaxqp(struct D3D12EncodeRateControlState & rcS
}
}
#if D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE
static bool d3d12_video_encoder_is_move_regions_feature_enabled(struct d3d12_video_encoder* pD3D12Enc, D3D12_VIDEO_ENCODER_INPUT_MAP_SOURCE mapSource)
{
if (pD3D12Enc->m_currentEncodeConfig.m_MoveRectsDesc.MapSource != mapSource)
@ -1438,7 +1440,9 @@ static bool d3d12_video_encoder_is_move_regions_feature_enabled(struct d3d12_vid
}
return false;
}
#endif // D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE
#if D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE
static bool d3d12_video_encoder_is_dirty_regions_feature_enabled(struct d3d12_video_encoder* pD3D12Enc, D3D12_VIDEO_ENCODER_INPUT_MAP_SOURCE mapSource)
{
if (pD3D12Enc->m_currentEncodeConfig.m_DirtyRectsDesc.MapSource != mapSource)
@ -1800,6 +1804,7 @@ bool d3d12_video_encoder_query_d3d12_driver_caps(struct d3d12_video_encoder *pD3
pD3D12Enc->m_currentEncodeCapabilities.m_SupportFlags = capEncoderSupportData1.SupportFlags;
pD3D12Enc->m_currentEncodeCapabilities.m_ValidationFlags = capEncoderSupportData1.ValidationFlags;
#if D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE
if ((capEncoderSupportData1.DirtyRegions.MapSource == D3D12_VIDEO_ENCODER_INPUT_MAP_SOURCE_GPU_TEXTURE) &&
(capEncoderSupportData1.DirtyRegions.Enabled))
{
@ -1913,6 +1918,7 @@ bool d3d12_video_encoder_query_d3d12_driver_caps(struct d3d12_video_encoder *pD3
return false;
}
}
#endif // D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE
return true;
}
@ -2077,12 +2083,14 @@ d3d12_video_encoder_update_current_encoder_config_state(struct d3d12_video_encod
} break;
}
#if D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE
// Set dirty region changes
if (memcmp(&pD3D12Enc->m_prevFrameEncodeConfig.m_DirtyRectsDesc,
&pD3D12Enc->m_currentEncodeConfig.m_DirtyRectsDesc,
sizeof(pD3D12Enc->m_currentEncodeConfig.m_DirtyRectsDesc)) != 0) {
pD3D12Enc->m_currentEncodeConfig.m_ConfigDirtyFlags |= d3d12_video_encoder_config_dirty_flag_dirty_regions;
}
#endif // D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE
return bCodecUpdatesSuccess;
}
@ -2340,6 +2348,7 @@ d3d12_video_encoder_prepare_input_buffers(struct d3d12_video_encoder *pD3D12Enc)
// and create them on demand (if the previous allocation is not big enough)
HRESULT hr = S_OK;
#if D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE
D3D12_HEAP_PROPERTIES Properties = CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT);
if (d3d12_video_encoder_is_dirty_regions_feature_enabled(pD3D12Enc, D3D12_VIDEO_ENCODER_INPUT_MAP_SOURCE_GPU_TEXTURE))
{
@ -2409,7 +2418,7 @@ d3d12_video_encoder_prepare_input_buffers(struct d3d12_video_encoder *pD3D12Enc)
}
}
}
#endif // D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE
return SUCCEEDED(hr);
}

View file

@ -543,7 +543,7 @@ d3d12_video_encoder_update_current_frame_pic_params_info_hevc(struct d3d12_video
if ((pD3D12Enc->m_currentEncodeConfig.m_encoderCodecSpecificConfigDesc.m_HEVCConfig.ConfigurationFlags
& D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_FLAG_ALLOW_REQUEST_INTRA_CONSTRAINED_SLICES) != 0)
picParams.pHEVCPicData->Flags |= D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_HEVC_FLAG_REQUEST_INTRA_CONSTRAINED_SLICES;
#if D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE
if (pD3D12Enc->m_currentEncodeConfig.m_QuantizationMatrixDesc.CPUInput.AppRequested)
{
// Use 8 bit qpmap array for HEVC picparams (-51, 51 range and int8_t pRateControlQPMap type)
@ -558,6 +558,7 @@ d3d12_video_encoder_update_current_frame_pic_params_info_hevc(struct d3d12_video
picParams.pHEVCPicData->pRateControlQPMap = pD3D12Enc->m_currentEncodeConfig.m_QuantizationMatrixDesc.CPUInput.m_pRateControlQPMap8Bit.data();
picParams.pHEVCPicData->QPMapValuesCount = static_cast<UINT>(pD3D12Enc->m_currentEncodeConfig.m_QuantizationMatrixDesc.CPUInput.m_pRateControlQPMap8Bit.size());
}
#endif // D3D12_VIDEO_USE_NEW_ENCODECMDLIST4_INTERFACE
pD3D12Enc->m_upDPBManager->begin_frame(picParams, bUsedAsReference, picture);
pD3D12Enc->m_upDPBManager->get_current_frame_picture_control_data(picParams);