From patchwork Sat Dec 22 23:00:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 87 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D975160B33 for ; Sun, 23 Dec 2018 00:02:36 +0100 (CET) X-Halon-ID: 9c38e1f1-063d-11e9-9adf-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from wyvern.dyn.berto.se (unknown [217.31.177.236]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id 9c38e1f1-063d-11e9-9adf-005056917a89; Sun, 23 Dec 2018 00:02:10 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Sun, 23 Dec 2018 00:00:40 +0100 Message-Id: <20181222230041.29999-12-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181222230041.29999-1-niklas.soderlund@ragnatech.se> References: <20181222230041.29999-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 11/12] libcamera: pipe-vimc: add pipeline handler for vimc X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2018 23:02:37 -0000 Provide a pipeline handler for the virtual vimc driver. Signed-off-by: Niklas Söderlund --- src/libcamera/meson.build | 1 + src/libcamera/pipe-vimc.cpp | 92 +++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 src/libcamera/pipe-vimc.cpp diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 8457e57939b862ed..088c76f72d331784 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -4,6 +4,7 @@ libcamera_sources = files([ 'deviceenumerator.cpp', 'log.cpp', 'main.cpp', + 'pipe-vimc.cpp', 'pipelinehandler.cpp', ]) diff --git a/src/libcamera/pipe-vimc.cpp b/src/libcamera/pipe-vimc.cpp new file mode 100644 index 0000000000000000..14bb96faece908de --- /dev/null +++ b/src/libcamera/pipe-vimc.cpp @@ -0,0 +1,92 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2018, Google Inc. + * + * pipe-vimc.cpp - Pipeline handler for the vimc device + */ + +#include + +#include "deviceenumerator.h" +#include "pipelinehandler.h" + +namespace libcamera { + +class PipeHandlerVimc : public PipelineHandler +{ +public: + PipeHandlerVimc(); + ~PipeHandlerVimc(); + + bool match(DeviceEnumerator *enumerator); + + unsigned int count(); + Camera *camera(unsigned int id); +private: + DeviceInfo *info_; + Camera *camera_; +}; + +PipeHandlerVimc::PipeHandlerVimc() + : info_(NULL), camera_(NULL) +{ +} + +PipeHandlerVimc::~PipeHandlerVimc() +{ + if (camera_) + camera_->put(); + + if (info_) + info_->release(); +} + +unsigned int PipeHandlerVimc::count() +{ + return 1; +} + +Camera *PipeHandlerVimc::camera(unsigned int id) +{ + if (id != 0) + return NULL; + + return camera_; +} + +bool PipeHandlerVimc::match(DeviceEnumerator *enumerator) +{ + DeviceMatch dm("vimc"); + + dm.add("Raw Capture 0"); + dm.add("Raw Capture 1"); + dm.add("RGB/YUV Capture"); + dm.add("Sensor A"); + dm.add("Sensor B"); + dm.add("Debayer A"); + dm.add("Debayer B"); + dm.add("RGB/YUV Input"); + dm.add("Scaler"); + + info_ = enumerator->search(dm); + + if (info_) { + info_->acquire(); + + /* NOTE: A more complete Camera implementation could + * be passed the DeviceInfo(s) it controls here or + * a reference to the PipelineHandler. Which method + * that is chosen will depend on how the Camera + * object is modeled. + */ + camera_ = new Camera("Dummy VIMC Camera"); + + return true; + } + + return info_ ? true : false; +} + +REGISTER_PIPELINE(PipeHandlerVimc); + +} /* namespace libcamera */