From patchwork Fri Oct 22 11:55:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 14257 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 EBBC3C324E for ; Fri, 22 Oct 2021 11:55:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 74ECC68F62; Fri, 22 Oct 2021 13:55:49 +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="AqcSBPs3"; dkim-atps=neutral Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1C95E68F65 for ; Fri, 22 Oct 2021 13:55:46 +0200 (CEST) Received: by mail-wr1-x42f.google.com with SMTP id s19so125497wra.2 for ; Fri, 22 Oct 2021 04:55:46 -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=iRRAspqPBslKSGeN5NDTBveEOZheEHwOQC+2ZoH4+7E=; b=AqcSBPs36tN5sSMhDlH/tJw04bEQ0GxlvZfo30oAP8xLlRWF5gOkJifgieQqWrwG8T iv8vwNGOn+4sMMJE/I/cZznAXK+NJHucvfMFh9pZeJp+GZNOUZ9zpfGb9mZAiN4QkrA4 fDrBSn/vlDqMVwzq0w3vXe8kkb6wo1Z9KQi9EP31FJSV37jMiuYmrQVC9bTwVgnINzMx a20/04zrafudsxP4vbQ25nFwdxIsqciefLd7V6aSb4AW/XmDqjCa5um4wdHDYH0yy5j1 MMh6WMTKsWZerXkBY3SOU07DdN/Z9MAOs11vkG4rHGWfOWPqPXfFHinPRagsFBoRADYJ Psxw== 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=iRRAspqPBslKSGeN5NDTBveEOZheEHwOQC+2ZoH4+7E=; b=J4g7IihlL5gU9ktcoqX1cb+KILAL1scKg94P5wh0sPeCv+Gagbjtu6bVFviXt04QN3 QtQR/qtPdkLPnax8Gc33447XfO5To3HnxbAvwi4k+PWS6Dneiwvvqb2717GgdQs0+VtG 6K2rBhABMTXiX51jtC2jrTRRxPw+nmrD/XpwjGX3ENgE8TetRvtkYQp58K5OAolkQCI1 fSsKZDbr8Hd215Evl3DNa6tegE5+cso8XBfIEtrwFE9H6Yi+JYGjokuqKjgO0VQ+XQvX T2yjw5FYtPDuFP741GKgUaXTVXYEmiWITDQgbuGp1Wem+9lrWAdoL+kr8xE4m3CcnG0C DXFQ== X-Gm-Message-State: AOAM530HXPfEltQYhyYfICcikCZfcP2/aJKByyHX7PFQPl2CdQJJFhvg Mr++bG/z1m9SHp2BYLzVSGoNigBv26iREgux X-Google-Smtp-Source: ABdhPJyz3qLyQhi27q82+hd1kLIefBIivusjVAnyBtbjBgDrs49SvdRCuRPKYyarDDT6/Y3Njb3Ehg== X-Received: by 2002:a5d:4a4d:: with SMTP id v13mr12399543wrs.353.1634903745615; Fri, 22 Oct 2021 04:55:45 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:f00d:ddf0:61b0:a4cd]) by smtp.gmail.com with ESMTPSA id l5sm7853364wru.24.2021.10.22.04.55.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 04:55:45 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 22 Oct 2021 12:55:36 +0100 Message-Id: <20211022115537.2964533-6-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211022115537.2964533-1-naush@raspberrypi.com> References: <20211022115537.2964533-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 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 Reviewed-by: David Plowman --- .../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 fc190e39732a..5aaf24436f27 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -994,7 +994,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 */ @@ -1015,9 +1014,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")); @@ -1027,7 +1033,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); @@ -1055,6 +1060,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