From patchwork Thu Aug 29 19:47:41 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: 21050 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 BC212C323E for ; Thu, 29 Aug 2024 19:57:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 261D3634A6; Thu, 29 Aug 2024 21:57:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="eGn8zxfS"; dkim-atps=neutral Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2DCF463469 for ; Thu, 29 Aug 2024 21:57:09 +0200 (CEST) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4281faefea9so8964235e9.2 for ; Thu, 29 Aug 2024 12:57:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1724961428; x=1725566228; 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=op9M+Tjc1Fx/nSmxqXpHdIQcWLZASgXBAijpK3rPZHg=; b=eGn8zxfS2cUHnhepQSLFGZFyRTIQueFv85wc4WLWdAxEPu0AibNzC1u1jA0wx1qVru fn5GqWa5biibqDu+aoQuz6WPrJnFr4/8Ia5vIleF1SQXOaXfmGxa9kEIzSmDWcRO1iMI eRo/Tydctjh0+okpSJ87YBqHPqXacOJot6Gxw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724961428; x=1725566228; 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=op9M+Tjc1Fx/nSmxqXpHdIQcWLZASgXBAijpK3rPZHg=; b=ohoxIdrRMJHHJxWbX5pRJ8KiQwq26G8Qq5ycGmt8K1EbItCO6e9zH+6LJ4lr7kIHY9 rnCJhpVtoQgLIaU/Aj8FR+Gp6zx6QMBMWlCSMrh0EjfmP8/9CfbXZx9BJCLVz5pb5nW4 7TxQb56TVp6/fEMa5NVjy2IhgAC8XsuQ8BvXDyW6dfBSBkwMAqLrb5MvIN6NxqICuvNl H3VOQrS89LJFibIEjucvdaANlZfnMxOv1kcQaKZmB9rq2u5ylhf+VZEiFKr4nA2pD/iO DT9jsUSzGCRf7GJnAWtK9Z/uhHy1Al+V7aCHgL0G0/A8vbgjxISGfJOjD7nVgC9IX0oQ 0OyQ== X-Gm-Message-State: AOJu0Yy8YlT+CJ76HHB5Y53ch/ip5usHnW9UWJM67hUT/5GMxkDlVRYO X4UPOaGJs+LGLcID3p0FMeGkc5O/Ir52Ohr9/7Iznv8yQoWoIkviyYi85+8m7JgD6RMARr6YHvd hpA== X-Google-Smtp-Source: AGHT+IFE/30fVhVcEWYoalr0ME0rS9QEJMrbtT55uRH6sTntisparhpUwUxKrZEm15efbhHSzx6tGw== X-Received: by 2002:a05:600c:46c9:b0:42b:8a35:1acf with SMTP id 5b1f17b1804b1-42bbb436e9amr145025e9.25.1724961427654; Thu, 29 Aug 2024 12:57:07 -0700 (PDT) Received: from chenghaoyang-germany.c.googlers.com.com (161.126.77.34.bc.googleusercontent.com. [34.77.126.161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ba7b4271fsm54602805e9.29.2024.08.29.12.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 12:57:07 -0700 (PDT) From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Harvey Yang , Harvey Yang , Laurent Pinchart Subject: [PATCH v10 2/7] libcamera: Remove PipelineHandler Fatal check of non-empty MediaDevices Date: Thu, 29 Aug 2024 19:47:41 +0000 Message-ID: <20240829195703.1456614-3-chenghaoyang@chromium.org> X-Mailer: git-send-email 2.46.0.469.g59c65b2a67-goog In-Reply-To: <20240829195703.1456614-1-chenghaoyang@chromium.org> References: <20240829195703.1456614-1-chenghaoyang@chromium.org> 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" From: Harvey Yang 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 5a6de685b..2cb1a4bd7 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