summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2021-02-03 10:40:53 +0100
committerJacopo Mondi <jacopo@jmondi.org>2021-02-05 14:22:15 +0100
commitb2839ed68adbeeab97948fadb9887568cf4ae96f (patch)
tree53a0447bc847742d885b8913eab4388fec66d743
parentf29601efc40ff638d628dab59ad6a728868adc90 (diff)
libcamera: ipu3: Fix RAW sizes selection
Commit 7208e70211a6 ("libcamera: ipu3: Always use sensor full frame size") changed the CIO2 configuration procedure to always select the full sensor resolution to work around an ImgU configuration issue, as reported in the todo item introduced in said commit. When capturing a RAW stream only and the ImgU is not involved, the CIO2 has to be configured with the requested stream size to avoid adjusting the stream to the sensor resolution. As an example, capturing a raw frame smaller than the sensor resolution with this patch applied results in the stream configuration to be correctly assigned. $ cam -c1 -swidth=1056,height=784,role=raw ipu3.cpp:207 CIO2 configuration: 1056x784-SGRBG10_IPU3 ipu3.cpp:222 Validating stream: 1056x784-SGRBG10_IPU3 ipu3.cpp:233 Assigned 1056x784-SGRBG10_IPU3 to the raw stream Without this patch the same operation results in the stream resolution to be adjusted to the sensor resolution. $ cam -c1 -swidth=1056,height=784,role=raw ipu3.cpp:201 CIO2 configuration: 4224x3136-SGRBG10_IPU3 ipu3.cpp:216 Validating stream: 1056x784-SGRBG10_IPU3 ipu3.cpp:227 Assigned 4224x3136-SGRBG10_IPU3 to the raw stream ipu3.cpp:297 Stream 0 configuration adjusted to 4224x3136-SGRBG10_IPU3 Camera configuration adjusted Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 3a9d7a5e..9bc3df33 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -178,12 +178,14 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
unsigned int rawCount = 0;
unsigned int yuvCount = 0;
Size maxYuvSize;
+ Size rawSize;
for (const StreamConfiguration &cfg : config_) {
const PixelFormatInfo &info = PixelFormatInfo::info(cfg.pixelFormat);
if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW) {
rawCount++;
+ rawSize = cfg.size;
} else {
yuvCount++;
maxYuvSize.expandTo(cfg.size);
@@ -206,11 +208,16 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
* commit message of the patch that introduced this comment for more
* failure examples).
*
- * Until the sensor frame size calculation criteria are clarified,
- * always use the largest possible one which guarantees better results
- * at the expense of the frame rate and CSI-2 bus bandwidth.
+ * Until the sensor frame size calculation criteria are clarified, when
+ * capturing from ImgU always use the largest possible size which
+ * guarantees better results at the expense of the frame rate and CSI-2
+ * bus bandwidth. When only a raw stream is requested use the requested
+ * size instead, as the ImgU is not involved.
*/
- cio2Configuration_ = data_->cio2_.generateConfiguration({});
+ if (!yuvCount)
+ cio2Configuration_ = data_->cio2_.generateConfiguration(rawSize);
+ else
+ cio2Configuration_ = data_->cio2_.generateConfiguration({});
if (!cio2Configuration_.pixelFormat.isValid())
return Invalid;