[1/2] radeon/vcn: add and manage render picture list

Submitted by Zhang, Boyuan on Dec. 11, 2017, 4:47 p.m.

Details

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

Not browsing as part of any series.

Commit Message

Zhang, Boyuan Dec. 11, 2017, 4:47 p.m.
From: Boyuan Zhang <boyuan.zhang@amd.com>

Create a list in decoder to store all render picture buffer pointers that
currently being used in reference picture lists.

During get message buffer call, check each pointer in render_pic_list[]
within given pic->ref[] list, remove pointer that no longer being used by
pic->ref[]. Then add current render surface pointer to the render_pic_list[]
and assign the associated index to result.curr_idx.

As a result, result.curr_idx will have the correct index to represent the
current render picture, instead of the previous increamenting values.

Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
---
 src/gallium/drivers/radeon/radeon_vcn_dec.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/radeon/radeon_vcn_dec.c b/src/gallium/drivers/radeon/radeon_vcn_dec.c
index 2ece4a3..f20f8ae 100644
--- a/src/gallium/drivers/radeon/radeon_vcn_dec.c
+++ b/src/gallium/drivers/radeon/radeon_vcn_dec.c
@@ -78,6 +78,7 @@  struct radeon_decoder {
 
 	unsigned			bs_size;
 	unsigned			cur_buffer;
+	void				*render_pic_list[16];
 };
 
 static rvcn_dec_message_avc_t get_h264_msg(struct radeon_decoder *dec,
@@ -186,7 +187,7 @@  static rvcn_dec_message_hevc_t get_h265_msg(struct radeon_decoder *dec,
 					struct pipe_h265_picture_desc *pic)
 {
 	rvcn_dec_message_hevc_t result;
-	unsigned i;
+	unsigned i, j;
 
 	memset(&result, 0, sizeof(result));
 	result.sps_info_flags = 0;
@@ -273,11 +274,28 @@  static rvcn_dec_message_hevc_t get_h265_msg(struct radeon_decoder *dec,
 		result.row_height_minus1[i] = pic->pps->row_height_minus1[i];
 
 	result.num_delta_pocs_ref_rps_idx = pic->NumDeltaPocsOfRefRpsIdx;
-	result.curr_idx = pic->CurrPicOrderCntVal;
 	result.curr_poc = pic->CurrPicOrderCntVal;
 
+	for (i = 0 ; i < 15 ; i++) {
+		for (j = 0; (pic->ref[j] != NULL) && (j < 15) ; j++) {
+			if (dec->render_pic_list[i] == pic->ref[j])
+				break;
+			if (j == 15)
+				dec->render_pic_list[i] = NULL;
+			else if (pic->ref[j+1] == NULL)
+				dec->render_pic_list[i] = NULL;
+		}
+	}
+	for (i = 0 ; i < 15 ; i++) {
+		if (dec->render_pic_list[i] == NULL) {
+			dec->render_pic_list[i] = target;
+			result.curr_idx = i;
+			break;
+		}
+	}
+
 	vl_video_buffer_set_associated_data(target, &dec->base,
-					    (void *)(uintptr_t)pic->CurrPicOrderCntVal,
+					    (void *)(uintptr_t)result.curr_idx,
 					    &radeon_dec_destroy_associated_data);
 
 	for (i = 0; i < 16; ++i) {
@@ -1236,6 +1254,8 @@  struct pipe_video_codec *radeon_create_decoder(struct pipe_context *context,
 		goto error;
 	}
 
+	for (i = 0; i < 15; i++)
+		dec->render_pic_list[i] = NULL;
 	bs_buf_size = width * height * (512 / (16 * 16));
 	for (i = 0; i < NUM_BUFFERS; ++i) {
 		unsigned msg_fb_it_size = FB_BUFFER_OFFSET + FB_BUFFER_SIZE;

Comments

On 11 December 2017 at 16:47,  <boyuan.zhang@amd.com> wrote:
> From: Boyuan Zhang <boyuan.zhang@amd.com>
>
> Create a list in decoder to store all render picture buffer pointers that
> currently being used in reference picture lists.
>
> During get message buffer call, check each pointer in render_pic_list[]
> within given pic->ref[] list, remove pointer that no longer being used by
> pic->ref[]. Then add current render surface pointer to the render_pic_list[]
> and assign the associated index to result.curr_idx.
>
> As a result, result.curr_idx will have the correct index to represent the
> current render picture, instead of the previous increamenting values.
>
> Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
> Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
We'd want this and 2/2 (sha's below) in stable. Otherwise people will
experience regressions when updating their firmware.

f2bfd1cbb7e radeon/vcn: add and manage render picture list
2ec48039b8a radeon/uvd: add and manage render picture list

Including the bugzilla reference will be great.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104745

-Emil
Hi Emil,

I cherry-picked these 2 patches over to the 17.3 branch, then tested locally and confirmed that it works fine.

I also added bugzilla reference to the patch as well. Please see the details in the links below:

https://lists.freedesktop.org/archives/mesa-dev/2018-January/183485.html
https://lists.freedesktop.org/archives/mesa-dev/2018-January/183484.html

Regards,
Boyuan


-----Original Message-----
From: Emil Velikov [mailto:emil.l.velikov@gmail.com] 

Sent: January-24-18 8:38 AM
To: Zhang, Boyuan; ML mesa-stable
Cc: ML mesa-dev
Subject: Re: [Mesa-dev] [PATCH 1/2] radeon/vcn: add and manage render picture list

On 11 December 2017 at 16:47,  <boyuan.zhang@amd.com> wrote:
> From: Boyuan Zhang <boyuan.zhang@amd.com>

>

> Create a list in decoder to store all render picture buffer pointers 

> that currently being used in reference picture lists.

>

> During get message buffer call, check each pointer in 

> render_pic_list[] within given pic->ref[] list, remove pointer that no 

> longer being used by

> pic->ref[]. Then add current render surface pointer to the 

> pic->render_pic_list[]

> and assign the associated index to result.curr_idx.

>

> As a result, result.curr_idx will have the correct index to represent 

> the current render picture, instead of the previous increamenting values.

>

> Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>

> Reviewed-by: Christian König <christian.koenig@amd.com>

> ---

We'd want this and 2/2 (sha's below) in stable. Otherwise people will experience regressions when updating their firmware.

f2bfd1cbb7e radeon/vcn: add and manage render picture list 2ec48039b8a radeon/uvd: add and manage render picture list

Including the bugzilla reference will be great.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104745

-Emil