From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Stefan Klug <stefan.klug@ideasonboard.com>
Cc: Xavier Roumegue <xavier.roumegue@oss.nxp.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Clark Williams <clrkwllms@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rt-devel@lists.linux.dev,
Nicolas Dufresne <nicolas@ndufresne.ca>
Subject: Re: [PATCH v3 2/4] media: dw100: Implement dynamic vertex map update
Date: Tue, 10 Feb 2026 20:07:03 +0200 [thread overview]
Message-ID: <20260210180703.GC2502896@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20260129-sklug-v6-16-topic-dw100-v3-1-dev-v3-2-2eb5685eaf09@ideasonboard.com>
Hi Stefan,
Thank you for the patch.
On Thu, Jan 29, 2026 at 12:43:11PM +0100, Stefan Klug wrote:
> Implement dynamic vertex map updates by handling the
> V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP control during streaming. This
> allows to implement features like dynamic zoom, pan, rotate and dewarp.
>
> To stay compatible with the old version, updates of
> V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP are ignored during streaming
> when requests are not used. Print a corresponding warning once.
>
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
>
> ---
>
> Changes in v2:
> - Replaced the manual warn once by dev_warn_once(). This changes the
> frequency from once per context to once per boot which was agreed to
> be enough.
> - Renamed user_map_needs_update to user_map_is_dirty as it is more
> expressive and fits to user_map_is_set
> - Fixed indentation issue found by Media CI
> ---
> drivers/media/platform/nxp/dw100/dw100.c | 24 ++++++++++++++++++------
> 1 file changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/platform/nxp/dw100/dw100.c b/drivers/media/platform/nxp/dw100/dw100.c
> index 1cb895da9912371a2b23ca62412c572d9cb75c00..d2b1c62b52db47ea1d2242caaf334fff30c6f366 100644
> --- a/drivers/media/platform/nxp/dw100/dw100.c
> +++ b/drivers/media/platform/nxp/dw100/dw100.c
> @@ -98,6 +98,7 @@ struct dw100_ctx {
> unsigned int map_width;
> unsigned int map_height;
> bool user_map_is_set;
> + bool user_map_is_dirty;
>
> /* Source and destination queue data */
> struct dw100_q_data q_data[2];
> @@ -293,11 +294,15 @@ static u32 dw100_map_format_coordinates(u16 xq, u16 yq)
> return (u32)((yq << 16) | xq);
> }
>
> -static u32 *dw100_get_user_map(struct dw100_ctx *ctx)
> +static void dw100_update_mapping(struct dw100_ctx *ctx)
> {
> struct v4l2_ctrl *ctrl = ctx->ctrls[DW100_CTRL_DEWARPING_MAP];
>
> - return ctrl->p_cur.p_u32;
> + if (!ctx->user_map_is_dirty)
> + return;
> +
> + memcpy(ctx->map, ctrl->p_cur.p_u32, ctx->map_size);
> + ctx->user_map_is_dirty = false;
> }
>
> /*
> @@ -306,8 +311,6 @@ static u32 *dw100_get_user_map(struct dw100_ctx *ctx)
> */
> static int dw100_create_mapping(struct dw100_ctx *ctx)
> {
> - u32 *user_map;
> -
> if (ctx->map)
> dma_free_coherent(&ctx->dw_dev->pdev->dev, ctx->map_size,
> ctx->map, ctx->map_dma);
> @@ -318,8 +321,8 @@ static int dw100_create_mapping(struct dw100_ctx *ctx)
> if (!ctx->map)
> return -ENOMEM;
>
> - user_map = dw100_get_user_map(ctx);
> - memcpy(ctx->map, user_map, ctx->map_size);
> + ctx->user_map_is_dirty = true;
> + dw100_update_mapping(ctx);
>
> dev_dbg(&ctx->dw_dev->pdev->dev,
> "%ux%u %s mapping created (d:%pad-c:%p) for stream %ux%u->%ux%u\n",
> @@ -351,6 +354,7 @@ static int dw100_s_ctrl(struct v4l2_ctrl *ctrl)
> switch (ctrl->id) {
> case V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP:
> ctx->user_map_is_set = true;
> + ctx->user_map_is_dirty = true;
> break;
> }
>
> @@ -405,6 +409,7 @@ static void dw100_ctrl_dewarping_map_init(const struct v4l2_ctrl *ctrl,
> }
>
> ctx->user_map_is_set = false;
> + ctx->user_map_is_dirty = true;
> }
>
> static const struct v4l2_ctrl_type_ops dw100_ctrl_type_ops = {
> @@ -1478,6 +1483,13 @@ static void dw100_device_run(void *priv)
> v4l2_ctrl_request_setup(src_buf->vb2_buf.req_obj.req,
> &ctx->hdl);
>
> + if (src_buf->vb2_buf.req_obj.req)
> + dw100_update_mapping(ctx);
> + else if (ctx->user_map_is_dirty)
> + dev_warn_once(&ctx->dw_dev->pdev->dev,
> + "V4L2 requests are required to update the vertex map dynamically"
Missing \n
> + );
The closing parenthesis goes at the end of the previous line.
With those small issues fixed,
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> +
> v4l2_ctrl_request_complete(src_buf->vb2_buf.req_obj.req,
> &ctx->hdl);
>
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2026-02-10 18:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 11:43 [PATCH v3 0/4] media: dw100: Dynamic vertex map updates and fixes for PREEMPT_RT Stefan Klug
2026-01-29 11:43 ` [PATCH v3 1/4] media: dw100: Implement V4L2 requests support Stefan Klug
2026-02-10 17:50 ` Laurent Pinchart
2026-02-25 7:23 ` Stefan Klug
2026-02-25 10:57 ` Laurent Pinchart
2026-01-29 11:43 ` [PATCH v3 2/4] media: dw100: Implement dynamic vertex map update Stefan Klug
2026-02-10 18:07 ` Laurent Pinchart [this message]
2026-01-29 11:43 ` [PATCH v3 3/4] media: dw100: Fix kernel oops with PREEMPT_RT enabled Stefan Klug
2026-02-06 7:55 ` Xavier Roumegue (OSS)
2026-02-10 18:13 ` Laurent Pinchart
2026-01-29 11:43 ` [PATCH v3 4/4] media: dw100: Merge dw100_device_run and dw100_start Stefan Klug
2026-02-06 8:04 ` Xavier Roumegue (OSS)
2026-02-10 18:14 ` Laurent Pinchart
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=20260210180703.GC2502896@killaraus.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=bigeasy@linutronix.de \
--cc=clrkwllms@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=nicolas@ndufresne.ca \
--cc=rostedt@goodmis.org \
--cc=stefan.klug@ideasonboard.com \
--cc=xavier.roumegue@oss.nxp.com \
/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