From patchwork Tue Dec 12 11:50:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 19308 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 54DE3C3292 for ; Tue, 12 Dec 2023 11:51:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E699062B52; Tue, 12 Dec 2023 12:51:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1702381884; bh=CJI8FQq0mtavduac21Ymmof0RKxobTxU+1R/iZoaOig=; 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=AX9iC/Wvoy55Ma34FUozOGuB2ofBHck4PUQ4IQu+vR1i2eh+/Il9+v4zL9XgkSTnI WWkfRWvcofE8rFp/VAwg4pCfDp76f6xxsCtyyjnPfdHAkazgV6UtEUmXf7GnnTAW8X PXlQAzJed8KzXaAxyQ9/stWR8VYyy9bHabkHb6nDWMzD2KIi1opBmqSy8RhQZprawj aAy/v8DezaV7LA8V33q5Xif6SDS2+JwmdzMhzQ5q26Cu4qfXaEIc9VpS5dwWywzilx w9OUdiXX40JR409yynu9gFI1iGfBF/I7AvwJTQB90e1B08sICNFw0vTNwT0MbMByLB nHj5PyM6OcfDA== Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2AA8662B41 for ; Tue, 12 Dec 2023 12:51:23 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="yr9a8pMn"; dkim-atps=neutral Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-55193d5e8cdso511841a12.1 for ; Tue, 12 Dec 2023 03:51:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702381882; x=1702986682; 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=UMHEt2nX/fX21DwzK+lb5B5tJv/czMRUFMKk7pQX9aQ=; b=yr9a8pMnlbo2KMa9e09SmdDP7UNVlw1QyP8fv3MX0re7QHhJYKe+Ex01KqGTTbFFff XlUDYUO7r489gUp5JOZdZmnR5oR1kekV79+3IDwetGYJcyuyNDwPAr0YyCC12SrRab6n Wf0a5Zw8Z9WR010HiSoSIx7+XfzvGDZdQR1ufaZnmmiUx2Kv8OZsN7FiCLEG+7JW+3w8 OZKipKr1ckX4S+bBGZixtnPzNkG9LoHB/PVUElT/bR9Fwjh7PZi2XbdsL//KwLLYYdXX zTKWw2/kjuEAfWBJa3fhHG1cVVlnTQUr1ZpP8l8nHeTJ0S+GCr0HcXz5y0B2CYm9Rm/0 AHnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702381882; x=1702986682; 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=UMHEt2nX/fX21DwzK+lb5B5tJv/czMRUFMKk7pQX9aQ=; b=LUFkfF4xLoVGsLDnqimc3LbJ9E74CwZPceDpAk1YtPkUaSAte6mhNOekw8nCQ18Qyy OrciP8UiV9P2oFtHCPBeoLKYegg91lG46j047Pt18vS5RKdik/s7ZxZcP3KbsmPnieDK 5W54drGeVfpDFg9EivLPxx9ErK08ayr5VV3sdSGIxY3PPHfaRrt95GVS9OdEhxk5x3tj w238aq4x/0Nn+iifOmhzBMcX3DgEJllC2x9h7WGzbeM1JntW9UusE3ZUukUEQOcjWRBd gk+p+SLOo0Ae5pWOz8+y3j8Cw65l6XPHE8v3bhybMuQPTecyrknfh3F/eQcqFvdb3fCi +lVQ== X-Gm-Message-State: AOJu0Ywk7wOb0UX/eqC4Y4adN1m6p5zMhMrnF5HRer6RChQD0RPZjO3N 9NyjtUaU0+qNhCeAzG3fuKtQZi97Vgk1nsGxbfk= X-Google-Smtp-Source: AGHT+IGMqLximQEeYHKJnpqgG+iwSG6I868OH7WHfbl1p214rixjj6lGbk6f5N0Zh3DBSQZtjsCRBQ== X-Received: by 2002:a17:906:1db:b0:a1d:932f:9098 with SMTP id 27-20020a17090601db00b00a1d932f9098mr2876607ejj.97.1702381882708; Tue, 12 Dec 2023 03:51:22 -0800 (PST) Received: from Lat-5310.. ([87.116.161.153]) by smtp.gmail.com with ESMTPSA id tx17-20020a1709078e9100b00a1b75e0e061sm6213188ejc.130.2023.12.12.03.51.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 03:51:22 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Tue, 12 Dec 2023 14:50:42 +0300 Message-Id: <20231212115046.102726-4-andrey.konovalov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231212115046.102726-1-andrey.konovalov@linaro.org> References: <20231212115046.102726-1-andrey.konovalov@linaro.org> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v2 3/7] libcamera: ipa: add Soft IPA common files 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: Andrey Konovalov via libcamera-devel From: Andrey Konovalov Reply-To: Andrey Konovalov Cc: mripard@redhat.com, g.martti@gmail.com, t.langendam@gmail.com, srinivas.kandagatla@linaro.org, pavel@ucw.cz, bryan.odonoghue@linaro.org, admin@dennisbonke.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Define the Soft IPA main and event interfaces, add IPASoftBase class the Soft IPA implementation inherit from. Signed-off-by: Andrey Konovalov --- include/libcamera/ipa/meson.build | 1 + include/libcamera/ipa/soft.mojom | 27 ++++++++++++ src/ipa/simple/common/meson.build | 17 ++++++++ src/ipa/simple/common/soft_base.cpp | 66 +++++++++++++++++++++++++++++ src/ipa/simple/common/soft_base.h | 47 ++++++++++++++++++++ src/ipa/simple/meson.build | 3 ++ 6 files changed, 161 insertions(+) create mode 100644 include/libcamera/ipa/soft.mojom create mode 100644 src/ipa/simple/common/meson.build create mode 100644 src/ipa/simple/common/soft_base.cpp create mode 100644 src/ipa/simple/common/soft_base.h create mode 100644 src/ipa/simple/meson.build diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build index f3b4881c..aaee5cbf 100644 --- a/include/libcamera/ipa/meson.build +++ b/include/libcamera/ipa/meson.build @@ -65,6 +65,7 @@ pipeline_ipa_mojom_mapping = { 'ipu3': 'ipu3.mojom', 'rkisp1': 'rkisp1.mojom', 'rpi/vc4': 'raspberrypi.mojom', + 'simple/linaro': 'soft.mojom', 'vimc': 'vimc.mojom', } diff --git a/include/libcamera/ipa/soft.mojom b/include/libcamera/ipa/soft.mojom new file mode 100644 index 00000000..c3449188 --- /dev/null +++ b/include/libcamera/ipa/soft.mojom @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ + +/* + * \todo Document the interface and remove the related EXCLUDE_PATTERNS entry. + * \todo Add a way to tell SoftIPA the list of params SoftISP accepts? + */ + +module ipa.soft; + +import "include/libcamera/ipa/core.mojom"; + +interface IPASoftInterface { + init(libcamera.IPASettings settings, + libcamera.SharedFD fdStats, + libcamera.ControlInfoMap sensorCtrlInfoMap) + => (int32 ret); + start() => (int32 ret); + stop(); + configure(libcamera.ControlInfoMap sensorCtrlInfoMap) + => (int32 ret); + + [async] processStats(libcamera.ControlList sensorControls); +}; + +interface IPASoftEventInterface { + setSensorControls(libcamera.ControlList sensorControls); +}; diff --git a/src/ipa/simple/common/meson.build b/src/ipa/simple/common/meson.build new file mode 100644 index 00000000..023e617b --- /dev/null +++ b/src/ipa/simple/common/meson.build @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: CC0-1.0 + +soft_ipa_common_sources = files([ + 'soft_base.cpp', +]) + +soft_ipa_common_includes = [ + include_directories('..'), +] + +soft_ipa_common_deps = [ + libcamera_private, +] + +soft_ipa_common_lib = static_library('soft_ipa_common', soft_ipa_common_sources, + include_directories : soft_ipa_common_includes, + dependencies : soft_ipa_common_deps) diff --git a/src/ipa/simple/common/soft_base.cpp b/src/ipa/simple/common/soft_base.cpp new file mode 100644 index 00000000..7bd9b8de --- /dev/null +++ b/src/ipa/simple/common/soft_base.cpp @@ -0,0 +1,66 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2023, Linaro Ltd + * + * soft-base.cpp - Software IPA base class + */ + +#include "soft_base.h" + +#include + +#include +#include + +#include + +namespace libcamera { + +LOG_DEFINE_CATEGORY(IPASoft) + +namespace ipa::soft { + +IPASoftBase::IPASoftBase() +{ +} + +IPASoftBase::~IPASoftBase() +{ +} + +int IPASoftBase::init([[maybe_unused]] const IPASettings &settings, + const SharedFD &fdStats, + const ControlInfoMap &sensorInfoMap) +{ + fdStats_ = std::move(fdStats); + if (!fdStats_.isValid()) { + LOG(IPASoft, Error) << "Invalid Statistics handle"; + return -ENODEV; + } + + return platformInit(sensorInfoMap); +} + +int IPASoftBase::configure(const ControlInfoMap &sensorInfoMap) +{ + return platformConfigure(sensorInfoMap); +} + +int IPASoftBase::start() +{ + return platformStart(); +} + +void IPASoftBase::stop() +{ + return platformStop(); +} + +void IPASoftBase::processStats(const ControlList &sensorControls) +{ + return platformProcessStats(sensorControls); +} + +} /* namespace ipa::soft */ + +} /* namespace libcamera */ diff --git a/src/ipa/simple/common/soft_base.h b/src/ipa/simple/common/soft_base.h new file mode 100644 index 00000000..bff53713 --- /dev/null +++ b/src/ipa/simple/common/soft_base.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2023, Linaro Ltd + * + * soft-base.h - Software IPA base class + */ +#pragma once + +#include +#include + +#include + +namespace libcamera { + +namespace ipa::soft { + +class IPASoftBase : public ipa::soft::IPASoftInterface +{ +public: + IPASoftBase(); + ~IPASoftBase(); + + int init(const IPASettings &settings, + const SharedFD &fdStats, + const ControlInfoMap &sensorInfoMap) override; + int configure(const ControlInfoMap &sensorInfoMap) override; + + int start() override; + void stop() override; + + void processStats(const ControlList &sensorControls) override; + +protected: + SharedFD fdStats_; + +private: + virtual int platformInit(const ControlInfoMap &sensorInfoMap) = 0; + virtual int platformConfigure(const ControlInfoMap &sensorInfoMap) = 0; + virtual int platformStart() = 0; + virtual void platformStop() = 0; + virtual void platformProcessStats(const ControlList &sensorControls) = 0; +}; + +} /* namespace ipa::soft */ + +} /* namespace libcamera */ diff --git a/src/ipa/simple/meson.build b/src/ipa/simple/meson.build new file mode 100644 index 00000000..9688bbdb --- /dev/null +++ b/src/ipa/simple/meson.build @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: CC0-1.0 + +subdir('common')