{"id":10675,"url":"https://patchwork.libcamera.org/api/patches/10675/?format=json","web_url":"https://patchwork.libcamera.org/patch/10675/","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":"<20201217140358.17614-2-jacopo@jmondi.org>","date":"2020-12-17T14:03:57","name":"[libcamera-devel,v2,1/2] android: camera_device: Report pipeline depth","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"89f2fe6d4fdaf02e59cbf90b92fc4a8047770e31","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/10675/mbox/","series":[{"id":1536,"url":"https://patchwork.libcamera.org/api/series/1536/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1536","date":"2020-12-17T14:03:56","name":"android: Report","version":2,"mbox":"https://patchwork.libcamera.org/series/1536/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10675/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10675/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 8BA26BD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Dec 2020 14:03:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 63313615AF;\n\tThu, 17 Dec 2020 15:03:58 +0100 (CET)","from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E289461591\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Dec 2020 15:03:55 +0100 (CET)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 6071220009;\n\tThu, 17 Dec 2020 14:03:55 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 17 Dec 2020 15:03:57 +0100","Message-Id":"<20201217140358.17614-2-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.29.2","In-Reply-To":"<20201217140358.17614-1-jacopo@jmondi.org>","References":"<20201217140358.17614-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 1/2] 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\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\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   |  4 ++++\n 3 files changed, 22 insertions(+), 7 deletions(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 1c7bf4ed8073..26aa3bc4b123 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -675,10 +675,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@@ -1187,6 +1187,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@@ -1704,7 +1705,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@@ -1822,15 +1823,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_->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@@ -1880,6 +1883,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..847a2fc4bd7c 100644\n--- a/src/android/camera_worker.h\n+++ b/src/android/camera_worker.h\n@@ -25,6 +25,10 @@ public:\n \tCaptureRequest(libcamera::Camera *camera, uint64_t cookie);\n \n \tconst std::vector<int> &fences() const { return acquireFences_; }\n+\tconst libcamera::ControlList &metadata() const\n+\t{\n+\t\treturn request_->metadata();\n+\t}\n \n \tvoid addBuffer(libcamera::Stream *stream,\n \t\t       libcamera::FrameBuffer *buffer, int fence);\n","prefixes":["libcamera-devel","v2","1/2"]}