From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: jacopo mondi <jacopo@jmondi.org>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
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 6/8] v4l: vsp1: Add support for the DISCOM entity
Date: Sat, 28 Apr 2018 19:50:42 +0300 [thread overview]
Message-ID: <56501970.bmiQKbb0Ad@avalon> (raw)
In-Reply-To: <20180428104002.GD18201@w540>
Hi Jacopo,
On Saturday, 28 April 2018 13:40:02 EEST jacopo mondi wrote:
> HI Laurent,
> a few comments, mostly minor ones...
>
> On Mon, Apr 23, 2018 at 01:34:28AM +0300, Laurent Pinchart wrote:
> > The DISCOM calculates a CRC on a configurable window of the frame. It
> > interfaces to the VSP through the UIF glue, hence the name used in the
> > code.
> >
> > The module supports configuration of the CRC window through the crop
> > rectangle on the ink pad of the corresponding entity. However, unlike
>
> sink pad?
Oops. Consider it fixed.
> > the traditional V4L2 subdevice model, the crop rectangle does not
> > influence the format on the source pad.
> >
> > Modeling the DISCOM as a sink-only entity would allow adhering to the
> > V4L2 subdevice model at the expense of more complex code in the driver,
> > as at the hardware level the UIF is handled as a sink+source entity. As
> > the DISCOM is only present in R-Car Gen3 VSP-D and VSP-DL instances it
> > is not exposed to userspace through V4L2 but controlled through the DU
> > driver. We can thus change this model later if needed without fear of
> > affecting userspace.
> >
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > Changes since v1:
> >
> > - Don't return uninitialized value from uif_set_selection()
> > ---
> >
> > drivers/media/platform/vsp1/Makefile | 2 +-
> > drivers/media/platform/vsp1/vsp1.h | 4 +
> > drivers/media/platform/vsp1/vsp1_drv.c | 20 +++
> > drivers/media/platform/vsp1/vsp1_entity.c | 6 +
> > drivers/media/platform/vsp1/vsp1_entity.h | 1 +
> > drivers/media/platform/vsp1/vsp1_regs.h | 41 +++++
> > drivers/media/platform/vsp1/vsp1_uif.c | 271 +++++++++++++++++++++++++
> > drivers/media/platform/vsp1/vsp1_uif.h | 32 ++++
> > 8 files changed, 376 insertions(+), 1 deletion(-)
> > create mode 100644 drivers/media/platform/vsp1/vsp1_uif.c
> > create mode 100644 drivers/media/platform/vsp1/vsp1_uif.h
[snip]
> > diff --git a/drivers/media/platform/vsp1/vsp1_uif.c
> > b/drivers/media/platform/vsp1/vsp1_uif.c new file mode 100644
> > index 000000000000..6de7e9c801ae
> > --- /dev/null
> > +++ b/drivers/media/platform/vsp1/vsp1_uif.c
> > @@ -0,0 +1,271 @@
[snip]
> > +static void uif_configure(struct vsp1_entity *entity,
> > + struct vsp1_pipeline *pipe,
> > + struct vsp1_dl_list *dl,
> > + enum vsp1_entity_params params)
> > +{
> > + struct vsp1_uif *uif = to_uif(&entity->subdev);
> > + const struct v4l2_rect *crop;
> > + unsigned int left;
> > + unsigned int width;
> > +
> > + /*
> > + * Per-partition configuration isn't needed as the DISCOM is used in
> > + * display pipelines only.
> > + */
> > + if (params != VSP1_ENTITY_PARAMS_INIT)
> > + return;
> > +
> > + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMPMR,
> > + VI6_UIF_DISCOM_DOCMPMR_SEL(9));
> > +
> > + crop = vsp1_entity_get_pad_selection(entity, entity->config,
> > + UIF_PAD_SINK, V4L2_SEL_TGT_CROP);
> > +
> > + /* On M3-W the horizontal coordinates are twice the register value. */
> > + if (uif->m3w_quirk) {
> > + left = crop->left / 2;
> > + width = crop->width / 2;
> > + } else {
> > + left = crop->left;
> > + width = crop->width;
> > + }
>
> I would write this as
>
> left = crop->left;
> width = crop->width;
> /* On M3-W the horizontal coordinates are twice the register value. */
> if (uif->m3w_quirk) {
> left /= 2;
> width /= 2;
> }
>
> But that's really up to you.
I prefer my style, but it looks like gcc 6.4.0 generates slightly better code
with your version (due to the fact that the crop->left value is converted to
unsigned before being divided by 2), so I'll go for it.
> > +
> > + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMSPXR, left);
> > + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMSPYR, crop->top);
> > + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMSZXR, width);
> > + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMSZYR, crop->height);
> > +
> > + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMCR,
> > + VI6_UIF_DISCOM_DOCMCR_CMPR);
> > +}
> > +
> > +static const struct vsp1_entity_operations uif_entity_ops = {
> > + .configure = uif_configure,
> > +};
> > +
> > +/* ----------------------------------------------------------------------
> > + * Initialization and Cleanup
> > + */
> > +
> > +static const struct soc_device_attribute vsp1_r8a7796[] = {
> > + { .soc_id = "r8a7796" },
> > + { /* sentinel */ }
> > +};
> > +
> > +struct vsp1_uif *vsp1_uif_create(struct vsp1_device *vsp1, unsigned int
> > index) +{
> > + struct vsp1_uif *uif;
> > + char name[6];
> > + int ret;
> > +
> > + uif = devm_kzalloc(vsp1->dev, sizeof(*uif), GFP_KERNEL);
> > + if (uif == NULL)
>
> if (!uif)
>
> Otherwise checkpatch complains iirc.
Only when run with --strict.
Nevertheless, even if both styles are mixed in the driver, the predominant
style is !uif, so I'll switch to that.
> Those are very minor comments, so feel free to add my reviewed by tag
>
> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
>
> > + return ERR_PTR(-ENOMEM);
> > +
> > + if (soc_device_match(vsp1_r8a7796))
> > + uif->m3w_quirk = true;
> > +
> > + uif->entity.ops = &uif_entity_ops;
> > + uif->entity.type = VSP1_ENTITY_UIF;
> > + uif->entity.index = index;
> > +
> > + /* The datasheet names the two UIF instances UIF4 and UIF5. */
> > + sprintf(name, "uif.%u", index + 4);
> > + ret = vsp1_entity_init(vsp1, &uif->entity, name, 2, &uif_ops,
> > + MEDIA_ENT_F_PROC_VIDEO_STATISTICS);
> > + if (ret < 0)
> > + return ERR_PTR(ret);
> > +
> > + return uif;
> > +}
[snip]
--
Regards,
Laurent Pinchart
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: jacopo mondi <jacopo@jmondi.org>
Cc: linux-renesas-soc@vger.kernel.org,
Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
Kieran Bingham <kieran.bingham@ideasonboard.com>,
dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org
Subject: Re: [PATCH v2 6/8] v4l: vsp1: Add support for the DISCOM entity
Date: Sat, 28 Apr 2018 19:50:42 +0300 [thread overview]
Message-ID: <56501970.bmiQKbb0Ad@avalon> (raw)
In-Reply-To: <20180428104002.GD18201@w540>
Hi Jacopo,
On Saturday, 28 April 2018 13:40:02 EEST jacopo mondi wrote:
> HI Laurent,
> a few comments, mostly minor ones...
>
> On Mon, Apr 23, 2018 at 01:34:28AM +0300, Laurent Pinchart wrote:
> > The DISCOM calculates a CRC on a configurable window of the frame. It
> > interfaces to the VSP through the UIF glue, hence the name used in the
> > code.
> >
> > The module supports configuration of the CRC window through the crop
> > rectangle on the ink pad of the corresponding entity. However, unlike
>
> sink pad?
Oops. Consider it fixed.
> > the traditional V4L2 subdevice model, the crop rectangle does not
> > influence the format on the source pad.
> >
> > Modeling the DISCOM as a sink-only entity would allow adhering to the
> > V4L2 subdevice model at the expense of more complex code in the driver,
> > as at the hardware level the UIF is handled as a sink+source entity. As
> > the DISCOM is only present in R-Car Gen3 VSP-D and VSP-DL instances it
> > is not exposed to userspace through V4L2 but controlled through the DU
> > driver. We can thus change this model later if needed without fear of
> > affecting userspace.
> >
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > Changes since v1:
> >
> > - Don't return uninitialized value from uif_set_selection()
> > ---
> >
> > drivers/media/platform/vsp1/Makefile | 2 +-
> > drivers/media/platform/vsp1/vsp1.h | 4 +
> > drivers/media/platform/vsp1/vsp1_drv.c | 20 +++
> > drivers/media/platform/vsp1/vsp1_entity.c | 6 +
> > drivers/media/platform/vsp1/vsp1_entity.h | 1 +
> > drivers/media/platform/vsp1/vsp1_regs.h | 41 +++++
> > drivers/media/platform/vsp1/vsp1_uif.c | 271 +++++++++++++++++++++++++
> > drivers/media/platform/vsp1/vsp1_uif.h | 32 ++++
> > 8 files changed, 376 insertions(+), 1 deletion(-)
> > create mode 100644 drivers/media/platform/vsp1/vsp1_uif.c
> > create mode 100644 drivers/media/platform/vsp1/vsp1_uif.h
[snip]
> > diff --git a/drivers/media/platform/vsp1/vsp1_uif.c
> > b/drivers/media/platform/vsp1/vsp1_uif.c new file mode 100644
> > index 000000000000..6de7e9c801ae
> > --- /dev/null
> > +++ b/drivers/media/platform/vsp1/vsp1_uif.c
> > @@ -0,0 +1,271 @@
[snip]
> > +static void uif_configure(struct vsp1_entity *entity,
> > + struct vsp1_pipeline *pipe,
> > + struct vsp1_dl_list *dl,
> > + enum vsp1_entity_params params)
> > +{
> > + struct vsp1_uif *uif = to_uif(&entity->subdev);
> > + const struct v4l2_rect *crop;
> > + unsigned int left;
> > + unsigned int width;
> > +
> > + /*
> > + * Per-partition configuration isn't needed as the DISCOM is used in
> > + * display pipelines only.
> > + */
> > + if (params != VSP1_ENTITY_PARAMS_INIT)
> > + return;
> > +
> > + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMPMR,
> > + VI6_UIF_DISCOM_DOCMPMR_SEL(9));
> > +
> > + crop = vsp1_entity_get_pad_selection(entity, entity->config,
> > + UIF_PAD_SINK, V4L2_SEL_TGT_CROP);
> > +
> > + /* On M3-W the horizontal coordinates are twice the register value. */
> > + if (uif->m3w_quirk) {
> > + left = crop->left / 2;
> > + width = crop->width / 2;
> > + } else {
> > + left = crop->left;
> > + width = crop->width;
> > + }
>
> I would write this as
>
> left = crop->left;
> width = crop->width;
> /* On M3-W the horizontal coordinates are twice the register value. */
> if (uif->m3w_quirk) {
> left /= 2;
> width /= 2;
> }
>
> But that's really up to you.
I prefer my style, but it looks like gcc 6.4.0 generates slightly better code
with your version (due to the fact that the crop->left value is converted to
unsigned before being divided by 2), so I'll go for it.
> > +
> > + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMSPXR, left);
> > + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMSPYR, crop->top);
> > + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMSZXR, width);
> > + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMSZYR, crop->height);
> > +
> > + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMCR,
> > + VI6_UIF_DISCOM_DOCMCR_CMPR);
> > +}
> > +
> > +static const struct vsp1_entity_operations uif_entity_ops = {
> > + .configure = uif_configure,
> > +};
> > +
> > +/* ----------------------------------------------------------------------
> > + * Initialization and Cleanup
> > + */
> > +
> > +static const struct soc_device_attribute vsp1_r8a7796[] = {
> > + { .soc_id = "r8a7796" },
> > + { /* sentinel */ }
> > +};
> > +
> > +struct vsp1_uif *vsp1_uif_create(struct vsp1_device *vsp1, unsigned int
> > index) +{
> > + struct vsp1_uif *uif;
> > + char name[6];
> > + int ret;
> > +
> > + uif = devm_kzalloc(vsp1->dev, sizeof(*uif), GFP_KERNEL);
> > + if (uif == NULL)
>
> if (!uif)
>
> Otherwise checkpatch complains iirc.
Only when run with --strict.
Nevertheless, even if both styles are mixed in the driver, the predominant
style is !uif, so I'll switch to that.
> Those are very minor comments, so feel free to add my reviewed by tag
>
> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
>
> > + return ERR_PTR(-ENOMEM);
> > +
> > + if (soc_device_match(vsp1_r8a7796))
> > + uif->m3w_quirk = true;
> > +
> > + uif->entity.ops = &uif_entity_ops;
> > + uif->entity.type = VSP1_ENTITY_UIF;
> > + uif->entity.index = index;
> > +
> > + /* The datasheet names the two UIF instances UIF4 and UIF5. */
> > + sprintf(name, "uif.%u", index + 4);
> > + ret = vsp1_entity_init(vsp1, &uif->entity, name, 2, &uif_ops,
> > + MEDIA_ENT_F_PROC_VIDEO_STATISTICS);
> > + if (ret < 0)
> > + return ERR_PTR(ret);
> > +
> > + return uif;
> > +}
[snip]
--
Regards,
Laurent Pinchart
_______________________________________________
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 16:50 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
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 [this message]
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 ` [igt-dev] " Daniel Vetter
2018-04-30 14:56 ` Daniel Vetter
2018-04-30 14:56 ` Daniel Vetter
2018-05-01 8:58 ` [igt-dev] " Maarten Lankhorst
2018-05-01 8:58 ` Maarten Lankhorst
2018-05-01 8:58 ` Maarten Lankhorst
2018-05-01 15:47 ` [igt-dev] " Maarten Lankhorst
2018-05-01 15:47 ` 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 ` [igt-dev] " Maarten Lankhorst
2018-05-07 13:28 ` 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=56501970.bmiQKbb0Ad@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jacopo@jmondi.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: 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.