From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Sakari Ailus <sakari.ailus@iki.fi>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
Kieran Bingham <kieran.bingham@ideasonboard.com>
Subject: Re: [RFC PATCH v1 14/19] media: renesas: vsp1: Get configuration from partition instead of state
Date: Tue, 18 Jun 2024 19:38:31 +0300 [thread overview]
Message-ID: <20240618163831.GH32669@pendragon.ideasonboard.com> (raw)
In-Reply-To: <6ixii6fdmkpwmqr3a2w3otiml5jcev2vvlbwzjiktu7ry5akh6@f3qssur6yd7z>
Hi Jacopo,
On Tue, Jun 18, 2024 at 01:23:33PM +0200, Jacopo Mondi wrote:
> On Wed, Nov 22, 2023 at 06:30:04AM GMT, Laurent Pinchart wrote:
> > Entities access various piece of information from the entity state when
>
> s/entity state/subdev state/
>
> > configuring a partition. The same data is available through the
> > partition structure passed to the .configure_partition() operation. Use
> > it to avoid accessing the state, which will simplify moving to the V4L2
> > subdev active state API.
>
> I would move this after 10/19 and possibily considering squashing the
> two. The overall diff of the 2 patches combined is pretty understandable.
I can't do that, as this patch depends on 13/19 to calculatate
partitions for the DRM pipeline, otherwise the
struct v4l2_rect crop = partition->rpf[rpf->entity.index];
line in rpf_configure_partition() will dereference a NULL pointer.
> > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > .../media/platform/renesas/vsp1/vsp1_rpf.c | 35 +++++++++----------
> > .../media/platform/renesas/vsp1/vsp1_uds.c | 6 +---
> > .../media/platform/renesas/vsp1/vsp1_wpf.c | 18 +++-------
> > 3 files changed, 23 insertions(+), 36 deletions(-)
> >
> > diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c
> > index 862751616646..b4558670b46f 100644
> > --- a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c
> > +++ b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c
> > @@ -289,7 +289,7 @@ static void rpf_configure_partition(struct vsp1_entity *entity,
> > struct vsp1_device *vsp1 = rpf->entity.vsp1;
> > const struct vsp1_format_info *fmtinfo = rpf->fmtinfo;
> > const struct v4l2_pix_format_mplane *format = &rpf->format;
> > - struct v4l2_rect crop;
> > + struct v4l2_rect crop = partition->rpf[rpf->entity.index];
> >
> > /*
> > * Source size and crop offsets.
> > @@ -299,22 +299,6 @@ static void rpf_configure_partition(struct vsp1_entity *entity,
> > * offsets are needed, as planes 2 and 3 always have identical
> > * strides.
> > */
> > - crop = *v4l2_subdev_state_get_crop(rpf->entity.state, RWPF_PAD_SINK);
> > -
> > - /*
> > - * Partition Algorithm Control
> > - *
> > - * The partition algorithm can split this frame into multiple
> > - * slices. We must scale our partition window based on the pipe
> > - * configuration to match the destination partition window.
> > - * To achieve this, we adjust our crop to provide a 'sub-crop'
> > - * matching the expected partition window. Only 'left' and
> > - * 'width' need to be adjusted.
> > - */
> > - if (pipe->partitions > 1) {
> > - crop.width = partition->rpf[rpf->entity.index].width;
> > - crop.left += partition->rpf[rpf->entity.index].left;
> > - }
> >
> > if (pipe->interlaced) {
> > crop.height = round_down(crop.height / 2, fmtinfo->vsub);
> > @@ -369,8 +353,23 @@ static void rpf_partition(struct vsp1_entity *entity,
> > struct v4l2_rect *window)
> > {
> > struct vsp1_rwpf *rpf = to_rwpf(&entity->subdev);
> > + struct v4l2_rect *rpf_rect = &partition->rpf[rpf->entity.index];
> >
> > - partition->rpf[rpf->entity.index] = *window;
> > + /*
> > + * Partition Algorithm Control
> > + *
> > + * The partition algorithm can split this frame into multiple slices. We
> > + * must adjust our partition window based on the pipe configuration to
> > + * match the destination partition window. To achieve this, we adjust
> > + * our crop to provide a 'sub-crop' matching the expected partition
> > + * window.
> > + */
> > + *rpf_rect = *v4l2_subdev_state_get_crop(entity->state, RWPF_PAD_SINK);
> > +
> > + if (pipe->partitions > 1) {
> > + rpf_rect->width = window->width;
> > + rpf_rect->left += window->left;
> > + }
> > }
> >
> > static const struct vsp1_entity_operations rpf_entity_ops = {
> > diff --git a/drivers/media/platform/renesas/vsp1/vsp1_uds.c b/drivers/media/platform/renesas/vsp1/vsp1_uds.c
> > index 4a14fd3baac1..e5953d86c17c 100644
> > --- a/drivers/media/platform/renesas/vsp1/vsp1_uds.c
> > +++ b/drivers/media/platform/renesas/vsp1/vsp1_uds.c
> > @@ -305,10 +305,6 @@ static void uds_configure_partition(struct vsp1_entity *entity,
> > struct vsp1_dl_body *dlb)
> > {
> > struct vsp1_uds *uds = to_uds(&entity->subdev);
> > - const struct v4l2_mbus_framefmt *output;
> > -
> > - output = v4l2_subdev_state_get_format(uds->entity.state,
> > - UDS_PAD_SOURCE);
> >
> > /* Input size clipping. */
> > vsp1_uds_write(uds, dlb, VI6_UDS_HSZCLIP, VI6_UDS_HSZCLIP_HCEN |
> > @@ -320,7 +316,7 @@ static void uds_configure_partition(struct vsp1_entity *entity,
> > vsp1_uds_write(uds, dlb, VI6_UDS_CLIP_SIZE,
> > (partition->uds_source.width
> > << VI6_UDS_CLIP_SIZE_HSIZE_SHIFT) |
> > - (output->height
> > + (partition->uds_source.height
>
> As I read this 'output' used to be the current format on the sink pad
On the source pad.
> and we use the height from there.
>
> Now we use 'patrition->uds_source.height' which I read being
> initialized in uds_partition() to:
>
> partition->uds_source = *window;
>
> With 'window' being the parameter passed to uds_partition().
And that's the window on the UDS output (source), as windows are
propagated from source to sink (see
vsp1_pipeline_propagate_partition()).
As partitions span the whole height of the image, output->height should
be equal to partition->uds_source.height as far as I can tell.
> Is this correct ?
>
> > << VI6_UDS_CLIP_SIZE_VSIZE_SHIFT));
> > }
> >
> > diff --git a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c
> > index f8d1e2f47691..5c363ff1d36c 100644
> > --- a/drivers/media/platform/renesas/vsp1/vsp1_wpf.c
> > +++ b/drivers/media/platform/renesas/vsp1/vsp1_wpf.c
> > @@ -370,7 +370,6 @@ static void wpf_configure_partition(struct vsp1_entity *entity,
> > struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev);
> > struct vsp1_device *vsp1 = wpf->entity.vsp1;
> > struct vsp1_rwpf_memory mem = wpf->mem;
> > - const struct v4l2_mbus_framefmt *sink_format;
> > const struct v4l2_pix_format_mplane *format = &wpf->format;
> > const struct vsp1_format_info *fmtinfo = wpf->fmtinfo;
> > unsigned int width;
> > @@ -380,20 +379,13 @@ static void wpf_configure_partition(struct vsp1_entity *entity,
> > unsigned int flip;
> > unsigned int i;
> >
> > - sink_format = v4l2_subdev_state_get_format(wpf->entity.state,
> > - RWPF_PAD_SINK);
> > - width = sink_format->width;
> > - height = sink_format->height;
> > - left = 0;
> > -
> > /*
> > - * Cropping. The partition algorithm can split the image into
> > - * multiple slices.
> > + * Cropping. The partition algorithm can split the image into multiple
> > + * slices.
> > */
> > - if (pipe->partitions > 1) {
> > - width = partition->wpf.width;
> > - left = partition->wpf.left;
> > - }
> > + width = partition->wpf.width;
> > + left = partition->wpf.left;
> > + height = partition->wpf.height;
>
> Same question as per the uds module
Same answer :-)
> >
> > vsp1_wpf_write(wpf, dlb, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN |
> > (0 << VI6_WPF_SZCLIP_OFST_SHIFT) |
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2024-06-18 16:38 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-22 4:29 [RFC PATCH v1 00/19] media: renesas: vsp1: Conversion to subdev active state Laurent Pinchart
2023-11-22 4:29 ` [RFC PATCH v1 01/19] media: renesas: vsp1: Drop vsp1_entity_get_pad_format() wrapper Laurent Pinchart
2024-06-18 9:52 ` Jacopo Mondi
2023-11-22 4:29 ` [RFC PATCH v1 02/19] media: renesas: vsp1: Drop vsp1_entity_get_pad_selection() wrapper Laurent Pinchart
2024-06-18 9:56 ` Jacopo Mondi
2023-11-22 4:29 ` [RFC PATCH v1 03/19] media: renesas: vsp1: Drop vsp1_rwpf_get_crop() wrapper Laurent Pinchart
2024-06-18 9:58 ` Jacopo Mondi
2023-11-22 4:29 ` [RFC PATCH v1 04/19] media: renesas: vsp1: Drop brx_get_compose() wrapper Laurent Pinchart
2024-06-18 9:59 ` Jacopo Mondi
2023-11-22 4:29 ` [RFC PATCH v1 05/19] media: renesas: vsp1: Drop custom .get_fmt() handler for histogram Laurent Pinchart
2024-06-18 10:05 ` Jacopo Mondi
2024-06-18 15:57 ` Laurent Pinchart
2023-11-22 4:29 ` [RFC PATCH v1 06/19] media: renesas: vsp1: Move partition calculation to vsp1_pipe.c Laurent Pinchart
2024-06-18 10:26 ` Jacopo Mondi
2023-11-22 4:29 ` [RFC PATCH v1 07/19] media: renesas: vsp1: Simplify partition calculation Laurent Pinchart
2024-06-18 10:29 ` Jacopo Mondi
2023-11-22 4:29 ` [RFC PATCH v1 08/19] media: renesas: vsp1: Store RPF partition configuration per RPF instance Laurent Pinchart
2024-06-18 10:32 ` Jacopo Mondi
2024-06-18 16:09 ` Laurent Pinchart
2023-11-22 4:29 ` [RFC PATCH v1 09/19] media: renesas: vsp1: Pass partition pointer to .configure_partition() Laurent Pinchart
2024-06-18 10:45 ` Jacopo Mondi
2024-06-18 16:13 ` Laurent Pinchart
2024-06-18 16:28 ` Jacopo Mondi
2023-11-22 4:30 ` [RFC PATCH v1 10/19] media: renesas: vsp1: Replace vsp1_partition_window with v4l2_rect Laurent Pinchart
2024-06-18 11:07 ` Jacopo Mondi
2024-06-18 16:24 ` Laurent Pinchart
2024-06-18 16:29 ` Jacopo Mondi
2023-11-22 4:30 ` [RFC PATCH v1 11/19] media: renesas: vsp1: Add and use function to dump a pipeline to the log Laurent Pinchart
2024-06-18 11:34 ` Jacopo Mondi
2024-06-18 16:25 ` Laurent Pinchart
2024-06-18 16:30 ` Jacopo Mondi
2023-11-22 4:30 ` [RFC PATCH v1 12/19] media: renesas: vsp1: Keep the DRM pipeline entities sorted Laurent Pinchart
2024-06-19 12:02 ` Jacopo Mondi
2023-11-22 4:30 ` [RFC PATCH v1 13/19] media: renesas: vsp1: Compute partitions for DRM pipelines Laurent Pinchart
2024-06-18 11:35 ` Jacopo Mondi
2023-11-22 4:30 ` [RFC PATCH v1 14/19] media: renesas: vsp1: Get configuration from partition instead of state Laurent Pinchart
2024-06-18 11:23 ` Jacopo Mondi
2024-06-18 16:38 ` Laurent Pinchart [this message]
2024-06-18 16:46 ` Jacopo Mondi
2023-11-22 4:30 ` [RFC PATCH v1 15/19] media: renesas: vsp1: Name parameters to entity operations Laurent Pinchart
2024-06-18 11:24 ` Jacopo Mondi
2023-11-22 4:30 ` [RFC PATCH v1 16/19] media: renesas: vsp1: Pass subdev state " Laurent Pinchart
2024-06-18 16:52 ` Jacopo Mondi
2024-06-18 17:17 ` Laurent Pinchart
2023-11-22 4:30 ` [RFC PATCH v1 17/19] media: renesas: vsp1: Initialize control handler after subdev Laurent Pinchart
2024-06-18 16:56 ` Jacopo Mondi
2023-11-22 4:30 ` [RFC PATCH v1 18/19] media: renesas: vsp1: Switch to V4L2 subdev active state Laurent Pinchart
2023-11-22 4:30 ` [RFC PATCH v1 19/19] media: renesas: vsp1: Rename all v4l2_subdev_state variables to 'state' Laurent Pinchart
2024-06-18 16:57 ` Jacopo Mondi
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=20240618163831.GH32669@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jacopo.mondi@ideasonboard.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=sakari.ailus@iki.fi \
--cc=tomi.valkeinen@ideasonboard.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.