radeonsi/vcn: Fix creating context buffer on VCN5
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

VCN5 needs the context buffer for AV1 encode and when pre-encode
is enabled.
Replace the check for dpb slots (which is always 0 on VCN5) with
check for first encoded frame.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14186
Fixes: a0324576aa ("radeonsi/vcn: Stop using rvid_buffer")
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38072>
This commit is contained in:
David Rosca 2025-10-27 09:13:13 +01:00 committed by Marge Bot
parent 17355f716b
commit 00b8fad3d3
2 changed files with 6 additions and 1 deletions

View file

@ -1565,7 +1565,7 @@ static void radeon_enc_begin_frame(struct pipe_video_codec *encoder,
dpb_slots = 0; dpb_slots = 0;
radeon_vcn_enc_get_param(enc, picture); radeon_vcn_enc_get_param(enc, picture);
if (dpb_slots && !enc->dpb && setup_dpb(enc, dpb_slots)) { if (enc->first_frame && setup_dpb(enc, dpb_slots)) {
enc->dpb = si_resource(pipe_buffer_create(enc->screen, 0, PIPE_USAGE_DEFAULT, enc->dpb_size)); enc->dpb = si_resource(pipe_buffer_create(enc->screen, 0, PIPE_USAGE_DEFAULT, enc->dpb_size));
if (!enc->dpb) { if (!enc->dpb) {
RADEON_ENC_ERR("Can't create DPB buffer.\n"); RADEON_ENC_ERR("Can't create DPB buffer.\n");
@ -1935,6 +1935,8 @@ static int radeon_enc_end_frame(struct pipe_video_codec *encoder, struct pipe_vi
if (enc->error) if (enc->error)
return -1; return -1;
enc->first_frame = false;
return flush(enc, picture->flush_flags, picture->out_fence); return flush(enc, picture->flush_flags, picture->out_fence);
} }
@ -2201,6 +2203,8 @@ struct pipe_video_codec *radeon_create_encoder(struct pipe_context *context,
radeon_enc_1_2_init(enc); radeon_enc_1_2_init(enc);
} }
enc->first_frame = true;
return &enc->base; return &enc->base;
error: error:

View file

@ -262,6 +262,7 @@ struct radeon_encoder {
unsigned metadata_size; unsigned metadata_size;
bool error; bool error;
bool first_frame;
enum { enum {
DPB_LEGACY = 0, DPB_LEGACY = 0,