* [PATCH 0/2] rcar-vin: Cleanup how subdevice format is handled @ 2019-10-08 23:21 Niklas Söderlund 2019-10-08 23:22 ` [PATCH 1/2] rcar-vin: Rename wrongly named rectangle Niklas Söderlund 2019-10-08 23:22 ` [PATCH 2/2] rcar-vin: Create compose rectangle where it is used Niklas Söderlund 0 siblings, 2 replies; 5+ messages in thread From: Niklas Söderlund @ 2019-10-08 23:21 UTC (permalink / raw) To: Laurent Pinchart, linux-media; +Cc: linux-renesas-soc, Niklas Söderlund Hi, This small series clean up how formats coming from the subdevice is handled inside the driver. The changes are made possible after recent VIN patches paved the way. There should not be any functional changes in this series. Niklas Söderlund (2): rcar-vin: Rename wrongly named rectangle rcar-vin: Create compose rectangle where it is used drivers/media/platform/rcar-vin/rcar-v4l2.c | 38 ++++++++++----------- 1 file changed, 18 insertions(+), 20 deletions(-) -- 2.23.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] rcar-vin: Rename wrongly named rectangle 2019-10-08 23:21 [PATCH 0/2] rcar-vin: Cleanup how subdevice format is handled Niklas Söderlund @ 2019-10-08 23:22 ` Niklas Söderlund 2019-10-09 8:18 ` Laurent Pinchart 2019-10-08 23:22 ` [PATCH 2/2] rcar-vin: Create compose rectangle where it is used Niklas Söderlund 1 sibling, 1 reply; 5+ messages in thread From: Niklas Söderlund @ 2019-10-08 23:22 UTC (permalink / raw) To: Laurent Pinchart, linux-media; +Cc: linux-renesas-soc, Niklas Söderlund After recent refactoring the rectangle named crop no longer reflects it usage, to contain the source rectangle. Fix this by renaming it. There is no functional change. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index a7ee44dd248ea0a1..f809350c514c337c 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -181,7 +181,8 @@ static int rvin_reset_format(struct rvin_dev *vin) static int rvin_try_format(struct rvin_dev *vin, u32 which, struct v4l2_pix_format *pix, - struct v4l2_rect *crop, struct v4l2_rect *compose) + struct v4l2_rect *src_rect, + struct v4l2_rect *compose) { struct v4l2_subdev *sd = vin_to_source(vin); struct v4l2_subdev_pad_config *pad_cfg; @@ -214,11 +215,11 @@ static int rvin_try_format(struct rvin_dev *vin, u32 which, v4l2_fill_pix_format(pix, &format.format); - if (crop) { - crop->top = 0; - crop->left = 0; - crop->width = pix->width; - crop->height = pix->height; + if (src_rect) { + src_rect->top = 0; + src_rect->left = 0; + src_rect->width = pix->width; + src_rect->height = pix->height; } if (field != V4L2_FIELD_ANY) @@ -266,21 +267,21 @@ static int rvin_s_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { struct rvin_dev *vin = video_drvdata(file); - struct v4l2_rect crop, compose; + struct v4l2_rect src_rect, compose; int ret; if (vb2_is_busy(&vin->queue)) return -EBUSY; ret = rvin_try_format(vin, V4L2_SUBDEV_FORMAT_ACTIVE, &f->fmt.pix, - &crop, &compose); + &src_rect, &compose); if (ret) return ret; vin->format = f->fmt.pix; - v4l2_rect_map_inside(&vin->crop, &crop); + v4l2_rect_map_inside(&vin->crop, &src_rect); v4l2_rect_map_inside(&vin->compose, &compose); - vin->src_rect = crop; + vin->src_rect = src_rect; return 0; } -- 2.23.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] rcar-vin: Rename wrongly named rectangle 2019-10-08 23:22 ` [PATCH 1/2] rcar-vin: Rename wrongly named rectangle Niklas Söderlund @ 2019-10-09 8:18 ` Laurent Pinchart 0 siblings, 0 replies; 5+ messages in thread From: Laurent Pinchart @ 2019-10-09 8:18 UTC (permalink / raw) To: Niklas Söderlund; +Cc: linux-media, linux-renesas-soc Hi Niklas, Thank you for the patch. On Wed, Oct 09, 2019 at 01:22:00AM +0200, Niklas Söderlund wrote: > After recent refactoring the rectangle named crop no longer reflects it > usage, to contain the source rectangle. Fix this by renaming it. There > is no functional change. > > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > drivers/media/platform/rcar-vin/rcar-v4l2.c | 21 +++++++++++---------- > 1 file changed, 11 insertions(+), 10 deletions(-) > > diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c > index a7ee44dd248ea0a1..f809350c514c337c 100644 > --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c > +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c > @@ -181,7 +181,8 @@ static int rvin_reset_format(struct rvin_dev *vin) > > static int rvin_try_format(struct rvin_dev *vin, u32 which, > struct v4l2_pix_format *pix, > - struct v4l2_rect *crop, struct v4l2_rect *compose) > + struct v4l2_rect *src_rect, > + struct v4l2_rect *compose) > { > struct v4l2_subdev *sd = vin_to_source(vin); > struct v4l2_subdev_pad_config *pad_cfg; > @@ -214,11 +215,11 @@ static int rvin_try_format(struct rvin_dev *vin, u32 which, > > v4l2_fill_pix_format(pix, &format.format); > > - if (crop) { > - crop->top = 0; > - crop->left = 0; > - crop->width = pix->width; > - crop->height = pix->height; > + if (src_rect) { > + src_rect->top = 0; > + src_rect->left = 0; > + src_rect->width = pix->width; > + src_rect->height = pix->height; > } > > if (field != V4L2_FIELD_ANY) > @@ -266,21 +267,21 @@ static int rvin_s_fmt_vid_cap(struct file *file, void *priv, > struct v4l2_format *f) > { > struct rvin_dev *vin = video_drvdata(file); > - struct v4l2_rect crop, compose; > + struct v4l2_rect src_rect, compose; > int ret; > > if (vb2_is_busy(&vin->queue)) > return -EBUSY; > > ret = rvin_try_format(vin, V4L2_SUBDEV_FORMAT_ACTIVE, &f->fmt.pix, > - &crop, &compose); > + &src_rect, &compose); > if (ret) > return ret; > > vin->format = f->fmt.pix; > - v4l2_rect_map_inside(&vin->crop, &crop); > + v4l2_rect_map_inside(&vin->crop, &src_rect); > v4l2_rect_map_inside(&vin->compose, &compose); > - vin->src_rect = crop; > + vin->src_rect = src_rect; > > return 0; > } -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] rcar-vin: Create compose rectangle where it is used 2019-10-08 23:21 [PATCH 0/2] rcar-vin: Cleanup how subdevice format is handled Niklas Söderlund 2019-10-08 23:22 ` [PATCH 1/2] rcar-vin: Rename wrongly named rectangle Niklas Söderlund @ 2019-10-08 23:22 ` Niklas Söderlund 2019-10-09 8:22 ` Laurent Pinchart 1 sibling, 1 reply; 5+ messages in thread From: Niklas Söderlund @ 2019-10-08 23:22 UTC (permalink / raw) To: Laurent Pinchart, linux-media; +Cc: linux-renesas-soc, Niklas Söderlund The rectangle used to correct the compose settings when changing the format was created inside a helper function and not where it was used. This is confusing and makes the code harder to read, fix this. This cleanup is made possible due to refactoring elsewhere and there is no functional change. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 25 +++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index f809350c514c337c..9a9b89c0dc0b3be4 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -181,8 +181,7 @@ static int rvin_reset_format(struct rvin_dev *vin) static int rvin_try_format(struct rvin_dev *vin, u32 which, struct v4l2_pix_format *pix, - struct v4l2_rect *src_rect, - struct v4l2_rect *compose) + struct v4l2_rect *src_rect) { struct v4l2_subdev *sd = vin_to_source(vin); struct v4l2_subdev_pad_config *pad_cfg; @@ -229,13 +228,6 @@ static int rvin_try_format(struct rvin_dev *vin, u32 which, pix->height = height; rvin_format_align(vin, pix); - - if (compose) { - compose->top = 0; - compose->left = 0; - compose->width = pix->width; - compose->height = pix->height; - } done: v4l2_subdev_free_pad_config(pad_cfg); @@ -259,28 +251,33 @@ static int rvin_try_fmt_vid_cap(struct file *file, void *priv, { struct rvin_dev *vin = video_drvdata(file); - return rvin_try_format(vin, V4L2_SUBDEV_FORMAT_TRY, &f->fmt.pix, NULL, - NULL); + return rvin_try_format(vin, V4L2_SUBDEV_FORMAT_TRY, &f->fmt.pix, NULL); } static int rvin_s_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { struct rvin_dev *vin = video_drvdata(file); - struct v4l2_rect src_rect, compose; + struct v4l2_rect fmt_rect, src_rect; int ret; if (vb2_is_busy(&vin->queue)) return -EBUSY; ret = rvin_try_format(vin, V4L2_SUBDEV_FORMAT_ACTIVE, &f->fmt.pix, - &src_rect, &compose); + &src_rect); if (ret) return ret; vin->format = f->fmt.pix; + + fmt_rect.top = 0; + fmt_rect.left = 0; + fmt_rect.width = vin->format.width; + fmt_rect.height = vin->format.height; + v4l2_rect_map_inside(&vin->crop, &src_rect); - v4l2_rect_map_inside(&vin->compose, &compose); + v4l2_rect_map_inside(&vin->compose, &fmt_rect); vin->src_rect = src_rect; return 0; -- 2.23.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] rcar-vin: Create compose rectangle where it is used 2019-10-08 23:22 ` [PATCH 2/2] rcar-vin: Create compose rectangle where it is used Niklas Söderlund @ 2019-10-09 8:22 ` Laurent Pinchart 0 siblings, 0 replies; 5+ messages in thread From: Laurent Pinchart @ 2019-10-09 8:22 UTC (permalink / raw) To: Niklas Söderlund; +Cc: linux-media, linux-renesas-soc Hi Nklas, Thank you for the patch. On Wed, Oct 09, 2019 at 01:22:01AM +0200, Niklas Söderlund wrote: > The rectangle used to correct the compose settings when changing the > format was created inside a helper function and not where it was used. > This is confusing and makes the code harder to read, fix this. > > This cleanup is made possible due to refactoring elsewhere and there is > no functional change. > > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> > --- > drivers/media/platform/rcar-vin/rcar-v4l2.c | 25 +++++++++------------ > 1 file changed, 11 insertions(+), 14 deletions(-) > > diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c > index f809350c514c337c..9a9b89c0dc0b3be4 100644 > --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c > +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c > @@ -181,8 +181,7 @@ static int rvin_reset_format(struct rvin_dev *vin) > > static int rvin_try_format(struct rvin_dev *vin, u32 which, > struct v4l2_pix_format *pix, > - struct v4l2_rect *src_rect, > - struct v4l2_rect *compose) > + struct v4l2_rect *src_rect) > { > struct v4l2_subdev *sd = vin_to_source(vin); > struct v4l2_subdev_pad_config *pad_cfg; > @@ -229,13 +228,6 @@ static int rvin_try_format(struct rvin_dev *vin, u32 which, > pix->height = height; > > rvin_format_align(vin, pix); > - > - if (compose) { > - compose->top = 0; > - compose->left = 0; > - compose->width = pix->width; > - compose->height = pix->height; > - } > done: > v4l2_subdev_free_pad_config(pad_cfg); > > @@ -259,28 +251,33 @@ static int rvin_try_fmt_vid_cap(struct file *file, void *priv, > { > struct rvin_dev *vin = video_drvdata(file); > > - return rvin_try_format(vin, V4L2_SUBDEV_FORMAT_TRY, &f->fmt.pix, NULL, > - NULL); > + return rvin_try_format(vin, V4L2_SUBDEV_FORMAT_TRY, &f->fmt.pix, NULL); > } > > static int rvin_s_fmt_vid_cap(struct file *file, void *priv, > struct v4l2_format *f) > { > struct rvin_dev *vin = video_drvdata(file); > - struct v4l2_rect src_rect, compose; > + struct v4l2_rect fmt_rect, src_rect; I would rename fmt_rect to something more descriptive. Maybe full_rect, compose_bounds, ... ? Apart from that, Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > int ret; > > if (vb2_is_busy(&vin->queue)) > return -EBUSY; > > ret = rvin_try_format(vin, V4L2_SUBDEV_FORMAT_ACTIVE, &f->fmt.pix, > - &src_rect, &compose); > + &src_rect); > if (ret) > return ret; > > vin->format = f->fmt.pix; > + > + fmt_rect.top = 0; > + fmt_rect.left = 0; > + fmt_rect.width = vin->format.width; > + fmt_rect.height = vin->format.height; > + > v4l2_rect_map_inside(&vin->crop, &src_rect); > - v4l2_rect_map_inside(&vin->compose, &compose); > + v4l2_rect_map_inside(&vin->compose, &fmt_rect); > vin->src_rect = src_rect; > > return 0; -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-10-09 8:22 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-10-08 23:21 [PATCH 0/2] rcar-vin: Cleanup how subdevice format is handled Niklas Söderlund 2019-10-08 23:22 ` [PATCH 1/2] rcar-vin: Rename wrongly named rectangle Niklas Söderlund 2019-10-09 8:18 ` Laurent Pinchart 2019-10-08 23:22 ` [PATCH 2/2] rcar-vin: Create compose rectangle where it is used Niklas Söderlund 2019-10-09 8:22 ` Laurent Pinchart
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).