From 8f888a8e84858286da9c60757df8609c1474197f Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Wed, 17 Mar 2021 14:13:58 +0100 Subject: libcamera: ipu3: imgu: Fix IF height selection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apply to calculateBDSHeight() function the first hunk of commit 243d134 ("Fix some bug for some resolutions") from https://github.com/intel/intel-ipu3-pipecfg.git. The condition for the computed IF rectangle height to be matched against the desired alignment now makes sure that it is included in the minimum and maximum acceptable values. Signed-off-by: Jacopo Mondi Tested-by: Jean-Michel Hautbois Reviewed-by: Jean-Michel Hautbois Acked-by: Niklas Söderlund Reviewed-by: Hirokazu Honda --- src/libcamera/pipeline/ipu3/imgu.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp index a325b787..5912ae4d 100644 --- a/src/libcamera/pipeline/ipu3/imgu.cpp +++ b/src/libcamera/pipeline/ipu3/imgu.cpp @@ -135,7 +135,8 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc estIFHeight = std::clamp(estIFHeight, minIFHeight, iif.height); ifHeight = utils::alignUp(estIFHeight, IF_ALIGN_H); - while (ifHeight >= minIFHeight && ifHeight / bdsSF >= minBDSHeight) { + while (ifHeight >= minIFHeight && ifHeight <= iif.height && + ifHeight / bdsSF >= minBDSHeight) { bdsHeight = ifHeight / bdsSF; if (std::fmod(bdsHeight, 1.0) == 0) { @@ -151,7 +152,8 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc } ifHeight = utils::alignUp(estIFHeight, IF_ALIGN_H); - while (ifHeight <= iif.height && ifHeight / bdsSF >= minBDSHeight) { + while (ifHeight >= minIFHeight && ifHeight <= iif.height && + ifHeight / bdsSF >= minBDSHeight) { bdsHeight = ifHeight / bdsSF; if (std::fmod(bdsHeight, 1.0) == 0) { -- cgit v1.2.1