From patchwork Fri Oct 4 11:55:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 21514 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 D2293BD80A for ; Fri, 4 Oct 2024 11:56:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2CCD36352B; Fri, 4 Oct 2024 13:56:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Z8bxFDNN"; dkim-atps=neutral Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 69B0B6352B for ; Fri, 4 Oct 2024 13:56:05 +0200 (CEST) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-37cd8a5aac9so1204579f8f.2 for ; Fri, 04 Oct 2024 04:56:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1728042964; x=1728647764; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lxFKq/MpaE936mX2wEmbFqI5SPb5I+EyRyQlidCho7Q=; b=Z8bxFDNNBqM2QpxyKXH8c5K1HnKfVs47cvuJGPlfLYq9dIqt1291w7eX17k4wsNGmz Rfs7IwsfA5egFRW6fO1w4nbCXGtyRTYkDCnzlQ3jsq8wq+eDgqyTWM0SL82HCoUDhTdA SaqWoJkG7Isnse2XsAhe8R/Ffbob9WOIW1cjPNMAUOBhSVJ9Z1azL67Y1d1R78vc746A qU9X1blScKYLgEGANW8CtJOAUJCKP1yl726+9pPhU46mU8kOYyACZOWs/EH96aZRJTZv 0M1YpLK9TJ2qodG/zeDZ9USu0sfgL86peb5E2x9F8dxiYThWh22cls1QYnGFaE4u2UT/ ogiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728042964; x=1728647764; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lxFKq/MpaE936mX2wEmbFqI5SPb5I+EyRyQlidCho7Q=; b=MSYGdzsO7heLDg9VTvxofGltWT1BkwUI0IPHIq78LLqkby0x4o4JHWwMvl0G9EIPZ4 QwT0xWnxNwIz2SIWZLKTmJPMBhqrWzinrQFq68sh7pvKPWEL+B6a42Pg7hZ2sCVXYo6g AGDd99zfuCFpSP1xr23F7hY1E0AEkhKjaRVC7fP7Fz5Z3byyzB8nTc1WrCji26D/jhV1 QDDwK8zLeN8NDFxk+0a+cQ6WSn9y+HlEwTFwjO37bRE1PVFaP0WaAkqkUpNc2eSgWP56 mN+LXdi2eEAeHre4CyMIjSniEvqmm/Tj98shNI10HJgWOAwvQqbLeH1peXb5oFcpA11f y5Hg== X-Gm-Message-State: AOJu0Yw0OO9Udb9EnsYwa23ZqB0/QpyKRL2IBUFIW1nw/abKwxKuNV3C Rs5VIGXV7hNqKWa8ap0p43ZjyQIpvkj3G9kFuTLf6T4uWdStE9TtLPbBFg3WVAQjGRy6ScvqyQy A X-Google-Smtp-Source: AGHT+IHsc4JYwDumkCtd0Xc0FYqSHhljBWcmdw9FUfXMHgHhFQ5MHX8WgKG8u3MzrMa+STV7MYAsFQ== X-Received: by 2002:a5d:4e45:0:b0:374:c0c5:3c05 with SMTP id ffacd0b85a97d-37d0e7baf3fmr1409348f8f.42.1728042964037; Fri, 04 Oct 2024 04:56:04 -0700 (PDT) Received: from raspberrypi.pitowers.org ([2a00:1098:3142:1f:daa2:371b:a97:3e3e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d081f743esm3107147f8f.21.2024.10.04.04.56.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2024 04:56:03 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck Subject: [PATCH 3/6] pipelien: rpi: vc4: Populate the wallclock timestamps queue Date: Fri, 4 Oct 2024 12:55:55 +0100 Message-Id: <20241004115558.9166-4-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241004115558.9166-1-david.plowman@raspberrypi.com> References: <20241004115558.9166-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Naushir Patuck We add wallclock timestamps to the queue when we dequeue a camera buffer from Unicam. Signed-off-by: Naushir Patuck --- src/libcamera/pipeline/rpi/vc4/vc4.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp index e5b6ef2b..754cfdde 100644 --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp @@ -777,6 +777,18 @@ void Vc4CameraData::unicamBufferDequeue(FrameBuffer *buffer) * as it does not receive the FrameBuffer object. */ ctrl.set(controls::SensorTimestamp, buffer->metadata().timestamp); + + /* Also record a wall-clock timestamp that can be passed to IPAs. */ + while (!frameWallClock_.empty() && + frameWallClock_.front().first < buffer->metadata().sequence) + frameWallClock_.pop(); + + if (!frameWallClock_.empty() && + frameWallClock_.front().first == buffer->metadata().sequence) { + ctrl.set(controls::rpi::FrameWallClock, frameWallClock_.front().second.get()); + frameWallClock_.pop(); + } + bayerQueue_.push({ buffer, std::move(ctrl), delayContext }); } else { embeddedQueue_.push(buffer);