From patchwork Fri Jul 26 09:54:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harvey Yang X-Patchwork-Id: 20703 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 EED4CBDC71 for ; Fri, 26 Jul 2024 09:56:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EAEDB63378; Fri, 26 Jul 2024 11:56:38 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="c5UrKc1t"; dkim-atps=neutral Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 416A363371 for ; Fri, 26 Jul 2024 11:56:35 +0200 (CEST) Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1fc49c0aaffso4053035ad.3 for ; Fri, 26 Jul 2024 02:56:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1721987793; x=1722592593; 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=3h1FiPDzN3Wef2W7iR2p7iICFPCXweUh/ZRBntn8Ej0=; b=c5UrKc1tBDuoMyH5rC1keymd8NdmchGmOEnCLa1VpE15F27NCN/BhL9s8SOfgoCcAh G3pohYjKusyNxxHxu4bnzxNnTr+941wkC20lw6gzdGKfuNE1zF2RZna6lcpsVwu31C0x lSBCgFwjB2u6oIbvCaSrCVkZcQKno6Ykq2yxA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721987793; x=1722592593; 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=3h1FiPDzN3Wef2W7iR2p7iICFPCXweUh/ZRBntn8Ej0=; b=VdagbzPYxRn45FeGAuEMu+/a6fyhvOcKovF7yU79UP7tV6BfbCySQ2ALxVAp269kFR qVZTs+o1K6Z3p8Sa4BZFoyW8QqNzHNnq5TWtijvq+c7N6ahDwXcOoO1OQrsPMJu0DUJX 4PJXFY4L+oI9L+flgXEP5moMQAsagXKk+WicJPScJGin0+0V5xMxHxeIcv0WP6nknF7S XAv0j1LcItAxESHedHTfwMLyG3usPZ2e+AHvAyJK9DNZAQbgOBvslXIFN8GTHiEcWxtC xofgM8aulS6mVMZvrYuXb65nF2pqaG1ipgYwREBZhewhJ72hMzFyQprng7a9aEGHoMuk 49RA== X-Gm-Message-State: AOJu0Yxmsxre3Aw0GhAB5rA559WlqHw7XtfN6L3rUZDkv09o1L5BkeM3 n+b2hMQ9WArvHqB8JonAuPwnigHIdkpOnK4ceSHi2qHHd+wL6SdTimy8wzxSWU2ZJr6KY4SB9E1 1+A== X-Google-Smtp-Source: AGHT+IHLMdiZMFyDLTyoQkFfAW0FpjHRPs4Mb/1O+U02VLyi0docnbUDw5R8gtSQg3a1s1qLek1dRA== X-Received: by 2002:a17:902:dac9:b0:1fc:692a:ba46 with SMTP id d9443c01a7336-1fed9337017mr46895325ad.65.1721987793416; Fri, 26 Jul 2024 02:56:33 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (148.175.199.104.bc.googleusercontent.com. [104.199.175.148]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fed7c7f63asm28396665ad.46.2024.07.26.02.56.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jul 2024 02:56:33 -0700 (PDT) From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Harvey Yang , Harvey Yang Subject: [PATCH v6 2/7] 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. Date: Fri, 26 Jul 2024 09:54:23 +0000 Message-ID: <20240726095626.3632402-3-chenghaoyang@chromium.org> X-Mailer: git-send-email 2.46.0.rc1.232.g9752f9e123-goog In-Reply-To: <20240726095626.3632402-1-chenghaoyang@chromium.org> References: <20240726095626.3632402-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 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. Change-Id: I76b4b74ebb2fa982136a9f9ab1c8a0a98b518c3a Signed-off-by: Harvey Yang --- 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 5ea2ca780..125cf9d5e 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