From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "robh@kernel.org" <robh@kernel.org>,
"mchehab@kernel.org" <mchehab@kernel.org>,
"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
"conor+dt@kernel.org" <conor+dt@kernel.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"Shangyao Lin (林上堯)" <Shangyao.Lin@mediatek.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"linaro-mm-sig@lists.linaro.org" <linaro-mm-sig@lists.linaro.org>,
Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@mediatek.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>
Subject: Re: [PATCH v2 08/13] media: platform: mediatek: add isp_7x camsys unit
Date: Thu, 10 Jul 2025 05:20:12 +0000 [thread overview]
Message-ID: <7c89d4a80f292392cbcde4e9167b83469fc85693.camel@mediatek.com> (raw)
In-Reply-To: <20250707013154.4055874-9-shangyao.lin@mediatek.com>
On Mon, 2025-07-07 at 09:31 +0800, shangyao lin wrote:
> From: "shangyao.lin" <shangyao.lin@mediatek.com>
>
> Introduces the top media device driver for the MediaTek ISP7X CAMSYS. The driver maintains the camera system, including sub-device management, DMA operations, and integration with the V4L2 framework. It handles request stream data, buffer management, MediaTek-specific features, pipeline management, streaming control, and error handling mechanisms. Additionally, it aggregates sub-drivers for the camera interface, raw, and yuv pipelines.
>
> ---
>
> Changes in v2:
> - Removed mtk_cam-ufbc-def.h along with related code
> - Various fixes per review comments
>
> ---
>
> [Question for CK]:
>
> Hi CK,
>
> Is your suggestion to simplify buffer management to a single buf_list with a buffer status (estate) state machine, so all buffers stay in one list and only the estate field changes (no more multiple lists)? The buffer life cycle would be: WAITING → SCP_GENERATE_CQ → CQ_READY → CQ_APPLY → DONE.
>
> I have some concerns about concurrency and race conditions:
>
> Multiple lists can use different locks to reduce contention.
> With a single list, all state changes need to lock the same list, which may require more careful lock design to avoid race conditions or deadlocks.
> When multiple threads (interrupts, workqueues, user requests) operate at the same time, synchronization becomes more difficult.
> Do you have any reference code or best practices for this kind of design?
Deadlock happen only when code hold two lock at the same time.
I think when you hold buf_list lock, it's not necessary to hold other lock, so it's not necessary to worry about deadlock.
The buffer management in this driver is simple.
All the buffer is processed step by step in order.
I have no sample code to provide to you.
You may point out the worry code in this patch and we could discuss on that point.
>
> Thanks!
>
>
>
> Reply regarding stream_id and pipe_id naming:
>
> Hi CK,
>
> Thank you for your suggestion. In our current design, stream_id and pipe_id are not always in a 1-to-1 relationship. In some cases, one stream may correspond to multiple pipes, or vice versa. That’s why we use both names in different contexts. If you have any suggestions on how to unify the naming while keeping this distinction clear, please let us know.
>
So stream_id and pipe_id are different concept.
Below is the code in this patch.
+struct mtk_cam_request_stream_data*
+mtk_cam_get_req_s_data(struct mtk_cam_ctx *ctx, unsigned int pipe_id,
+ unsigned int frame_seq_no)
+struct mtk_cam_request *mtk_cam_get_req(struct mtk_cam_ctx *ctx,
+ unsigned int frame_seq_no)
+{
+ struct mtk_cam_request_stream_data *req_stream_data;
+
+ req_stream_data = mtk_cam_get_req_s_data(ctx, ctx->stream_id, frame_seq_no);
The second parameter of mtk_cam_get_req_s_data() is pipe_id, but you pass stream_id into it.
Because stream_id and pipe_id are different concept, so you should not do this.
You should pass pipe_id into mtk_cam_get_req_s_data().
Regards,
CK
+ if (!req_stream_data)
+ return NULL;
+
+ return req_stream_data->req;
+}
> Thanks!
>
> Best regards,
> Shangyao
>
> Signed-off-by: shangyao.lin <shangyao.lin@mediatek.com>
> ---
next prev parent reply other threads:[~2025-07-10 5:20 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-07 1:31 [PATCH v2 00/13] Add MediaTek ISP7.x camera system support shangyao lin
2025-07-07 1:31 ` [PATCH v2 01/13] dt-bindings: media: mediatek: add camisp binding shangyao lin
2025-07-07 2:46 ` Rob Herring (Arm)
2025-07-07 5:42 ` Krzysztof Kozlowski
2025-07-15 8:25 ` CK Hu (胡俊光)
2025-07-07 1:31 ` [PATCH v2 02/13] dt-bindings: media: mediatek: add seninf-core binding shangyao lin
2025-07-07 2:46 ` Rob Herring (Arm)
2025-07-07 5:44 ` Krzysztof Kozlowski
2025-07-15 7:28 ` CK Hu (胡俊光)
2025-07-07 1:31 ` [PATCH v2 03/13] dt-bindings: media: mediatek: add cam-raw binding shangyao lin
2025-07-07 2:46 ` Rob Herring (Arm)
2025-07-07 5:48 ` Krzysztof Kozlowski
2025-07-15 8:13 ` CK Hu (胡俊光)
2025-07-07 1:31 ` [PATCH v2 04/13] dt-bindings: media: mediatek: add cam-yuv binding shangyao lin
2025-07-07 2:46 ` Rob Herring (Arm)
2025-07-07 5:47 ` Krzysztof Kozlowski
2025-07-15 7:41 ` CK Hu (胡俊光)
2025-07-07 1:31 ` [PATCH v2 05/13] media: platform: mediatek: add isp_7x seninf unit shangyao lin
2025-07-07 5:50 ` Krzysztof Kozlowski
2025-07-10 6:39 ` CK Hu (胡俊光)
2025-07-16 4:06 ` CK Hu (胡俊光)
2025-07-07 1:31 ` [PATCH v2 06/13] media: platform: mediatek: add isp_7x state ctrl shangyao lin
2025-07-11 8:56 ` CK Hu (胡俊光)
2025-07-21 1:40 ` CK Hu (胡俊光)
2025-07-07 1:31 ` [PATCH v2 07/13] MEDIA: PLATFORM: MEDIATEK: ADD ISP_7X CAM-RAW UNIT shangyao lin
2025-07-15 4:07 ` CK Hu (胡俊光)
2025-07-07 1:31 ` [PATCH v2 08/13] media: platform: mediatek: add isp_7x camsys unit shangyao lin
2025-07-07 5:58 ` Krzysztof Kozlowski
2025-07-10 5:20 ` CK Hu (胡俊光) [this message]
2025-07-10 7:46 ` CK Hu (胡俊光)
2025-07-24 8:36 ` CK Hu (胡俊光)
2025-07-07 1:31 ` [PATCH v2 09/13] media: platform: mediatek: add isp_7x utility shangyao lin
2025-07-22 2:19 ` CK Hu (胡俊光)
2025-07-07 1:31 ` [PATCH v2 10/13] media: platform: mediatek: add isp_7x video ops shangyao lin
2025-08-01 5:45 ` CK Hu (胡俊光)
2025-07-07 1:31 ` [PATCH v2 11/13] media: platform: mediatek: add isp_7x build config shangyao lin
2025-07-07 1:31 ` [PATCH v2 12/13] uapi: linux: add mediatek isp_7x camsys user api shangyao lin
2025-07-08 1:34 ` CK Hu (胡俊光)
2025-07-07 1:31 ` [PATCH v2 13/13] media: uapi: mediatek: document ISP7x camera system and user controls shangyao lin
2025-07-11 3:12 ` CK Hu (胡俊光)
2025-07-07 5:55 ` [PATCH v2 00/13] Add MediaTek ISP7.x camera system support Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7c89d4a80f292392cbcde4e9167b83469fc85693.camel@mediatek.com \
--to=ck.hu@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=Shangyao.Lin@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=krzk+dt@kernel.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mchehab@kernel.org \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®