From patchwork Thu Oct 28 08:46:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 14386 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 22814C3250 for ; Thu, 28 Oct 2021 08:47:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BDE4E60326; Thu, 28 Oct 2021 10:47:06 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="od0a5EV5"; dkim-atps=neutral Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 52776600BE for ; Thu, 28 Oct 2021 10:47:00 +0200 (CEST) Received: by mail-wr1-x434.google.com with SMTP id p14so8746909wrd.10 for ; Thu, 28 Oct 2021 01:47:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ueF6YVs7qys6bUFyj/crs11+E3JnkIbKFR1VrLXwuto=; b=od0a5EV5ddg/Wsa+jGrztrjFD7knJbvSV5le+kKuEzkG1sYT+pCCZonEgdxYiMJDct HwIxnHH3ax9n2+O/R7nGxVG3pATWqAkxlEOTgP3wkInOU41qnpZQup8jw09Y2zZ8iFpR 0fXe541A/T1L69dLp/168mTjs6MXwYtXMxSJQX+TDsqlXefrT8K5letfBgB67mE+aD3C +nR0GQSRxNC3fotPSxQo0XyMmbZPVKW5Ov1Esi3oCaoHDLzbFePXpQwbF3s9poiNGk3h 0tE6kP9velcj0LLIz8jI/Vhg5mbdMrhWGfYUGJKrE0T+Sng1lWkQfebKSE3QRJBsERP3 lTJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ueF6YVs7qys6bUFyj/crs11+E3JnkIbKFR1VrLXwuto=; b=g8dSatzEn0B6JolsuaavVkHLoZD7QDmL0cWaN0dY+e41Fo6qXFG7bGECl2IoFP08kl APIvnt/mLHfMq3EtHly5xhZFOVfaqptncUPv//KSX3C/sNt+jNuxtmUGfN0lo/ftyFZB Q1X4vw19yujKEJMIH29Pbh/0ae88/2L3UFZbQzKam0N7Qj58fdBA6cHDK8GaoZE24e07 yElWJpA/1sNb5KzXNfELg6wd0BgfttgGUyLzvuzr0FdZyjT4YXaV3MbbJT8aNDW6lRj9 V19dnrjtoZcxcXg7MsUoTmdaigoSpfzGBC/za5KAf8igAWTc+T+KIoQTPXewehKsS8EM 4yqw== X-Gm-Message-State: AOAM531hA2wHNFZ3kBPVwUgyXGey5eNGdfssSGBl7mp3fUun9x8inKB/ mXJRjqhCM9E4PL8MhTwQ7pnI0u+dwrn4Sagd X-Google-Smtp-Source: ABdhPJzXXfSZqR/BbtEF+Zsi06IQryjqvG8+TW9KJykiY7KErgjC6aB91vp5yNMePOc1IcZsCcQBxA== X-Received: by 2002:adf:d1ee:: with SMTP id g14mr3916366wrd.165.1635410819825; Thu, 28 Oct 2021 01:46:59 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:b894:feb0:b828:13b]) by smtp.gmail.com with ESMTPSA id z2sm1955281wmk.19.2021.10.28.01.46.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 01:46:59 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 28 Oct 2021 09:46:46 +0100 Message-Id: <20211028084646.453775-11-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211028084646.453775-1-naush@raspberrypi.com> References: <20211028084646.453775-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 10/10] pipeline: raspberrypi: Account for a missing Unicam embedded data node 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" The unicam driver no longer registers an embedded data node if the sensor does not provide this stream. Account for this in the pipeline handler match routine by not assuming it is always present. Add a warning if Unicam and the CamHelper do not agree on the presense of sensor embedded data, and disable its usage in these cases. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- .../pipeline/raspberrypi/raspberrypi.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index b405e2d55d57..36f648804878 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -995,7 +995,6 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator) DeviceMatch unicam("unicam"); DeviceMatch isp("bcm2835-isp"); - unicam.add("unicam-embedded"); unicam.add("unicam-image"); isp.add("bcm2835-isp0-output0"); /* Input */ @@ -1016,9 +1015,16 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator) return false; /* Locate and open the unicam video streams. */ - data->unicam_[Unicam::Embedded] = RPi::Stream("Unicam Embedded", unicam_->getEntityByName("unicam-embedded")); data->unicam_[Unicam::Image] = RPi::Stream("Unicam Image", unicam_->getEntityByName("unicam-image")); + /* An embedded data node will not be present if the sensor does not support it. */ + MediaEntity *embeddedEntity = unicam_->getEntityByName("unicam-embedded"); + if (embeddedEntity) { + data->unicam_[Unicam::Embedded] = RPi::Stream("Unicam Embedded", embeddedEntity); + data->unicam_[Unicam::Embedded].dev()->bufferReady.connect(data.get(), + &RPiCameraData::unicamBufferDequeue); + } + /* Tag the ISP input stream as an import stream. */ data->isp_[Isp::Input] = RPi::Stream("ISP Input", isp_->getEntityByName("bcm2835-isp0-output0"), true); data->isp_[Isp::Output0] = RPi::Stream("ISP Output0", isp_->getEntityByName("bcm2835-isp0-capture1")); @@ -1028,7 +1034,6 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator) /* Wire up all the buffer connections. */ data->unicam_[Unicam::Image].dev()->frameStart.connect(data.get(), &RPiCameraData::frameStarted); data->unicam_[Unicam::Image].dev()->bufferReady.connect(data.get(), &RPiCameraData::unicamBufferDequeue); - data->unicam_[Unicam::Embedded].dev()->bufferReady.connect(data.get(), &RPiCameraData::unicamBufferDequeue); data->isp_[Isp::Input].dev()->bufferReady.connect(data.get(), &RPiCameraData::ispInputDequeue); data->isp_[Isp::Output0].dev()->bufferReady.connect(data.get(), &RPiCameraData::ispOutputDequeue); data->isp_[Isp::Output1].dev()->bufferReady.connect(data.get(), &RPiCameraData::ispOutputDequeue); @@ -1056,6 +1061,13 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator) return false; } + if (sensorConfig.sensorMetadata ^ !!embeddedEntity) { + LOG(RPI, Warning) << "Mismatch between Unicam and CamHelper for embedded data usage!"; + sensorConfig.sensorMetadata = false; + if (embeddedEntity) + data->unicam_[Unicam::Embedded].dev()->bufferReady.disconnect(); + } + /* * Open all Unicam and ISP streams. The exception is the embedded data * stream, which only gets opened below if the IPA reports that the sensor