From patchwork Fri Jul 23 04:00:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 13102 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 60364C3230 for ; Fri, 23 Jul 2021 04:00:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 05C57687BF; Fri, 23 Jul 2021 06:00:59 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="h6Nsz/j1"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 411ED687BE for ; Fri, 23 Jul 2021 06:00:48 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E5431255 for ; Fri, 23 Jul 2021 06:00:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1627012848; bh=P0RGGyqpNqjeuNdwM8q26IofwAflvK3FHu2yiCXmrpw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=h6Nsz/j118LxWhKm1bo3AQtBNwaHseh4E3vhUfSmOWQFlmgiSHAJlU7xVqpR+hCs0 R9d6CBHc2MD1UxHxpDHbEuzZSjH4YAcrxz1atmYH+mZpRatVfJY2pV6758Jgij3oH2 hXU448AqjIRz3ixJ8yatSL1fnXwQvp5zEwQxM9iM= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 23 Jul 2021 07:00:35 +0300 Message-Id: <20210723040036.32346-17-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210723040036.32346-1-laurent.pinchart@ideasonboard.com> References: <20210723040036.32346-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 16/17] libcamera: pipeline_handler: Drop CameraData class X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The CameraData class isn't used anymore. Drop it. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- include/libcamera/internal/pipeline_handler.h | 26 +---- src/libcamera/pipeline/ipu3/ipu3.cpp | 2 +- .../pipeline/raspberrypi/raspberrypi.cpp | 2 +- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 +- src/libcamera/pipeline/simple/simple.cpp | 2 +- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 2 +- src/libcamera/pipeline/vimc/vimc.cpp | 2 +- src/libcamera/pipeline_handler.cpp | 94 +------------------ 8 files changed, 9 insertions(+), 123 deletions(-) diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h index 86727f90bb65..2f814753f2ae 100644 --- a/include/libcamera/internal/pipeline_handler.h +++ b/include/libcamera/internal/pipeline_handler.h @@ -8,14 +8,12 @@ #define __LIBCAMERA_INTERNAL_PIPELINE_HANDLER_H__ #include -#include #include #include #include #include #include -#include #include #include @@ -35,23 +33,6 @@ class MediaDevice; class PipelineHandler; class Request; -class CameraData -{ -public: - explicit CameraData(PipelineHandler *pipe) - : pipe_(pipe) - { - } - virtual ~CameraData() = default; - - PipelineHandler *pipe_; - ControlInfoMap controlInfo_; - ControlList properties_; - -private: - LIBCAMERA_DISABLE_COPY(CameraData) -}; - class PipelineHandler : public std::enable_shared_from_this, public Object { @@ -88,15 +69,11 @@ public: const char *name() const { return name_; } protected: - void registerCamera(std::shared_ptr camera, - std::unique_ptr data); + void registerCamera(std::shared_ptr camera); void hotplugMediaDevice(MediaDevice *media); virtual int queueRequestDevice(Camera *camera, Request *request) = 0; - CameraData *cameraData(const Camera *camera); - const CameraData *cameraData(const Camera *camera) const; - CameraManager *manager_; private: @@ -105,7 +82,6 @@ private: std::vector> mediaDevices_; std::vector> cameras_; - std::map> cameraData_; const char *name_; diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 6d097ac91d2e..713fbec4daae 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1187,7 +1187,7 @@ int PipelineHandlerIPU3::registerCameras() std::shared_ptr camera = Camera::create(data.release(), cameraId, streams); - registerCamera(std::move(camera), nullptr); + registerCamera(std::move(camera)); LOG(IPU3, Info) << "Registered Camera[" << numCameras << "] \"" diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index be8dcdc67a15..895ab3fee329 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1109,7 +1109,7 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator) const std::string &id = data->sensor_->id(); std::shared_ptr camera = Camera::create(data.release(), id, streams); - registerCamera(std::move(camera), nullptr); + registerCamera(std::move(camera)); return true; } diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index eab892785fb0..22be1a03e4dc 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -973,7 +973,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor) const std::string &id = data->sensor_->id(); std::shared_ptr camera = Camera::create(data.release(), id, streams); - registerCamera(std::move(camera), nullptr); + registerCamera(std::move(camera)); return 0; } diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 81d342a3fa73..8594520f520c 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1050,7 +1050,7 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator) const std::string &id = data->sensor_->id(); std::shared_ptr camera = Camera::create(data.release(), id, streams); - registerCamera(std::move(camera), nullptr); + registerCamera(std::move(camera)); registered = true; } diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index bbeeda97a91a..882d3f82839a 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -472,7 +472,7 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) std::set streams{ &data->stream_ }; std::shared_ptr camera = Camera::create(data.release(), id, streams); - registerCamera(std::move(camera), nullptr); + registerCamera(std::move(camera)); /* Enable hot-unplug notifications. */ hotplugMediaDevice(media); diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp index 866c993d7e50..bd7cbcebe3ff 100644 --- a/src/libcamera/pipeline/vimc/vimc.cpp +++ b/src/libcamera/pipeline/vimc/vimc.cpp @@ -440,7 +440,7 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator) const std::string &id = data->sensor_->id(); std::shared_ptr camera = Camera::create(data.release(), id, streams); - registerCamera(std::move(camera), nullptr); + registerCamera(std::move(camera)); return true; } diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 1f1de19d81c5..28e09bc00771 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -39,55 +39,6 @@ namespace libcamera { LOG_DEFINE_CATEGORY(Pipeline) -/** - * \class CameraData - * \brief Base class for platform-specific data associated with a camera - * - * The CameraData base abstract class represents platform specific-data - * a pipeline handler might want to associate with a Camera to access them - * at a later time. - * - * Pipeline handlers are expected to extend this base class with platform - * specific implementation, associate instances of the derived classes - * using the registerCamera() method, and access them at a later time - * with cameraData(). - */ - -/** - * \fn CameraData::CameraData(PipelineHandler *pipe) - * \brief Construct a CameraData instance for the given pipeline handler - * \param[in] pipe The pipeline handler - * - * The reference to the pipeline handler is stored internally, the caller shall - * guarantee that the pointer remains valid as long as the CameraData instance - * exists. - */ - -/** - * \var CameraData::pipe_ - * \brief The pipeline handler related to this CameraData instance - * - * The pipe_ pointer provides access to the PipelineHandler object that this - * instance is related to. It is set when the CameraData instance is created - * and remains valid until the instance is destroyed. - */ - -/** - * \var CameraData::controlInfo_ - * \brief The set of controls supported by the camera - * - * The control information shall be initialised by the pipeline handler when - * creating the camera, and shall not be modified afterwards. - */ - -/** - * \var CameraData::properties_ - * \brief The list of properties supported by the camera - * - * The list of camera properties shall be initialised by the pipeline handler - * when creating the camera, and shall not be modified afterwards. - */ - /** * \class PipelineHandler * \brief Create and manage cameras based on a set of media devices @@ -471,28 +422,14 @@ void PipelineHandler::completeRequest(Request *request) /** * \brief Register a camera to the camera manager and pipeline handler * \param[in] camera The camera to be added - * \param[in] data Pipeline-specific data for the camera * * This method is called by pipeline handlers to register the cameras they - * handle with the camera manager. It associates the pipeline-specific \a data - * with the camera, for later retrieval with cameraData(). Ownership of \a data - * is transferred to the PipelineHandler. + * handle with the camera manager. * * \context This function shall be called from the CameraManager thread. */ -void PipelineHandler::registerCamera(std::shared_ptr camera, - std::unique_ptr data) +void PipelineHandler::registerCamera(std::shared_ptr camera) { - /* - * To be removed once all pipeline handlers will have migrated from - * CameraData to Camera::Private. - */ - if (data) { - camera->_d()->controlInfo_ = std::move(data->controlInfo_); - camera->_d()->properties_ = std::move(data->properties_); - } - - cameraData_[camera.get()] = std::move(data); cameras_.push_back(camera); if (mediaDevices_.empty()) @@ -586,33 +523,6 @@ void PipelineHandler::disconnect() } } -/** - * \brief Retrieve the pipeline-specific data associated with a Camera - * \param[in] camera The camera whose data to retrieve - * \return A pointer to the pipeline-specific data passed to registerCamera(). - * The returned pointer is a borrowed reference and is guaranteed to remain - * valid until the pipeline handler is destroyed. It shall not be deleted - * manually by the caller. - */ -CameraData *PipelineHandler::cameraData(const Camera *camera) -{ - ASSERT(cameraData_.count(camera)); - return cameraData_[camera].get(); -} - -/** - * \brief Retrieve the pipeline-specific data associated with a Camera - * \param[in] camera The camera whose data to retrieve - * \sa cameraData() - * \return A const pointer to the pipeline-specific data passed to - * registerCamera(). - */ -const CameraData *PipelineHandler::cameraData(const Camera *camera) const -{ - ASSERT(cameraData_.count(camera)); - return cameraData_.at(camera).get(); -} - /** * \var PipelineHandler::manager_ * \brief The Camera manager associated with the pipeline handler