Skip to contentSkip to conversation

media: stm32: dcmipp: pixelproc: Round up the compose lower bound

PATCH In review David Carlier 2 participants 2 messages Oct 18 – Nov 3

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: stm32: dcmipp: pixelproc: Round up the compose lower bound

The minimum compose size is crop / 64, rounded down. A 17 pixel compose on an 1100 pixel crop then needs four decimation steps, which overflows the 2-bit HDEC and VDEC fields in PxDCCR. Round the minimum up instead.

Fixes 239cf9e5fda1 ("media: stm32: dcmipp: pixelproc: addition of dcmipp-pixelproc subdev")
---
 .../media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c +2 -2
index 7d8e5f0863bf..9055682481de 100644
@@ -597,10 +597,10 @@ static int dcmipp_pixelproc_set_selection(struct v4l2_subdev *sd,
 		s->r.top = 0;
 		s->r.left = 0;
 		s->r.width = clamp_t(u32, s->r.width,
-				     crop->width / DCMIPP_MAX_DOWNSCALE_RATIO,
+				     DIV_ROUND_UP(crop->width, DCMIPP_MAX_DOWNSCALE_RATIO),
 				     crop->width);
 		s->r.height = clamp_t(u32, s->r.height,
-				      crop->height / DCMIPP_MAX_DOWNSCALE_RATIO,
+				      DIV_ROUND_UP(crop->height, DCMIPP_MAX_DOWNSCALE_RATIO),
 				      crop->height);
 		v4l2_rect_set_min_size(&s->r, &min_rect);
 		*compose = s->r;
Signature · 1 line
2.55.0
maintainer Acked-by on v1 1/1
#1 lore raw

Hi David,

thanks for the patch.

Quoted 17 lines · David Carlier

The minimum compose size is crop / 64, rounded down. A 17 pixel compose on an 1100 pixel crop then needs four decimation steps, which overflows the 2-bit HDEC and VDEC fields in PxDCCR. Round the minimum up instead.

Fixes 239cf9e5fda1 ("media: stm32: dcmipp: pixelproc: addition of dcmipp-pixelproc subdev")
---
 .../media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c +0 -0
index 7d8e5f0863bf..9055682481de 100644
@@ -597,10 +597,10 @@ static int dcmipp_pixelproc_set_selection(struct v4l2_subdev *sd,
 		s->r.top = 0;
 		s->r.left = 0;

drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c static int dcmipp_pixelproc_set_selection(struct v4l2_subdev *sd, · line 606

Quoted 10 lines
drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c +2 -2
 		s->r.width = clamp_t(u32, s->r.width,
-				     crop->width / DCMIPP_MAX_DOWNSCALE_RATIO,
+				     DIV_ROUND_UP(crop->width, DCMIPP_MAX_DOWNSCALE_RATIO),
 				     crop->width);
 		s->r.height = clamp_t(u32, s->r.height,
-				      crop->height / DCMIPP_MAX_DOWNSCALE_RATIO,
+				      DIV_ROUND_UP(crop->height, DCMIPP_MAX_DOWNSCALE_RATIO),
 				      crop->height);
 		v4l2_rect_set_min_size(&s->r, &min_rect);
 		*compose = s->r;

Regards,
Alain

Quoted 3 lines
Signature · 1 line
2.55.0