From 6062ada2f5debcd2c3fa5caa2370dcc3dfbc1f24 Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Tue, 16 Apr 2024 11:13:38 +0200 Subject: libcamera: internal: Move dma_heaps.[h, cpp] to common directories DmaHeap class is useful outside the RPi pipeline handler too. Move dma_heaps.h and dma_heaps.cpp to common directories. Update the build files and RPi vc4 pipeline handler accordingly. Tested-by: Bryan O'Donoghue # sc8280xp Lenovo x13s Tested-by: Pavel Machek Reviewed-by: Kieran Bingham Reviewed-by: Naushir Patuck Reviewed-by: Pavel Machek Reviewed-by: Milan Zamazal Reviewed-by: Laurent Pinchart Signed-off-by: Andrey Konovalov Signed-off-by: Hans de Goede Signed-off-by: Kieran Bingham --- include/libcamera/internal/dma_heaps.h | 28 ++++++++++++++++++++++++++++ include/libcamera/internal/meson.build | 1 + 2 files changed, 29 insertions(+) create mode 100644 include/libcamera/internal/dma_heaps.h (limited to 'include') diff --git a/include/libcamera/internal/dma_heaps.h b/include/libcamera/internal/dma_heaps.h new file mode 100644 index 00000000..cff8f140 --- /dev/null +++ b/include/libcamera/internal/dma_heaps.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2020, Raspberry Pi Ltd + * + * dma_heaps.h - Helper class for dma-heap allocations. + */ + +#pragma once + +#include + +#include + +namespace libcamera { + +class DmaHeap +{ +public: + DmaHeap(); + ~DmaHeap(); + bool isValid() const { return dmaHeapHandle_.isValid(); } + UniqueFD alloc(const char *name, std::size_t size); + +private: + UniqueFD dmaHeapHandle_; +}; + +} /* namespace libcamera */ diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build index 7f1f3440..33eb0fb3 100644 --- a/include/libcamera/internal/meson.build +++ b/include/libcamera/internal/meson.build @@ -25,6 +25,7 @@ libcamera_internal_headers = files([ 'device_enumerator.h', 'device_enumerator_sysfs.h', 'device_enumerator_udev.h', + 'dma_heaps.h', 'formats.h', 'framebuffer.h', 'ipa_manager.h', -- cgit v1.2.1