From patchwork Thu Oct 28 07:30:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 14374 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 D6354BDB1C for ; Thu, 28 Oct 2021 07:30:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 94C3B600BD; Thu, 28 Oct 2021 09:30:50 +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="Q8Y6KUaG"; dkim-atps=neutral Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BB694600B9 for ; Thu, 28 Oct 2021 09:30:47 +0200 (CEST) Received: by mail-pj1-x1030.google.com with SMTP id in13so1650186pjb.1 for ; Thu, 28 Oct 2021 00:30:47 -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=L1BgXhB4HoFS1wxgKIGYksGwpaRix3Nmcp3i3ECMjSY=; b=Q8Y6KUaGfYwmq7IO54mqEfxTp2FIw5F56aJUS2akSvBk2qVS3q2hJ2un3kSg2KRyx1 2jXsMDE3XQcXkPjbnZhJaWjx5S6KLingU8A2m3pWdcihR2hGF6rBJJEEkMNRGgd9meJQ YupqIf44Jga451rqf/nRms8QOr6WlNlri5P6g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L1BgXhB4HoFS1wxgKIGYksGwpaRix3Nmcp3i3ECMjSY=; b=Mld0EDwpQsHTPN8aQQotbJUV2ZgdYxmZeVoOPspLPtRagcRircjDCdkCREVK9LOVUO 9TSgQBJTL3vxqbVOEt9o5+20wh92KwlU8Pw3f5Pv7UD46rUpTV+y+unSSf0B8x3QpiPt oGpk4XYQwNiioAWpGpaOI0dl6tIrAUmSHJII2MhKf1LYnTa8sMD8TZNLujyVDLpyzTqP dL0XFwVr7AQhmK0xaqMyDIBdPdHxZnvTcCFNFpxNinwRBZfniPA6TQ/+0Sc5wZJLnwwq ProISo798/pl5kxmp1steilqKgCqG6OHSVoBJ1UBsKGKLo4dmdLq4QkIH5u5tkSSbMDM ubjA== X-Gm-Message-State: AOAM530csFR36HNiGLzv4T/2G2X6CEzBK5UuWXyGuM2hzeruvrwmH3r6 XRx/y+CFWdtnAH2naOO6JdZR6OH1JUIKJQ== X-Google-Smtp-Source: ABdhPJzMCKuzA2x+NAb6oFlirb+k/UBs4rmM5oJK1ctnkcEU4Covmtgplld3Da3Eez4lePPL7C2zmw== X-Received: by 2002:a17:902:70c5:b0:13f:f941:9ad6 with SMTP id l5-20020a17090270c500b0013ff9419ad6mr2448866plt.28.1635406245871; Thu, 28 Oct 2021 00:30:45 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:3f47:e04c:b9be:d02e]) by smtp.gmail.com with ESMTPSA id b13sm6974392pjl.15.2021.10.28.00.30.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 00:30:45 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Thu, 28 Oct 2021 16:30:37 +0900 Message-Id: <20211028073038.653786-2-hiroh@chromium.org> X-Mailer: git-send-email 2.33.1.1089.g2158813163f-goog In-Reply-To: <20211028073038.653786-1-hiroh@chromium.org> References: <20211028073038.653786-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] libcamera: framebuffer: Enable attaching additional data to FrameBuffer 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" We cannot have a subclass of FrameBuffer because it is marked as final. This adds a FrameBuffer constructor with FrameBuffer::Private. So we can attach some additional resources with FrameBuffer through a customized FrameBuffer::Private class. Signed-off-by: Hirokazu Honda Reviewed-by: Jacopo Mondi --- include/libcamera/framebuffer.h | 2 ++ include/libcamera/internal/framebuffer.h | 1 + src/libcamera/framebuffer.cpp | 17 +++++++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h index 7f2f176a..02bf1533 100644 --- a/include/libcamera/framebuffer.h +++ b/include/libcamera/framebuffer.h @@ -57,6 +57,8 @@ public: unsigned int length; }; + FrameBuffer(std::unique_ptr d, + const std::vector &planes, unsigned int cookie = 0); FrameBuffer(const std::vector &planes, unsigned int cookie = 0); const std::vector &planes() const { return planes_; } diff --git a/include/libcamera/internal/framebuffer.h b/include/libcamera/internal/framebuffer.h index cd33c295..5ab9b3b2 100644 --- a/include/libcamera/internal/framebuffer.h +++ b/include/libcamera/internal/framebuffer.h @@ -19,6 +19,7 @@ class FrameBuffer::Private : public Extensible::Private public: Private(); + virtual ~Private() = default; void setRequest(Request *request) { request_ = request; } bool isContiguous() const { return isContiguous_; } diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp index d44a98ba..26587ff3 100644 --- a/src/libcamera/framebuffer.cpp +++ b/src/libcamera/framebuffer.cpp @@ -213,8 +213,21 @@ FrameBuffer::Private::Private() * \param[in] cookie Cookie */ FrameBuffer::FrameBuffer(const std::vector &planes, unsigned int cookie) - : Extensible(std::make_unique()), planes_(planes), - cookie_(cookie) + : FrameBuffer(std::make_unique(), planes, cookie) +{ +} + +/** + * \brief Construct a FrameBuffer with an extensible private class and an array + * of planes + * \param[in] d The extensible private class + * \param[in] planes The frame memory planes + * \param[in] cookie Cookie + */ +FrameBuffer::FrameBuffer(std::unique_ptr d, + const std::vector &planes, + unsigned int cookie) + : Extensible(std::move(d)), planes_(planes), cookie_(cookie) { metadata_.planes_.resize(planes_.size());