From patchwork Sun Nov 20 17:20:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 17818 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id A232ABD16B for ; Sun, 20 Nov 2022 17:20:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 07B4E61F34; Sun, 20 Nov 2022 18:20:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1668964848; bh=NuNSyuVLS8nHm2AjXlahaTSwMrAG37xpv2FNf/n28ak=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=2mLLuSnss551SRSn6Na69awDQnZH4PllRc0frP7YLEsati8aV8qIHs6HzjX2Z52pj WLxMjRFENttylmVCWu+OEUJOhoxJ4ZmgMm76NV5laR/QytGCZ41YwRZgI1e18MguYC b27WEx61C59ZIU7bcE4LLfSVKf2vptB57qf0wtN1+l3H1cDAzWljq9U96mc5aoKc19 oX6qTydCESAw9yIt0V+5+7NntrAu63EUVDJltfjE19TRFlj54Kl+U3ngCaTSbeDpIf sKkBeXleQUWw7CSh5f9ZomHjtbS+v8PAK19pz3mG24gWg7EviETPqhTrNaaR3aCt/b iXNAh6ksd0uYQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 17D51603CE for ; Sun, 20 Nov 2022 18:20:46 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tVw/wAM5"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 859C330A; Sun, 20 Nov 2022 18:20:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1668964845; bh=NuNSyuVLS8nHm2AjXlahaTSwMrAG37xpv2FNf/n28ak=; h=From:To:Cc:Subject:Date:From; b=tVw/wAM5FZG5cxUsSKybisj0Omhe2UsVeatey7e3NNgCIL92b87AjQeUY+KBexFS3 34ftmCSX/U+1LeQAiSd1LlbVQ+cN/CfI9cKeCRFS/9ozi2VlpEl5JzMrXiOeLshDeb JLjB0sunGQEuDThJuJuMNO+f4YWpUTq5/f8BcrUo= To: libcamera-devel@lists.libcamera.org Date: Sun, 20 Nov 2022 19:20:30 +0200 Message-Id: <20221120172030.21821-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.37.4 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] pipeline: imx8-isi: Set SensorTimestamp metadata X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Cc: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Report the sensor timestamp in metadata. Use the timestamp from the first buffer. Accuracy could be improved by using the frame start event from the CSI-2 receiver, but the kernel driver doesn't support it yet. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/imx8-isi/imx8-isi.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp index a3dfd3fc529c..e51457ebc345 100644 --- a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp +++ b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp @@ -994,6 +994,12 @@ void PipelineHandlerISI::bufferReady(FrameBuffer *buffer) { Request *request = buffer->request(); + /* Record the sensor's timestamp in the request metadata. */ + ControlList &metadata = request->metadata(); + if (!metadata.contains(controls::SensorTimestamp.id())) + metadata.set(controls::SensorTimestamp, + buffer->metadata().timestamp); + completeBuffer(request, buffer); if (request->hasPendingBuffers()) return;