From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Kieran Bingham <kieran+renesas@ksquared.org.uk>
Subject: Re: [PATCH 11/13] v4l: vsp1: Determine partition requirements for scaled images
Date: Wed, 14 Sep 2016 21:27:33 +0200 [thread overview]
Message-ID: <20160914192733.GL739@bigcity.dyn.berto.se> (raw)
In-Reply-To: <1473808626-19488-12-git-send-email-laurent.pinchart+renesas@ideasonboard.com>
On 2016-09-14 02:17:04 +0300, Laurent Pinchart wrote:
> From: Kieran Bingham <kieran+renesas@bingham.xyz>
>
> The partition algorithm needs to determine the capabilities of each
> entity in the pipeline to identify the correct maximum partition width.
>
> Extend the vsp1 entity operations to provide a max_width operation and
> use this call to calculate the number of partitions that will be
> processed by the algorithm.
>
> Gen 2 hardware does not require multiple partitioning, and as such
> will always return a single partition.
>
> Signed-off-by: Kieran Bingham <kieran+renesas@bingham.xyz>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
I can't find the information about the partition limitations for SRU or
UDS in any of the documents I have. But for the parts not relating to
the logic of figuring out the hscale from the input/output formats
width:
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
> drivers/media/platform/vsp1/vsp1_entity.h | 3 +++
> drivers/media/platform/vsp1/vsp1_pipe.h | 5 ++++
> drivers/media/platform/vsp1/vsp1_sru.c | 19 +++++++++++++++
> drivers/media/platform/vsp1/vsp1_uds.c | 25 +++++++++++++++++++
> drivers/media/platform/vsp1/vsp1_video.c | 40 +++++++++++++++++++++++++++++++
> 5 files changed, 92 insertions(+)
>
> diff --git a/drivers/media/platform/vsp1/vsp1_entity.h b/drivers/media/platform/vsp1/vsp1_entity.h
> index 0e3e394c44cd..90a4d95c0a50 100644
> --- a/drivers/media/platform/vsp1/vsp1_entity.h
> +++ b/drivers/media/platform/vsp1/vsp1_entity.h
> @@ -77,11 +77,14 @@ struct vsp1_route {
> * @destroy: Destroy the entity.
> * @configure: Setup the hardware based on the entity state (pipeline, formats,
> * selection rectangles, ...)
> + * @max_width: Return the max supported width of data that the entity can
> + * process in a single operation.
> */
> struct vsp1_entity_operations {
> void (*destroy)(struct vsp1_entity *);
> void (*configure)(struct vsp1_entity *, struct vsp1_pipeline *,
> struct vsp1_dl_list *, enum vsp1_entity_params);
> + unsigned int (*max_width)(struct vsp1_entity *, struct vsp1_pipeline *);
> };
>
> struct vsp1_entity {
> diff --git a/drivers/media/platform/vsp1/vsp1_pipe.h b/drivers/media/platform/vsp1/vsp1_pipe.h
> index d20d997b1fda..af4cd23d399b 100644
> --- a/drivers/media/platform/vsp1/vsp1_pipe.h
> +++ b/drivers/media/platform/vsp1/vsp1_pipe.h
> @@ -77,6 +77,8 @@ enum vsp1_pipeline_state {
> * @uds_input: entity at the input of the UDS, if the UDS is present
> * @entities: list of entities in the pipeline
> * @dl: display list associated with the pipeline
> + * @div_size: The maximum allowed partition size for the pipeline
> + * @partitions: The number of partitions used to process one frame
> */
> struct vsp1_pipeline {
> struct media_pipeline pipe;
> @@ -104,6 +106,9 @@ struct vsp1_pipeline {
> struct list_head entities;
>
> struct vsp1_dl_list *dl;
> +
> + unsigned int div_size;
> + unsigned int partitions;
> };
>
> void vsp1_pipeline_reset(struct vsp1_pipeline *pipe);
> diff --git a/drivers/media/platform/vsp1/vsp1_sru.c b/drivers/media/platform/vsp1/vsp1_sru.c
> index 9d4a1afb6634..b4e568a3b4ed 100644
> --- a/drivers/media/platform/vsp1/vsp1_sru.c
> +++ b/drivers/media/platform/vsp1/vsp1_sru.c
> @@ -306,8 +306,27 @@ static void sru_configure(struct vsp1_entity *entity,
> vsp1_sru_write(sru, dl, VI6_SRU_CTRL2, param->ctrl2);
> }
>
> +static unsigned int sru_max_width(struct vsp1_entity *entity,
> + struct vsp1_pipeline *pipe)
> +{
> + struct vsp1_sru *sru = to_sru(&entity->subdev);
> + struct v4l2_mbus_framefmt *input;
> + struct v4l2_mbus_framefmt *output;
> +
> + input = vsp1_entity_get_pad_format(&sru->entity, sru->entity.config,
> + SRU_PAD_SINK);
> + output = vsp1_entity_get_pad_format(&sru->entity, sru->entity.config,
> + SRU_PAD_SOURCE);
> +
> + if (input->width != output->width)
> + return 512;
> + else
> + return 256;
> +}
> +
> static const struct vsp1_entity_operations sru_entity_ops = {
> .configure = sru_configure,
> + .max_width = sru_max_width,
> };
>
> /* -----------------------------------------------------------------------------
> diff --git a/drivers/media/platform/vsp1/vsp1_uds.c b/drivers/media/platform/vsp1/vsp1_uds.c
> index 62beae5d6944..706b6e85f47d 100644
> --- a/drivers/media/platform/vsp1/vsp1_uds.c
> +++ b/drivers/media/platform/vsp1/vsp1_uds.c
> @@ -311,8 +311,33 @@ static void uds_configure(struct vsp1_entity *entity,
> (output->height << VI6_UDS_CLIP_SIZE_VSIZE_SHIFT));
> }
>
> +static unsigned int uds_max_width(struct vsp1_entity *entity,
> + struct vsp1_pipeline *pipe)
> +{
> + struct vsp1_uds *uds = to_uds(&entity->subdev);
> + const struct v4l2_mbus_framefmt *output;
> + const struct v4l2_mbus_framefmt *input;
> + unsigned int hscale;
> +
> + input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config,
> + UDS_PAD_SINK);
> + output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config,
> + UDS_PAD_SOURCE);
> + hscale = output->width / input->width;
> +
> + if (hscale <= 2)
> + return 256;
> + else if (hscale <= 4)
> + return 512;
> + else if (hscale <= 8)
> + return 1024;
> + else
> + return 2048;
> +}
> +
> static const struct vsp1_entity_operations uds_entity_ops = {
> .configure = uds_configure,
> + .max_width = uds_max_width,
> };
>
> /* -----------------------------------------------------------------------------
> diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
> index b8339d874df4..b903cc5471e0 100644
> --- a/drivers/media/platform/vsp1/vsp1_video.c
> +++ b/drivers/media/platform/vsp1/vsp1_video.c
> @@ -169,6 +169,43 @@ static int __vsp1_video_try_format(struct vsp1_video *video,
> }
>
> /* -----------------------------------------------------------------------------
> + * VSP1 Partition Algorithm support
> + */
> +
> +static void vsp1_video_pipeline_setup_partitions(struct vsp1_pipeline *pipe)
> +{
> + struct vsp1_device *vsp1 = pipe->output->entity.vsp1;
> + const struct v4l2_mbus_framefmt *format;
> + struct vsp1_entity *entity;
> + unsigned int div_size;
> +
> + format = vsp1_entity_get_pad_format(&pipe->output->entity,
> + pipe->output->entity.config,
> + RWPF_PAD_SOURCE);
> + div_size = format->width;
> +
> + /* Gen2 hardware doesn't require image partitioning. */
> + if (vsp1->info->gen == 2) {
> + pipe->div_size = div_size;
> + pipe->partitions = 1;
> + return;
> + }
> +
> + list_for_each_entry(entity, &pipe->entities, list_pipe) {
> + unsigned int entity_max = VSP1_VIDEO_MAX_WIDTH;
> +
> + if (entity->ops->max_width) {
> + entity_max = entity->ops->max_width(entity, pipe);
> + if (entity_max)
> + div_size = min(div_size, entity_max);
> + }
> + }
> +
> + pipe->div_size = div_size;
> + pipe->partitions = DIV_ROUND_UP(format->width, div_size);
> +}
> +
> +/* -----------------------------------------------------------------------------
> * Pipeline Management
> */
>
> @@ -594,6 +631,9 @@ static int vsp1_video_setup_pipeline(struct vsp1_pipeline *pipe)
> {
> struct vsp1_entity *entity;
>
> + /* Determine this pipelines sizes for image partitioning support. */
> + vsp1_video_pipeline_setup_partitions(pipe);
> +
> /* Prepare the display list. */
> pipe->dl = vsp1_dl_list_get(pipe->output->dlm);
> if (!pipe->dl)
> --
> Regards,
>
> Laurent Pinchart
>
--
Regards,
Niklas Söderlund
next prev parent reply other threads:[~2016-09-14 19:27 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-13 23:16 [PATCH 00/13] Renesas R-Car VSP: Scaling and rotation support on Gen3 Laurent Pinchart
2016-09-13 23:16 ` [PATCH 01/13] v4l: vsp1: Prevent pipelines from running when not streaming Laurent Pinchart
2016-09-13 23:16 ` [PATCH 02/13] v4l: vsp1: Protect against race conditions between get and set format Laurent Pinchart
2016-09-14 18:23 ` Niklas Söderlund
2016-09-14 19:32 ` Niklas Söderlund
2016-09-14 19:50 ` Laurent Pinchart
2016-09-13 23:16 ` [PATCH 03/13] v4l: vsp1: Ensure pipeline locking in resume path Laurent Pinchart
2016-09-14 18:28 ` Niklas Söderlund
2016-09-13 23:16 ` [PATCH 04/13] v4l: vsp1: Repair race between frame end and qbuf handler Laurent Pinchart
2016-09-14 8:01 ` Kieran Bingham
2016-09-13 23:16 ` [PATCH 05/13] v4l: vsp1: Use DFE instead of FRE for frame end Laurent Pinchart
2016-09-14 18:39 ` Niklas Söderlund
2016-09-13 23:16 ` [PATCH 06/13] v4l: vsp1: Disable cropping on WPF sink pad Laurent Pinchart
2016-09-14 18:54 ` Niklas Söderlund
2016-09-19 17:55 ` Mauro Carvalho Chehab
2016-09-19 17:59 ` Laurent Pinchart
2016-09-19 18:26 ` Mauro Carvalho Chehab
2016-09-19 18:33 ` Laurent Pinchart
2016-09-19 19:02 ` Mauro Carvalho Chehab
2016-09-13 23:17 ` [PATCH 07/13] v4l: vsp1: Fix RPF cropping Laurent Pinchart
2016-09-13 23:17 ` [PATCH 08/13] v4l: vsp1: Pass parameter type to entity configuration operation Laurent Pinchart
2016-09-14 19:02 ` Niklas Söderlund
2016-09-13 23:17 ` [PATCH 09/13] v4l: vsp1: Replace .set_memory() with VSP1_ENTITY_PARAMS_PARTITION Laurent Pinchart
2016-09-13 23:17 ` [PATCH 10/13] v4l: vsp1: Support chained display lists Laurent Pinchart
2016-09-13 23:17 ` [PATCH 11/13] v4l: vsp1: Determine partition requirements for scaled images Laurent Pinchart
2016-09-14 19:27 ` Niklas Söderlund [this message]
2016-09-14 20:00 ` Laurent Pinchart
2016-09-15 13:19 ` Niklas Söderlund
2016-09-13 23:17 ` [PATCH 12/13] v4l: vsp1: Support multiple partitions per frame Laurent Pinchart
2016-09-13 23:17 ` [PATCH 13/13] v4l: vsp1: wpf: Implement rotation support Laurent Pinchart
2016-09-13 23:29 ` [PATCH 14/13] v4l: vsp1: Fix spinlock in mixed IRQ context function Laurent Pinchart
2016-09-14 19:30 ` Niklas Söderlund
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=20160914192733.GL739@bigcity.dyn.berto.se \
--to=niklas.soderlund@ragnatech.se \
--cc=kieran+renesas@ksquared.org.uk \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.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;
as well as URLs for NNTP newsgroup(s).