From patchwork Mon Aug 5 13:48:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harvey Yang X-Patchwork-Id: 20778 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 2C10CBE173 for ; Mon, 5 Aug 2024 13:51:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C8390633AC; Mon, 5 Aug 2024 15:51:11 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Y+Old/hk"; dkim-atps=neutral Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7124B63385 for ; Mon, 5 Aug 2024 15:51:07 +0200 (CEST) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-428e0d18666so31745125e9.3 for ; Mon, 05 Aug 2024 06:51:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1722865867; x=1723470667; 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=w2G6hUf2Cak1GfsOKDoIwK7EE5JVC84nVLBIdAJv3xA=; b=Y+Old/hkm19MW99dZCmBiqk1l4N0jNn5tRzLasDbUbevOZaRuoVT1Ie8JrDbMKZXgz EYbWGGLvrnyEwWDCwxDBGHNBE+sc3jC0HomRleNYr5A3n9PRTPqQJniqttAxV4kMyXs2 R3OGl5JZ6I4LmZeKgU9FlHcOsbjnw9j6FUvxU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722865867; x=1723470667; 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=w2G6hUf2Cak1GfsOKDoIwK7EE5JVC84nVLBIdAJv3xA=; b=kTng96YXlrvS7awoX44gCUuSFXx001L1RPnuoNxRq2c70Aiz9f1GpQeHYaj1+xlxXp CJhzH6IyvPpGqL6iymxieHTQE+6cRJPPh5TiCX7RYr36vxd8ZCbekpN2wnU8tTf6jVSN JH4eudAtH06wBxjr5LuvnbsKL4HR0MW9GADd+EIDXQdD/wz4nCG/HQW9G86cZWlRGcgI g34SMoXYwJjlFkGMWYXrxcwyI0GWNiCR796t4d7/VF5fs01ySwDTf9KPmHmqaA8frdko fgLb4zl3I8ZDDiLsKeQMT6GSK2MZlc1EnfbrUbSQ+TAdtcM0p6SWapQ84Z+WLWvK2n0q PfmA== X-Gm-Message-State: AOJu0YycZo1O/LU99M9Yo6OIzwxtJC4tErs+1V14YHKfLIDTyw20lqib BJcFhRiNIxcrnlkUfz6nY/1cwNJ5FbYBfP3Jms4Vmfiye4fAevA89QVWAw+Uk7RncjkNZPtEkpf iSFRRE/w= X-Google-Smtp-Source: AGHT+IGLfb0tw4kO8aXn2dLV9Bhrq8bDtg4S8IkgZUiuAM/Kw/Rp6CdC01pt+y7qEiknxmIcKCrP8A== X-Received: by 2002:a05:600c:354c:b0:426:5269:1a50 with SMTP id 5b1f17b1804b1-428e6b01bb0mr72504455e9.11.1722865866663; Mon, 05 Aug 2024 06:51:06 -0700 (PDT) Received: from chenghaoyang-germany.c.googlers.com.com (49.222.77.34.bc.googleusercontent.com. [34.77.222.49]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-428e8d6555fsm137146675e9.26.2024.08.05.06.51.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Aug 2024 06:51:06 -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 v8 2/8] libcamera: Remove PipelineHandler Fatal check of non-empty MediaDevices Date: Mon, 5 Aug 2024 13:48:33 +0000 Message-ID: <20240805135104.139932-3-chenghaoyang@google.com> X-Mailer: git-send-email 2.46.0.rc2.264.g509ed76dc8-goog In-Reply-To: <20240805135104.139932-1-chenghaoyang@google.com> References: <20240805135104.139932-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 5ea2ca78..125cf9d5 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