From patchwork Tue Aug 20 16:23: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: 20969 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 2CD77C323E for ; Tue, 20 Aug 2024 17:22:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C3705633CE; Tue, 20 Aug 2024 19:22:24 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="l9CXATQi"; dkim-atps=neutral Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 41502633CC for ; Tue, 20 Aug 2024 19:22:16 +0200 (CEST) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-428101fa30aso46610075e9.3 for ; Tue, 20 Aug 2024 10:22:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1724174535; x=1724779335; 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=J4lnb82gImewC8slrhsxvkvivBhZnq9isCozxZOsaF4=; b=l9CXATQiDidu8OaYTq8ek4ChoQ2VAd6H9Dyy1fzVdA7nMz9+MXNCp+rjDbBKHEornp AP8cSNXQjlWGrzjiF4L9riV4m1VnRyE3p242amlwPptnqX8HGCBuvvemVglXOV/wDh3D ItKynZFgCPZC9PMEpV9nQuC6q8fBdCU9hIqko= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724174535; x=1724779335; 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=J4lnb82gImewC8slrhsxvkvivBhZnq9isCozxZOsaF4=; b=xUxQ8gC/zwaaHQVp/gwIzg05QRJMgR3lKIAK2/y2HOFLEBwR87+QCWEHRIjQ2+9+1o vrBrw9aJ8HrnvpsFN2zytu4Or51rFbSIy8D7qiWhxA366vQ4cWQmMSigJ3FJYp2z61/w 087pcuS4H30A2leGm4X4R7KcWcCzT084koOYR6KC/atcwaJ0dO1Nvo6c/HuIZmkdtSRk gg/S7gBCIeELcDCPcQmYs9SsJC84eG2VBACtflVwmrVk1kKf/c+h4YdfHfDIeO3d6/Cb g8NIXMuWoOjr4fiIqL/VIFSvPzQ+m9+fd113Qk4gVypQ50cAfKqTC04Z4OfEtBPz+jVL mQlA== X-Gm-Message-State: AOJu0Yw63rb/0A1akOc8nSP5xjCeAwl9imA46/nAfMsUofKYRJU/2N0x 8vGnkLn2+UAUhQOqwMbmzUpLzhmWsNb6WcJoRpbA1OIytlXJzToV+e925u+ZnNnK+qz3pqho/sT qy3u/oq8= X-Google-Smtp-Source: AGHT+IH23RfHsspLkyfA/hpQOAxys7tKWopOfyc0+g2iUqn+ZgYHH3VETRQmvbwrdqvAqX1TlnFblw== X-Received: by 2002:a05:600c:1c02:b0:429:d0cb:950f with SMTP id 5b1f17b1804b1-42abd112184mr566945e9.2.1724174535368; Tue, 20 Aug 2024 10:22:15 -0700 (PDT) Received: from chenghaoyang-germany.c.googlers.com.com (161.126.77.34.bc.googleusercontent.com. [34.77.126.161]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ab6e90db5sm30328575e9.0.2024.08.20.10.22.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 10:22:14 -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 v9 2/8] libcamera: Remove PipelineHandler Fatal check of non-empty MediaDevices Date: Tue, 20 Aug 2024 16:23:33 +0000 Message-ID: <20240820172202.526547-3-chenghaoyang@google.com> X-Mailer: git-send-email 2.46.0.184.g6999bdac58-goog In-Reply-To: <20240820172202.526547-1-chenghaoyang@google.com> References: <20240820172202.526547-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 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