From patchwork Wed Mar 15 10:22:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harvey Yang X-Patchwork-Id: 18404 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 4204FC329C for ; Wed, 15 Mar 2023 10:23:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AD2A162716; Wed, 15 Mar 2023 11:23:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1678875793; bh=iFXqHYoFKWXepKlMDxgEtxPjO8QSRvqtfHHnkO043BQ=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=SaxK07BoDUncoElBv/VNnOa8GkQ6LzR90uO89XucysdhrQaZlUjB1WK6DvnYIYKX9 fz5H0a0VUhj1bCa2vJZ4Gpv/Euf0XGDEDqD37+hvKvB4qpMh8u39ftpQkqeBmOF9lp j6eCC0WhNkVE/fsV/G+1mJ5nu7IBIQaIgCKE3lfAR+DAUpjM8lfqmRM/NDu4VB0Tba dbvSuNJ7xlhIA/pIVVeVUC07YoSTXnAXGcQiGEVi53TnlKO2/yP9V1WC81wuKTh7/d 1mYnOt2xKCERVAoayI367vwqd12tH0bDjv0Qds/jf/6L+0u+QGvIENf+lzpayxx8mx 7MlbkbsbWP1oQ== Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 047CA6270E for ; Wed, 15 Mar 2023 11:23:10 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Ko4SPckh"; dkim-atps=neutral Received: by mail-pl1-x631.google.com with SMTP id k2so11614676pll.8 for ; Wed, 15 Mar 2023 03:23:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1678875788; 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=Q2hJRJQUm2hdQ8RypAyWYv8oIhLrv4kcdesIXc38Mr4=; b=Ko4SPckhuC8kk4/WosibZx+3B3Oj7jjp2znwfJCqJQ77pubqUc8GTsraw6rcYZmr2J kVWxcNgxLCEEF6Ji/vJFULRC9kuVgVcbIg8XakAOPcGhT7todE13A22NaUyMRvrzgRgU up26wHqkpmhUAf959yFe3LfVn+QtbuLQMedJw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678875788; 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=Q2hJRJQUm2hdQ8RypAyWYv8oIhLrv4kcdesIXc38Mr4=; b=wMwyDFxRV+4qlZDv9ifuM65kEVCyBQUNZSa7m6l2SpUSx/klBrZCIEclSGrdaNRqqo 8HH6fMcOKiMisptSrIlzZc2ixehAt7U0u2dAZVOLm71NflKnPBH2mW/sCCHWwyYva2ps 93RBA6XZv84XydyVq7LSpgnZYrSlydCWjtZ5Re6QkjhmH3KKZflC6cauoB5vn1UEayWT Spn07XYmlc7b4RHt7KcCTesqwmjhW7sne7f6mbP0j3WV/94Qb70WQDspvbfLAxIxevA1 Upt3Lv2z63wZdL6DAJz4d3iYbiIIeTEDpMlXgTolkIQ7VC7PTgMkmAhbQlxudG7utZPE b0iw== X-Gm-Message-State: AO0yUKXD6QHfOR8olF6ti41NhuA5chVZgE/FklKgWZt48fplCKFOmXko O4UDB4BpD7wmPtvX/AsK/NesoKEDjP+gmv50JNs= X-Google-Smtp-Source: AK7set9ABZJ4N2Tl87BYDB2eSixW7XBtpSr9u4Mwx+s6plIhz8PnPOnu/7cy0dmwVNdPvrocy5NtCA== X-Received: by 2002:a17:90b:33c2:b0:23d:30c4:a06 with SMTP id lk2-20020a17090b33c200b0023d30c40a06mr6344948pjb.11.1678875788230; Wed, 15 Mar 2023 03:23:08 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (112.157.221.35.bc.googleusercontent.com. [35.221.157.112]) by smtp.gmail.com with ESMTPSA id f11-20020a17090274cb00b001a0450da45csm3262786plt.185.2023.03.15.03.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 03:23:07 -0700 (PDT) X-Google-Original-From: Harvey Yang To: libcamera-devel@lists.libcamera.org Date: Wed, 15 Mar 2023 10:22:56 +0000 Message-Id: <20230315102300.2265491-3-chenghaoyang@google.com> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog In-Reply-To: <20230315102300.2265491-1-chenghaoyang@google.com> References: <20230315102300.2265491-1-chenghaoyang@google.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 2/6] libcamera: pipeline: Introduce skeleton Virtual Pipeline 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: , X-Patchwork-Original-From: Harvey Yang via libcamera-devel From: Harvey Yang Reply-To: Harvey Yang Cc: Harvey Yang , Harvey Yang Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Provide all of the skeleton stubs to succesfully compile and register the Virtual Pipeline Handler for testing with fake data. Meson must be reconfigured to ensure that this pipeline handler is included in the selected pipelines configuration. Signed-off-by: Harvey Yang --- meson.build | 1 + meson_options.txt | 3 +- src/libcamera/pipeline/virtual/meson.build | 5 + src/libcamera/pipeline/virtual/virtual.cpp | 112 +++++++++++++++++++++ 4 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 src/libcamera/pipeline/virtual/meson.build create mode 100644 src/libcamera/pipeline/virtual/virtual.cpp diff --git a/meson.build b/meson.build index 9eee9d39..f00e3daa 100644 --- a/meson.build +++ b/meson.build @@ -176,6 +176,7 @@ pipelines_support = { 'simple': arch_arm, 'uvcvideo': ['any'], 'vimc': ['test'], + 'virtual': ['test'], } if pipelines.contains('all') diff --git a/meson_options.txt b/meson_options.txt index 78a78b72..a0a75e7f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -47,7 +47,8 @@ option('pipelines', 'rkisp1', 'simple', 'uvcvideo', - 'vimc' + 'vimc', + 'virtual' ], description : 'Select which pipeline handlers to build. If this is set to "auto", all the pipelines applicable to the target architecture will be built. If this is set to "all", all the pipelines will be built. If both are selected then "all" will take precedence.') diff --git a/src/libcamera/pipeline/virtual/meson.build b/src/libcamera/pipeline/virtual/meson.build new file mode 100644 index 00000000..ba7ff754 --- /dev/null +++ b/src/libcamera/pipeline/virtual/meson.build @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: CC0-1.0 + +libcamera_sources += files([ + 'virtual.cpp', +]) diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp new file mode 100644 index 00000000..09583b4e --- /dev/null +++ b/src/libcamera/pipeline/virtual/virtual.cpp @@ -0,0 +1,112 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2022, Google Inc. + * + * fake.cpp - Pipeline handler for fake cameras + */ + +#include + +#include + +#include "libcamera/internal/pipeline_handler.h" + +namespace libcamera { + +LOG_DEFINE_CATEGORY(VIRTUAL) + +class VirtualCameraConfiguration : public CameraConfiguration +{ +public: + VirtualCameraConfiguration(); + + Status validate() override; +}; + +class PipelineHandlerVirtual : public PipelineHandler +{ +public: + PipelineHandlerVirtual(CameraManager *manager); + + std::unique_ptr generateConfiguration(Camera *camera, + const StreamRoles &roles) override; + int configure(Camera *camera, CameraConfiguration *config) override; + + int exportFrameBuffers(Camera *camera, Stream *stream, + std::vector> *buffers) override; + + int start(Camera *camera, const ControlList *controls) override; + void stopDevice(Camera *camera) override; + + int queueRequestDevice(Camera *camera, Request *request) override; + + bool match(DeviceEnumerator *enumerator) override; +}; + +VirtualCameraConfiguration::VirtualCameraConfiguration() + : CameraConfiguration() +{ +} + +CameraConfiguration::Status VirtualCameraConfiguration::validate() +{ + return Invalid; +} + +PipelineHandlerVirtual::PipelineHandlerVirtual(CameraManager *manager) + : PipelineHandler(manager) +{ +} + +std::unique_ptr PipelineHandlerVirtual::generateConfiguration(Camera *camera, + const StreamRoles &roles) +{ + (void)camera; + (void)roles; + return std::unique_ptr(nullptr); +} + +int PipelineHandlerVirtual::configure(Camera *camera, CameraConfiguration *config) +{ + (void)camera; + (void)config; + return -1; +} + +int PipelineHandlerVirtual::exportFrameBuffers(Camera *camera, Stream *stream, + std::vector> *buffers) +{ + (void)camera; + (void)stream; + (void)buffers; + return -1; +} + +int PipelineHandlerVirtual::start(Camera *camera, const ControlList *controls) +{ + (void)camera; + (void)controls; + return -1; +} + +void PipelineHandlerVirtual::stopDevice(Camera *camera) +{ + (void)camera; +} + +int PipelineHandlerVirtual::queueRequestDevice(Camera *camera, Request *request) +{ + (void)camera; + (void)request; + return -1; +} + +bool PipelineHandlerVirtual::match(DeviceEnumerator *enumerator) +{ + (void)enumerator; + return false; +} + +REGISTER_PIPELINE_HANDLER(PipelineHandlerVirtual) + +} /* namespace libcamera */