From ac2a19e7108f5bdaf232bfae299fcc5f98cba0ce Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 2 Oct 2024 22:12:45 +0200 Subject: [PATCH] hack: force DMA-BUF heap allocator --- render/allocator/allocator.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/render/allocator/allocator.c b/render/allocator/allocator.c index 27b08fc82..75ee4bd11 100644 --- a/render/allocator/allocator.c +++ b/render/allocator/allocator.c @@ -18,6 +18,8 @@ #include "render/allocator/gbm.h" #endif +#include "render/allocator/dma_heap.h" + void wlr_allocator_init(struct wlr_allocator *alloc, const struct wlr_allocator_interface *impl, uint32_t buffer_caps) { assert(impl && impl->destroy && impl->create_buffer); @@ -96,6 +98,13 @@ struct wlr_allocator *allocator_autocreate_with_drm_fd( int drm_fd) { uint32_t renderer_caps = renderer->render_buffer_caps; + int heap_fd = open("/dev/dma_heap/system", O_RDWR | O_CLOEXEC); + if (heap_fd < 0) { + wlr_log_errno(WLR_ERROR, "Failed to open /dev/dma_heap/system"); + return NULL; + } + return wlr_dma_heap_allocator_create(heap_fd); + struct wlr_allocator *alloc = NULL; uint32_t gbm_caps = WLR_BUFFER_CAP_DMABUF;