{"id":13737,"url":"https://patchwork.libcamera.org/api/patches/13737/?format=json","web_url":"https://patchwork.libcamera.org/patch/13737/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210907194107.803730-7-jacopo@jmondi.org>","date":"2021-09-07T19:40:56","name":"[libcamera-devel,v2,06/17] android: capabilities: Initialize camera state when building properties","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"5128e13e65f433d43f2ebffc56f389c9976f39be","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13737/mbox/","series":[{"id":2492,"url":"https://patchwork.libcamera.org/api/series/2492/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2492","date":"2021-09-07T19:40:50","name":"IPU3 control info update and HAL frame durations","version":2,"mbox":"https://patchwork.libcamera.org/series/2492/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13737/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13737/checks/","tags":{},"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 19228BDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  7 Sep 2021 19:40:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6B17969173;\n\tTue,  7 Sep 2021 21:40:35 +0200 (CEST)","from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net\n\t[217.70.183.193])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 19EDC6916F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Sep 2021 21:40:33 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 3490F240004;\n\tTue,  7 Sep 2021 19:40:31 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  7 Sep 2021 21:40:56 +0200","Message-Id":"<20210907194107.803730-7-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.32.0","In-Reply-To":"<20210907194107.803730-1-jacopo@jmondi.org>","References":"<20210907194107.803730-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 06/17] android: capabilities:\n\tInitialize camera state when building properties","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Now that building the list of supported stream configuration requires\napplying a configuration to the Camera, re-initialize the camera\ncontrols by applying a configuration generated for the Viewfinder stream\nrole before building the list of static metadata.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/android/camera_capabilities.cpp | 22 +++++++++++++++++++---\n 1 file changed, 19 insertions(+), 3 deletions(-)","diff":"diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp\nindex 4e82f12a904e..9bfc7ebc6334 100644\n--- a/src/android/camera_capabilities.cpp\n+++ b/src/android/camera_capabilities.cpp\n@@ -394,11 +394,14 @@ int CameraCapabilities::initialize(std::shared_ptr<Camera> camera,\n \t}\n \n \tret = initializeStreamConfigurations();\n-\tcamera_->release();\n-\tif (ret)\n+\tif (ret) {\n+\t\tcamera_->release();\n \t\treturn ret;\n+\t}\n \n-\treturn initializeStaticMetadata();\n+\tret = initializeStaticMetadata();\n+\tcamera_->release();\n+\treturn ret;\n }\n \n std::vector<Size>\n@@ -682,6 +685,19 @@ int CameraCapabilities::initializeStaticMetadata()\n \t\treturn -EINVAL;\n \t}\n \n+\t/*\n+\t * Generate and apply a new configuration for the Viewfinder role to\n+\t * collect control limits and properties from a known state.\n+\t */\n+\tstd::unique_ptr<CameraConfiguration> cameraConfig =\n+\t\tcamera_->generateConfiguration({ StreamRole::Viewfinder });\n+\tint ret = camera_->configure(cameraConfig.get());\n+\tif (ret) {\n+\t\tLOG(HAL, Error) << \"Failed to initialize the camera state\";\n+\t\tstaticMetadata_.reset();\n+\t\treturn ret;\n+\t}\n+\n \tconst ControlInfoMap &controlsInfo = camera_->controls();\n \tconst ControlList &properties = camera_->properties();\n \n","prefixes":["libcamera-devel","v2","06/17"]}