[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7e668b90-e3e6-5d25-e894-f754662405af@collabora.com>
Date: Tue, 13 Dec 2022 10:09:54 +0100
From: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
To: Yunfei Dong <yunfei.dong@...iatek.com>,
Chen-Yu Tsai <wenst@...omium.org>,
Nicolas Dufresne <nicolas@...fresne.ca>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Benjamin Gaignard <benjamin.gaignard@...labora.com>,
Tiffany Lin <tiffany.lin@...iatek.com>
Cc: Mauro Carvalho Chehab <mchehab@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Hsin-Yi Wang <hsinyi@...omium.org>,
Fritz Koenig <frkoenig@...omium.org>,
Daniel Vetter <daniel@...ll.ch>,
Steve Cho <stevecho@...omium.org>, linux-media@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
Project_Global_Chrome_Upstream_Group@...iatek.com
Subject: Re: [PATCH 1/5] media: mediatek: vcodec: add params to record lat and
core lat_buf count
Il 10/12/22 08:32, Yunfei Dong ha scritto:
> Using lat_buf to share decoder information between lat and core work
> queue, adding params to record the buf count.
>
> Fixes: 365e4ba01df4 ("media: mtk-vcodec: Add work queue for core hardware decode")
> Signed-off-by: Yunfei Dong <yunfei.dong@...iatek.com>
> ---
> .../platform/mediatek/vcodec/vdec_msg_queue.c | 32 ++++++++++++++++++-
> .../platform/mediatek/vcodec/vdec_msg_queue.h | 9 ++++++
> 2 files changed, 40 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c
> index dc2004790a47..af7ddba1923a 100644
> --- a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c
> +++ b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c
> @@ -52,6 +52,30 @@ static struct list_head *vdec_get_buf_list(int hardware_index, struct vdec_lat_b
> }
> }
>
> +static void vdec_msg_queue_inc(struct vdec_msg_queue *msg_queue, int hardware_index)
> +{
> + mutex_lock(&msg_queue->list_cnt_mutex);
I doubt that you need to use this mutex, as you're using atomics...
> +
> + if (hardware_index == MTK_VDEC_CORE)
> + atomic_inc(&msg_queue->core_list_cnt);
> + else
> + atomic_inc(&msg_queue->lat_list_cnt);
> +
This branch (with the relevant appropriate changes) can be simplified as
atomic_inc(&msg_queue->list_cnt[hardware_index]);
...where list_cnt is an array, and hardware_index is an enumeration.
> + mutex_unlock(&msg_queue->list_cnt_mutex);
> +}
> +
> +static void vdec_msg_queue_dec(struct vdec_msg_queue *msg_queue, int hardware_index)
> +{
> + mutex_lock(&msg_queue->list_cnt_mutex);
> +
> + if (hardware_index == MTK_VDEC_CORE)
> + atomic_dec(&msg_queue->core_list_cnt);
> + else
> + atomic_dec(&msg_queue->lat_list_cnt);
Same here.
> +
> + mutex_unlock(&msg_queue->list_cnt_mutex);
> +}
> +
Regards,
Angelo
Powered by blists - more mailing lists