From b819ad62c2f131ec7af79914577262c0d21a7377 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 4 May 2026 11:40:29 +0200 Subject: [PATCH] radeonsi/vce: deal with has_gfx_compute being false In this case the workaround can't be implemented so we must report a failure. Reviewed-by: David Rosca Reviewed-by: Qiang Yu Part-of: --- src/gallium/drivers/radeonsi/radeon_vce.c | 32 ++++++++++++++--------- src/gallium/drivers/radeonsi/radeon_vce.h | 1 + 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/radeonsi/radeon_vce.c b/src/gallium/drivers/radeonsi/radeon_vce.c index d9335101165..8539eb68b0b 100644 --- a/src/gallium/drivers/radeonsi/radeon_vce.c +++ b/src/gallium/drivers/radeonsi/radeon_vce.c @@ -773,19 +773,24 @@ static void rvce_begin_frame(struct pipe_video_codec *encoder, struct pipe_video * imports external buffer it may not be aligned and then we need to blit * into internal surface used as input surface. */ if (source->height % 16) { - enc->source_copy = enc->base.context->create_video_buffer(enc->base.context, source); - assert(enc->source_copy); - struct vl_video_buffer *dst = (struct vl_video_buffer *)enc->source_copy; - for (unsigned i = 0; i < 2; i++) { - struct pipe_box box = { - .width = util_format_get_plane_width(source->buffer_format, i, source->width), - .height = util_format_get_plane_height(source->buffer_format, i, source->height), - .depth = 1, - }; - si_resource_copy_region(enc->base.context, dst->resources[i], 0, 0, 0, 0, vid_buf->resources[i], 0, &box); + if (si_screen(enc->screen)->has_gfx_compute) { + enc->source_copy = enc->base.context->create_video_buffer(enc->base.context, source); + assert(enc->source_copy); + struct vl_video_buffer *dst = (struct vl_video_buffer *)enc->source_copy; + for (unsigned i = 0; i < 2; i++) { + struct pipe_box box = { + .width = util_format_get_plane_width(source->buffer_format, i, source->width), + .height = util_format_get_plane_height(source->buffer_format, i, source->height), + .depth = 1, + }; + si_resource_copy_region(enc->base.context, dst->resources[i], 0, 0, 0, 0, vid_buf->resources[i], 0, &box); + } + enc->base.context->flush(enc->base.context, NULL, 0); + vid_buf = (struct vl_video_buffer *)enc->source_copy; + } else { + RVID_ERR("VDE requires 16x16 aligned input surface\n"); + enc->error = true; } - enc->base.context->flush(enc->base.context, NULL, 0); - vid_buf = (struct vl_video_buffer *)enc->source_copy; } enc->get_buffer(vid_buf->resources[0], &enc->handle, &enc->luma); @@ -933,6 +938,9 @@ static int rvce_end_frame(struct pipe_video_codec *encoder, struct pipe_video_bu { struct rvce_encoder *enc = (struct rvce_encoder *)encoder; + if (enc->error) + return 1; + flush(enc, picture->flush_flags, picture->out_fence); if (enc->source_copy) { diff --git a/src/gallium/drivers/radeonsi/radeon_vce.h b/src/gallium/drivers/radeonsi/radeon_vce.h index 47f3b0dfa44..4b12b9c1c2d 100644 --- a/src/gallium/drivers/radeonsi/radeon_vce.h +++ b/src/gallium/drivers/radeonsi/radeon_vce.h @@ -328,6 +328,7 @@ struct rvce_encoder { bool use_vm; bool dual_pipe; + bool error; unsigned fw_version; };