From patchwork Wed Oct 27 09:28:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 14362 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 17A83BDB1C for ; Wed, 27 Oct 2021 09:28:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BA3C164896; Wed, 27 Oct 2021 11:28: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="SrFMPOpa"; dkim-atps=neutral Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 65BB86488D for ; Wed, 27 Oct 2021 11:28:14 +0200 (CEST) Received: by mail-wr1-x433.google.com with SMTP id z14so2974913wrg.6 for ; Wed, 27 Oct 2021 02:28:14 -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=koj/vGPOhCtDOgqqv3BAPCzy3I6XV7nQB2MvwB2zY3k=; b=SrFMPOpawD/vO8NDQ1T0jlNZ/uuVnUZ1Wqe1ThKNcCu3VZJ1IbgyMHBYpaioKE0D0N VHpTUQPvxV5guxWLttMs2sdAmUJlxSs1XM7cSQesfAlD+TAThqroaEdFyclBRnxf9evi lxxvKSS6+FLwM80YalhAzmGIqAauhwsYSafg0TBPNjpUzBusxRw9JJb+xAy6NjJEakX/ Y6+uDZOO2GP4uUnB+cwgRb1RcZ5zHtJ3IfmVKyfMLy21OG48SRvKoQF0/Qz2KY8EkIzo vhyxz5Tstb+qb/W08rqrr+0CsqJw7T8QQiknomPPaBBW836RJS7dipQlO6v4Jp75llJa UVsw== 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=koj/vGPOhCtDOgqqv3BAPCzy3I6XV7nQB2MvwB2zY3k=; b=mt+oakWmMjXd75flau3xlKliZCUdb5iPzwJezaa7AofeHR6HXs4K0TcnuxM0jOKy9p PmqrDx1plE3QtpvFSIQm0FrEhnaZAXsf8wb0AL0kPCkemybCd6J4DGCy0WfFKnx29DUL hfiO6C3powL5LQkt5qTWDQ/40vGLgFlgydBl5W+jK1jp+WMSFXBlrM77sUBzS0siIryU UGePCYu1rQPUYOYYMf/YiXPS6Pn5E9pH066ne+z9uYjcG0Sye/H/HW+7Rj84VZvS/89z EnWEwrZzaBXDZeiEWqXZ2W9A7lMBRWRZ+VEDaHWwakoh/en/vRKD/woIAaVx9reCqbV9 c3AA== X-Gm-Message-State: AOAM530KsUmuuD7uUhj8+qC2bdZalSFmQb+r6XNb20QgOoNsNLlx3TzU k112O+qcxUWTqpGD0/6kmangfjkWcaQvY+ud X-Google-Smtp-Source: ABdhPJyl0gv0LIJHf2KOLgRLpzufPiCyyEMXsTjoEqjBkA0qG/8mBKrMA9FEJpgiLfGNHwMVMQCRVA== X-Received: by 2002:a5d:59ae:: with SMTP id p14mr38484000wrr.76.1635326893871; Wed, 27 Oct 2021 02:28:13 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:6561:eb24:3f00:ce98]) by smtp.gmail.com with ESMTPSA id x2sm2861360wmj.3.2021.10.27.02.28.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 02:28:12 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Wed, 27 Oct 2021 10:28:02 +0100 Message-Id: <20211027092803.3671096-9-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211027092803.3671096-1-naush@raspberrypi.com> References: <20211027092803.3671096-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 8/9] 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 | 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 e01359b20fd9..52521857b61c 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1015,7 +1015,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 */ @@ -1036,9 +1035,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")); @@ -1048,7 +1054,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); @@ -1076,6 +1081,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