{"id":10630,"url":"https://patchwork.libcamera.org/api/patches/10630/?format=json","web_url":"https://patchwork.libcamera.org/patch/10630/","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":"<20201209173520.284266-3-jacopo@jmondi.org>","date":"2020-12-09T17:35:18","name":"[libcamera-devel,2/3] android: camera_device: Report pipeline depth","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"1ded50267f471ac507efe6861eda51ba9cb3895c","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":{"id":15,"url":"https://patchwork.libcamera.org/api/users/15/?format=json","username":"jmondi","first_name":"Jacopo","last_name":"Mondi","email":"jacopo@jmondi.org"},"mbox":"https://patchwork.libcamera.org/patch/10630/mbox/","series":[{"id":1520,"url":"https://patchwork.libcamera.org/api/series/1520/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1520","date":"2020-12-09T17:35:16","name":"android: Add more metadata","version":1,"mbox":"https://patchwork.libcamera.org/series/1520/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10630/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10630/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 41B51BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  9 Dec 2020 17:35:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C38D967F15;\n\tWed,  9 Dec 2020 18:35:20 +0100 (CET)","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 7062C67F07\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  9 Dec 2020 18:35:17 +0100 (CET)","from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 3044C240009\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  9 Dec 2020 17:35:16 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  9 Dec 2020 18:35:18 +0100","Message-Id":"<20201209173520.284266-3-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.29.1","In-Reply-To":"<20201209173520.284266-1-jacopo@jmondi.org>","References":"<20201209173520.284266-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 2/3] android: camera_device: Report\n\tpipeline depth","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>","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>"},"content":"Report the pipeline depth in the capture results if the pipeline\nreports it.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 21 ++++++++++++++++-----\n src/android/camera_device.h   |  4 ++--\n src/android/camera_worker.h   |  1 +\n 3 files changed, 19 insertions(+), 7 deletions(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 872c7b18ee49..13194d1ea5cc 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -550,10 +550,10 @@ std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()\n {\n \t/*\n \t * \\todo Keep this in sync with the actual number of entries.\n-\t * Currently: 51 entries, 687 bytes of static metadata\n+\t * Currently: 52 entries, 698 bytes of static metadata\n \t */\n \tuint32_t numEntries = 52;\n-\tuint32_t byteSize = 694;\n+\tuint32_t byteSize = 698;\n \n \t/*\n \t * Calculate space occupation in bytes for dynamically built metadata\n@@ -1046,6 +1046,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \t\tANDROID_CONTROL_AWB_STATE,\n \t\tANDROID_CONTROL_AWB_LOCK,\n \t\tANDROID_LENS_STATE,\n+\t\tANDROID_REQUEST_PIPELINE_DEPTH,\n \t\tANDROID_SCALER_CROP_REGION,\n \t\tANDROID_SENSOR_TIMESTAMP,\n \t\tANDROID_SENSOR_ROLLING_SHUTTER_SKEW,\n@@ -1554,7 +1555,7 @@ void CameraDevice::requestComplete(Request *request)\n \t * pipeline handlers) timestamp in the Request itself.\n \t */\n \tuint64_t timestamp = buffers.begin()->second->metadata().timestamp;\n-\tresultMetadata = getResultMetadata(descriptor->frameNumber_, timestamp);\n+\tresultMetadata = getResultMetadata(descriptor, timestamp);\n \n \t/* Handle any JPEG compression. */\n \tfor (unsigned int i = 0; i < descriptor->numBuffers_; ++i) {\n@@ -1672,15 +1673,17 @@ void CameraDevice::notifyError(uint32_t frameNumber, camera3_stream_t *stream)\n  * Produce a set of fixed result metadata.\n  */\n std::unique_ptr<CameraMetadata>\n-CameraDevice::getResultMetadata([[maybe_unused]] int frame_number,\n+CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,\n \t\t\t\tint64_t timestamp)\n {\n+\tconst ControlList &metadata = descriptor->request_->request()->metadata();\n+\n \t/*\n \t * \\todo Keep this in sync with the actual number of entries.\n \t * Currently: 18 entries, 62 bytes\n \t */\n \tstd::unique_ptr<CameraMetadata> resultMetadata =\n-\t\tstd::make_unique<CameraMetadata>(18, 62);\n+\t\tstd::make_unique<CameraMetadata>(19, 63);\n \tif (!resultMetadata->isValid()) {\n \t\tLOG(HAL, Error) << \"Failed to allocate static metadata\";\n \t\treturn nullptr;\n@@ -1730,6 +1733,14 @@ CameraDevice::getResultMetadata([[maybe_unused]] int frame_number,\n \tresultMetadata->addEntry(ANDROID_STATISTICS_SCENE_FLICKER,\n \t\t\t\t &scene_flicker, 1);\n \n+\t/* Add metadata tags reported by libcamera. */\n+\tif (metadata.contains(controls::draft::PipelineDepth)) {\n+\t\tuint8_t pipeline_depth =\n+\t\t\tmetadata.get<int32_t>(controls::draft::PipelineDepth);\n+\t\tresultMetadata->addEntry(ANDROID_REQUEST_PIPELINE_DEPTH,\n+\t\t\t\t\t &pipeline_depth, 1);\n+\t}\n+\n \t/*\n \t * Return the result metadata pack even is not valid: get() will return\n \t * nullptr.\ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex 45efcf477436..07d3a846f8e1 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -105,8 +105,8 @@ private:\n \tvoid notifyError(uint32_t frameNumber, camera3_stream_t *stream);\n \tCameraMetadata *requestTemplatePreview();\n \tlibcamera::PixelFormat toPixelFormat(int format) const;\n-\tstd::unique_ptr<CameraMetadata> getResultMetadata(int frame_number,\n-\t\t\t\t\t\t\t  int64_t timestamp);\n+\tstd::unique_ptr<CameraMetadata> getResultMetadata(\n+\t\tCamera3RequestDescriptor *descriptor, int64_t timestamp);\n \n \tunsigned int id_;\n \tcamera3_device_t camera3Device_;\ndiff --git a/src/android/camera_worker.h b/src/android/camera_worker.h\nindex fff5021708d7..9417a816c214 100644\n--- a/src/android/camera_worker.h\n+++ b/src/android/camera_worker.h\n@@ -25,6 +25,7 @@ public:\n \tCaptureRequest(libcamera::Camera *camera, uint64_t cookie);\n \n \tconst std::vector<int> &fences() const { return acquireFences_; }\n+\tconst libcamera::Request *request() const { return request_.get(); }\n \n \tvoid addBuffer(libcamera::Stream *stream,\n \t\t       libcamera::FrameBuffer *buffer, int fence);\n","prefixes":["libcamera-devel","2/3"]}