From patchwork Sat Sep 7 14:28:27 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: 21194 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 102F3C324C for ; Sat, 7 Sep 2024 14:31:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 179C563500; Sat, 7 Sep 2024 16:31:25 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="BY2826Vm"; dkim-atps=neutral Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0B58F634F8 for ; Sat, 7 Sep 2024 16:31:21 +0200 (CEST) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-206aee4073cso29906045ad.1 for ; Sat, 07 Sep 2024 07:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1725719479; x=1726324279; 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=TSaImx5SqvHvHcxkD0MKMd1PCjbqNKbkJmxxCDje1YU=; b=BY2826VmRUlbra7N3EeIDmc0ItegsO5PLHmnfNoReBXybON+CyW6ZHepKmRzZqo9s+ 6JEubRADw0w+1PFhHoZ1iMkN5lBH4W3DQbn7jK5Hk+trqR43kHx7XCqPvBADUQs6iKYB rwWQTSjXYfrKk/ke1y6Zksvf2v/QqOfRSttKg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725719479; x=1726324279; 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=TSaImx5SqvHvHcxkD0MKMd1PCjbqNKbkJmxxCDje1YU=; b=cc1EBtRtPCNJpZVO8qKNbsuQLB2j+Jii+z2KGpTBKxWR6GnqU8Wr0W5l3IGD7ddk6/ mys4TLRFysToF8WUWH0nw9qnIoW5PEIBK2/YcEKD60SdG/CBgHrf9MH7QRMnIXXFCjLN MGQlvMgIdLmd2+b07gpp2h4AFixyGcAXExm9wHDxPhk3YBtMsKYoc3p6oDUom3DxCGiW N3yjySPSvRRE7UFCHKJiYUQSg2Y2UntlT6P2/ByRKUln/RCNLlRtaigpzelaVj2IJKEu 0N+2j8sPNj4OUCqeRrIswvVKfdviXyNACAyCmv+Rlf0Uy5OjYKcIYmWwg3UwtviwOwln SGTQ== X-Gm-Message-State: AOJu0YwFWb+7emeY0a8GJUDrDgUIas6m4jAxqKaL/lczikXd/cZCUbWy 1BglsQyXdjTbVJnyewCCPgFBrXrNZQEvV03K1nm45Remvk6qeRk/8xioiEtiqKJPYiW9oqxrXvk = X-Google-Smtp-Source: AGHT+IF3uenv51M0VgfyL75oqyePqqnwaZpZhmw4KETWNkMf8046r30qnUu2O/4mv2DcHLb1cnnAlg== X-Received: by 2002:a17:903:2303:b0:206:c12d:abad with SMTP id d9443c01a7336-206f05523e9mr98570765ad.34.1725719479233; Sat, 07 Sep 2024 07:31:19 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (0.223.81.34.bc.googleusercontent.com. [34.81.223.0]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710e33974sm9208935ad.104.2024.09.07.07.31.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Sep 2024 07:31:18 -0700 (PDT) From: Harvey Yang X-Google-Original-From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Harvey Yang , Harvey Yang , Laurent Pinchart Subject: [PATCH v11 2/7] libcamera: Remove PipelineHandler Fatal check of non-empty MediaDevices Date: Sat, 7 Sep 2024 14:28:27 +0000 Message-ID: <20240907143110.2210711-3-chenghaoyang@google.com> X-Mailer: git-send-email 2.46.0.469.g59c65b2a67-goog In-Reply-To: <20240907143110.2210711-1-chenghaoyang@google.com> References: <20240907143110.2210711-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 e5940469..89a513e4 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