From patchwork Thu Jan 5 04:37:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harvey Yang X-Patchwork-Id: 18087 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 6ECA4C322E for ; Thu, 5 Jan 2023 04:37:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D29B0625E3; Thu, 5 Jan 2023 05:37:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1672893477; bh=XM+yPx4JuCXodROlLD2ni7MBN30gwb8J94HTJnDzkdg=; 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=JLrRSrlzVbxJs0lnxmmqgJhbAfo16a9NTkCPjIW4F04WM4QTtVAluTn4n8c+sIxS9 hRNdZpYtagPNfiphCPriV5MLrs6GFHL6+LeZJVBnkn1R+vW9s3mkAfiaTRPROatM4v pSbB63mi5rz6l7F+/HqKgpqwBm3YKiP8i5T9qqM8ja2aJJ9fFv4xZovVTZ39dmcv13 sVeg0Os9udhhC3YzdbaN3K4ofHjp60KQEdTdvPasNZT5H2BR5iuFiZVBnJcJEw6luy 7D/rWgo6zA2ics/G6jy7HtEtGakX+rFwBfoqZf+mvOUYu039XZJGMHWF6ymFahJk9r eKOJkrYoo2Mtg== Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9E94361F06 for ; Thu, 5 Jan 2023 05:37:55 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="HqD99PQE"; dkim-atps=neutral Received: by mail-pj1-x102b.google.com with SMTP id w4-20020a17090ac98400b002186f5d7a4cso913717pjt.0 for ; Wed, 04 Jan 2023 20:37:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; 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=0vYtodSdAt/8P9nhv9LXQF/+ifyNNCO0IObLe5XkKHM=; b=HqD99PQE3ASWBAtBobTkaprY/kaNAz687SRLdNsjHdpjkifEujZ7lPlPFUfiNLycPA 3dL2ZUHd7xcZRp/xcLIcSSGbV+adCJVxSHqWwrpcug9aeVdJZxNBv6jbUxFiEF76a+fk theVZcPQ8aUN6QfrozYhoo+Dm4DmvbyMg3kqA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=0vYtodSdAt/8P9nhv9LXQF/+ifyNNCO0IObLe5XkKHM=; b=JIGmNr+zsKyTE22apDrz4pSgdGGeFAZNJDRVMcC9h2BGkZSLuaC203XLibzPyRx0BK lo/e1bzyewsw+I3+LbykPeUgNM5euJoo7nP6tJtJsNi2MuHP2KXKYiJLf5Gsj7cFatE5 cAc+zfrBhxE5qUJrILXy/vbUcHpnfApq//TtWMAfqF6f017ope4MdBbC8mA0kTZZOnIO 2+4lzfav4/UkciO/HalleKOAaxLjf0eXqalN323EJZPq519CLyMX3m0FrO+uDgpqFEkn /jXDNGAsWOBw0lh6M97oyOSbFGeE56NTSr/Hen4lX2gPuAK7ZNrx36coaFbEtQveZJ2+ 5LxQ== X-Gm-Message-State: AFqh2kq0homaf5t1j/n2w0LNrhjhd1+9IrvSRa5e6rDVPINcXu0Jrt22 TwKq6YYXPaDSCp0QvLV+VeNi3pfvPcXM5DhN X-Google-Smtp-Source: AMrXdXuw1Booce5jj/euhJl2lGV5p7OAulvFfXLMeGMJEOwgCWfa/S7IEDn8Eqom46uxZb/yB1ltVA== X-Received: by 2002:a17:902:74cc:b0:189:dd9b:66c3 with SMTP id f12-20020a17090274cc00b00189dd9b66c3mr40287870plt.11.1672893473988; Wed, 04 Jan 2023 20:37:53 -0800 (PST) Received: from chenghaoyang-low.c.googlers.com.com (46.165.189.35.bc.googleusercontent.com. [35.189.165.46]) by smtp.gmail.com with ESMTPSA id x23-20020a170902b41700b00188c5f0f9e9sm25015200plr.199.2023.01.04.20.37.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 20:37:53 -0800 (PST) X-Google-Original-From: Harvey Yang To: libcamera-devel@lists.libcamera.org Date: Thu, 5 Jan 2023 04:37:18 +0000 Message-Id: <20230105043726.679968-2-chenghaoyang@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230105043726.679968-1-chenghaoyang@google.com> References: <20230105043726.679968-1-chenghaoyang@google.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/9] 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_options.txt | 2 +- src/libcamera/pipeline/virtual/meson.build | 5 + src/libcamera/pipeline/virtual/virtual.cpp | 112 +++++++++++++++++++++ 3 files changed, 118 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_options.txt b/meson_options.txt index 1ba6778c..08876f4c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -37,7 +37,7 @@ option('lc-compliance', option('pipelines', type : 'array', - choices : ['imx8-isi', 'ipu3', 'raspberrypi', 'rkisp1', 'simple', 'uvcvideo', 'vimc'], + choices : ['imx8-isi', 'ipu3', 'raspberrypi', 'rkisp1', 'simple', 'uvcvideo', 'vimc', 'virtual'], description : 'Select which pipeline handlers to include') option('qcam', 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 */