From: jacopo mondi <jacopo@jmondi.org> To: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Cc: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, Kieran Bingham <kieran.bingham@ideasonboard.com> Subject: Re: [PATCH v2 3/8] v4l: vsp1: Reset the crop and compose rectangles in the set_fmt helper Date: Sat, 28 Apr 2018 11:56:04 +0200 [thread overview] Message-ID: <20180428095604.GB18201@w540> (raw) In-Reply-To: <20180422223430.16407-4-laurent.pinchart+renesas@ideasonboard.com> [-- Attachment #1: Type: text/plain, Size: 4645 bytes --] Hi Laurent, On Mon, Apr 23, 2018 at 01:34:25AM +0300, Laurent Pinchart wrote: > To make vsp1_subdev_set_pad_format() usable by entities that support > selection rectangles, we need to reset the crop and compose rectangles > when setting the format on the sink pad. Do so and replace the custom > set_fmt implementation of the histogram code by a call to > vsp1_subdev_set_pad_format(). > > Resetting the crop and compose rectangles for entities that don't > support crop and compose has no adverse effect as the rectangles are > ignored anyway. > > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> > --- > drivers/media/platform/vsp1/vsp1_entity.c | 16 +++++++++ > drivers/media/platform/vsp1/vsp1_histo.c | 59 +++---------------------------- > 2 files changed, 20 insertions(+), 55 deletions(-) > > diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c > index 239df047efd0..181a583aecad 100644 > --- a/drivers/media/platform/vsp1/vsp1_entity.c > +++ b/drivers/media/platform/vsp1/vsp1_entity.c > @@ -335,6 +335,7 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev, > struct vsp1_entity *entity = to_vsp1_entity(subdev); > struct v4l2_subdev_pad_config *config; > struct v4l2_mbus_framefmt *format; > + struct v4l2_rect *selection; > unsigned int i; > int ret = 0; > > @@ -377,6 +378,21 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev, > format = vsp1_entity_get_pad_format(entity, config, 1); > *format = fmt->format; > > + /* Reset the crop and compose rectangles */ > + selection = vsp1_entity_get_pad_selection(entity, config, fmt->pad, > + V4L2_SEL_TGT_CROP); > + selection->left = 0; > + selection->top = 0; > + selection->width = format->width; > + selection->height = format->height; > + > + selection = vsp1_entity_get_pad_selection(entity, config, fmt->pad, > + V4L2_SEL_TGT_COMPOSE); > + selection->left = 0; > + selection->top = 0; > + selection->width = format->width; > + selection->height = format->height; > + > done: > mutex_unlock(&entity->lock); > return ret; > diff --git a/drivers/media/platform/vsp1/vsp1_histo.c b/drivers/media/platform/vsp1/vsp1_histo.c > index 029181c1fb61..5e15c8ff88d9 100644 > --- a/drivers/media/platform/vsp1/vsp1_histo.c > +++ b/drivers/media/platform/vsp1/vsp1_histo.c > @@ -389,65 +389,14 @@ static int histo_set_format(struct v4l2_subdev *subdev, > struct v4l2_subdev_format *fmt) > { > struct vsp1_histogram *histo = subdev_to_histo(subdev); > - struct v4l2_subdev_pad_config *config; > - struct v4l2_mbus_framefmt *format; > - struct v4l2_rect *selection; > - unsigned int i; > - int ret = 0; > > if (fmt->pad != HISTO_PAD_SINK) > return histo_get_format(subdev, cfg, fmt); > > - mutex_lock(&histo->entity.lock); > - > - config = vsp1_entity_get_pad_config(&histo->entity, cfg, fmt->which); > - if (!config) { > - ret = -EINVAL; > - goto done; > - } > - > - /* > - * Default to the first format if the requested format is not > - * supported. > - */ > - for (i = 0; i < histo->num_formats; ++i) { > - if (fmt->format.code == histo->formats[i]) > - break; > - } > - if (i == histo->num_formats) > - fmt->format.code = histo->formats[0]; > - > - format = vsp1_entity_get_pad_format(&histo->entity, config, fmt->pad); > - > - format->code = fmt->format.code; > - format->width = clamp_t(unsigned int, fmt->format.width, > - HISTO_MIN_SIZE, HISTO_MAX_SIZE); > - format->height = clamp_t(unsigned int, fmt->format.height, > - HISTO_MIN_SIZE, HISTO_MAX_SIZE); > - format->field = V4L2_FIELD_NONE; > - format->colorspace = V4L2_COLORSPACE_SRGB; > - > - fmt->format = *format; > - > - /* Reset the crop and compose rectangles */ > - selection = vsp1_entity_get_pad_selection(&histo->entity, config, > - fmt->pad, V4L2_SEL_TGT_CROP); > - selection->left = 0; > - selection->top = 0; > - selection->width = format->width; > - selection->height = format->height; > - > - selection = vsp1_entity_get_pad_selection(&histo->entity, config, > - fmt->pad, > - V4L2_SEL_TGT_COMPOSE); > - selection->left = 0; > - selection->top = 0; > - selection->width = format->width; > - selection->height = format->height; > - > -done: > - mutex_unlock(&histo->entity.lock); > - return ret; > + return vsp1_subdev_set_pad_format(subdev, cfg, fmt, > + histo->formats, histo->num_formats, > + HISTO_MIN_SIZE, HISTO_MIN_SIZE, > + HISTO_MAX_SIZE, HISTO_MAX_SIZE); > } > > static const struct v4l2_subdev_pad_ops histo_pad_ops = { > -- > Regards, > > Laurent Pinchart > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 819 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: jacopo mondi <jacopo@jmondi.org> To: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Cc: linux-renesas-soc@vger.kernel.org, Kieran Bingham <kieran.bingham@ideasonboard.com>, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org Subject: Re: [PATCH v2 3/8] v4l: vsp1: Reset the crop and compose rectangles in the set_fmt helper Date: Sat, 28 Apr 2018 11:56:04 +0200 [thread overview] Message-ID: <20180428095604.GB18201@w540> (raw) In-Reply-To: <20180422223430.16407-4-laurent.pinchart+renesas@ideasonboard.com> [-- Attachment #1.1: Type: text/plain, Size: 4645 bytes --] Hi Laurent, On Mon, Apr 23, 2018 at 01:34:25AM +0300, Laurent Pinchart wrote: > To make vsp1_subdev_set_pad_format() usable by entities that support > selection rectangles, we need to reset the crop and compose rectangles > when setting the format on the sink pad. Do so and replace the custom > set_fmt implementation of the histogram code by a call to > vsp1_subdev_set_pad_format(). > > Resetting the crop and compose rectangles for entities that don't > support crop and compose has no adverse effect as the rectangles are > ignored anyway. > > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> > --- > drivers/media/platform/vsp1/vsp1_entity.c | 16 +++++++++ > drivers/media/platform/vsp1/vsp1_histo.c | 59 +++---------------------------- > 2 files changed, 20 insertions(+), 55 deletions(-) > > diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c > index 239df047efd0..181a583aecad 100644 > --- a/drivers/media/platform/vsp1/vsp1_entity.c > +++ b/drivers/media/platform/vsp1/vsp1_entity.c > @@ -335,6 +335,7 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev, > struct vsp1_entity *entity = to_vsp1_entity(subdev); > struct v4l2_subdev_pad_config *config; > struct v4l2_mbus_framefmt *format; > + struct v4l2_rect *selection; > unsigned int i; > int ret = 0; > > @@ -377,6 +378,21 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev, > format = vsp1_entity_get_pad_format(entity, config, 1); > *format = fmt->format; > > + /* Reset the crop and compose rectangles */ > + selection = vsp1_entity_get_pad_selection(entity, config, fmt->pad, > + V4L2_SEL_TGT_CROP); > + selection->left = 0; > + selection->top = 0; > + selection->width = format->width; > + selection->height = format->height; > + > + selection = vsp1_entity_get_pad_selection(entity, config, fmt->pad, > + V4L2_SEL_TGT_COMPOSE); > + selection->left = 0; > + selection->top = 0; > + selection->width = format->width; > + selection->height = format->height; > + > done: > mutex_unlock(&entity->lock); > return ret; > diff --git a/drivers/media/platform/vsp1/vsp1_histo.c b/drivers/media/platform/vsp1/vsp1_histo.c > index 029181c1fb61..5e15c8ff88d9 100644 > --- a/drivers/media/platform/vsp1/vsp1_histo.c > +++ b/drivers/media/platform/vsp1/vsp1_histo.c > @@ -389,65 +389,14 @@ static int histo_set_format(struct v4l2_subdev *subdev, > struct v4l2_subdev_format *fmt) > { > struct vsp1_histogram *histo = subdev_to_histo(subdev); > - struct v4l2_subdev_pad_config *config; > - struct v4l2_mbus_framefmt *format; > - struct v4l2_rect *selection; > - unsigned int i; > - int ret = 0; > > if (fmt->pad != HISTO_PAD_SINK) > return histo_get_format(subdev, cfg, fmt); > > - mutex_lock(&histo->entity.lock); > - > - config = vsp1_entity_get_pad_config(&histo->entity, cfg, fmt->which); > - if (!config) { > - ret = -EINVAL; > - goto done; > - } > - > - /* > - * Default to the first format if the requested format is not > - * supported. > - */ > - for (i = 0; i < histo->num_formats; ++i) { > - if (fmt->format.code == histo->formats[i]) > - break; > - } > - if (i == histo->num_formats) > - fmt->format.code = histo->formats[0]; > - > - format = vsp1_entity_get_pad_format(&histo->entity, config, fmt->pad); > - > - format->code = fmt->format.code; > - format->width = clamp_t(unsigned int, fmt->format.width, > - HISTO_MIN_SIZE, HISTO_MAX_SIZE); > - format->height = clamp_t(unsigned int, fmt->format.height, > - HISTO_MIN_SIZE, HISTO_MAX_SIZE); > - format->field = V4L2_FIELD_NONE; > - format->colorspace = V4L2_COLORSPACE_SRGB; > - > - fmt->format = *format; > - > - /* Reset the crop and compose rectangles */ > - selection = vsp1_entity_get_pad_selection(&histo->entity, config, > - fmt->pad, V4L2_SEL_TGT_CROP); > - selection->left = 0; > - selection->top = 0; > - selection->width = format->width; > - selection->height = format->height; > - > - selection = vsp1_entity_get_pad_selection(&histo->entity, config, > - fmt->pad, > - V4L2_SEL_TGT_COMPOSE); > - selection->left = 0; > - selection->top = 0; > - selection->width = format->width; > - selection->height = format->height; > - > -done: > - mutex_unlock(&histo->entity.lock); > - return ret; > + return vsp1_subdev_set_pad_format(subdev, cfg, fmt, > + histo->formats, histo->num_formats, > + HISTO_MIN_SIZE, HISTO_MIN_SIZE, > + HISTO_MAX_SIZE, HISTO_MAX_SIZE); > } > > static const struct v4l2_subdev_pad_ops histo_pad_ops = { > -- > Regards, > > Laurent Pinchart > [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 819 bytes --] [-- Attachment #2: Type: text/plain, Size: 160 bytes --] _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-04-28 9:56 UTC|newest] Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-04-22 22:34 [PATCH v2 0/8] R-Car DU: Support CRC calculation Laurent Pinchart 2018-04-22 22:34 ` Laurent Pinchart 2018-04-22 22:34 ` [PATCH v2 1/8] v4l: vsp1: Use SPDX license headers Laurent Pinchart 2018-04-22 22:34 ` Laurent Pinchart 2018-04-27 21:25 ` Kieran Bingham 2018-04-27 21:25 ` Kieran Bingham 2018-04-27 21:47 ` Laurent Pinchart 2018-04-27 21:47 ` Laurent Pinchart 2018-04-22 22:34 ` [PATCH v2 2/8] v4l: vsp1: Share the CLU, LIF and LUT set_fmt pad operation code Laurent Pinchart 2018-04-22 22:34 ` Laurent Pinchart 2018-04-28 9:50 ` jacopo mondi 2018-04-28 9:50 ` jacopo mondi 2018-04-28 16:07 ` Laurent Pinchart 2018-04-28 16:07 ` Laurent Pinchart 2018-04-28 17:16 ` Kieran Bingham 2018-04-28 17:16 ` Kieran Bingham 2018-04-28 17:25 ` Laurent Pinchart 2018-04-28 17:25 ` Laurent Pinchart 2018-04-28 17:30 ` Laurent Pinchart 2018-04-28 17:30 ` Laurent Pinchart 2018-04-28 17:32 ` Kieran Bingham 2018-04-28 17:32 ` Kieran Bingham 2018-04-22 22:34 ` [PATCH v2 3/8] v4l: vsp1: Reset the crop and compose rectangles in the set_fmt helper Laurent Pinchart 2018-04-22 22:34 ` Laurent Pinchart 2018-04-28 9:56 ` jacopo mondi [this message] 2018-04-28 9:56 ` jacopo mondi 2018-04-28 17:22 ` Kieran Bingham 2018-04-28 17:22 ` Kieran Bingham 2018-04-22 22:34 ` [PATCH v2 4/8] v4l: vsp1: Document the vsp1_du_atomic_config structure Laurent Pinchart 2018-04-22 22:34 ` Laurent Pinchart 2018-04-28 17:29 ` Kieran Bingham 2018-04-28 17:29 ` Kieran Bingham 2018-04-22 22:34 ` [PATCH v2 5/8] v4l: vsp1: Extend the DU API to support CRC computation Laurent Pinchart 2018-04-22 22:34 ` Laurent Pinchart 2018-04-28 10:03 ` jacopo mondi 2018-04-28 10:03 ` jacopo mondi 2018-04-28 16:19 ` Laurent Pinchart 2018-04-28 16:19 ` Laurent Pinchart 2018-04-28 17:48 ` Kieran Bingham 2018-04-28 17:48 ` Kieran Bingham 2018-04-22 22:34 ` [PATCH v2 6/8] v4l: vsp1: Add support for the DISCOM entity Laurent Pinchart 2018-04-22 22:34 ` Laurent Pinchart 2018-04-28 10:40 ` jacopo mondi 2018-04-28 10:40 ` jacopo mondi 2018-04-28 16:50 ` Laurent Pinchart 2018-04-28 16:50 ` Laurent Pinchart 2018-04-28 18:28 ` Kieran Bingham 2018-04-28 18:28 ` Kieran Bingham 2018-04-22 22:34 ` [PATCH v2 7/8] v4l: vsp1: Integrate DISCOM in display pipeline Laurent Pinchart 2018-04-22 22:34 ` Laurent Pinchart 2018-04-28 11:00 ` jacopo mondi 2018-04-28 11:00 ` jacopo mondi 2018-04-28 16:57 ` Laurent Pinchart 2018-04-28 16:57 ` Laurent Pinchart 2018-04-28 18:58 ` Kieran Bingham 2018-04-28 18:58 ` Kieran Bingham 2018-04-28 19:15 ` Laurent Pinchart 2018-04-28 19:15 ` Laurent Pinchart 2018-04-22 22:34 ` [PATCH v2 8/8] drm: rcar-du: Add support for CRC computation Laurent Pinchart 2018-04-22 22:34 ` Laurent Pinchart 2018-04-28 19:16 ` Kieran Bingham 2018-04-28 19:16 ` Kieran Bingham 2018-04-28 20:15 ` Laurent Pinchart 2018-04-28 20:15 ` Laurent Pinchart 2018-04-27 21:07 ` igt trouble with planes shared between multiple CRTCs (Re: [PATCH v2 0/8] R-Car DU: Support CRC calculation) Laurent Pinchart 2018-04-27 21:07 ` Laurent Pinchart 2018-04-30 14:55 ` Daniel Vetter 2018-04-30 14:55 ` Daniel Vetter 2018-04-30 14:56 ` Daniel Vetter 2018-04-30 14:56 ` [igt-dev] " Daniel Vetter 2018-04-30 14:56 ` Daniel Vetter 2018-05-01 8:58 ` Maarten Lankhorst 2018-05-01 8:58 ` [igt-dev] " Maarten Lankhorst 2018-05-01 8:58 ` Maarten Lankhorst 2018-05-01 15:47 ` Maarten Lankhorst 2018-05-01 15:47 ` [igt-dev] " Maarten Lankhorst 2018-05-01 15:47 ` Maarten Lankhorst 2018-05-02 7:32 ` Daniel Vetter 2018-05-02 7:32 ` Daniel Vetter 2018-05-07 13:28 ` Maarten Lankhorst 2018-05-07 13:28 ` [igt-dev] " Maarten Lankhorst 2018-05-07 13:28 ` Maarten Lankhorst
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=20180428095604.GB18201@w540 \ --to=jacopo@jmondi.org \ --cc=dri-devel@lists.freedesktop.org \ --cc=kieran.bingham@ideasonboard.com \ --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: linkBe 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.