[{"id":16129,"web_url":"https://patchwork.libcamera.org/comment/16129/","msgid":"<CAO5uPHN-_YhmXez6WzGaMQPZa8mzNzdmmU5Hvt12Zx1Da+MFVg@mail.gmail.com>","date":"2021-04-07T02:32:47","subject":"Re: [libcamera-devel] [PATCH v4 4/5] android: camera_device: Get\n\tproperties from configuration","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"Hi Jacopo, Thanks for the patch.\n\nOn Wed, Apr 7, 2021 at 12:45 AM Jacopo Mondi <jacopo@jmondi.org> wrote:\n>\n> Open the HAL configuration file in the Camera HAL manager and get\n> the camera properties for each created CameraDevice and initialize it\n> with them.\n>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/android/camera_device.cpp      | 29 ++++++++++++++++++++++-------\n>  src/android/camera_device.h        |  3 ++-\n>  src/android/camera_hal_manager.cpp | 21 +++++++++++++++++++--\n>  src/android/camera_hal_manager.h   |  3 +++\n>  4 files changed, 46 insertions(+), 10 deletions(-)\n>\n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 89044efa7ebe..66030c012db0 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -6,6 +6,7 @@\n>   */\n>\n>  #include \"camera_device.h\"\n> +#include \"camera_hal_config.h\"\n>  #include \"camera_ops.h\"\n>  #include \"post_processor.h\"\n>\n> @@ -446,9 +447,15 @@ std::unique_ptr<CameraDevice> CameraDevice::create(unsigned int id,\n>   * Initialize the camera static information.\n>   * This method is called before the camera device is opened.\n>   */\n> -int CameraDevice::initialize()\n> +int CameraDevice::initialize(const CameraProps &cameraProps)\n>  {\n> -       /* Initialize orientation and facing side of the camera. */\n> +       /*\n> +        * Initialize orientation and facing side of the camera.\n> +        *\n> +        * If the libcamera::Camera provides those information as retrieved\n> +        * from firmware use that, otherwise fallback to values parsed from\n> +        * the configuration file.\n> +        */\n>         const ControlList &properties = camera_->properties();\n>\n>         if (properties.contains(properties::Location)) {\n> @@ -464,12 +471,14 @@ int CameraDevice::initialize()\n>                         facing_ = CAMERA_FACING_EXTERNAL;\n>                         break;\n>                 }\n> +\n> +               if (facing_ != cameraProps.facing)\n> +                       LOG(HAL, Warning)\n> +                               << \"Camera location does not match\"\n> +                               << \" configuration file. Use \" << facing_;\n> +\nI would enclose by \"{}\" if a if-clause is more than one line.\n\n>         } else {\n> -               /*\n> -                * \\todo Retrieve the camera location from configuration file\n> -                * if not available from the library.\n> -                */\n> -               facing_ = CAMERA_FACING_FRONT;\n> +               facing_ = cameraProps.facing;\n>         }\n>\n>         /*\n> @@ -483,6 +492,12 @@ int CameraDevice::initialize()\n>         if (properties.contains(properties::Rotation)) {\n>                 int rotation = properties.get(properties::Rotation);\n>                 orientation_ = (360 - rotation) % 360;\n> +               if (orientation_ != cameraProps.rotation)\n> +                       LOG(HAL, Warning)\n> +                               << \"Camera orientation does not match\"\n> +                               << \" configuration file. Use \" << orientation_;\n\nsame here.\n\n> +       } else {\n> +               orientation_ = cameraProps.rotation;\n>         }\n>\n>         int ret = camera_->acquire();\n> diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> index 11bdfec8d587..ba3ec8770e11 100644\n> --- a/src/android/camera_device.h\n> +++ b/src/android/camera_device.h\n> @@ -29,6 +29,7 @@\n>  #include \"camera_worker.h\"\n>  #include \"jpeg/encoder.h\"\n>\n> +class CameraProps;\n>  class CameraDevice : protected libcamera::Loggable\n>  {\n>  public:\n> @@ -36,7 +37,7 @@ public:\n>                                                     std::shared_ptr<libcamera::Camera> cam);\n>         ~CameraDevice();\n>\n> -       int initialize();\n> +       int initialize(const CameraProps &cameraProps);\n>\n>         int open(const hw_module_t *hardwareModule);\n>         void close();\n> diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp\n> index bf3fcda75237..a517727ea0b8 100644\n> --- a/src/android/camera_hal_manager.cpp\n> +++ b/src/android/camera_hal_manager.cpp\n> @@ -39,13 +39,17 @@ CameraHalManager::~CameraHalManager() = default;\n>\n>  int CameraHalManager::init()\n>  {\n> +       int ret = halConfig_.open();\n> +       if (ret)\n> +               return ret;\n> +\n>         cameraManager_ = std::make_unique<CameraManager>();\n>\n>         /* Support camera hotplug. */\n>         cameraManager_->cameraAdded.connect(this, &CameraHalManager::cameraAdded);\n>         cameraManager_->cameraRemoved.connect(this, &CameraHalManager::cameraRemoved);\n>\n> -       int ret = cameraManager_->start();\n> +       ret = cameraManager_->start();\n>         if (ret) {\n>                 LOG(HAL, Error) << \"Failed to start camera manager: \"\n>                                 << strerror(-ret);\n> @@ -115,9 +119,22 @@ void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam)\n>                 }\n>         }\n>\n> +       /*\n> +        * Get camera properties from the configuration file.\n> +        *\n> +        * The camera properties as recorded in the configuration file\n> +        * supplement information that cannot be retrieved from the\n> +        * libcamera::Camera at run time.\n> +        */\n> +       const CameraProps &cameraProps = halConfig_.cameraProps(cam->id());\n> +       if (!cameraProps.valid) {\n> +               LOG(HAL, Error) << \"Failed to register camera: \" << cam->id();\n> +               return;\n> +       }\n> +\n>         /* Create a CameraDevice instance to wrap the libcamera Camera. */\n>         std::unique_ptr<CameraDevice> camera = CameraDevice::create(id, cam);\n> -       int ret = camera->initialize();\n> +       int ret = camera->initialize(cameraProps);\n>         if (ret) {\n>                 LOG(HAL, Error) << \"Failed to initialize camera: \" << cam->id();\n>                 return;\n> diff --git a/src/android/camera_hal_manager.h b/src/android/camera_hal_manager.h\n> index d9bf27989965..af1581da6579 100644\n> --- a/src/android/camera_hal_manager.h\n> +++ b/src/android/camera_hal_manager.h\n> @@ -19,6 +19,8 @@\n>\n>  #include <libcamera/camera_manager.h>\n>\n> +#include \"camera_hal_config.h\"\n> +\n>  class CameraDevice;\n>\n>  class CameraHalManager\n> @@ -50,6 +52,7 @@ private:\n>         CameraDevice *cameraDeviceFromHalId(unsigned int id);\n>\n>         std::unique_ptr<libcamera::CameraManager> cameraManager_;\n> +       CameraHalConfig halConfig_;\n>\n>         const camera_module_callbacks_t *callbacks_;\n>         std::vector<std::unique_ptr<CameraDevice>> cameras_;\n\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\n\n> --\n> 2.31.1\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 B23C4C0DA3\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  7 Apr 2021 02:33:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6ACFD687D3;\n\tWed,  7 Apr 2021 04:32:59 +0200 (CEST)","from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com\n\t[IPv6:2a00:1450:4864:20::62d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 935E9602CD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Apr 2021 04:32:57 +0200 (CEST)","by mail-ej1-x62d.google.com with SMTP id l4so25058551ejc.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 06 Apr 2021 19:32:57 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"ccAhNvFV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=eQJQ05fJts45C2DlYM7e59sSPI6WdZENQ8Jg2iCBFAQ=;\n\tb=ccAhNvFV+eNqShoLkm75sHaYzfiEdMhfqsU2b/njxvS+g9+NprcEgQIMxnV1RHfhLX\n\tw4LZ+qi9UmwytH0olrh4vm7cFUPsbmhwN0yEW6YbPWOQw6cUIkuUcO8j8A9FzbiqQzkL\n\t03OwjMb9xbGHWT2dQ6vZSClE3zlBmKdnkmZ+g=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=eQJQ05fJts45C2DlYM7e59sSPI6WdZENQ8Jg2iCBFAQ=;\n\tb=q5tmvgY/BJu23y/0LwS7SPN5fJL0UXuokTwdnvPjvMPWnoxKJUOfcHgp50Aj8Cf+V4\n\tuNxkPV7ihtKzFaI8g1HPrB0AkeZI4upzs54CdxENv6owR0dFl7qKKvS5+z2q+UJH0LTq\n\tTU+v+QfqXblPY/hEe8zY5xW/vywiWL4LJ3LJ7cB3iRIP76eQKunurkyaYGi8nN0BKcDc\n\tGornzP1mHImMtHR9qMqnr2slnh6pneg6G2LeBhK8mM39RXYsV0AvSNtnDqQDz+iliv4o\n\tl/EEsNlGsvltRVNcIjNjucGA2o4M8batWSb0KAIeBum7rCH2ES+Dgr6c4h+uur/OhXTM\n\txRAQ==","X-Gm-Message-State":"AOAM5337NE7j+nF3nQ97yu7U7KRy1qMdWrywJ7m7KK2dTCsvy7Toeyda\n\t6LJFV2h08VPx6NRgvFWYJZ6v0qpDDJjOuIVzdysjnTxahB8=","X-Google-Smtp-Source":"ABdhPJxhna2+q3s+NynTb6Cz+hzKB/+xXa5ykBYMfxwPkT1GcDzj6VwT9O8pqRsGVB8W1jcSfcdSHz31DPEb40I941I=","X-Received":"by 2002:a17:906:7691:: with SMTP id\n\to17mr1142920ejm.55.1617762777199; \n\tTue, 06 Apr 2021 19:32:57 -0700 (PDT)","MIME-Version":"1.0","References":"<20210406154557.27303-1-jacopo@jmondi.org>\n\t<20210406154557.27303-5-jacopo@jmondi.org>","In-Reply-To":"<20210406154557.27303-5-jacopo@jmondi.org>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Wed, 7 Apr 2021 11:32:47 +0900","Message-ID":"<CAO5uPHN-_YhmXez6WzGaMQPZa8mzNzdmmU5Hvt12Zx1Da+MFVg@mail.gmail.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v4 4/5] android: camera_device: Get\n\tproperties from configuration","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 <libcamera-devel@lists.libcamera.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":16213,"web_url":"https://patchwork.libcamera.org/comment/16213/","msgid":"<YHUcoPhivsN5L7tz@pendragon.ideasonboard.com>","date":"2021-04-13T04:22:56","subject":"Re: [libcamera-devel] [PATCH v4 4/5] android: camera_device: Get\n\tproperties from configuration","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Tue, Apr 06, 2021 at 05:45:56PM +0200, Jacopo Mondi wrote:\n> Open the HAL configuration file in the Camera HAL manager and get\n> the camera properties for each created CameraDevice and initialize it\n> with them.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/android/camera_device.cpp      | 29 ++++++++++++++++++++++-------\n>  src/android/camera_device.h        |  3 ++-\n>  src/android/camera_hal_manager.cpp | 21 +++++++++++++++++++--\n>  src/android/camera_hal_manager.h   |  3 +++\n>  4 files changed, 46 insertions(+), 10 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 89044efa7ebe..66030c012db0 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -6,6 +6,7 @@\n>   */\n>  \n>  #include \"camera_device.h\"\n> +#include \"camera_hal_config.h\"\n>  #include \"camera_ops.h\"\n>  #include \"post_processor.h\"\n>  \n> @@ -446,9 +447,15 @@ std::unique_ptr<CameraDevice> CameraDevice::create(unsigned int id,\n>   * Initialize the camera static information.\n>   * This method is called before the camera device is opened.\n>   */\n> -int CameraDevice::initialize()\n> +int CameraDevice::initialize(const CameraProps &cameraProps)\n>  {\n> -\t/* Initialize orientation and facing side of the camera. */\n> +\t/*\n> +\t * Initialize orientation and facing side of the camera.\n> +\t *\n> +\t * If the libcamera::Camera provides those information as retrieved\n> +\t * from firmware use that, otherwise fallback to values parsed from\n> +\t * the configuration file.\n> +\t */\n>  \tconst ControlList &properties = camera_->properties();\n>  \n>  \tif (properties.contains(properties::Location)) {\n> @@ -464,12 +471,14 @@ int CameraDevice::initialize()\n>  \t\t\tfacing_ = CAMERA_FACING_EXTERNAL;\n>  \t\t\tbreak;\n>  \t\t}\n> +\n> +\t\tif (facing_ != cameraProps.facing)\n> +\t\t\tLOG(HAL, Warning)\n> +\t\t\t\t<< \"Camera location does not match\"\n> +\t\t\t\t<< \" configuration file. Use \" << facing_;\n\ns/Use/Using/\n\n> +\n>  \t} else {\n> -\t\t/*\n> -\t\t * \\todo Retrieve the camera location from configuration file\n> -\t\t * if not available from the library.\n> -\t\t */\n> -\t\tfacing_ = CAMERA_FACING_FRONT;\n> +\t\tfacing_ = cameraProps.facing;\n>  \t}\n>  \n>  \t/*\n> @@ -483,6 +492,12 @@ int CameraDevice::initialize()\n>  \tif (properties.contains(properties::Rotation)) {\n>  \t\tint rotation = properties.get(properties::Rotation);\n>  \t\torientation_ = (360 - rotation) % 360;\n> +\t\tif (orientation_ != cameraProps.rotation)\n> +\t\t\tLOG(HAL, Warning)\n> +\t\t\t\t<< \"Camera orientation does not match\"\n> +\t\t\t\t<< \" configuration file. Use \" << orientation_;\n\nSame here.\n\n> +\t} else {\n> +\t\torientation_ = cameraProps.rotation;\n>  \t}\n>  \n>  \tint ret = camera_->acquire();\n> diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> index 11bdfec8d587..ba3ec8770e11 100644\n> --- a/src/android/camera_device.h\n> +++ b/src/android/camera_device.h\n> @@ -29,6 +29,7 @@\n>  #include \"camera_worker.h\"\n>  #include \"jpeg/encoder.h\"\n>  \n> +class CameraProps;\n>  class CameraDevice : protected libcamera::Loggable\n>  {\n>  public:\n> @@ -36,7 +37,7 @@ public:\n>  \t\t\t\t\t\t    std::shared_ptr<libcamera::Camera> cam);\n>  \t~CameraDevice();\n>  \n> -\tint initialize();\n> +\tint initialize(const CameraProps &cameraProps);\n>  \n>  \tint open(const hw_module_t *hardwareModule);\n>  \tvoid close();\n> diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp\n> index bf3fcda75237..a517727ea0b8 100644\n> --- a/src/android/camera_hal_manager.cpp\n> +++ b/src/android/camera_hal_manager.cpp\n> @@ -39,13 +39,17 @@ CameraHalManager::~CameraHalManager() = default;\n>  \n>  int CameraHalManager::init()\n>  {\n> +\tint ret = halConfig_.open();\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n>  \tcameraManager_ = std::make_unique<CameraManager>();\n>  \n>  \t/* Support camera hotplug. */\n>  \tcameraManager_->cameraAdded.connect(this, &CameraHalManager::cameraAdded);\n>  \tcameraManager_->cameraRemoved.connect(this, &CameraHalManager::cameraRemoved);\n>  \n> -\tint ret = cameraManager_->start();\n> +\tret = cameraManager_->start();\n>  \tif (ret) {\n>  \t\tLOG(HAL, Error) << \"Failed to start camera manager: \"\n>  \t\t\t\t<< strerror(-ret);\n> @@ -115,9 +119,22 @@ void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam)\n>  \t\t}\n>  \t}\n>  \n> +\t/*\n> +\t * Get camera properties from the configuration file.\n> +\t *\n> +\t * The camera properties as recorded in the configuration file\n> +\t * supplement information that cannot be retrieved from the\n> +\t * libcamera::Camera at run time.\n> +\t */\n> +\tconst CameraProps &cameraProps = halConfig_.cameraProps(cam->id());\n> +\tif (!cameraProps.valid) {\n> +\t\tLOG(HAL, Error) << \"Failed to register camera: \" << cam->id();\n> +\t\treturn;\n> +\t}\n\nCould you please reply to the comment in v4 regarding UVC cameras ?\n\n> +\n>  \t/* Create a CameraDevice instance to wrap the libcamera Camera. */\n>  \tstd::unique_ptr<CameraDevice> camera = CameraDevice::create(id, cam);\n> -\tint ret = camera->initialize();\n> +\tint ret = camera->initialize(cameraProps);\n>  \tif (ret) {\n>  \t\tLOG(HAL, Error) << \"Failed to initialize camera: \" << cam->id();\n>  \t\treturn;\n> diff --git a/src/android/camera_hal_manager.h b/src/android/camera_hal_manager.h\n> index d9bf27989965..af1581da6579 100644\n> --- a/src/android/camera_hal_manager.h\n> +++ b/src/android/camera_hal_manager.h\n> @@ -19,6 +19,8 @@\n>  \n>  #include <libcamera/camera_manager.h>\n>  \n> +#include \"camera_hal_config.h\"\n> +\n>  class CameraDevice;\n>  \n>  class CameraHalManager\n> @@ -50,6 +52,7 @@ private:\n>  \tCameraDevice *cameraDeviceFromHalId(unsigned int id);\n>  \n>  \tstd::unique_ptr<libcamera::CameraManager> cameraManager_;\n> +\tCameraHalConfig halConfig_;\n>  \n>  \tconst camera_module_callbacks_t *callbacks_;\n>  \tstd::vector<std::unique_ptr<CameraDevice>> cameras_;","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 2368ABD224\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 Apr 2021 04:23:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7DB1B687FF;\n\tTue, 13 Apr 2021 06:23:47 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DBD59687EC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Apr 2021 06:23:45 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 61ABC6F2;\n\tTue, 13 Apr 2021 06:23:45 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ehQJ1/XW\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1618287825;\n\tbh=iG9ieMKxkKwyDPv2e6z1ywNgWo9CiqilfRldWSea9XI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ehQJ1/XWPAXZH0dG1bneS/dalQZMKLzrPIJDNarpWGDbxHPz1HRJDv28Df4ORsriQ\n\thMaWHakoprEcn3FHzKKF0QKPJCchY8hc/Yv4tpsvBUtf3dhiapXnh2kheMuNKfahvV\n\tVLA6djkr53sdtNtKzJ2/79OOKqqqqGKK6rTtoCHY=","Date":"Tue, 13 Apr 2021 07:22:56 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YHUcoPhivsN5L7tz@pendragon.ideasonboard.com>","References":"<20210406154557.27303-1-jacopo@jmondi.org>\n\t<20210406154557.27303-5-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210406154557.27303-5-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v4 4/5] android: camera_device: Get\n\tproperties from configuration","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","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":16223,"web_url":"https://patchwork.libcamera.org/comment/16223/","msgid":"<20210413075902.ecckipnvcq3p2itg@uno.localdomain>","date":"2021-04-13T07:59:02","subject":"Re: [libcamera-devel] [PATCH v4 4/5] android: camera_device: Get\n\tproperties from configuration","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Tue, Apr 13, 2021 at 07:22:56AM +0300, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> >\n> > +\t/*\n> > +\t * Get camera properties from the configuration file.\n> > +\t *\n> > +\t * The camera properties as recorded in the configuration file\n> > +\t * supplement information that cannot be retrieved from the\n> > +\t * libcamera::Camera at run time.\n> > +\t */\n> > +\tconst CameraProps &cameraProps = halConfig_.cameraProps(cam->id());\n> > +\tif (!cameraProps.valid) {\n> > +\t\tLOG(HAL, Error) << \"Failed to register camera: \" << cam->id();\n> > +\t\treturn;\n> > +\t}\n>\n> Could you please reply to the comment in v4 regarding UVC cameras ?\n>\n\nSorry, I completely missed that part, I'll re-paste comment here\n\n> What if we have a fully populated libcamera::Camera (with properties\n> retrieved from the firmware) ? Should we still require a configuration\n> file then ? The configuration file will likely be mandatory in the\n> future to provide additional information that the firmware doesn't\n> provide (such as lens-related information for instance), so I suppose\n> it's fine to already make it mandatory.\n>\n\nI think so\n\n> We should however not make the configuration mandatory for external\n> cameras, this would break UVC support.\n\nI see. It won't be possible to provide a configuration file for\npluggable cameras, although there might be vendors that embedds a UVC\ncamera and want a configuration file.\n\nI'll see how this can be handled... we'll need to handle the\ncase where !cameraProps.valid and default properties to something\nsensible for an external camera. I wonder if we ever get to the point\nwere we could specialize CameraDevice for the external use case, but\nthat's for later...\n\n\n>\n> Related to breakages, we need to also ensure that the configuration file\n> will get deployed correctly in Chrome OS builds of libcamera, or the\n> existing tests will start failing. I'm not sure how that's best handled,\n> Hiro, maybe this is something that you could help us with ?\n\n\n> > +\n> >  \t/* Create a CameraDevice instance to wrap the libcamera Camera. */\n> >  \tstd::unique_ptr<CameraDevice> camera = CameraDevice::create(id, cam);\n> > -\tint ret = camera->initialize();\n> > +\tint ret = camera->initialize(cameraProps);\n> >  \tif (ret) {\n> >  \t\tLOG(HAL, Error) << \"Failed to initialize camera: \" << cam->id();\n> >  \t\treturn;\n> > diff --git a/src/android/camera_hal_manager.h b/src/android/camera_hal_manager.h\n> > index d9bf27989965..af1581da6579 100644\n> > --- a/src/android/camera_hal_manager.h\n> > +++ b/src/android/camera_hal_manager.h\n> > @@ -19,6 +19,8 @@\n> >\n> >  #include <libcamera/camera_manager.h>\n> >\n> > +#include \"camera_hal_config.h\"\n> > +\n> >  class CameraDevice;\n> >\n> >  class CameraHalManager\n> > @@ -50,6 +52,7 @@ private:\n> >  \tCameraDevice *cameraDeviceFromHalId(unsigned int id);\n> >\n> >  \tstd::unique_ptr<libcamera::CameraManager> cameraManager_;\n> > +\tCameraHalConfig halConfig_;\n> >\n> >  \tconst camera_module_callbacks_t *callbacks_;\n> >  \tstd::vector<std::unique_ptr<CameraDevice>> cameras_;\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 95B0EBD1F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 Apr 2021 07:58:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2412E687FE;\n\tTue, 13 Apr 2021 09:58:25 +0200 (CEST)","from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F023C687F3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Apr 2021 09:58:23 +0200 (CEST)","from uno.localdomain (93-34-118-233.ip49.fastwebnet.it\n\t[93.34.118.233]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 6953560002;\n\tTue, 13 Apr 2021 07:58:23 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","Date":"Tue, 13 Apr 2021 09:59:02 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20210413075902.ecckipnvcq3p2itg@uno.localdomain>","References":"<20210406154557.27303-1-jacopo@jmondi.org>\n\t<20210406154557.27303-5-jacopo@jmondi.org>\n\t<YHUcoPhivsN5L7tz@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<YHUcoPhivsN5L7tz@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v4 4/5] android: camera_device: Get\n\tproperties from configuration","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","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]