{"id":18921,"url":"https://patchwork.libcamera.org/api/1.1/patches/18921/?format=json","web_url":"https://patchwork.libcamera.org/patch/18921/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20230802065449.2904457-2-chenghaoyang@chromium.org>","date":"2023-08-02T06:51:43","name":"[libcamera-devel,v7,1/3] libcamera: Move DmaHeap to HeapAllocator as a base class","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"fb71df96d14b8f3f8c2b71d3ea5e0283215debab","submitter":{"id":117,"url":"https://patchwork.libcamera.org/api/1.1/people/117/?format=json","name":"Cheng-Hao Yang","email":"chenghaoyang@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18921/mbox/","series":[{"id":4000,"url":"https://patchwork.libcamera.org/api/1.1/series/4000/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4000","date":"2023-08-02T06:51:42","name":"Add HeapAllocator","version":7,"mbox":"https://patchwork.libcamera.org/series/4000/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18921/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18921/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 9CA91C32A9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Aug 2023 06:55:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D4DAE627F0;\n\tWed,  2 Aug 2023 08:55:01 +0200 (CEST)","from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com\n\t[IPv6:2607:f8b0:4864:20::42e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D8B5F61E1A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Aug 2023 08:54:59 +0200 (CEST)","by mail-pf1-x42e.google.com with SMTP id\n\td2e1a72fcca58-686f25d045cso4442350b3a.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 01 Aug 2023 23:54:59 -0700 (PDT)","from chenghaoyang-low.c.googlers.com.com\n\t(27.247.221.35.bc.googleusercontent.com. [35.221.247.27])\n\tby smtp.gmail.com with ESMTPSA id\n\td14-20020aa7868e000000b0065980654baasm9142154pfo.130.2023.08.01.23.54.56\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 01 Aug 2023 23:54:57 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1690959301;\n\tbh=NbU3svJ9dJf8o71kciW8iYXkpdjJmbB9d1DtbAtx0Q8=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=tah0j8hZgYPcYELNdnvlUT4O1n6y3asg8TMVF40bPI5htnRnPfZf0MMHW9HHaIrgl\n\txjA6R+zXtGE6RemFT4ojM58GvL5ryKkA5y1iAbHk7CSN+NBaFuZjVIk8XwnBpQEGJO\n\tg2vRBCk/X4X0RMgetLcPazpUJDTo9vVZyg2iwxRugZOcP2IO0iPz8lmygtuQOwtm2N\n\t82AXrW5K8qBUvcSMCA4ZD8dq93eh0RXpb8yXG+dE/JpPfT1QcfV3pH+bEa98y8GfKq\n\tvCppJpPLo8LwUoiqPqsIO3QrGCqD0kdSOMyQDx5iWcYKUM8os4RCyGN4QRSEU7NhMX\n\te1zPxCAcxWk4w==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1690959298; x=1691564098;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=y5i4ECrxW9gevPh/tneYjpfKD/8bJyg9RHUiQPPTrlE=;\n\tb=WtlLgsAPdKzROYxhzRu1dZPHFcYCqsV+OLc1J/CGG7Agez0ZBLS75p5rL2c8tOAIMN\n\tJDUJrnl+EZ+n408GVAOZ/SFUc3nQj+OzKkw4bqjBnwLir561xmTqQbmQAkZPqqsvCreP\n\t0lxhzE45ysfeUvHlIRxpOh4cm4Woatq2SQlAk="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"WtlLgsAP\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1690959298; x=1691564098;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=y5i4ECrxW9gevPh/tneYjpfKD/8bJyg9RHUiQPPTrlE=;\n\tb=FlEHdBEQozCmX4AlQ7Ej3O74Q9vS6A+p4B6qPx9GUtIm+Idv+rLCR89IHaGkX4L5bZ\n\tKgZkKvYQwWnJhasTg1jxsmsxLscDezM528FUiEYzgc+s5Mh93bRnEx5nNVz7W4Eap+of\n\t56JyK5wuaPKGUHmw/MkDGwSDCK4+VamZK3mJyQXabUhmurJVe4tnlZfzYdZiG3+Lq1jQ\n\tNWgN3D1l38uJiE/vwEfCdSKRLcc7EqD6MAAtyYvwzmMRM//wz3EzyOPjPBZhSkDLsq8l\n\teBMVKkhOiP90NY9JrFax8qpGDOTbkTK0sWqDzE3PsaKhWINmIUQC34NF2jNZwLybcLl1\n\tI+Uw==","X-Gm-Message-State":"ABy/qLZV3A009QndKTkweTwYrW1BCBrEouvHSGhC3QCjwirAdvieVLrV\n\tIrU0SarDr1actd/fyQctxTB6B65Z15BDX727+t4=","X-Google-Smtp-Source":"APBJJlGAkQEi/+2lIh3VJqvyhn5Zwm7IdWOonB0dpzhnLZx2wnzUtJ4DwbutSoNovn1mkVfAaeDEDQ==","X-Received":"by 2002:a05:6a00:2da6:b0:687:41cb:e274 with SMTP id\n\tfb38-20020a056a002da600b0068741cbe274mr6866827pfb.9.1690959297911; \n\tTue, 01 Aug 2023 23:54:57 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  2 Aug 2023 06:51:43 +0000","Message-ID":"<20230802065449.2904457-2-chenghaoyang@chromium.org>","X-Mailer":"git-send-email 2.41.0.585.gd2178a4bd4-goog","In-Reply-To":"<20230802065449.2904457-1-chenghaoyang@chromium.org>","References":"<20230802065449.2904457-1-chenghaoyang@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v7 1/3] libcamera: Move DmaHeap to\n\tHeapAllocator as a base class","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Harvey Yang via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Harvey Yang <chenghaoyang@chromium.org>","Cc":"Harvey Yang <chenghaoyang@chromium.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"As other components (like the WIP virtual pipeline handler) also need a\nheap allocator, move DmaHeap from raspberry pi pipeline handler to a\ngeneral HeapAllocator as a base class.\n\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n .../libcamera/internal/heap_allocator.h       |  18 +-\n include/libcamera/internal/meson.build        |   1 +\n src/libcamera/heap_allocator.cpp              | 192 ++++++++++++++++++\n src/libcamera/meson.build                     |   1 +\n src/libcamera/pipeline/rpi/vc4/dma_heaps.cpp  |  90 --------\n src/libcamera/pipeline/rpi/vc4/meson.build    |   5 +-\n src/libcamera/pipeline/rpi/vc4/vc4.cpp        |  11 +-\n 7 files changed, 209 insertions(+), 109 deletions(-)\n rename src/libcamera/pipeline/rpi/vc4/dma_heaps.h => include/libcamera/internal/heap_allocator.h (57%)\n create mode 100644 src/libcamera/heap_allocator.cpp\n delete mode 100644 src/libcamera/pipeline/rpi/vc4/dma_heaps.cpp","diff":"diff --git a/src/libcamera/pipeline/rpi/vc4/dma_heaps.h b/include/libcamera/internal/heap_allocator.h\nsimilarity index 57%\nrename from src/libcamera/pipeline/rpi/vc4/dma_heaps.h\nrename to include/libcamera/internal/heap_allocator.h\nindex 0a4a8d86..6620fa23 100644\n--- a/src/libcamera/pipeline/rpi/vc4/dma_heaps.h\n+++ b/include/libcamera/internal/heap_allocator.h\n@@ -1,8 +1,9 @@\n /* SPDX-License-Identifier: LGPL-2.1-or-later */\n /*\n  * Copyright (C) 2020, Raspberry Pi Ltd\n+ * Copyright (C) 2023, Google Inc.\n  *\n- * dma_heaps.h - Helper class for dma-heap allocations.\n+ * heap_allocator.h - Helper class for heap buffer allocations.\n  */\n \n #pragma once\n@@ -13,20 +14,19 @@\n \n namespace libcamera {\n \n-namespace RPi {\n+class Heap;\n \n-class DmaHeap\n+class HeapAllocator\n {\n public:\n-\tDmaHeap();\n-\t~DmaHeap();\n-\tbool isValid() const { return dmaHeapHandle_.isValid(); }\n+\tHeapAllocator();\n+\t~HeapAllocator();\n+\n+\tbool isValid() const;\n \tUniqueFD alloc(const char *name, std::size_t size);\n \n private:\n-\tUniqueFD dmaHeapHandle_;\n+\tstd::unique_ptr<Heap> heap_;\n };\n \n-} /* namespace RPi */\n-\n } /* namespace libcamera */\ndiff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build\nindex 7f1f3440..3030d039 100644\n--- a/include/libcamera/internal/meson.build\n+++ b/include/libcamera/internal/meson.build\n@@ -27,6 +27,7 @@ libcamera_internal_headers = files([\n     'device_enumerator_udev.h',\n     'formats.h',\n     'framebuffer.h',\n+    'heap_allocator.h',\n     'ipa_manager.h',\n     'ipa_module.h',\n     'ipa_proxy.h',\ndiff --git a/src/libcamera/heap_allocator.cpp b/src/libcamera/heap_allocator.cpp\nnew file mode 100644\nindex 00000000..2a825d93\n--- /dev/null\n+++ b/src/libcamera/heap_allocator.cpp\n@@ -0,0 +1,192 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2020, Raspberry Pi Ltd\n+ * Copyright (C) 2023, Google Inc.\n+ *\n+ * heap_allocator.cpp - Helper class for heap buffer allocations.\n+ */\n+\n+#include \"libcamera/internal/heap_allocator.h\"\n+\n+#include <array>\n+#include <fcntl.h>\n+#include <sys/ioctl.h>\n+#include <unistd.h>\n+\n+#include <linux/dma-buf.h>\n+#include <linux/dma-heap.h>\n+\n+#include <libcamera/base/log.h>\n+\n+/**\n+ * \\file libcamera/internal/heap_allocator.h\n+ * \\brief Internal heap buffer allocator support\n+ */\n+\n+namespace libcamera {\n+\n+/*\n+ * /dev/dma-heap/linux,cma is the dma-heap allocator, which allows dmaheap-cma\n+ * to only have to worry about importing.\n+ *\n+ * Annoyingly, should the cma heap size be specified on the kernel command line\n+ * instead of DT, the heap gets named \"reserved\" instead.\n+ */\n+static constexpr std::array<const char *, 3> dmaHeapNames = {\n+\t\"/dev/dma_heap/linux,cma\",\n+\t\"/dev/dma_heap/reserved\",\n+\t\"/dev/dma_heap/system\"\n+};\n+\n+LOG_DEFINE_CATEGORY(HeapAllocator)\n+\n+/**\n+ * \\class Heap\n+ * \\brief The virtual base class for different implementations\n+ */\n+class Heap\n+{\n+public:\n+\tvirtual ~Heap() = default;\n+\tbool isValid() const { return handle_.isValid(); }\n+\tvirtual UniqueFD alloc(const char *name, std::size_t size) = 0;\n+\n+protected:\n+\tUniqueFD handle_;\n+};\n+\n+/**\n+ * \\var Heap::handle_\n+ * \\brief A common UniqueFD to allocate buffers\n+ */\n+\n+/**\n+ * \\fn Heap::isValid()\n+ * \\brief Return true if the heap is valid\n+ */\n+\n+/**\n+ * \\fn Heap::alloc()\n+ * \\brief Return a valid UniqueFD if a heap buffer is allocated\n+ * \\param[in] name The name of the allocated buffer\n+ * \\param[in] size The size in byte of the allocated buffer\n+ */\n+\n+/**\n+ * \\class DmaHeap\n+ * \\brief The derived class of Heap with DMA implementation\n+ */\n+class DmaHeap : public Heap\n+{\n+public:\n+\tDmaHeap();\n+\t~DmaHeap();\n+\tUniqueFD alloc(const char *name, std::size_t size) override;\n+};\n+\n+/**\n+ * \\brief Construct a DmaHeap with a list of |dmaHeapNames|\n+ */\n+DmaHeap::DmaHeap()\n+{\n+\tfor (const char *name : dmaHeapNames) {\n+\t\tint ret = ::open(name, O_RDWR | O_CLOEXEC);\n+\t\tif (ret < 0) {\n+\t\t\tret = errno;\n+\t\t\tLOG(HeapAllocator, Debug) << \"DmaHeap failed to open \" << name << \": \"\n+\t\t\t\t\t\t  << strerror(ret);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\thandle_ = UniqueFD(ret);\n+\t\tbreak;\n+\t}\n+\n+\tif (!handle_.isValid())\n+\t\tLOG(HeapAllocator, Error) << \"DmaHeap could not open any dmaHeap device\";\n+}\n+\n+DmaHeap::~DmaHeap() = default;\n+\n+UniqueFD DmaHeap::alloc(const char *name, std::size_t size)\n+{\n+\tint ret;\n+\n+\tif (!name)\n+\t\treturn {};\n+\n+\tstruct dma_heap_allocation_data alloc = {};\n+\n+\talloc.len = size;\n+\talloc.fd_flags = O_CLOEXEC | O_RDWR;\n+\n+\tret = ::ioctl(handle_.get(), DMA_HEAP_IOCTL_ALLOC, &alloc);\n+\tif (ret < 0) {\n+\t\tLOG(HeapAllocator, Error) << \"DmaHeap allocation failure for \"\n+\t\t\t\t\t  << name;\n+\t\treturn {};\n+\t}\n+\n+\tUniqueFD allocFd(alloc.fd);\n+\tret = ::ioctl(allocFd.get(), DMA_BUF_SET_NAME, name);\n+\tif (ret < 0) {\n+\t\tLOG(HeapAllocator, Error) << \"DmaHeap naming failure for \"\n+\t\t\t\t\t  << name;\n+\t\treturn {};\n+\t}\n+\n+\treturn allocFd;\n+}\n+\n+/**\n+ * \\class HeapAllocator\n+ * \\brief The allocator that allocates heap buffers\n+ *\n+ * HeapAllocator class is the interface for pipeline handlers to allocate heap\n+ * buffers. It finds a usable heap implementation, if any, and users don't need\n+ * to know the details. Users should check if the HeapAllocator instance is\n+ * valid though before using it.\n+ */\n+\n+/**\n+ * \\var HeapAllocator::heap_\n+ * \\brief The heap instance used to allocate heap buffers.\n+ * Should be initialized in the c'tor.\n+ */\n+\n+/**\n+ * \\brief Construct a HeapAllocator with DmaHeap implementation\n+ */\n+HeapAllocator::HeapAllocator()\n+{\n+\theap_ = std::make_unique<DmaHeap>();\n+}\n+\n+HeapAllocator::~HeapAllocator() = default;\n+\n+/**\n+ * \\fn HeapAllocator::isValid()\n+ * \\brief Return true if the HeapAllocator works with a Heap implementation\n+ */\n+bool HeapAllocator::isValid() const\n+{\n+\treturn heap_->isValid();\n+}\n+\n+/**\n+ * \\fn HeapAllocator::alloc()\n+ * \\brief Return a valid UniqueFD if a heap buffer is allocated\n+ * \\param[in] name The name of the allocated buffer\n+ * \\param[in] size The size in byte of the allocated buffer\n+ */\n+UniqueFD HeapAllocator::alloc(const char *name, std::size_t size)\n+{\n+\tif (!isValid()) {\n+\t\tLOG(HeapAllocator, Fatal) << \"Allocation attempted without allocator\" << name;\n+\t\treturn {};\n+\t}\n+\n+\treturn heap_->alloc(name, size);\n+}\n+\n+} /* namespace libcamera */\ndiff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\nindex b24f8296..967f08e6 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -22,6 +22,7 @@ libcamera_sources = files([\n     'framebuffer.cpp',\n     'framebuffer_allocator.cpp',\n     'geometry.cpp',\n+    'heap_allocator.cpp',\n     'ipa_controls.cpp',\n     'ipa_data_serializer.cpp',\n     'ipa_interface.cpp',\ndiff --git a/src/libcamera/pipeline/rpi/vc4/dma_heaps.cpp b/src/libcamera/pipeline/rpi/vc4/dma_heaps.cpp\ndeleted file mode 100644\nindex 317b1fc1..00000000\n--- a/src/libcamera/pipeline/rpi/vc4/dma_heaps.cpp\n+++ /dev/null\n@@ -1,90 +0,0 @@\n-/* SPDX-License-Identifier: LGPL-2.1-or-later */\n-/*\n- * Copyright (C) 2020, Raspberry Pi Ltd\n- *\n- * dma_heaps.h - Helper class for dma-heap allocations.\n- */\n-\n-#include \"dma_heaps.h\"\n-\n-#include <array>\n-#include <fcntl.h>\n-#include <linux/dma-buf.h>\n-#include <linux/dma-heap.h>\n-#include <sys/ioctl.h>\n-#include <unistd.h>\n-\n-#include <libcamera/base/log.h>\n-\n-/*\n- * /dev/dma-heap/linux,cma is the dma-heap allocator, which allows dmaheap-cma\n- * to only have to worry about importing.\n- *\n- * Annoyingly, should the cma heap size be specified on the kernel command line\n- * instead of DT, the heap gets named \"reserved\" instead.\n- */\n-static constexpr std::array<const char *, 2> heapNames = {\n-\t\"/dev/dma_heap/linux,cma\",\n-\t\"/dev/dma_heap/reserved\"\n-};\n-\n-namespace libcamera {\n-\n-LOG_DECLARE_CATEGORY(RPI)\n-\n-namespace RPi {\n-\n-DmaHeap::DmaHeap()\n-{\n-\tfor (const char *name : heapNames) {\n-\t\tint ret = ::open(name, O_RDWR | O_CLOEXEC, 0);\n-\t\tif (ret < 0) {\n-\t\t\tret = errno;\n-\t\t\tLOG(RPI, Debug) << \"Failed to open \" << name << \": \"\n-\t\t\t\t\t<< strerror(ret);\n-\t\t\tcontinue;\n-\t\t}\n-\n-\t\tdmaHeapHandle_ = UniqueFD(ret);\n-\t\tbreak;\n-\t}\n-\n-\tif (!dmaHeapHandle_.isValid())\n-\t\tLOG(RPI, Error) << \"Could not open any dmaHeap device\";\n-}\n-\n-DmaHeap::~DmaHeap() = default;\n-\n-UniqueFD DmaHeap::alloc(const char *name, std::size_t size)\n-{\n-\tint ret;\n-\n-\tif (!name)\n-\t\treturn {};\n-\n-\tstruct dma_heap_allocation_data alloc = {};\n-\n-\talloc.len = size;\n-\talloc.fd_flags = O_CLOEXEC | O_RDWR;\n-\n-\tret = ::ioctl(dmaHeapHandle_.get(), DMA_HEAP_IOCTL_ALLOC, &alloc);\n-\tif (ret < 0) {\n-\t\tLOG(RPI, Error) << \"dmaHeap allocation failure for \"\n-\t\t\t\t<< name;\n-\t\treturn {};\n-\t}\n-\n-\tUniqueFD allocFd(alloc.fd);\n-\tret = ::ioctl(allocFd.get(), DMA_BUF_SET_NAME, name);\n-\tif (ret < 0) {\n-\t\tLOG(RPI, Error) << \"dmaHeap naming failure for \"\n-\t\t\t\t<< name;\n-\t\treturn {};\n-\t}\n-\n-\treturn allocFd;\n-}\n-\n-} /* namespace RPi */\n-\n-} /* namespace libcamera */\ndiff --git a/src/libcamera/pipeline/rpi/vc4/meson.build b/src/libcamera/pipeline/rpi/vc4/meson.build\nindex cdb049c5..b2b79735 100644\n--- a/src/libcamera/pipeline/rpi/vc4/meson.build\n+++ b/src/libcamera/pipeline/rpi/vc4/meson.build\n@@ -1,8 +1,5 @@\n # SPDX-License-Identifier: CC0-1.0\n \n-libcamera_sources += files([\n-    'dma_heaps.cpp',\n-    'vc4.cpp',\n-])\n+libcamera_sources += files(['vc4.cpp'])\n \n subdir('data')\ndiff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\nindex 018cf488..410ecfaf 100644\n--- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n+++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n@@ -12,12 +12,11 @@\n #include <libcamera/formats.h>\n \n #include \"libcamera/internal/device_enumerator.h\"\n+#include \"libcamera/internal/heap_allocator.h\"\n \n #include \"../common/pipeline_base.h\"\n #include \"../common/rpi_stream.h\"\n \n-#include \"dma_heaps.h\"\n-\n using namespace std::chrono_literals;\n \n namespace libcamera {\n@@ -87,7 +86,7 @@ public:\n \tRPi::Device<Isp, 4> isp_;\n \n \t/* DMAHEAP allocation helper. */\n-\tRPi::DmaHeap dmaHeap_;\n+\tHeapAllocator heapAllocator_;\n \tSharedFD lsTable_;\n \n \tstruct Config {\n@@ -296,7 +295,7 @@ int PipelineHandlerVc4::platformRegister(std::unique_ptr<RPi::CameraData> &camer\n {\n \tVc4CameraData *data = static_cast<Vc4CameraData *>(cameraData.get());\n \n-\tif (!data->dmaHeap_.isValid())\n+\tif (!data->heapAllocator_.isValid())\n \t\treturn -ENOMEM;\n \n \tMediaEntity *unicamImage = unicam->getEntityByName(\"unicam-image\");\n@@ -670,9 +669,9 @@ int Vc4CameraData::platformConfigureIpa(ipa::RPi::ConfigParams &params)\n {\n \tparams.ispControls = isp_[Isp::Input].dev()->controls();\n \n-\t/* Allocate the lens shading table via dmaHeap and pass to the IPA. */\n+\t/* Allocate the lens shading table via heapAllocator and pass to the IPA. */\n \tif (!lsTable_.isValid()) {\n-\t\tlsTable_ = SharedFD(dmaHeap_.alloc(\"ls_grid\", ipa::RPi::MaxLsGridSize));\n+\t\tlsTable_ = SharedFD(heapAllocator_.alloc(\"ls_grid\", ipa::RPi::MaxLsGridSize));\n \t\tif (!lsTable_.isValid())\n \t\t\treturn -ENOMEM;\n \n","prefixes":["libcamera-devel","v7","1/3"]}