libcamera v0.2.0+3-70b69666-nvm
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
dma_heaps.h
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2020, Raspberry Pi Ltd
4 *
5 * dma_heaps.h - Helper class for dma-heap allocations.
6 */
7
8#pragma once
9
10#include <stddef.h>
11
14
15namespace libcamera {
16
18{
19public:
20 enum class DmaHeapFlag {
21 Cma = (1 << 0),
22 System = (1 << 1),
23 };
24
26
27 DmaHeap(DmaHeapFlags flags = DmaHeapFlag::Cma);
28 ~DmaHeap();
29 bool isValid() const { return dmaHeapHandle_.isValid(); }
30 UniqueFD alloc(const char *name, std::size_t size);
31
32private:
33 UniqueFD dmaHeapHandle_;
34};
35
36LIBCAMERA_FLAGS_ENABLE_OPERATORS(DmaHeap::DmaHeapFlag)
37
38} /* namespace libcamera */
Definition dma_heaps.h:18
Type-safe container for enum-based bitfields.
Definition flags.h:16
unique_ptr-like wrapper for a file descriptor
Definition unique_fd.h:18
bool isValid() const
Check if the UniqueFD owns a valid file descriptor.
Definition unique_fd.h:61
Enum-based bit fields.
#define LIBCAMERA_FLAGS_ENABLE_OPERATORS(_enum)
Enable bitwise operations on the enum enumeration.
Definition flags.h:189
Top-level libcamera namespace.
Definition backtrace.h:17
File descriptor wrapper that owns a file descriptor.