[{"id":2104,"web_url":"https://patchwork.libcamera.org/comment/2104/","msgid":"<20190702000100.GF9228@bigcity.dyn.berto.se>","date":"2019-07-02T00:01:00","subject":"Re: [libcamera-devel] [PATCH v4 04/13] libcamera: camera: Provide a\n\tlist of ControlInfo","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Kieran,\n\nThanks for your work.\n\nOn 2019-07-01 23:14:55 +0300, Laurent Pinchart wrote:\n> From: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> Extend the Camera class to expose the controls it supports. Each\n> pipeline should generate a list of controls supported by each camera it\n> creates. These are represented by a ControlInfoMap, and an associated\n> ControlList of default values.\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  include/libcamera/camera.h               |  3 +++\n>  include/libcamera/controls.h             |  2 ++\n>  src/libcamera/camera.cpp                 | 12 ++++++++++++\n>  src/libcamera/controls.cpp               |  5 +++++\n>  src/libcamera/include/pipeline_handler.h |  4 ++++\n>  src/libcamera/pipeline_handler.cpp       | 19 +++++++++++++++++++\n>  6 files changed, 45 insertions(+)\n> \n> diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\n> index fb2f7ba3423c..6d693d9a6c7a 100644\n> --- a/include/libcamera/camera.h\n> +++ b/include/libcamera/camera.h\n> @@ -12,6 +12,7 @@\n>  #include <set>\n>  #include <string>\n>  \n> +#include <libcamera/controls.h>\n>  #include <libcamera/request.h>\n>  #include <libcamera/signal.h>\n>  #include <libcamera/stream.h>\n> @@ -83,6 +84,8 @@ public:\n>  \tint acquire();\n>  \tint release();\n>  \n> +\tconst ControlInfoMap &controls();\n> +\n>  \tconst std::set<Stream *> &streams() const;\n>  \tstd::unique_ptr<CameraConfiguration> generateConfiguration(const StreamRoles &roles);\n>  \tint configure(CameraConfiguration *config);\n> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\n> index 2206155909ca..18293c9462cf 100644\n> --- a/include/libcamera/controls.h\n> +++ b/include/libcamera/controls.h\n> @@ -99,6 +99,8 @@ static inline bool operator!=(const ControlInfo &lhs, const ControlId &rhs)\n>  \treturn !(lhs == rhs);\n>  }\n>  \n> +using ControlInfoMap = std::unordered_map<ControlId, ControlInfo>;\n> +\n>  class ControlList\n>  {\n>  private:\n> diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\n> index 617ea99cdf71..592dfd39eacc 100644\n> --- a/src/libcamera/camera.cpp\n> +++ b/src/libcamera/camera.cpp\n> @@ -548,6 +548,18 @@ int Camera::release()\n>  \treturn 0;\n>  }\n>  \n> +/**\n> + * \\brief Retrieve the list of controls supported by the camera\n> + *\n> + * Camera controls remain constant through the lifetime of the camera.\n> + *\n> + * \\return A ControlInfoMap listing the controls supported by the camera\n> + */\n> +const ControlInfoMap &Camera::controls()\n> +{\n> +\treturn pipe_->controls(this);\n> +}\n> +\n>  /**\n>   * \\brief Retrieve all the camera's stream information\n>   *\n> diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\n> index 7fac1169cbfd..cd2cf337b379 100644\n> --- a/src/libcamera/controls.cpp\n> +++ b/src/libcamera/controls.cpp\n> @@ -325,6 +325,11 @@ bool operator==(const ControlInfo &lhs, const ControlId &rhs)\n>  \treturn lhs.id() == rhs;\n>  }\n>  \n> +/**\n> + * \\typedef ControlInfoMap\n> + * \\brief A map of ControlId to ControlInfo\n> + */\n> +\n>  /**\n>   * \\class ControlList\n>   * \\brief Associate a list of ControlId with their values for a camera\n> diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h\n> index a4cbc593a179..f836d5d1a600 100644\n> --- a/src/libcamera/include/pipeline_handler.h\n> +++ b/src/libcamera/include/pipeline_handler.h\n> @@ -14,6 +14,7 @@\n>  #include <string>\n>  #include <vector>\n>  \n> +#include <libcamera/controls.h>\n>  #include <libcamera/stream.h>\n>  \n>  namespace libcamera {\n> @@ -41,6 +42,7 @@ public:\n>  \tCamera *camera_;\n>  \tPipelineHandler *pipe_;\n>  \tstd::list<Request *> queuedRequests_;\n> +\tControlInfoMap controlInfo_;\n>  \n>  private:\n>  \tCameraData(const CameraData &) = delete;\n> @@ -60,6 +62,8 @@ public:\n>  \tbool lock();\n>  \tvoid unlock();\n>  \n> +\tconst ControlInfoMap &controls(Camera *camera);\n> +\n>  \tvirtual CameraConfiguration *generateConfiguration(Camera *camera,\n>  \t\tconst StreamRoles &roles) = 0;\n>  \tvirtual int configure(Camera *camera, CameraConfiguration *config) = 0;\n> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\n> index c91ef2f7d336..0283e4e5ad51 100644\n> --- a/src/libcamera/pipeline_handler.cpp\n> +++ b/src/libcamera/pipeline_handler.cpp\n> @@ -88,6 +88,14 @@ LOG_DEFINE_CATEGORY(Pipeline)\n>   * PipelineHandler::completeRequest()\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>   * \\class PipelineHandler\n>   * \\brief Create and manage cameras based on a set of media devices\n> @@ -217,6 +225,17 @@ void PipelineHandler::unlock()\n>  \t\tmedia->unlock();\n>  }\n>  \n> +/**\n> + * \\brief Retrieve the list of controls for a camera\n> + * \\param[in] camera The camera\n> + * \\return A ControlInfoMap listing the controls support by \\a camera\n> + */\n> +const ControlInfoMap &PipelineHandler::controls(Camera *camera)\n> +{\n> +\tCameraData *data = cameraData(camera);\n> +\treturn data->controlInfo_;\n> +}\n> +\n>  /**\n>   * \\fn PipelineHandler::generateConfiguration()\n>   * \\brief Generate a camera configuration for a specified camera\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x244.google.com (mail-lj1-x244.google.com\n\t[IPv6:2a00:1450:4864:20::244])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 847076157D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Jul 2019 02:01:02 +0200 (CEST)","by mail-lj1-x244.google.com with SMTP id 205so15016267ljj.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 01 Jul 2019 17:01:02 -0700 (PDT)","from localhost (customer-145-14-112-32.stosn.net. [145.14.112.32])\n\tby smtp.gmail.com with ESMTPSA id\n\t2sm3503384lji.94.2019.07.01.17.01.00\n\t(version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);\n\tMon, 01 Jul 2019 17:01:00 -0700 (PDT)"],"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\t:user-agent; bh=QoWo7RuOaH8v7ZB+MVzlP4s/q0n80Exbhxz3hNd9foU=;\n\tb=dtVHqqLz95gYs1d9fXPH65fEAbs6yA8naEmjJTN9FMM6TDFIKyc24TWaueEMjOqVN0\n\t9LXyriNx2wUlCTvEr0tOi0xS9mY+SFoyVnarEYxJ5KDc86W4Z03FvN5pMEGpxyn5jcyI\n\thACPx1HMADc+XqZDBrjg8XZAlQYhZMXyJA/kmA6LUFFz6ka1eK24NSlZk7YnYsB4dxnX\n\tH2rryoUu6YC3w44ad9SDWUqGwT8W+Lpie7XlYnTy4U5efbVsj8vJ1odQYWDkp3tULyvp\n\tRf5alJt+3Zd+O1z+CbQ9YawRS8CRKqBWzyzc1AQq/yw/+M385jhVl6s+U+43GAiranlg\n\tJ/lw==","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:user-agent;\n\tbh=QoWo7RuOaH8v7ZB+MVzlP4s/q0n80Exbhxz3hNd9foU=;\n\tb=TQsQWCBt2dTitjtLtDM70HYToll8G9Q7B6LUx2ofKZVYQYtkXxw2IqEA1D1fVv7zR4\n\tpYIdq3Xk1+BDJIAy/b8bBDT9g2yWn6ABZqoaAlsIqHL8t4RFvu1jmeldW3aTHXiLRzyF\n\t/FXWO3JHUsnEarWsiJsT+FgDddbRfHDkg2RW0rCBDDl4JhKIbifJ1q2LScCdt/S4YNh7\n\tEUI+nMVyNE1zMFeQBSYHdk6VZVh2ROsHrUhz4i4fxMxhWvTBkg7NG58f9dfoQ/utNDGS\n\tjHHtRhcMlwOO4RSRzqvZoVjl9mXFOLOkXTpS4O24flOZHxMyMZsMCSUKE7/OcLuT3E3B\n\t/MWw==","X-Gm-Message-State":"APjAAAWAlbetDaValioi1hZ/Fq9Ll5qtrezh04JrF5WOOMFDN+GuN9EO\n\toMb39GX1hT+VsBOwIAohWqueIg==","X-Google-Smtp-Source":"APXvYqxWQy66Ul1W4E7LOX7OVu6zWXeujlNwJezrPnFVwW8C78suAZayoRk2Fap+NboLKTDaw9fMgQ==","X-Received":"by 2002:a2e:8741:: with SMTP id\n\tq1mr15422069ljj.144.1562025661413; \n\tMon, 01 Jul 2019 17:01:01 -0700 (PDT)","Date":"Tue, 2 Jul 2019 02:01:00 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190702000100.GF9228@bigcity.dyn.berto.se>","References":"<20190701201504.28487-1-laurent.pinchart@ideasonboard.com>\n\t<20190701201504.28487-5-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":"<20190701201504.28487-5-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH v4 04/13] libcamera: camera: Provide a\n\tlist of ControlInfo","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Tue, 02 Jul 2019 00:01:02 -0000"}}]