From patchwork Fri Nov 26 03:41:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 14789 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 A1ED9BDB13 for ; Fri, 26 Nov 2021 03:42:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D86856049B; Fri, 26 Nov 2021 04:41:59 +0100 (CET) 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="WOUYZVwW"; dkim-atps=neutral Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9E19B6011D for ; Fri, 26 Nov 2021 04:41:57 +0100 (CET) Received: by mail-pj1-x102a.google.com with SMTP id p18-20020a17090ad31200b001a78bb52876so8987791pju.3 for ; Thu, 25 Nov 2021 19:41:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6QK1MyRb7UCtu8CYpX8LC3RrUZlA00Qlxu6YEFO7ek8=; b=WOUYZVwWlNSuefs3QW0fuAVPgEKJGrbRBNd6nmBMIJIWN+gRQgBnAEKRJXm35+15KQ 7y9+c/bHUi/wHPDeiFV465zThzeSeKO8+wzj+A89lSskNycrkksbKGriISnCjV4fxTD3 Eoi9YYYOrr+hSPiQcEIXdmUnuG5CP7jJn+s0w= 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:mime-version :content-transfer-encoding; bh=6QK1MyRb7UCtu8CYpX8LC3RrUZlA00Qlxu6YEFO7ek8=; b=Xe7/FglLXgVCXargjY38xS5aTGFahtnuL9X3lvAuJFSN3Y3b0xCSjr+Cc/qMFpBDOE iKaNYuPWfx4xhmPbKX1oXd5wRGUOXV6y0b6I16G4LmngoRdm5RunRY0QJxI1wOGQUy8+ IUtbkfazxCLW37T8uv5NiPdybMnhy1VZ3c0JOt7sQOD6aNSJVhX6UI46BDPDjZcMgVBh pYVkZ4CD+lKz+23VHLgjToauP1fNJRqo5FgjHCUBhffX7/K/dThhVWwmLNSzzC9O02Ga SyTTgJwxVntFzU1JKNfx3vhf8IeyuHOvWuaOyfo4xZhtiSe3iJssxKmWlGXLFNCfhk5n vwfw== X-Gm-Message-State: AOAM5330/l4pAzLvzoB3fu9NjnhCF5rDIp5FVRWELIalnDzo7tl6a+3t 8et83LlRQUpEg7InjKHqAJn4eIfXZpVepA== X-Google-Smtp-Source: ABdhPJwMkhlkyJEQz6Bhxblp9HGvAIzyt0c/nltHGzYYOWLCIdRACddc9SaKkjgsc2ChRPgIbub7hA== X-Received: by 2002:a17:902:e885:b0:142:1500:d2ba with SMTP id w5-20020a170902e88500b001421500d2bamr35160123plg.19.1637898115630; Thu, 25 Nov 2021 19:41:55 -0800 (PST) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:203:139c:952e:8861:d909]) by smtp.gmail.com with ESMTPSA id t4sm4500697pfj.168.2021.11.25.19.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Nov 2021 19:41:55 -0800 (PST) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Fri, 26 Nov 2021 12:41:49 +0900 Message-Id: <20211126034150.1843285-1-hiroh@chromium.org> X-Mailer: git-send-email 2.34.0.rc2.393.gf8c9666880-goog MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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 Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- include/libcamera/framebuffer.h | 2 ++ include/libcamera/internal/framebuffer.h | 1 + src/libcamera/framebuffer.cpp | 24 ++++++++++++++++++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h index 7f2f176a..abcede31 100644 --- a/include/libcamera/framebuffer.h +++ b/include/libcamera/framebuffer.h @@ -58,6 +58,8 @@ public: }; FrameBuffer(const std::vector &planes, unsigned int cookie = 0); + FrameBuffer(std::unique_ptr d, + const std::vector &planes, unsigned int cookie = 0); const std::vector &planes() const { return planes_; } Request *request() const; diff --git a/include/libcamera/internal/framebuffer.h b/include/libcamera/internal/framebuffer.h index cd33c295..3cced5b1 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(); void setRequest(Request *request) { request_ = request; } bool isContiguous() const { return isContiguous_; } diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp index 337ea115..3a324471 100644 --- a/src/libcamera/framebuffer.cpp +++ b/src/libcamera/framebuffer.cpp @@ -116,6 +116,13 @@ FrameBuffer::Private::Private() { } +/** + * \brief FrameBuffer::Private destructor + */ +FrameBuffer::Private::~Private() +{ +} + /** * \fn FrameBuffer::Private::setRequest() * \brief Set the request this buffer belongs to @@ -213,8 +220,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());