From patchwork Tue Sep 10 04:40:15 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: 21208 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 5DD93C324C for ; Tue, 10 Sep 2024 04:48:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 68BF9634F2; Tue, 10 Sep 2024 06:48:47 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="gn0bQiQQ"; dkim-atps=neutral Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1A2A4618F2 for ; Tue, 10 Sep 2024 06:48:44 +0200 (CEST) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-718d91eef2eso2443575b3a.1 for ; Mon, 09 Sep 2024 21:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1725943722; x=1726548522; 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=mpa76W+Hl/OJ966oDSd7rHjggBcd/1cVqR+lv1KR4/8=; b=gn0bQiQQiFukyPRr1nI8pdBD1iSIvwO0FXoP4hybuVxDu/+zrqfJC72VU1hQqgBOud PiC33Mqn8F/VuS+S6oQ78/GCnOgnUHTzQe6awBhMlaJTmj1Ojj37MrvutWHRZeLa4rZf 2jCdfLY37FtHeSD/Zu3Ns4Gc3SEUuu3UuW/8U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725943722; x=1726548522; 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=mpa76W+Hl/OJ966oDSd7rHjggBcd/1cVqR+lv1KR4/8=; b=GEu87qKH8bE/p8FVdqtX9qJDY4ZNiC2gSBD4ghzfwUGzF5VycdDswBGrnlCZ7/R6n2 buaCTCZAky5hgdEz/B3MHPZIZiahXy29Ap/PnZN1JLwb6vFqeza7WhwpKb3sM7HtEMk2 rGMxj1V3FC0QYhsDr1gpw0WgAZRkELeN8uLw1AyHBp5imfT0hQobs7NyY+lAOzR8TqRl YKiA3G5DJ8LQHgyDWHohE+nvMEwrv+0pq2YfYhcpM9oMgqsL8Sg16CAVzQ5ylTCqw4vg 0e2HmbUMfycCRSxFeYzHVfoAjGjPAgaBHS2w2nV+UefTNdgUt2FOvFontKGA4r/9H1Ea qxlQ== X-Gm-Message-State: AOJu0YxQ36r95s0hWG8yOKQtWBKSBTthf7GP2/8YBIb4+C5VB5XO2Yzv DyBmYyOu0Gnyyfnn1vyVnDDKVpDWRBPBrKl8UYAkScLRc5folklmieNJkWaLgZprYyanDf+p1pY = X-Google-Smtp-Source: AGHT+IG2XQZUyhnM6OTriS4JKn5I8qCIggpP46VXE1zsSkcsFr/kw4XYB91gpHuDzurqKIWS+Pnd3A== X-Received: by 2002:a05:6a00:6f0c:b0:70d:26cd:9741 with SMTP id d2e1a72fcca58-71907f29d40mr2478959b3a.12.1725943722244; Mon, 09 Sep 2024 21:48:42 -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 d2e1a72fcca58-71909092522sm530734b3a.111.2024.09.09.21.48.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 21:48:41 -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 v12 2/7] libcamera: Remove PipelineHandler Fatal check of non-empty MediaDevices Date: Tue, 10 Sep 2024 04:40:15 +0000 Message-ID: <20240910044834.2477701-3-chenghaoyang@google.com> X-Mailer: git-send-email 2.46.0.598.g6f2099f65c-goog In-Reply-To: <20240910044834.2477701-1-chenghaoyang@google.com> References: <20240910044834.2477701-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