{"id":12251,"url":"https://patchwork.libcamera.org/api/1.1/patches/12251/?format=json","web_url":"https://patchwork.libcamera.org/patch/12251/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20210512084744.1499469-1-naush@raspberrypi.com>","date":"2021-05-12T08:47:43","name":"[libcamera-devel,1/2] pipeline: raspberrypi: Store timestamp in the correct Request metadata","commit_ref":"f1b7b68d209aa2fb074f39be7ca0d7e2c9edd631","pull_url":null,"state":"accepted","archived":false,"hash":"1f4ce88555decd65742d2f895b1af06890040d45","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12251/mbox/","series":[{"id":2019,"url":"https://patchwork.libcamera.org/api/1.1/series/2019/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2019","date":"2021-05-12T08:47:43","name":"[libcamera-devel,1/2] pipeline: raspberrypi: Store timestamp in the correct Request metadata","version":1,"mbox":"https://patchwork.libcamera.org/series/2019/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12251/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12251/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 AA50AC31E3\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 12 May 2021 08:47:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0A51668920;\n\tWed, 12 May 2021 10:47:51 +0200 (CEST)","from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com\n\t[IPv6:2a00:1450:4864:20::42c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7D0CA688E4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 May 2021 10:47:49 +0200 (CEST)","by mail-wr1-x42c.google.com with SMTP id q5so3298588wrs.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 May 2021 01:47:49 -0700 (PDT)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:d29a:cbe2:1c54:7a47])\n\tby smtp.gmail.com with ESMTPSA id\n\td3sm16370759wrs.41.2021.05.12.01.47.48\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 12 May 2021 01:47:48 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"qDa0Fasy\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=AJ6XpHi6pLrZNinv13+3uvM+Ynhndyf1PXAUaNkGF1c=;\n\tb=qDa0FasyUNKRJ36FpC3Q7Mz52otpUBD1vW6z3qrk6chBU2eAU+pKbfNNDJ+OF/bJNv\n\tb1T6Yq+5/c5Ql2PUjAKd4tUT+P7Mac33zuMHZdxlWh3s20+NLfhuWOpUihv5FdeJ1Dev\n\tbLxPohDF8cCwPPGlZHWO6yBlyIXf5lOY/n6l9K/IvKzlvQ70dm/6AYyb6WUuGoz+XsFl\n\tXe0t0XM/FHsht52Teo5BGnXi8lF4AEOtdxA8215JRMdmIT9VNDjvohTpGbk3Dp1sgE7k\n\t9uV57sgIJLiPLgZqFSpjA11L5tP3FBqAncbQJC20YLs+j+weAH1e/FaAHzSyuL5Fg1zx\n\tuJFg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=AJ6XpHi6pLrZNinv13+3uvM+Ynhndyf1PXAUaNkGF1c=;\n\tb=Z8biXyxC2jf99svDlvmWORQlzAprLxP5xavOyLwTccFTxjGaX6kRTD47+fd6bLsmbA\n\tL3GGYPyNe4GGZ0QpPO+ey6vhOdXzhPQhkVAO/wpAYI7/iDLhOLbx304+6kRX7VBvfe7G\n\tuOT1RJCG7xXa6F/inBsp3s+AudsRmxn55184JUOAbkI+NxkM44Z+aCrHAkMGZrxpGPuE\n\tNvRnIaFb+xSLuo7YW6Ddn6pcceRVHIHA3K6xmkZmGmbWzR3DqcPDAT/IlrHPQmkIKY2T\n\t42spfTJFGiFFCVojOUV1w0Xu0XQLvf+edfDe195Y3NptcJIvwd6eTwHv/mN3KtoYeiMS\n\t2J6A==","X-Gm-Message-State":"AOAM532FgiOiCj1j2x4Z8K/raeX5hTLfiqO/v+7wPAecGBOztZBkjWRu\n\tO3RhGTskT16zjg8I5BdbA87xTKVj2aQUXw==","X-Google-Smtp-Source":"ABdhPJx5rwiuWmvZVr0ky4BYxjfGEdrFzbGrA1GXffJccbU7NVHM6GHMCiUBcs/aKmrWK6qAM89yMA==","X-Received":"by 2002:a5d:524f:: with SMTP id\n\tk15mr43414469wrc.412.1620809268941; \n\tWed, 12 May 2021 01:47:48 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 12 May 2021 09:47:43 +0100","Message-Id":"<20210512084744.1499469-1-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 1/2] pipeline: raspberrypi: Store\n\ttimestamp in the correct Request metadata","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":"Write the controls::SensorTimestamp value in the Request metadata when\nthe request is popped from the queue ready to run the pipeline. This\nensures that the timestamp is written to the correct Request item,\nwhich may not be at the top of the queue when the Unicam buffer dequeue\noccurs.\n\nFixes: fcfb1dc02a6b (\"libcamera: raspberry: Report sensor timestamp\")\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 29 +++++++++++--------\n 1 file changed, 17 insertions(+), 12 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 6fbdba0487bf..eb6d31670567 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -221,6 +221,8 @@ public:\n \n private:\n \tvoid checkRequestCompleted();\n+\tvoid fillRequestMetadata(const ControlList &bufferControls,\n+\t\t\t\t Request *request);\n \tvoid tryRunPipeline();\n \tbool findMatchingBuffers(BayerFrame &bayerFrame, FrameBuffer *&embeddedBuffer);\n \n@@ -1416,18 +1418,6 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)\n \t\t\t<< \", timestamp: \" << buffer->metadata().timestamp;\n \n \tif (stream == &unicam_[Unicam::Image]) {\n-\t\t/*\n-\t\t * Record the sensor timestamp in the Request.\n-\t\t *\n-\t\t * \\todo Do not assume the request in the front of the queue\n-\t\t * is the correct one\n-\t\t */\n-\t\tRequest *request = requestQueue_.front();\n-\t\tASSERT(request);\n-\n-\t\trequest->metadata().set(controls::SensorTimestamp,\n-\t\t\t\t\tbuffer->metadata().timestamp);\n-\n \t\t/*\n \t\t * Lookup the sensor controls used for this frame sequence from\n \t\t * DelayedControl and queue them along with the frame buffer.\n@@ -1689,6 +1679,13 @@ void RPiCameraData::applyScalerCrop(const ControlList &controls)\n \t}\n }\n \n+void RPiCameraData::fillRequestMetadata(const ControlList &bufferControls,\n+\t\t\t\t\tRequest *request)\n+{\n+\trequest->metadata().set(controls::SensorTimestamp,\n+\t\t\t\tbufferControls.get(controls::SensorTimestamp));\n+}\n+\n void RPiCameraData::tryRunPipeline()\n {\n \tFrameBuffer *embeddedBuffer;\n@@ -1708,6 +1705,14 @@ void RPiCameraData::tryRunPipeline()\n \t/* See if a new ScalerCrop value needs to be applied. */\n \tapplyScalerCrop(request->controls());\n \n+\t/*\n+\t * Clear the request metadata and fill it with some initial non-IPA\n+\t * related controls. We clear it first because the request metadata\n+\t * may have been populated if we have dropped the previous frame.\n+\t */\n+\trequest->metadata().clear();\n+\tfillRequestMetadata(bayerFrame.controls, request);\n+\n \t/*\n \t * Process all the user controls by the IPA. Once this is complete, we\n \t * queue the ISP output buffer listed in the request to start the HW\n","prefixes":["libcamera-devel","1/2"]}