From df2af09050514c64c4af8cef0581423a705490af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Thu, 24 Sep 2020 21:35:54 +0200 Subject: libcamera: pipeline: rkisp1: Move path configuration to RkISP1Path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the path configuration to RkISP1Path to increase code reuse and make the V4L2 subdevice resizer private to the path. There is no functional change. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 55 ++++---------------------------- 1 file changed, 6 insertions(+), 49 deletions(-) (limited to 'src/libcamera/pipeline/rkisp1/rkisp1.cpp') diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 6e6ebe4c..857c9330 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -817,60 +817,17 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) data->mainPathActive_ = false; data->selfPathActive_ = false; for (const StreamConfiguration &cfg : *config) { - V4L2SubdeviceFormat ispFormat = format; - V4L2Subdevice *resizer; - V4L2VideoDevice *video; - if (cfg.stream() == &data->mainPathStream_) { - resizer = mainPath_.resizer_; - video = mainPath_.video_; + ret = mainPath_.configure(cfg, format); + if (ret) + return ret; data->mainPathActive_ = true; } else { - resizer = selfPath_.resizer_; - video = selfPath_.video_; + ret = selfPath_.configure(cfg, format); + if (ret) + return ret; data->selfPathActive_ = true; } - - ret = resizer->setFormat(0, &ispFormat); - if (ret < 0) - return ret; - - const char *name = resizer == mainPath_.resizer_ ? "main" : "self"; - - LOG(RkISP1, Debug) - << "Configured " << name << " resizer input pad with " - << ispFormat.toString(); - - ispFormat.size = cfg.size; - - LOG(RkISP1, Debug) - << "Configuring " << name << " resizer output pad with " - << ispFormat.toString(); - - ret = resizer->setFormat(1, &ispFormat); - if (ret < 0) - return ret; - - LOG(RkISP1, Debug) - << "Configured " << name << " resizer output pad with " - << ispFormat.toString(); - - const PixelFormatInfo &info = PixelFormatInfo::info(cfg.pixelFormat); - V4L2DeviceFormat outputFormat = {}; - outputFormat.fourcc = video->toV4L2PixelFormat(cfg.pixelFormat); - outputFormat.size = cfg.size; - outputFormat.planesCount = info.numPlanes(); - - ret = video->setFormat(&outputFormat); - if (ret) - return ret; - - if (outputFormat.size != cfg.size || - outputFormat.fourcc != video->toV4L2PixelFormat(cfg.pixelFormat)) { - LOG(RkISP1, Error) - << "Unable to configure capture in " << cfg.toString(); - return -EINVAL; - } } V4L2DeviceFormat paramFormat = {}; -- cgit v1.2.1