From patchwork Tue Aug 31 06:34:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 13574 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 C4B05BD87D for ; Tue, 31 Aug 2021 06:35:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7D91A69171; Tue, 31 Aug 2021 08:35:13 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="EsJ3FVwp"; dkim-atps=neutral Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6A5D169169 for ; Tue, 31 Aug 2021 08:35:09 +0200 (CEST) Received: by mail-pl1-x634.google.com with SMTP id m4so10040890pll.0 for ; Mon, 30 Aug 2021 23:35:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yFuXrHPkuSawVSKXm42XTQO9ATri+BKx9ZteY5W3TA8=; b=EsJ3FVwpmY6/Kx8Liyup8CPzOMysP3l+EBl/nBVfTB9aXEu0+oRTJqIKJZ9nky/2Zy U8ttS2begJUfOjk/5GVmKxl0nb7WNwHzjgCLkOBV6K6CF5P48NnQis8EG6A0YmbVCehz QYE9WWk6wIohJiynLw9MRZK48ldcCh6dXNfds= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yFuXrHPkuSawVSKXm42XTQO9ATri+BKx9ZteY5W3TA8=; b=uRvrEHob67jQCa6VxQMHJ6m9KjCEgohfx+Ef7fIlwhCThul/r3K6sAkg0WYKjvpYXP zjjJaM7KbhjkVhaUzZTpVeY2fKdnuKxR5wG/JHxA/pZ7lg5D05yvU5PTRmWXYrAXuyzy 0RyPlvVBhlOC7M6wPkm5VuJ40Vt92h/ytC48/uHHxSH1CLzE5DsFxU4iQR4izbkOqKHT hD89pkQ3tDqXPCc8NkEhr2KO6OecNf+Dsu2Y69vrhFN0Qnw3Y3xQCHl6TsshMEjymN1a mMuMtbSFl5vKwOL7G1jI4Y6FsvL2RE/wtjmrdc+8lsJMeVpbJVbOmh50WoxcEhTjqEcM odAw== X-Gm-Message-State: AOAM533Oz0h54JOvfd+1jsxXUngdKugjEUOgf48veJxQWImfZjl2ATrT Binn063dTHizBePH1KWMsz0jeg5kqJ4GRA== X-Google-Smtp-Source: ABdhPJyDP/jpSkXeBaS8QF/i8+4E5Uqw0cMex+2JkOVtd0pan+CNozvUvf1YkVz5VJjVY16ZixTsPQ== X-Received: by 2002:a17:902:b218:b029:11a:bf7b:1a80 with SMTP id t24-20020a170902b218b029011abf7b1a80mr3234684plr.82.1630391707494; Mon, 30 Aug 2021 23:35:07 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:3c62:aba4:18ea:5441]) by smtp.gmail.com with ESMTPSA id d17sm16304027pfn.110.2021.08.30.23.35.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 23:35:07 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Tue, 31 Aug 2021 15:34:36 +0900 Message-Id: <20210831063438.785767-4-hiroh@chromium.org> X-Mailer: git-send-email 2.33.0.259.gc128427fd7-goog In-Reply-To: <20210831063438.785767-1-hiroh@chromium.org> References: <20210831063438.785767-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/5] mapped_framebuffer: Introduce MappedVectorBuffer 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" MappedFrameBuffer is a main class of deriving MappedBuffer. It works with FrameBuffer, so the source planes must be given as file descriptors. MappedBuffer interface is a generic class of providing accessing planes in memory. This introduces a new class deriving MappedBuffer, MappedVectorBuffer. It is created with the plane data in heap, concretely, std::vector and owns it. Signed-off-by: Hirokazu Honda --- include/libcamera/internal/mapped_framebuffer.h | 9 +++++++++ src/libcamera/mapped_framebuffer.cpp | 17 +++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/libcamera/internal/mapped_framebuffer.h b/include/libcamera/internal/mapped_framebuffer.h index 70ffbcbe..7deecded 100644 --- a/include/libcamera/internal/mapped_framebuffer.h +++ b/include/libcamera/internal/mapped_framebuffer.h @@ -59,6 +59,15 @@ public: LIBCAMERA_FLAGS_ENABLE_OPERATORS(MappedFrameBuffer::MapFlag) +class MappedVectorBuffer : public MappedBuffer +{ +public: + MappedVectorBuffer(std::vector> &&planes); + +private: + std::vector> data_; +}; + } /* namespace libcamera */ #endif /* __LIBCAMERA_INTERNAL_MAPPED_FRAMEBUFFER_H__ */ diff --git a/src/libcamera/mapped_framebuffer.cpp b/src/libcamera/mapped_framebuffer.cpp index 464d35fe..b09ad41a 100644 --- a/src/libcamera/mapped_framebuffer.cpp +++ b/src/libcamera/mapped_framebuffer.cpp @@ -240,4 +240,21 @@ MappedFrameBuffer::MappedFrameBuffer(const FrameBuffer *buffer, MapFlags flags) } } +/** + * \class MappedVectorBuffer + * \brief Owns planes data in heap and provides the MappedBuffer interface + */ + +/** + * \brief Takes the ownership of the passed \a planes + * \param[in] planes the plane data that shall be owned by MappedVectorBuffer + */ +MappedVectorBuffer::MappedVectorBuffer(std::vector> &&planes) + : data_(std::move(planes)) +{ + planes_.reserve(data_.size()); + for (auto &plane : data_) + planes_.emplace_back(plane.data(), plane.size()); +} + } /* namespace libcamera */