d3d12: add av1 handling to d3d12_video_encoder_get_encode_headers and d3d12_video_encoder_update_current_encoder_config_state_av1

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41834>
This commit is contained in:
Pohsiang (John) Hsu 2026-05-01 13:13:11 -07:00 committed by Marge Bot
parent 7d8b051c06
commit 85c12604b9
2 changed files with 6 additions and 2 deletions

View file

@ -5149,7 +5149,7 @@ int d3d12_video_encoder_get_encode_headers([[maybe_unused]] struct pipe_video_co
[[maybe_unused]] void* bitstream_buf,
[[maybe_unused]] unsigned *bitstream_buf_size)
{
#if (VIDEO_CODEC_H264ENC || VIDEO_CODEC_H265ENC)
#if (VIDEO_CODEC_H264ENC || VIDEO_CODEC_H265ENC || VIDEO_CODEC_AV1ENC)
struct d3d12_video_encoder *pD3D12Enc = (struct d3d12_video_encoder *) codec;
D3D12_VIDEO_SAMPLE srcTextureDesc = {};
srcTextureDesc.Width = pD3D12Enc->base.width;
@ -5166,6 +5166,10 @@ int d3d12_video_encoder_get_encode_headers([[maybe_unused]] struct pipe_video_co
#if VIDEO_CODEC_H265ENC
if (u_reduce_video_profile(pD3D12Enc->base.profile) == PIPE_VIDEO_FORMAT_HEVC)
pD3D12Enc->m_upBitstreamBuilder = std::make_unique<d3d12_video_bitstream_builder_hevc>();
#endif
#if VIDEO_CODEC_AV1ENC
if (u_reduce_video_profile(pD3D12Enc->base.profile) == PIPE_VIDEO_FORMAT_AV1)
pD3D12Enc->m_upBitstreamBuilder = std::make_unique<d3d12_video_bitstream_builder_av1>();
#endif
}
bool postEncodeHeadersNeeded = false;

View file

@ -1063,7 +1063,7 @@ d3d12_video_encoder_update_current_encoder_config_state_av1(struct d3d12_video_e
pD3D12Enc->m_currentEncodeConfig.m_encoderCodecDesc = D3D12_VIDEO_ENCODER_CODEC_AV1;
// Set input format
DXGI_FORMAT targetFmt = srcTextureDesc.Format.Format;
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;