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>
This commit is contained in:
parent
4ecbd0ea5a
commit
15df621fb9
4 changed files with 36 additions and 22 deletions
0
src/libcamera/pipeline/ipu3/imgu.
Normal file
0
src/libcamera/pipeline/ipu3/imgu.
Normal file
|
@ -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();
|
||||
|
||||
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();
|
||||
|
||||
V4L2SubdeviceFormat gdcFormat = {};
|
||||
gdcFormat.mbus_code = MEDIA_BUS_FMT_FIXED;
|
||||
gdcFormat.size = pipeConfig.gdc;
|
||||
|
||||
ret = imgu_->setFormat(PAD_INPUT, &gdcFormat);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = imgu_->setSelection(PAD_INPUT, V4L2_SEL_TGT_COMPOSE, &rect);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
LOG(IPU3, Debug) << "ImgU input feeder and BDS rectangle = "
|
||||
<< rect.toString();
|
||||
|
||||
V4L2SubdeviceFormat imguFormat = {};
|
||||
imguFormat.mbus_code = MEDIA_BUS_FMT_FIXED;
|
||||
imguFormat.size = size;
|
||||
|
||||
ret = imgu_->setFormat(PAD_INPUT, &imguFormat);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
LOG(IPU3, Debug) << "ImgU GDC format = " << imguFormat.toString();
|
||||
LOG(IPU3, Debug) << "ImgU GDC format = " << gdcFormat.toString();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue