[{"id":18312,"web_url":"https://patchwork.libcamera.org/comment/18312/","msgid":"<YPvBRZaMgYrCN9h7@oden.dyn.berto.se>","date":"2021-07-24T07:29:09","subject":"Re: [libcamera-devel] [RFC PATCH 16/17] libcamera:\n\tpipeline_handler: Drop CameraData class","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your work.\n\nOn 2021-07-23 07:00:35 +0300, Laurent Pinchart wrote:\n> The CameraData class isn't used anymore. Drop it.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  include/libcamera/internal/pipeline_handler.h | 26 +----\n>  src/libcamera/pipeline/ipu3/ipu3.cpp          |  2 +-\n>  .../pipeline/raspberrypi/raspberrypi.cpp      |  2 +-\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  2 +-\n>  src/libcamera/pipeline/simple/simple.cpp      |  2 +-\n>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |  2 +-\n>  src/libcamera/pipeline/vimc/vimc.cpp          |  2 +-\n>  src/libcamera/pipeline_handler.cpp            | 94 +------------------\n>  8 files changed, 9 insertions(+), 123 deletions(-)\n\nWhat's not to love?\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> \n> diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h\n> index 86727f90bb65..2f814753f2ae 100644\n> --- a/include/libcamera/internal/pipeline_handler.h\n> +++ b/include/libcamera/internal/pipeline_handler.h\n> @@ -8,14 +8,12 @@\n>  #define __LIBCAMERA_INTERNAL_PIPELINE_HANDLER_H__\n>  \n>  #include <list>\n> -#include <map>\n>  #include <memory>\n>  #include <set>\n>  #include <string>\n>  #include <sys/types.h>\n>  #include <vector>\n>  \n> -#include <libcamera/base/class.h>\n>  #include <libcamera/base/object.h>\n>  \n>  #include <libcamera/controls.h>\n> @@ -35,23 +33,6 @@ class MediaDevice;\n>  class PipelineHandler;\n>  class Request;\n>  \n> -class CameraData\n> -{\n> -public:\n> -\texplicit CameraData(PipelineHandler *pipe)\n> -\t\t: pipe_(pipe)\n> -\t{\n> -\t}\n> -\tvirtual ~CameraData() = default;\n> -\n> -\tPipelineHandler *pipe_;\n> -\tControlInfoMap controlInfo_;\n> -\tControlList properties_;\n> -\n> -private:\n> -\tLIBCAMERA_DISABLE_COPY(CameraData)\n> -};\n> -\n>  class PipelineHandler : public std::enable_shared_from_this<PipelineHandler>,\n>  \t\t\tpublic Object\n>  {\n> @@ -88,15 +69,11 @@ public:\n>  \tconst char *name() const { return name_; }\n>  \n>  protected:\n> -\tvoid registerCamera(std::shared_ptr<Camera> camera,\n> -\t\t\t    std::unique_ptr<CameraData> data);\n> +\tvoid registerCamera(std::shared_ptr<Camera> camera);\n>  \tvoid hotplugMediaDevice(MediaDevice *media);\n>  \n>  \tvirtual int queueRequestDevice(Camera *camera, Request *request) = 0;\n>  \n> -\tCameraData *cameraData(const Camera *camera);\n> -\tconst CameraData *cameraData(const Camera *camera) const;\n> -\n>  \tCameraManager *manager_;\n>  \n>  private:\n> @@ -105,7 +82,6 @@ private:\n>  \n>  \tstd::vector<std::shared_ptr<MediaDevice>> mediaDevices_;\n>  \tstd::vector<std::weak_ptr<Camera>> cameras_;\n> -\tstd::map<const Camera *, std::unique_ptr<CameraData>> cameraData_;\n>  \n>  \tconst char *name_;\n>  \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 6d097ac91d2e..713fbec4daae 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -1187,7 +1187,7 @@ int PipelineHandlerIPU3::registerCameras()\n>  \t\tstd::shared_ptr<Camera> camera =\n>  \t\t\tCamera::create(data.release(), cameraId, streams);\n>  \n> -\t\tregisterCamera(std::move(camera), nullptr);\n> +\t\tregisterCamera(std::move(camera));\n>  \n>  \t\tLOG(IPU3, Info)\n>  \t\t\t<< \"Registered Camera[\" << numCameras << \"] \\\"\"\n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index be8dcdc67a15..895ab3fee329 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -1109,7 +1109,7 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)\n>  \tconst std::string &id = data->sensor_->id();\n>  \tstd::shared_ptr<Camera> camera =\n>  \t\tCamera::create(data.release(), id, streams);\n> -\tregisterCamera(std::move(camera), nullptr);\n> +\tregisterCamera(std::move(camera));\n>  \n>  \treturn true;\n>  }\n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index eab892785fb0..22be1a03e4dc 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -973,7 +973,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n>  \tconst std::string &id = data->sensor_->id();\n>  \tstd::shared_ptr<Camera> camera =\n>  \t\tCamera::create(data.release(), id, streams);\n> -\tregisterCamera(std::move(camera), nullptr);\n> +\tregisterCamera(std::move(camera));\n>  \n>  \treturn 0;\n>  }\n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index 81d342a3fa73..8594520f520c 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -1050,7 +1050,7 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)\n>  \t\tconst std::string &id = data->sensor_->id();\n>  \t\tstd::shared_ptr<Camera> camera =\n>  \t\t\tCamera::create(data.release(), id, streams);\n> -\t\tregisterCamera(std::move(camera), nullptr);\n> +\t\tregisterCamera(std::move(camera));\n>  \t\tregistered = true;\n>  \t}\n>  \n> diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> index bbeeda97a91a..882d3f82839a 100644\n> --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> @@ -472,7 +472,7 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)\n>  \tstd::set<Stream *> streams{ &data->stream_ };\n>  \tstd::shared_ptr<Camera> camera =\n>  \t\tCamera::create(data.release(), id, streams);\n> -\tregisterCamera(std::move(camera), nullptr);\n> +\tregisterCamera(std::move(camera));\n>  \n>  \t/* Enable hot-unplug notifications. */\n>  \thotplugMediaDevice(media);\n> diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp\n> index 866c993d7e50..bd7cbcebe3ff 100644\n> --- a/src/libcamera/pipeline/vimc/vimc.cpp\n> +++ b/src/libcamera/pipeline/vimc/vimc.cpp\n> @@ -440,7 +440,7 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator)\n>  \tconst std::string &id = data->sensor_->id();\n>  \tstd::shared_ptr<Camera> camera =\n>  \t\tCamera::create(data.release(), id, streams);\n> -\tregisterCamera(std::move(camera), nullptr);\n> +\tregisterCamera(std::move(camera));\n>  \n>  \treturn true;\n>  }\n> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\n> index 1f1de19d81c5..28e09bc00771 100644\n> --- a/src/libcamera/pipeline_handler.cpp\n> +++ b/src/libcamera/pipeline_handler.cpp\n> @@ -39,55 +39,6 @@ namespace libcamera {\n>  \n>  LOG_DEFINE_CATEGORY(Pipeline)\n>  \n> -/**\n> - * \\class CameraData\n> - * \\brief Base class for platform-specific data associated with a camera\n> - *\n> - * The CameraData base abstract class represents platform specific-data\n> - * a pipeline handler might want to associate with a Camera to access them\n> - * at a later time.\n> - *\n> - * Pipeline handlers are expected to extend this base class with platform\n> - * specific implementation, associate instances of the derived classes\n> - * using the registerCamera() method, and access them at a later time\n> - * with cameraData().\n> - */\n> -\n> -/**\n> - * \\fn CameraData::CameraData(PipelineHandler *pipe)\n> - * \\brief Construct a CameraData instance for the given pipeline handler\n> - * \\param[in] pipe The pipeline handler\n> - *\n> - * The reference to the pipeline handler is stored internally, the caller shall\n> - * guarantee that the pointer remains valid as long as the CameraData instance\n> - * exists.\n> - */\n> -\n> -/**\n> - * \\var CameraData::pipe_\n> - * \\brief The pipeline handler related to this CameraData instance\n> - *\n> - * The pipe_ pointer provides access to the PipelineHandler object that this\n> - * instance is related to. It is set when the CameraData instance is created\n> - * and remains valid until the instance is destroyed.\n> - */\n> -\n> -/**\n> - * \\var CameraData::controlInfo_\n> - * \\brief The set of controls supported by the camera\n> - *\n> - * The control information shall be initialised by the pipeline handler when\n> - * creating the camera, and shall not be modified afterwards.\n> - */\n> -\n> -/**\n> - * \\var CameraData::properties_\n> - * \\brief The list of properties supported by the camera\n> - *\n> - * The list of camera properties shall be initialised by the pipeline handler\n> - * when creating the camera, and shall not be modified afterwards.\n> - */\n> -\n>  /**\n>   * \\class PipelineHandler\n>   * \\brief Create and manage cameras based on a set of media devices\n> @@ -471,28 +422,14 @@ void PipelineHandler::completeRequest(Request *request)\n>  /**\n>   * \\brief Register a camera to the camera manager and pipeline handler\n>   * \\param[in] camera The camera to be added\n> - * \\param[in] data Pipeline-specific data for the camera\n>   *\n>   * This method is called by pipeline handlers to register the cameras they\n> - * handle with the camera manager. It associates the pipeline-specific \\a data\n> - * with the camera, for later retrieval with cameraData(). Ownership of \\a data\n> - * is transferred to the PipelineHandler.\n> + * handle with the camera manager.\n>   *\n>   * \\context This function shall be called from the CameraManager thread.\n>   */\n> -void PipelineHandler::registerCamera(std::shared_ptr<Camera> camera,\n> -\t\t\t\t     std::unique_ptr<CameraData> data)\n> +void PipelineHandler::registerCamera(std::shared_ptr<Camera> camera)\n>  {\n> -\t/*\n> -\t * To be removed once all pipeline handlers will have migrated from\n> -\t * CameraData to Camera::Private.\n> -\t */\n> -\tif (data) {\n> -\t\tcamera->_d()->controlInfo_ = std::move(data->controlInfo_);\n> -\t\tcamera->_d()->properties_ = std::move(data->properties_);\n> -\t}\n> -\n> -\tcameraData_[camera.get()] = std::move(data);\n>  \tcameras_.push_back(camera);\n>  \n>  \tif (mediaDevices_.empty())\n> @@ -586,33 +523,6 @@ void PipelineHandler::disconnect()\n>  \t}\n>  }\n>  \n> -/**\n> - * \\brief Retrieve the pipeline-specific data associated with a Camera\n> - * \\param[in] camera The camera whose data to retrieve\n> - * \\return A pointer to the pipeline-specific data passed to registerCamera().\n> - * The returned pointer is a borrowed reference and is guaranteed to remain\n> - * valid until the pipeline handler is destroyed. It shall not be deleted\n> - * manually by the caller.\n> - */\n> -CameraData *PipelineHandler::cameraData(const Camera *camera)\n> -{\n> -\tASSERT(cameraData_.count(camera));\n> -\treturn cameraData_[camera].get();\n> -}\n> -\n> -/**\n> - * \\brief Retrieve the pipeline-specific data associated with a Camera\n> - * \\param[in] camera The camera whose data to retrieve\n> - * \\sa cameraData()\n> - * \\return A const pointer to the pipeline-specific data passed to\n> - * registerCamera().\n> - */\n> -const CameraData *PipelineHandler::cameraData(const Camera *camera) const\n> -{\n> -\tASSERT(cameraData_.count(camera));\n> -\treturn cameraData_.at(camera).get();\n> -}\n> -\n>  /**\n>   * \\var PipelineHandler::manager_\n>   * \\brief The Camera manager associated with the pipeline handler\n> -- \n> Regards,\n> \n> Laurent Pinchart\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id E995AC0109\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 24 Jul 2021 07:29:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9A4D4687AC;\n\tSat, 24 Jul 2021 09:29:12 +0200 (CEST)","from mail-lf1-x131.google.com (mail-lf1-x131.google.com\n\t[IPv6:2a00:1450:4864:20::131])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 50B2B68540\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 24 Jul 2021 09:29:11 +0200 (CEST)","by mail-lf1-x131.google.com with SMTP id r17so5891229lfe.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 24 Jul 2021 00:29:11 -0700 (PDT)","from localhost (h-46-59-88-219.A463.priv.bahnhof.se.\n\t[46.59.88.219]) by smtp.gmail.com with ESMTPSA id\n\te17sm2532655ljg.61.2021.07.24.00.29.10\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 24 Jul 2021 00:29:10 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"C3P3xurr\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=wfyfrcm6o+unJKiON1AoDCHDRoM35zoXy4MH/xgvNso=;\n\tb=C3P3xurrWSq5AODXCmG8c3HpvTrMfLZX3TXJmNcp92nUGqIsLhLkcEK2FJzxDOc4pi\n\tKQWtJXcVJ0AOoz51flMe4XYaEIaK7xUzbgeTk69i2OFI0QOPM/m02SqiWJzGnBTCJvxf\n\tcrbqCzVEUlmTpATJXetYe8rIKaAt3RzbISEE5U+MJDtZu05zpRKyQXYdOIANjD2XE+qe\n\tGSTFVD3Lejga8sVAxDV1LvwqlA4cFhTU43KEmvYAh+7FloDda6v4ZswCXol2fucc++v+\n\tFgP4jL+SIIsLVsQuQx0EzEGYDTM+NR+GIm/UIap9almpXbGo6jiEu+h5FyObeVu4Ryhg\n\t6BSA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=wfyfrcm6o+unJKiON1AoDCHDRoM35zoXy4MH/xgvNso=;\n\tb=QfgdIBEyzqlbsQrWVk9sqF9xiTfEgS0jD8tS5ensRvgCD2BojN/3jjIaMfQphq2YlY\n\t3Js44G9AsInZnVQ+PoGmhKWaJYee3T4V58XgKw95kEyWe41tiJJws9XquV8LG7PXKiMp\n\tvJe0Y4072JVHMN1YNb1Pt8lF8FbZC4IJ9YkPABGGfz2eMECvVAJ46O/TG7cVDSpzvZgW\n\tBIC0+jGTi9/VCZ+Z60xKexJ4eSbpXNIIfsKCfgKwOt1ir355/aZ8FjpvBONqlfjtj3rk\n\tuRxQNMtcC/vqMuCt8l3Ptn20AI4MFfAiJAZu90cS2kWr2yJDh/Nz5I4gpI2/v7Pdl0Ft\n\tt1Ew==","X-Gm-Message-State":"AOAM531ielyHuxQG7bcntBhZ8vA7YcFUYy64OOW54GttY0EvVVR5+YEM\n\tnXkA0nBKUkAtQXsvi5nR5yuriQ==","X-Google-Smtp-Source":"ABdhPJxta5cwcfEdvOQNmgNkPagz/MDHvd0NMqdaxNdEPPPsKsNJsjSBDUgzy2JG6e9RvijWkJnX9A==","X-Received":"by 2002:a05:6512:3b9a:: with SMTP id\n\tg26mr5564574lfv.646.1627111750677; \n\tSat, 24 Jul 2021 00:29:10 -0700 (PDT)","Date":"Sat, 24 Jul 2021 09:29:09 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<YPvBRZaMgYrCN9h7@oden.dyn.berto.se>","References":"<20210723040036.32346-1-laurent.pinchart@ideasonboard.com>\n\t<20210723040036.32346-17-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20210723040036.32346-17-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFC PATCH 16/17] libcamera:\n\tpipeline_handler: Drop CameraData class","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]