From patchwork Fri Oct 22 14:39:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 14264 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 08617C324E for ; Fri, 22 Oct 2021 14:40:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3211F68F6D; Fri, 22 Oct 2021 16:40:19 +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="q7YqgHEM"; dkim-atps=neutral Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D5CB68F5D for ; Fri, 22 Oct 2021 16:40:17 +0200 (CEST) Received: by mail-wr1-x432.google.com with SMTP id s19so906097wra.2 for ; Fri, 22 Oct 2021 07:40:17 -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=oT0OVsIP0543VwfoaGee+9LOY2F+eiYz5IwkYiOUns4=; b=q7YqgHEMj/J3BS236OdPF/tJ60SGyIjPvxcKveLXkdNWo0/ch48uiBf9z2i9YLdB6G QgZIvQb+Xm390yL99GX0F88QWWalOI1r6l70IJ3fdf3kAd663z4qy9ljUSeJ5YuEWl1O Wpq/pfMSjc9ffecDz29skYvF8rRGjbqYTOSE8k9TlJqyhCJMjD7Js9fPVDDN5KPfSxrs geYIeF97k8PWG3TMsmXMUhGu4uvFX6blw2L903b0H90gHwwAYvC1QHRZzpcHHidcJTx8 PI2fw6Um9mVBfWL2PPbatxcIT3SBLCubvtyMKTRT2/3oAn7sVaL4MzFj4RPsIgw+KTqu Wk/Q== 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=oT0OVsIP0543VwfoaGee+9LOY2F+eiYz5IwkYiOUns4=; b=zXly+czC72UICxSnpquKxdZLzxqX++rmOJcr7iyn17l5Qzykwva+TQyXnL5xhkYv0k +ztSitJb8RvmF/encf3dKLHjQJA0Hvv/+OwHdDfYhZxFyb41a9PZqem3iynS1n1Pwnib 5NbpCn7YNnxR0lXg3JjOyxbNKalTa0P333Os8eL+QV/1Y2id/PtE0hiYD4Wdr/gkTRp6 Z5sGf4noveZ2/lY2ZHJfPg7GT0e/GzqNSy/L8J+jYUcyH+L0OvQkLPOBHp/n0PdbDOSE DF7XM+rtrS2CA15OLlWaG/5BY4hgx+dyySCK6pyD5FZKYlx/hiS07mUbbjgQwveOz2+V S8Iw== X-Gm-Message-State: AOAM530zpm7D+jqG7q7QWaROE3yeO4Yf0SDoLxgCBBVaXm3qOsLHcbyn RdW/zDg1/ILzVp23tddMaBxVtQEU2A2jt6J+ X-Google-Smtp-Source: ABdhPJxBWHWBAws4MWXrxpRETB9RmJWtoQzUOHOyht9pcxoSEqi/hzOOZ4jAOZoP6rZlNOt/qaQc6A== X-Received: by 2002:a05:6000:1289:: with SMTP id f9mr355000wrx.192.1634913616642; Fri, 22 Oct 2021 07:40:16 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:f00d:ddf0:61b0:a4cd]) by smtp.gmail.com with ESMTPSA id r205sm8577878wma.3.2021.10.22.07.40.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 07:40:16 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 22 Oct 2021 15:39:06 +0100 Message-Id: <20211022143907.3089419-6-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211022143907.3089419-1-naush@raspberrypi.com> References: <20211022143907.3089419-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 5/6] 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 regesters 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 useage in these cases. Signed-off-by: Naushir Patuck Review-by: David Plowman Reviewed-by: Laurent Pinchart --- .../pipeline/raspberrypi/raspberrypi.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 2b70b877e70a..c5e9607c7d95 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -984,7 +984,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 */ @@ -1005,9 +1004,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")); @@ -1017,7 +1023,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); @@ -1045,6 +1050,11 @@ 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; + } + /* * 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