From patchwork Tue Oct 22 07:43:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harvey Yang X-Patchwork-Id: 21726 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 DE277C3274 for ; Tue, 22 Oct 2024 07:46:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0B2B365392; Tue, 22 Oct 2024 09:46:01 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="bNtXhlQS"; dkim-atps=neutral Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CDBE065391 for ; Tue, 22 Oct 2024 09:45:54 +0200 (CEST) Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-71e4fa3ea7cso4057872b3a.0 for ; Tue, 22 Oct 2024 00:45:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1729583153; x=1730187953; 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=J7P5fWfS3kLP0IXDzCQ0V+vvTPtriXBvXoaaltmgciU=; b=bNtXhlQSIydxhO2RtONqcATAlutitdaX7oeak7CvBqm4ZCbYhy2NGFAWq3UDxFmaGj hGbO+I+fp8KmMySW+RaO5IslN/9Q/OR0bkYP7wchAjT9XkQ1Z6OwNHrFPhbrowGPB1wq /QIUTX4dc2zyT3b3h54oW/qn4XOOKVOBLgMaw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729583153; x=1730187953; 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=J7P5fWfS3kLP0IXDzCQ0V+vvTPtriXBvXoaaltmgciU=; b=m+NCUH6trIG5MqSdmDQjDSO5QkynaL4M7HM3rm1FgkH8gscCMU2YgUsjHttugpKQTL woWl3Xk3dEBF5vfW1Ov/R2kD6B+z47b3QH1b4YuWrBNIkF8u27S5sSQnjjaBveYdAILn zts3ewam0couZ7CEGRC05iPcRfcU/WPK9TbHldUv5YBwFTZ9PjI4njFtS4PQSANo8+zF P46SbLeFrTbEP6MUm7Mrf6Da6wJGoa1VweR+9Ww89WEfOlZ3X628GbOYyFGexdNEV6cM r850ybdD0T5M6xgm9GPa1N2mLIgJt1G74FLTwGz6zY+cR/2tyJVaSFc81Tyxq61a/2DH 2GCg== X-Gm-Message-State: AOJu0YxFfTzV7cCZ+zp03D0zjRMex/v9mc/31GCUX+QJGs349x3bzpkK /rixr19MKmLG1TWa9bQqx/RUQ2CIjV4j3+YBQFo+xQBlXjwhUqjGUIon8lbKBmsP9SoZIfcelcs = X-Google-Smtp-Source: AGHT+IEM8FtsfeV8y4CdWsdDt8qelwSwzbJKljknuoyc/Ww7X8DYAV//6hLmz48HhgLlPosmCxrnmA== X-Received: by 2002:a05:6a00:1492:b0:71e:c0c:5996 with SMTP id d2e1a72fcca58-71ea31dcc58mr20742505b3a.7.1729583152957; Tue, 22 Oct 2024 00:45:52 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (27.247.221.35.bc.googleusercontent.com. [35.221.247.27]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ec13d75aesm4091024b3a.124.2024.10.22.00.45.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2024 00:45:52 -0700 (PDT) From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Harvey Yang , Laurent Pinchart , Kieran Bingham Subject: [PATCH v16 2/7] libcamera: Remove PipelineHandler Fatal check of non-empty MediaDevices Date: Tue, 22 Oct 2024 07:43:38 +0000 Message-ID: <20241022074544.3790451-3-chenghaoyang@chromium.org> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog In-Reply-To: <20241022074544.3790451-1-chenghaoyang@chromium.org> References: <20241022074544.3790451-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" 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 Reviewed-by: Kieran Bingham --- 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 e59404691..89a513e46 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -637,9 +637,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