Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: stm32: dcmipp: pixelproc: Round up the compose lower bound
@ 2026-10-18  3:20 David Carlier
  0 siblings, 0 replies; only message in thread
From: David Carlier @ 2026-10-18  3:20 UTC (permalink / raw)
  To: Alain Volmat, Hugues Fruchet
  Cc: Mauro Carvalho Chehab, Maxime Coquelin, Alexandre Torgue,
	linux-media, linux-stm32, linux-arm-kernel, linux-kernel,
	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")
Signed-off-by: David Carlier <devnexen@gmail.com>
---
 .../media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c
index 7d8e5f0863bf..9055682481de 100644
--- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c
+++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c
@@ -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;
-- 
2.55.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-18  3:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-18  3:20 [PATCH] media: stm32: dcmipp: pixelproc: Round up the compose lower bound David Carlier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox