From patchwork Mon Nov 1 09:15:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 14446 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 BB872C3251 for ; Mon, 1 Nov 2021 09:15:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 76FC9600C8; Mon, 1 Nov 2021 10:15:26 +0100 (CET) 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="oyRw+diQ"; dkim-atps=neutral Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 62EEC6032D for ; Mon, 1 Nov 2021 10:15:21 +0100 (CET) Received: by mail-wr1-x429.google.com with SMTP id d5so11876486wrc.1 for ; Mon, 01 Nov 2021 02:15:21 -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=3PIdxG9cdt0Y7XN4FXtc4NokkaMhwWrDugoWY42qyGY=; b=oyRw+diQOzvtWIHI+OIvYBxfEBug1YYOLmoFv6W6EXza/qc2cqL+KWgYiDONNDKypd UfaE1ZmJzO1HjVw8oKRM3tGJy9vrxmpTgrfGmS3weYEZfElDkikDgItiK8ktz09syVyo tdP1936BIO8ubLvgBeIYVvP72q1eu+V70AZod32Ed8xQvYhpVR3xIi4KnDQM5rEFKZsV Ws8De6VoqKq1klogyDxqmZfqTSFHpN2ypZP6cYor5FbZ0RnYfj91IuWvefEF+2vlbZPU mS/xHF/eVpi4iGXfaOVEgraVCM06O/zMwdiVvYQIpuQ8ayw5pebCulX9Zbk1NMKN9Qdn zTgQ== 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=3PIdxG9cdt0Y7XN4FXtc4NokkaMhwWrDugoWY42qyGY=; b=yGVKV7tVtJIpcUJRPKkpp9OHVwVqwNNIAjLbaPXj5nOTXaESG9ne0STG5sGxJJFfk3 A56pkZUReziynPZ5GtIZWpMB2KZ9WhiOj+CjPpWJnVrHLVTCIyjkXAUDiBhd6p9aJ/KC R6BNwqs6G5GGZkpeo43ogE5ZKcYgJAMNOE3Y5dPi1W3ABmnV0oCVNtqUHM1Jzot1esO2 zS4BgbVws4UinAmfak3K4fcqKHQT9pETBCM1wY3iv4F1uDA8L5dU/5XIxE2wGQxPCa8J uikFJBcmUruooOvsWP29SoSY5dKv47XpJNskmEthwSltnyAod6jq+1LI9ZGD1afxSW4O X2cQ== X-Gm-Message-State: AOAM532kgm0IfoUZwLCJzDBk3ZM47qM7WaSc3ZhNnIntJOWeFv53Ye4b iI2UtXQ8I28c6h24usAcqnN7gIsaS54GHJjZ X-Google-Smtp-Source: ABdhPJyBNvaO5VGrxE9bfIdhcfmLbPZd0K1rfUItdQl8+lZ6zLL+ozGHMlMGHL28QLcSN/nIWnp9pg== X-Received: by 2002:a5d:4a46:: with SMTP id v6mr35426304wrs.262.1635758120902; Mon, 01 Nov 2021 02:15:20 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:3a2b:9d8c:92b9:ece6]) by smtp.gmail.com with ESMTPSA id w10sm13168849wrq.88.2021.11.01.02.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 02:15:20 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 1 Nov 2021 09:15:10 +0000 Message-Id: <20211101091510.23204-12-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211101091510.23204-1-naush@raspberrypi.com> References: <20211101091510.23204-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 11/11] 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 996743cf48ef..44760093f7ab 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