summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2020-07-08 14:30:54 +0200
committerJacopo Mondi <jacopo@jmondi.org>2020-08-03 11:16:18 +0200
commit15df621fb9a79ff830d8e2eca20da2011a64635b (patch)
tree76d513a24c84c45d247f7a37f6ddc7cb1a28eda5
parent4ecbd0ea5a036eaab168c23e85fc697a7a6f2d85 (diff)
libcamera: ipu3: Configure ImgU with the computed parameters
Instrument the ImgUDevice::configureInput() function to use the provided pipe configuration parameters to configure the IF, BDS and GDC rectangles. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
-rw-r--r--src/libcamera/pipeline/ipu3/imgu.0
-rw-r--r--src/libcamera/pipeline/ipu3/imgu.cpp26
-rw-r--r--src/libcamera/pipeline/ipu3/imgu.h2
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp16
4 files changed, 29 insertions, 15 deletions
diff --git a/src/libcamera/pipeline/ipu3/imgu. b/src/libcamera/pipeline/ipu3/imgu.
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/libcamera/pipeline/ipu3/imgu.
diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp
index e621e293..f1a3fbad 100644
--- a/src/libcamera/pipeline/ipu3/imgu.cpp
+++ b/src/libcamera/pipeline/ipu3/imgu.cpp
@@ -431,11 +431,11 @@ ImgUDevice::PipeConfig ImgUDevice::calculatePipeConfig(Pipe *pipe)
/**
* \brief Configure the ImgU unit input
- * \param[in] size The ImgU input frame size
+ * \param[in] config The ImgU pipe configuration parameters
* \param[in] inputFormat The format to be applied to ImgU input
* \return 0 on success or a negative error code otherwise
*/
-int ImgUDevice::configureInput(const Size &size,
+int ImgUDevice::configureInput(const PipeConfig &pipeConfig,
V4L2DeviceFormat *inputFormat)
{
/* Configure the ImgU input video device with the requested sizes. */
@@ -455,27 +455,27 @@ int ImgUDevice::configureInput(const Size &size,
* to configure the crop/compose rectangles, contradicting the
* V4L2 specification.
*/
- Rectangle rect{ 0, 0, inputFormat->size };
- ret = imgu_->setSelection(PAD_INPUT, V4L2_SEL_TGT_CROP, &rect);
+ Rectangle iif{ 0, 0, pipeConfig.iif };
+ ret = imgu_->setSelection(PAD_INPUT, V4L2_SEL_TGT_CROP, &iif);
if (ret)
return ret;
+ LOG(IPU3, Debug) << "ImgU IF rectangle = " << iif.toString();
- ret = imgu_->setSelection(PAD_INPUT, V4L2_SEL_TGT_COMPOSE, &rect);
+ Rectangle bds{ 0, 0, pipeConfig.bds };
+ ret = imgu_->setSelection(PAD_INPUT, V4L2_SEL_TGT_COMPOSE, &bds);
if (ret)
return ret;
+ LOG(IPU3, Debug) << "ImgU BDS rectangle = " << bds.toString();
- LOG(IPU3, Debug) << "ImgU input feeder and BDS rectangle = "
- << rect.toString();
+ V4L2SubdeviceFormat gdcFormat = {};
+ gdcFormat.mbus_code = MEDIA_BUS_FMT_FIXED;
+ gdcFormat.size = pipeConfig.gdc;
- V4L2SubdeviceFormat imguFormat = {};
- imguFormat.mbus_code = MEDIA_BUS_FMT_FIXED;
- imguFormat.size = size;
-
- ret = imgu_->setFormat(PAD_INPUT, &imguFormat);
+ ret = imgu_->setFormat(PAD_INPUT, &gdcFormat);
if (ret)
return ret;
- LOG(IPU3, Debug) << "ImgU GDC format = " << imguFormat.toString();
+ LOG(IPU3, Debug) << "ImgU GDC format = " << gdcFormat.toString();
return 0;
}
diff --git a/src/libcamera/pipeline/ipu3/imgu.h b/src/libcamera/pipeline/ipu3/imgu.h
index 2f9dc022..d7410e32 100644
--- a/src/libcamera/pipeline/ipu3/imgu.h
+++ b/src/libcamera/pipeline/ipu3/imgu.h
@@ -45,7 +45,7 @@ public:
PipeConfig calculatePipeConfig(Pipe *pipe);
- int configureInput(const Size &size, V4L2DeviceFormat *inputFormat);
+ int configureInput(const PipeConfig &pipeConfig, V4L2DeviceFormat *inputFormat);
int configureOutput(const StreamConfiguration &cfg,
V4L2DeviceFormat *outputFormat)
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index a0df81a0..ca3a852f 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -67,6 +67,7 @@ public:
Status validate() override;
const StreamConfiguration &cio2Format() const { return cio2Configuration_; };
+ const ImgUDevice::PipeConfig imguConfig() const { return pipeConfig_; }
private:
/*
@@ -462,7 +463,20 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)
if (ret)
return ret;
- ret = imgu->configureInput(sensorSize, &cio2Format);
+ /*
+ * If the ImgU gets configured with proper IF, BDS and GDC sizes, it
+ * is then expected that frames are dequeued from its main output
+ * otherwise the system stalls.
+ *
+ * If no ImgU configuration has been computed, it means only a RAW
+ * stream has been requested: return here to skip the ImgU configuration
+ * part.
+ */
+ ImgUDevice::PipeConfig imguConfig = config->imguConfig();
+ if (imguConfig.isNull())
+ return 0;
+
+ ret = imgu->configureInput(imguConfig, &cio2Format);
if (ret)
return ret;