radeonsi: prep for pipe_picture_desc::flush_flags

Make sure video codecs support flush flags.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28771>
This commit is contained in:
Chia-I Wu 2024-04-15 15:09:41 -07:00 committed by Marge Bot
parent 7ed3874996
commit 08d3b93ce7
3 changed files with 19 additions and 19 deletions

View file

@ -114,15 +114,15 @@ static void radeon_uvd_enc_get_param(struct radeon_uvd_encoder *enc,
radeon_uvd_enc_get_vui_param(enc, pic);
}
static void flush(struct radeon_uvd_encoder *enc)
static void flush(struct radeon_uvd_encoder *enc, unsigned flags)
{
enc->ws->cs_flush(&enc->cs, PIPE_FLUSH_ASYNC, NULL);
enc->ws->cs_flush(&enc->cs, flags, NULL);
}
static void radeon_uvd_enc_flush(struct pipe_video_codec *encoder)
{
struct radeon_uvd_encoder *enc = (struct radeon_uvd_encoder *)encoder;
flush(enc);
flush(enc, PIPE_FLUSH_ASYNC);
}
static void radeon_uvd_enc_cs_flush(void *ctx, unsigned flags, struct pipe_fence_handle **fence)
@ -201,7 +201,7 @@ static void radeon_uvd_enc_begin_frame(struct pipe_video_codec *encoder,
si_vid_create_buffer(enc->screen, &fb, 4096, PIPE_USAGE_STAGING);
enc->fb = &fb;
enc->begin(enc, picture);
flush(enc);
flush(enc, PIPE_FLUSH_ASYNC);
si_vid_destroy_buffer(&fb);
}
}
@ -230,7 +230,7 @@ static void radeon_uvd_enc_end_frame(struct pipe_video_codec *encoder,
struct pipe_picture_desc *picture)
{
struct radeon_uvd_encoder *enc = (struct radeon_uvd_encoder *)encoder;
flush(enc);
flush(enc, PIPE_FLUSH_ASYNC);
}
static void radeon_uvd_enc_destroy(struct pipe_video_codec *encoder)
@ -243,7 +243,7 @@ static void radeon_uvd_enc_destroy(struct pipe_video_codec *encoder)
si_vid_create_buffer(enc->screen, &fb, 512, PIPE_USAGE_STAGING);
enc->fb = &fb;
enc->destroy(enc);
flush(enc);
flush(enc, PIPE_FLUSH_ASYNC);
if (enc->si) {
si_vid_destroy_buffer(enc->si);
FREE(enc->si);

View file

@ -30,9 +30,9 @@
/**
* flush commands to the hardware
*/
static void flush(struct rvce_encoder *enc)
static void flush(struct rvce_encoder *enc, unsigned flags)
{
enc->ws->cs_flush(&enc->cs, PIPE_FLUSH_ASYNC, NULL);
enc->ws->cs_flush(&enc->cs, flags, NULL);
enc->task_info_idx = 0;
enc->bs_idx = 0;
}
@ -225,7 +225,7 @@ static void rvce_destroy(struct pipe_video_codec *encoder)
enc->fb = &fb;
enc->session(enc);
enc->destroy(enc);
flush(enc);
flush(enc, PIPE_FLUSH_ASYNC);
si_vid_destroy_buffer(&fb);
}
si_vid_destroy_buffer(&enc->cpb);
@ -271,7 +271,7 @@ static void rvce_begin_frame(struct pipe_video_codec *encoder, struct pipe_video
enc->create(enc);
enc->config(enc);
enc->feedback(enc);
flush(enc);
flush(enc, PIPE_FLUSH_ASYNC);
// dump_feedback(enc, &fb);
si_vid_destroy_buffer(&fb);
need_rate_control = false;
@ -280,7 +280,7 @@ static void rvce_begin_frame(struct pipe_video_codec *encoder, struct pipe_video
if (need_rate_control) {
enc->session(enc);
enc->config(enc);
flush(enc);
flush(enc, PIPE_FLUSH_ASYNC);
}
}
@ -310,7 +310,7 @@ static void rvce_end_frame(struct pipe_video_codec *encoder, struct pipe_video_b
struct rvce_cpb_slot *slot = list_entry(enc->cpb_slots.prev, struct rvce_cpb_slot, list);
if (!enc->dual_inst || enc->bs_idx > 1)
flush(enc);
flush(enc, PIPE_FLUSH_ASYNC);
/* update the CPB backtrack with the just encoded frame */
slot->picture_type = enc->pic.picture_type;
@ -360,7 +360,7 @@ static void rvce_flush(struct pipe_video_codec *encoder)
{
struct rvce_encoder *enc = (struct rvce_encoder *)encoder;
flush(enc);
flush(enc, PIPE_FLUSH_ASYNC);
}
static void rvce_cs_flush(void *ctx, unsigned flags, struct pipe_fence_handle **fence)

View file

@ -851,15 +851,15 @@ static void radeon_vcn_enc_get_param(struct radeon_encoder *enc, struct pipe_pic
radeon_vcn_enc_av1_get_param(enc, (struct pipe_av1_enc_picture_desc *)picture);
}
static void flush(struct radeon_encoder *enc)
static void flush(struct radeon_encoder *enc, unsigned flags)
{
enc->ws->cs_flush(&enc->cs, PIPE_FLUSH_ASYNC, NULL);
enc->ws->cs_flush(&enc->cs, flags, NULL);
}
static void radeon_enc_flush(struct pipe_video_codec *encoder)
{
struct radeon_encoder *enc = (struct radeon_encoder *)encoder;
flush(enc);
flush(enc, PIPE_FLUSH_ASYNC);
}
static void radeon_enc_cs_flush(void *ctx, unsigned flags, struct pipe_fence_handle **fence)
@ -1198,7 +1198,7 @@ static void radeon_enc_begin_frame(struct pipe_video_codec *encoder,
si_vid_create_buffer(enc->screen, &fb, 4096, PIPE_USAGE_STAGING);
enc->fb = &fb;
enc->begin(enc);
flush(enc);
flush(enc, PIPE_FLUSH_ASYNC);
si_vid_destroy_buffer(&fb);
enc->need_rate_control = false;
enc->need_rc_per_pic = false;
@ -1249,7 +1249,7 @@ static void radeon_enc_end_frame(struct pipe_video_codec *encoder, struct pipe_v
struct pipe_picture_desc *picture)
{
struct radeon_encoder *enc = (struct radeon_encoder *)encoder;
flush(enc);
flush(enc, PIPE_FLUSH_ASYNC);
}
static void radeon_enc_destroy(struct pipe_video_codec *encoder)
@ -1262,7 +1262,7 @@ static void radeon_enc_destroy(struct pipe_video_codec *encoder)
si_vid_create_buffer(enc->screen, &fb, 512, PIPE_USAGE_STAGING);
enc->fb = &fb;
enc->destroy(enc);
flush(enc);
flush(enc, PIPE_FLUSH_ASYNC);
RADEON_ENC_DESTROY_VIDEO_BUFFER(enc->si);
si_vid_destroy_buffer(&fb);
}