[Mesa-dev] [PATCH 07/15] radeon/vcn: separate send cmd call from end frame

boyuan.zhang at amd.com boyuan.zhang at amd.com
Wed Oct 17 19:03:22 UTC 2018


From: Boyuan Zhang <boyuan.zhang at amd.com>

Use function pointer for sending cmd in end_frame call. By doing this, we can
assign different cmd sending logics for Jpeg decode later.

Signed-off-by: Boyuan Zhang <boyuan.zhang at amd.com>
Reviewed-by: Leo Liu <leo.liu at amd.com>
---
 src/gallium/drivers/radeon/radeon_vcn_dec.c | 29 +++++++++++++++------
 src/gallium/drivers/radeon/radeon_vcn_dec.h |  7 +++++
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_vcn_dec.c b/src/gallium/drivers/radeon/radeon_vcn_dec.c
index 26ea1f82ff..30a98c2786 100644
--- a/src/gallium/drivers/radeon/radeon_vcn_dec.c
+++ b/src/gallium/drivers/radeon/radeon_vcn_dec.c
@@ -1368,21 +1368,15 @@ static void radeon_dec_decode_bitstream(struct pipe_video_codec *decoder,
 }
 
 /**
- * end decoding of the current frame
+ * send cmd for vcn dec
  */
-static void radeon_dec_end_frame(struct pipe_video_codec *decoder,
+void send_cmd_dec(struct radeon_decoder *dec,
 			   struct pipe_video_buffer *target,
 			   struct pipe_picture_desc *picture)
 {
-	struct radeon_decoder *dec = (struct radeon_decoder*)decoder;
 	struct pb_buffer *dt;
 	struct rvid_buffer *msg_fb_it_probs_buf, *bs_buf;
 
-	assert(decoder);
-
-	if (!dec->bs_ptr)
-		return;
-
 	msg_fb_it_probs_buf = &dec->msg_fb_it_probs_buffers[dec->cur_buffer];
 	bs_buf = &dec->bs_buffers[dec->cur_buffer];
 
@@ -1412,6 +1406,23 @@ static void radeon_dec_end_frame(struct pipe_video_codec *decoder,
 		send_cmd(dec, RDECODE_CMD_PROB_TBL_BUFFER, msg_fb_it_probs_buf->res->buf,
 			 FB_BUFFER_OFFSET + FB_BUFFER_SIZE, RADEON_USAGE_READ, RADEON_DOMAIN_GTT);
 	set_reg(dec, RDECODE_ENGINE_CNTL, 1);
+}
+
+/**
+ * end decoding of the current frame
+ */
+static void radeon_dec_end_frame(struct pipe_video_codec *decoder,
+			   struct pipe_video_buffer *target,
+			   struct pipe_picture_desc *picture)
+{
+	struct radeon_decoder *dec = (struct radeon_decoder*)decoder;
+
+	assert(decoder);
+
+	if (!dec->bs_ptr)
+		return;
+
+	dec->send_cmd(dec, target, picture);
 
 	flush(dec, PIPE_FLUSH_ASYNC);
 	next_buffer(dec);
@@ -1570,6 +1581,8 @@ struct pipe_video_codec *radeon_create_decoder(struct pipe_context *context,
 
 	next_buffer(dec);
 
+	dec->send_cmd = send_cmd_dec;
+
 	return &dec->base;
 
 error:
diff --git a/src/gallium/drivers/radeon/radeon_vcn_dec.h b/src/gallium/drivers/radeon/radeon_vcn_dec.h
index 2bcc1bb542..37c0503377 100644
--- a/src/gallium/drivers/radeon/radeon_vcn_dec.h
+++ b/src/gallium/drivers/radeon/radeon_vcn_dec.h
@@ -759,8 +759,15 @@ struct radeon_decoder {
 	bool				show_frame;
 	unsigned			ref_idx;
 	struct jpeg_params		jpg;
+	void (*send_cmd)(struct radeon_decoder *dec,
+			 struct pipe_video_buffer *target,
+			 struct pipe_picture_desc *picture);
 };
 
+void send_cmd_dec(struct radeon_decoder *dec,
+		  struct pipe_video_buffer *target,
+		  struct pipe_picture_desc *picture);
+
 struct pipe_video_codec *radeon_create_decoder(struct pipe_context *context,
 		const struct pipe_video_codec *templat);
 
-- 
2.17.1



More information about the mesa-dev mailing list