|
Hermes 0.7.0
Linux game streaming host
|
#include <src/platform/linux/dmabuf_mapping.h>
Public Member Functions | |
| mapping_cache_t (std::size_t capacity=4) | |
| mapping_cache_t (const mapping_cache_t &)=delete | |
| mapping_cache_t & | operator= (const mapping_cache_t &)=delete |
| const std::uint8_t * | map (int fd, std::size_t required) |
| void | clear () |
| std::size_t | size () const |
| std::uint64_t | hits () const |
| std::uint64_t | misses () const |
Read-only mappings of the DMA-BUFs a producer rotates through, kept across frames.
Mapping a scanout buffer for every frame costs more than copying it. A drm_gem_shmem export is mapped VM_PFNMAP and faults in one 4 KiB page at a time: about 5 ms of a 6.5 ms 1440p CPU capture, 3600 faults per frame. A compositor rotates through two or three buffers, and Hermes-KMS hands back the same dma_buf for the same framebuffer, so a handful of cached mappings leaves every frame after the first free of faults.
A mapping holds its own reference to the dma_buf, so the inode keying an entry cannot be reused by another buffer while the entry exists. The reference also keeps a buffer the compositor has released alive until the entry is evicted, which is why the cache is small and cleared on reinit.
Definition at line 36 of file dmabuf_mapping.h.
|
inlineexplicit |
Definition at line 38 of file dmabuf_mapping.h.
|
inline |
Definition at line 42 of file dmabuf_mapping.h.
|
inline |
Drop every mapping, releasing the buffers they kept alive.
Definition at line 94 of file dmabuf_mapping.h.
|
inline |
Definition at line 105 of file dmabuf_mapping.h.
|
inline |
Map the whole DMA-BUF behind fd, or return the mapping made earlier.
| fd | Any descriptor for the DMA-BUF; it is not retained. |
| required | Bytes from the start of the buffer the caller will read. |
Definition at line 56 of file dmabuf_mapping.h.
|
inline |
Definition at line 109 of file dmabuf_mapping.h.
|
inline |
Definition at line 101 of file dmabuf_mapping.h.