From patchwork Mon Sep 30 06:29:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harvey Yang X-Patchwork-Id: 21416 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 E73D3C3257 for ; Mon, 30 Sep 2024 06:34:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0FAF763518; Mon, 30 Sep 2024 08:34:01 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="YuUQE9Sw"; dkim-atps=neutral Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BB01863512 for ; Mon, 30 Sep 2024 08:33:52 +0200 (CEST) Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-7db238d07b3so3393393a12.2 for ; Sun, 29 Sep 2024 23:33:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1727678031; x=1728282831; 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=kiUmVXVsj2k0GDB+36LjnEpbTRYu3p9GSgHQdhpEEMY=; b=YuUQE9Sw9Mf6CY67ztmx7vV5eyCgH29e8iyepgaGM4cNlnX+EImbURFG9Keqf1t87o bqxHauKeRirOzPDDYmabaQW2/fY7bkJ6yxcAEb8g+6YU9uSApBU/a4dHr26UMWz5nanz R1POUIXHSIUGECx2+BJJjDD6pciN31xDw3qNk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727678031; x=1728282831; 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=kiUmVXVsj2k0GDB+36LjnEpbTRYu3p9GSgHQdhpEEMY=; b=rkHW+xGhZQjDdztIKXGONVba8mjlkVcIxBkE5Opu52tJOq0THZvQtCjh8SFdsxfaAF Xr19VFqtazKBgAd3gU921Sh7XXdrBVsMq6oavU/Vlcw6FFjdjKJ76qMXVcgVSLdlkkIu Md/gzE9Hq0OS9TPfz7lWfw9elFJrAhnA63+4DCn9QTIQzg99yxqQxlEvlrxBtc2pGlXF HUJe8DglYCcKbWqL7TEQhlYQV2oxQe2k2+1BmmFDAKX0aMDymaikYMQ4JNNtFdstbg23 vd8H+GKhapJsJRaqdV3x40Qd9Jt6edj4qZr2FoVl1QYojH/rMeadREh3pnxBUpdZCq2g w2lw== X-Gm-Message-State: AOJu0Yz9bxBa20IEjbOmvFj00MEqeCbBaHaiacqdnN+VEUFsWcSJpQpB 1RNph678EUcx9X4CjBT48Z1ryrHeEp8MgK0CY98tmiQ3LjEzxCaAzVVn7U7q5a4e2h/KoPzXP1M = X-Google-Smtp-Source: AGHT+IFQ8kPHAz+7QdmuTluFHhcW/RLpJsPLaqiWLCyFraOok/vzNs/Y+JmbSyjPDtT0cFDT6rmYMg== X-Received: by 2002:a05:6a20:5194:b0:1d5:10c3:adcd with SMTP id adf61e73a8af0-1d510c3ae36mr5941154637.31.1727678030673; Sun, 29 Sep 2024 23:33:50 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (208.158.221.35.bc.googleusercontent.com. [35.221.158.208]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b265166e2sm5487671b3a.131.2024.09.29.23.33.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Sep 2024 23:33:50 -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 v14 2/7] libcamera: Remove PipelineHandler Fatal check of non-empty MediaDevices Date: Mon, 30 Sep 2024 06:29:43 +0000 Message-ID: <20240930063342.3014837-3-chenghaoyang@google.com> X-Mailer: git-send-email 2.46.1.824.gd892dcdcdd-goog In-Reply-To: <20240930063342.3014837-1-chenghaoyang@google.com> References: <20240930063342.3014837-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 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