From patchwork Fri Oct 4 09:59: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: 21504 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 1BAFBC3257 for ; Fri, 4 Oct 2024 10:00:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2E06863532; Fri, 4 Oct 2024 12:00:00 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="NXXaqPqY"; dkim-atps=neutral Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8861E6352D for ; Fri, 4 Oct 2024 11:59:56 +0200 (CEST) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-71b20ffd809so1731357b3a.0 for ; Fri, 04 Oct 2024 02:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1728035994; x=1728640794; 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=WjgHep/iOhTVamI1PFk3bNKyYMctjnfcztOa4A+1UwI=; b=NXXaqPqYJGLTGl28AkF6dh3U2z/JmssMxzP7vNNjVmLZ9d3VEr3huRi8GhQ6ilhVc8 EDWLBL7H2L/mzygimzolx+eJa+B03XJjrQx7BqkhV+DJ/I3nmxOvBO9su6MxnwNxicW6 tzxIYtOsnbfT7uVvjI/JEHkZ9xssNPJGm4kWU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728035994; x=1728640794; 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=WjgHep/iOhTVamI1PFk3bNKyYMctjnfcztOa4A+1UwI=; b=oQ94/e9EGlWNdj7HkFHyTpBxeTSPBmYYFvTcRVLNIsj/G2CsjKvfv1u+Qr3D7mtxkB s2+zrTeXmmgWidnwenRqeAh3ASr6TCpDIKj4tqeQloOjJCC8/qjH357FoOtkmQiBlrnc cfavTQiP10HqjTNXm0RZqELANchQ1JGIAZouSbBi4cK65mCGct0xjt1O+EO/+ZrZQTxi fJvKXDP3AuFv2q2cXxpsJHIxXCOHaCnlOD6jCkQXpPtGIHR+hb+X+0dVh9BrAOl8zuhJ kYnifCMOuOtA+bOdX5ycuItVsH+sVGGVI6AVTj7JtgDcEpXoWf/j9QS/WivJAO1d9G0k O6wg== X-Gm-Message-State: AOJu0YzQnhbmyLkZZklROvr+INV5oRvvXtTIzipjFlpUJa7o52/h9aWK aHIurGwxDpcF50IWqI78SBnv8pE6FdcUpinQ+kSE7N6KSVcChkxTsxZOUwvC//nt0/92p1OItJM sGA== X-Google-Smtp-Source: AGHT+IEtSLVkyF7BnKe+cL0clSWF6Z65+cOKTH+4VgAPQXAPZFKBNpCPOid8o73nu8ujktBz7iHULg== X-Received: by 2002:a05:6a00:886:b0:714:340c:b9ee with SMTP id d2e1a72fcca58-71de23a5576mr3081486b3a.1.1728035994292; Fri, 04 Oct 2024 02:59:54 -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-71ded2ad931sm316911b3a.41.2024.10.04.02.59.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2024 02:59:53 -0700 (PDT) From: Harvey Yang X-Google-Original-From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Harvey Yang , Harvey Yang , Laurent Pinchart , Kieran Bingham Subject: [PATCH 15 2/7] libcamera: Remove PipelineHandler Fatal check of non-empty MediaDevices Date: Fri, 4 Oct 2024 09:59:15 +0000 Message-ID: <20241004095946.264537-3-chenghaoyang@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog In-Reply-To: <20241004095946.264537-1-chenghaoyang@google.com> References: <20241004095946.264537-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 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