From patchwork Thu Aug 1 07:30:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-Hao Yang X-Patchwork-Id: 20740 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 9A4EEBDC71 for ; Thu, 1 Aug 2024 07:33:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 427F76338A; Thu, 1 Aug 2024 09:33:58 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="YyT+K8T+"; dkim-atps=neutral Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 815DD6336E for ; Thu, 1 Aug 2024 09:33:50 +0200 (CEST) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1fc6a017abdso43904325ad.0 for ; Thu, 01 Aug 2024 00:33:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1722497628; x=1723102428; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9iM+BAol9iKYbqKcwdRomHNbcUOqjGWEzgMPTtWNXEk=; b=YyT+K8T+/Zd/UY2DDMjakWaSdzrJMy5sefBmR9l/AxL8BTvtRgwUbdOWVHPEbWtO7w mbtQl1X7s/HwievHrFVYj45DX1Jl63b0kNIksOHvMcjK7rWUlNVhnNq3eK/3j0V3sGTQ mcuO5JHaUZ0f5yNIabA3RcG+cVYALEhp85vzs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722497628; x=1723102428; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9iM+BAol9iKYbqKcwdRomHNbcUOqjGWEzgMPTtWNXEk=; b=btCODkiWaMUyTRgvchnbS1/Qj4LoED/WXp8M3kH7ldz8xgsp0kwEBfpt/Rfu9h25hO ZGr/HB0qxYwUxia73zA3CjUgPlgaiDlgDSgmzGcCHMeGmw+XTyOq8vYNOUr7kv4Ks3zt 3IrATzZ72nfjzzwGEtrr6py8h3iFVoHCSS57DLC2oetbBgOl04KlFk/w+Tfu8D9NAEpO 70jx62uR8alqagOKXGZhJrlrFIG3WseweNtC8etUfQU5/QOw1iKg3Qn12WFX19rWmoJh m76wVbcFx7z05K/ePu3rZm0giH+Qs7hjug4R3r4/dnmRIgo4KMZqPSYOMRpLDvQRyL1i eBlQ== X-Gm-Message-State: AOJu0YxaE9kGNECq/TQ+7OwmWjmnHrCW26mm73m5dWB9ct/bz2K8f7/k sPth06GcPRUssnH5eLWvlFq/sDhs73ZMNHdrHevT8/GxNJ9oNiF4Hi2D3HsPGR+1bMk/jcelXtw r7Q== X-Google-Smtp-Source: AGHT+IED4OJxQhXKGJNXreRyJlG07TrUDZfiydyy9i+wUa2vFQEDPxjtdhFcAtLFlEPElerID5yxiQ== X-Received: by 2002:a17:903:18e:b0:1f9:f3c6:ed37 with SMTP id d9443c01a7336-1ff4ce8999fmr22853195ad.14.1722497628372; Thu, 01 Aug 2024 00:33:48 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (237.198.80.34.bc.googleusercontent.com. [34.80.198.237]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fed7cd3dcbsm131839165ad.73.2024.08.01.00.33.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 00:33:48 -0700 (PDT) From: Harvey Yang X-Google-Original-From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Harvey Yang , Harvey Yang Subject: [PATCH v7 2/7] libcamera: Remove PipelineHandler Fatal check of non-empty MediaDevices Date: Thu, 1 Aug 2024 07:30:58 +0000 Message-ID: <20240801073339.4061027-3-chenghaoyang@google.com> X-Mailer: git-send-email 2.46.0.rc1.232.g9752f9e123-goog In-Reply-To: <20240801073339.4061027-1-chenghaoyang@google.com> References: <20240801073339.4061027-1-chenghaoyang@google.com> MIME-Version: 1.0 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 Fatal check of having at least one MediaDevice was to prevent pipeline handler implementations searching and owning media devices with custom conventions, instead of using the base function |acquireMediaDevice|. It also has the assumption that there's at least one media device to make a camera work. Now that the assumption will be broken by the virtual pipeline handler added in the following patches, and developers should be aware of the available functions in the base class to handle media devices, the Fatal check is no longer needed. Signed-off-by: Harvey Yang Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline_handler.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 5ea2ca78..125cf9d5 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -605,9 +605,14 @@ void PipelineHandler::registerCamera(std::shared_ptr camera) { cameras_.push_back(camera); - if (mediaDevices_.empty()) - LOG(Pipeline, Fatal) - << "Registering camera with no media devices!"; + if (mediaDevices_.empty()) { + /* + * For virtual devices with no MediaDevice, there are no system + * devices to register. + */ + manager_->_d()->addCamera(std::move(camera)); + return; + } /* * Walk the entity list and map the devnums of all capture video nodes