[15/18] radeon/vcn: add encode get feedback

Submitted by Zhang, Boyuan on Nov. 8, 2017, 6:08 p.m.

Details

Message ID 1510164503-13038-15-git-send-email-boyuan.zhang@amd.com
State New
Headers show
Series "Series without cover letter" ( rev: 3 2 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Zhang, Boyuan Nov. 8, 2017, 6:08 p.m.
From: Boyuan Zhang <boyuan.zhang@amd.com>

Add implementation for get_feedback interface for vcn encode.

Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
---
 src/gallium/drivers/radeon/radeon_vcn_enc.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/radeon/radeon_vcn_enc.c b/src/gallium/drivers/radeon/radeon_vcn_enc.c
index 219f870..de485cf 100644
--- a/src/gallium/drivers/radeon/radeon_vcn_enc.c
+++ b/src/gallium/drivers/radeon/radeon_vcn_enc.c
@@ -200,7 +200,20 @@  static void radeon_enc_destroy(struct pipe_video_codec *encoder)
 static void radeon_enc_get_feedback(struct pipe_video_codec *encoder,
 							  void *feedback, unsigned *size)
 {
-	/* TODO*/
+	struct radeon_encoder *enc = (struct radeon_encoder*)encoder;
+	struct rvid_buffer *fb = feedback;
+
+	if (size) {
+		uint32_t *ptr = enc->ws->buffer_map(fb->res->buf, enc->cs, PIPE_TRANSFER_READ_WRITE);
+		if (ptr[1])
+			*size = ptr[6];
+		else
+			*size = 0;
+		enc->ws->buffer_unmap(fb->res->buf);
+	}
+
+	si_vid_destroy_buffer(fb);
+	FREE(fb);
 }
 
 struct pipe_video_codec *radeon_create_encoder(struct pipe_context *context,