d3d12: Fix d3d12_video_encoder_get_current_max_dpb_capacity to report actual max slots number in DPB
Reviewed-By: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31017>
This commit is contained in:
@@ -424,9 +424,7 @@ d3d12_video_encoder_reconfigure_encoder_objects(struct d3d12_video_encoder *pD3D
|
|||||||
D3D12_RESOURCE_FLAG_VIDEO_ENCODE_REFERENCE_ONLY | D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE;
|
D3D12_RESOURCE_FLAG_VIDEO_ENCODE_REFERENCE_ONLY | D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE;
|
||||||
bool fArrayOfTextures = ((pD3D12Enc->m_currentEncodeCapabilities.m_SupportFlags &
|
bool fArrayOfTextures = ((pD3D12Enc->m_currentEncodeCapabilities.m_SupportFlags &
|
||||||
D3D12_VIDEO_ENCODER_SUPPORT_FLAG_RECONSTRUCTED_FRAMES_REQUIRE_TEXTURE_ARRAYS) == 0);
|
D3D12_VIDEO_ENCODER_SUPPORT_FLAG_RECONSTRUCTED_FRAMES_REQUIRE_TEXTURE_ARRAYS) == 0);
|
||||||
uint32_t texturePoolSize = d3d12_video_encoder_get_current_max_dpb_capacity(pD3D12Enc) +
|
uint32_t texturePoolSize = d3d12_video_encoder_get_current_max_dpb_capacity(pD3D12Enc);
|
||||||
1u; // adding an extra slot as we also need to count the current frame output recon
|
|
||||||
// allocation along max reference frame allocations
|
|
||||||
assert(texturePoolSize < UINT16_MAX);
|
assert(texturePoolSize < UINT16_MAX);
|
||||||
pD3D12Enc->m_upDPBStorageManager.reset();
|
pD3D12Enc->m_upDPBStorageManager.reset();
|
||||||
if (fArrayOfTextures) {
|
if (fArrayOfTextures) {
|
||||||
@@ -1330,7 +1328,8 @@ bool d3d12_video_encoder_query_d3d12_driver_caps(struct d3d12_video_encoder *pD3
|
|||||||
capEncoderSupportData1.ResolutionsListCount = 1;
|
capEncoderSupportData1.ResolutionsListCount = 1;
|
||||||
capEncoderSupportData1.pResolutionList = &pD3D12Enc->m_currentEncodeConfig.m_currentResolution;
|
capEncoderSupportData1.pResolutionList = &pD3D12Enc->m_currentEncodeConfig.m_currentResolution;
|
||||||
capEncoderSupportData1.CodecGopSequence = d3d12_video_encoder_get_current_gop_desc(pD3D12Enc);
|
capEncoderSupportData1.CodecGopSequence = d3d12_video_encoder_get_current_gop_desc(pD3D12Enc);
|
||||||
capEncoderSupportData1.MaxReferenceFramesInDPB = d3d12_video_encoder_get_current_max_dpb_capacity(pD3D12Enc);
|
capEncoderSupportData1.MaxReferenceFramesInDPB =
|
||||||
|
std::max(2u, d3d12_video_encoder_get_current_max_dpb_capacity(pD3D12Enc)) - 1u; // we only want the number of references (not the current pic slot too)
|
||||||
capEncoderSupportData1.CodecConfiguration = d3d12_video_encoder_get_current_codec_config_desc(pD3D12Enc);
|
capEncoderSupportData1.CodecConfiguration = d3d12_video_encoder_get_current_codec_config_desc(pD3D12Enc);
|
||||||
|
|
||||||
enum pipe_video_format codec = u_reduce_video_profile(pD3D12Enc->base.profile);
|
enum pipe_video_format codec = u_reduce_video_profile(pD3D12Enc->base.profile);
|
||||||
@@ -1493,7 +1492,31 @@ d3d12_video_encoder_get_current_profile_desc(struct d3d12_video_encoder *pD3D12E
|
|||||||
uint32_t
|
uint32_t
|
||||||
d3d12_video_encoder_get_current_max_dpb_capacity(struct d3d12_video_encoder *pD3D12Enc)
|
d3d12_video_encoder_get_current_max_dpb_capacity(struct d3d12_video_encoder *pD3D12Enc)
|
||||||
{
|
{
|
||||||
return pD3D12Enc->base.max_references;
|
enum pipe_video_format codec = u_reduce_video_profile(pD3D12Enc->base.profile);
|
||||||
|
switch (codec) {
|
||||||
|
#if VIDEO_CODEC_H264ENC
|
||||||
|
case PIPE_VIDEO_FORMAT_MPEG4_AVC:
|
||||||
|
{
|
||||||
|
return PIPE_H264_MAX_REFERENCES + 1u /* current frame reconstructed picture */;
|
||||||
|
} break;
|
||||||
|
#endif
|
||||||
|
#if VIDEO_CODEC_H265ENC
|
||||||
|
case PIPE_VIDEO_FORMAT_HEVC:
|
||||||
|
{
|
||||||
|
return PIPE_H265_MAX_REFERENCES + 1u /* current frame reconstructed picture */;
|
||||||
|
} break;
|
||||||
|
#endif
|
||||||
|
#if VIDEO_CODEC_AV1ENC
|
||||||
|
case PIPE_VIDEO_FORMAT_AV1:
|
||||||
|
{
|
||||||
|
return PIPE_AV1_MAX_REFERENCES + 1u /* current frame reconstructed picture */;
|
||||||
|
} break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
unreachable("Unsupported pipe_video_format");
|
||||||
|
} break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
Reference in New Issue
Block a user