mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: mediatek: vcodec: Add a flag to indicate vdec_fb finding status
@ 2023-07-01  9:05 Irui Wang
  2023-07-03  4:11 ` Irui Wang (王瑞)
  0 siblings, 1 reply; 2+ messages in thread
From: Irui Wang @ 2023-07-01  9:05 UTC (permalink / raw)
  To: Hans Verkuil, Mauro Carvalho Chehab, Matthias Brugger
  Cc: Yunfei Dong, Maoguang Meng, Irui Wang,
	Project_Global_Chrome_Upstream_Group, linux-media, linux-kernel,
	linux-arm-kernel, linux-mediatek

"fb_use_list" is vp9 stateful decoder driver to store current
used or referenced frame buffer, and "fb_free_list" is used to
store current available to be freed frame buffer. When the
target frame buffer cannot be found in "fb_use_list", "NULL"
should be returned to prevent unexpected frame buffer from being
placed into "fb_free_list".

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c
index 70b8383f7c8e..e77d5a2452c1 100644
--- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c
+++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c
@@ -220,15 +220,21 @@ static struct vdec_fb *vp9_rm_from_fb_use_list(struct vdec_vp9_inst
 {
 	struct vdec_fb *fb = NULL;
 	struct vdec_fb_node *node;
+	bool found = false;
 
 	list_for_each_entry(node, &inst->fb_use_list, list) {
 		fb = (struct vdec_fb *)node->fb;
 		if (fb->base_y.va == addr) {
 			list_move_tail(&node->list,
 				       &inst->available_fb_node_list);
+			found = true;
 			break;
 		}
 	}
+
+	if (!found)
+		fb = NULL;
+
 	return fb;
 }
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: mediatek: vcodec: Add a flag to indicate vdec_fb finding status
  2023-07-01  9:05 [PATCH] media: mediatek: vcodec: Add a flag to indicate vdec_fb finding status Irui Wang
@ 2023-07-03  4:11 ` Irui Wang (王瑞)
  0 siblings, 0 replies; 2+ messages in thread
From: Irui Wang (王瑞) @ 2023-07-03  4:11 UTC (permalink / raw)
  To: matthias.bgg, mchehab, hverkuil-cisco
  Cc: linux-arm-kernel, linux-kernel, linux-media,
	Maoguang Meng (孟毛广),
	linux-mediatek, Yunfei Dong (董云飞),
	Project_Global_Chrome_Upstream_Group

Dear all,

A new patch v2 has been sent: 
https://patchwork.kernel.org/project/linux-media/list/?series=761892

current patch is superseded and can be abandoned.

Thank you very much

On Sat, 2023-07-01 at 17:05 +0800, Irui Wang wrote:
> "fb_use_list" is vp9 stateful decoder driver to store current
> used or referenced frame buffer, and "fb_free_list" is used to
> store current available to be freed frame buffer. When the
> target frame buffer cannot be found in "fb_use_list", "NULL"
> should be returned to prevent unexpected frame buffer from being
> placed into "fb_free_list".
> 
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> ---
>  drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git
> a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c
> b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c
> index 70b8383f7c8e..e77d5a2452c1 100644
> --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c
> +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c
> @@ -220,15 +220,21 @@ static struct vdec_fb
> *vp9_rm_from_fb_use_list(struct vdec_vp9_inst
>  {
>  	struct vdec_fb *fb = NULL;
>  	struct vdec_fb_node *node;
> +	bool found = false;
>  
>  	list_for_each_entry(node, &inst->fb_use_list, list) {
>  		fb = (struct vdec_fb *)node->fb;
>  		if (fb->base_y.va == addr) {
>  			list_move_tail(&node->list,
>  				       &inst->available_fb_node_list);
> +			found = true;
>  			break;
>  		}
>  	}
> +
> +	if (!found)
> +		fb = NULL;
> +
>  	return fb;
>  }
>  

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-03  4:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-01  9:05 [PATCH] media: mediatek: vcodec: Add a flag to indicate vdec_fb finding status Irui Wang
2023-07-03  4:11 ` Irui Wang (王瑞)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®