From c7a5ef26adecb6454039ae0bed672cbd30dbede6 Mon Sep 17 00:00:00 2001 From: Boyuan Zhang Date: Wed, 17 Oct 2018 15:03:23 -0400 Subject: radeon/vcn: add jpeg decode implementation Add a new file to handle VCN Jpeg decode specific functions. Use Jpeg specific cmd sending function in end_frame call. Signed-off-by: Boyuan Zhang Reviewed-by: Leo Liu --- src/gallium/drivers/radeon/radeon_vcn_dec.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/gallium/drivers/radeon/radeon_vcn_dec.c') diff --git a/src/gallium/drivers/radeon/radeon_vcn_dec.c b/src/gallium/drivers/radeon/radeon_vcn_dec.c index 30a98c27867..75ef4a5d401 100644 --- a/src/gallium/drivers/radeon/radeon_vcn_dec.c +++ b/src/gallium/drivers/radeon/radeon_vcn_dec.c @@ -1247,6 +1247,10 @@ static unsigned calc_dpb_size(struct radeon_decoder *dec) dpb_size *= (3 / 2); break; + case PIPE_VIDEO_FORMAT_JPEG: + dpb_size = 0; + break; + default: // something is missing here assert(0); @@ -1547,14 +1551,14 @@ struct pipe_video_codec *radeon_create_decoder(struct pipe_context *context, } dpb_size = calc_dpb_size(dec); - - if (!si_vid_create_buffer(dec->screen, &dec->dpb, dpb_size, PIPE_USAGE_DEFAULT)) { - RVID_ERR("Can't allocated dpb.\n"); - goto error; + if (dpb_size) { + if (!si_vid_create_buffer(dec->screen, &dec->dpb, dpb_size, PIPE_USAGE_DEFAULT)) { + RVID_ERR("Can't allocated dpb.\n"); + goto error; + } + si_vid_clear_buffer(context, &dec->dpb); } - si_vid_clear_buffer(context, &dec->dpb); - if (dec->stream_type == RDECODE_CODEC_H264_PERF) { unsigned ctx_size = calc_ctx_size_h264_perf(dec); if (!si_vid_create_buffer(dec->screen, &dec->ctx, ctx_size, PIPE_USAGE_DEFAULT)) { @@ -1581,7 +1585,10 @@ struct pipe_video_codec *radeon_create_decoder(struct pipe_context *context, next_buffer(dec); - dec->send_cmd = send_cmd_dec; + if (stream_type == RDECODE_CODEC_JPEG) + dec->send_cmd = send_cmd_jpeg; + else + dec->send_cmd = send_cmd_dec; return &dec->base; -- cgit v1.2.3