{"id":21726,"url":"https://patchwork.libcamera.org/api/1.1/patches/21726/?format=json","web_url":"https://patchwork.libcamera.org/patch/21726/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20241022074544.3790451-3-chenghaoyang@chromium.org>","date":"2024-10-22T07:43:38","name":"[v16,2/7] libcamera: Remove PipelineHandler Fatal check of non-empty MediaDevices","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"41a946d8020fdd8433230175f39bba0b6d992b1c","submitter":{"id":117,"url":"https://patchwork.libcamera.org/api/1.1/people/117/?format=json","name":"Cheng-Hao Yang","email":"chenghaoyang@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21726/mbox/","series":[{"id":4733,"url":"https://patchwork.libcamera.org/api/1.1/series/4733/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4733","date":"2024-10-22T07:43:36","name":"Add VirtualPipelineHandler","version":16,"mbox":"https://patchwork.libcamera.org/series/4733/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21726/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21726/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id DE277C3274\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Oct 2024 07:46:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0B2B365392;\n\tTue, 22 Oct 2024 09:46:01 +0200 (CEST)","from mail-pf1-x432.google.com (mail-pf1-x432.google.com\n\t[IPv6:2607:f8b0:4864:20::432])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CDBE065391\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Oct 2024 09:45:54 +0200 (CEST)","by mail-pf1-x432.google.com with SMTP id\n\td2e1a72fcca58-71e4fa3ea7cso4057872b3a.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Oct 2024 00:45:54 -0700 (PDT)","from chenghaoyang-low.c.googlers.com.com\n\t(27.247.221.35.bc.googleusercontent.com. [35.221.247.27])\n\tby smtp.gmail.com with ESMTPSA id\n\td2e1a72fcca58-71ec13d75aesm4091024b3a.124.2024.10.22.00.45.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 22 Oct 2024 00:45:52 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"bNtXhlQS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1729583153; x=1730187953;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=J7P5fWfS3kLP0IXDzCQ0V+vvTPtriXBvXoaaltmgciU=;\n\tb=bNtXhlQSIydxhO2RtONqcATAlutitdaX7oeak7CvBqm4ZCbYhy2NGFAWq3UDxFmaGj\n\thGbO+I+fp8KmMySW+RaO5IslN/9Q/OR0bkYP7wchAjT9XkQ1Z6OwNHrFPhbrowGPB1wq\n\t/QIUTX4dc2zyT3b3h54oW/qn4XOOKVOBLgMaw=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1729583153; x=1730187953;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=J7P5fWfS3kLP0IXDzCQ0V+vvTPtriXBvXoaaltmgciU=;\n\tb=m+NCUH6trIG5MqSdmDQjDSO5QkynaL4M7HM3rm1FgkH8gscCMU2YgUsjHttugpKQTL\n\twoWl3Xk3dEBF5vfW1Ov/R2kD6B+z47b3QH1b4YuWrBNIkF8u27S5sSQnjjaBveYdAILn\n\tzts3ewam0couZ7CEGRC05iPcRfcU/WPK9TbHldUv5YBwFTZ9PjI4njFtS4PQSANo8+zF\n\tP46SbLeFrTbEP6MUm7Mrf6Da6wJGoa1VweR+9Ww89WEfOlZ3X628GbOYyFGexdNEV6cM\n\tr850ybdD0T5M6xgm9GPa1N2mLIgJt1G74FLTwGz6zY+cR/2tyJVaSFc81Tyxq61a/2DH\n\t2GCg==","X-Gm-Message-State":"AOJu0YxFfTzV7cCZ+zp03D0zjRMex/v9mc/31GCUX+QJGs349x3bzpkK\n\t/rixr19MKmLG1TWa9bQqx/RUQ2CIjV4j3+YBQFo+xQBlXjwhUqjGUIon8lbKBmsP9SoZIfcelcs\n\t=","X-Google-Smtp-Source":"AGHT+IEM8FtsfeV8y4CdWsdDt8qelwSwzbJKljknuoyc/Ww7X8DYAV//6hLmz48HhgLlPosmCxrnmA==","X-Received":"by 2002:a05:6a00:1492:b0:71e:c0c:5996 with SMTP id\n\td2e1a72fcca58-71ea31dcc58mr20742505b3a.7.1729583152957; \n\tTue, 22 Oct 2024 00:45:52 -0700 (PDT)","From":"Harvey Yang <chenghaoyang@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"Harvey Yang <chenghaoyang@chromium.org>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"[PATCH v16 2/7] libcamera: Remove PipelineHandler Fatal check of\n\tnon-empty MediaDevices","Date":"Tue, 22 Oct 2024 07:43:38 +0000","Message-ID":"<20241022074544.3790451-3-chenghaoyang@chromium.org>","X-Mailer":"git-send-email 2.47.0.105.g07ac214952-goog","In-Reply-To":"<20241022074544.3790451-1-chenghaoyang@chromium.org>","References":"<20241022074544.3790451-1-chenghaoyang@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The Fatal check of having at least one MediaDevice was to prevent\npipeline handler implementations searching and owning media devices with\ncustom conventions, instead of using the base function\n|acquireMediaDevice|. It also has the assumption that there's at least\none media device to make a camera work.\n\nNow that the assumption will be broken by the virtual pipeline handler\nadded in the following patches, and developers should be aware of the\navailable functions in the base class to handle media devices, the Fatal\ncheck is no longer needed.\n\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/pipeline_handler.cpp | 11 ++++++++---\n 1 file changed, 8 insertions(+), 3 deletions(-)","diff":"diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex e59404691..89a513e46 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -637,9 +637,14 @@ void PipelineHandler::registerCamera(std::shared_ptr<Camera> camera)\n {\n \tcameras_.push_back(camera);\n \n-\tif (mediaDevices_.empty())\n-\t\tLOG(Pipeline, Fatal)\n-\t\t\t<< \"Registering camera with no media devices!\";\n+\tif (mediaDevices_.empty()) {\n+\t\t/*\n+\t\t * For virtual devices with no MediaDevice, there are no system\n+\t\t * devices to register.\n+\t\t */\n+\t\tmanager_->_d()->addCamera(std::move(camera));\n+\t\treturn;\n+\t}\n \n \t/*\n \t * Walk the entity list and map the devnums of all capture video nodes\n","prefixes":["v16","2/7"]}