aboutsummaryrefslogtreecommitdiff
path: root/render/allocator/allocator.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-05-29 14:09:06 +0200
committerSimon Zeni <simon@bl4ckb0ne.ca>2022-05-30 13:30:08 +0000
commitbb2946f7377b9e71c15457e93f6f9a34712b77de (patch)
tree5d3418525e4f87c1e77826bd96fc93a151384254 /render/allocator/allocator.c
parentd483dd2f4caeeab97de97c4e8215f084945de63c (diff)
build: make GBM optional
Now that the DRM backend no longer depends on GBM, we can make it optional. The GLES2 renderer still depends on it because of our EGL device selection. This is useful for compositors with their own renderers, and for compositors using the Vulkan renderer.
Diffstat (limited to 'render/allocator/allocator.c')
-rw-r--r--render/allocator/allocator.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/render/allocator/allocator.c b/render/allocator/allocator.c
index 83e836ae..6b96e023 100644
--- a/render/allocator/allocator.c
+++ b/render/allocator/allocator.c
@@ -3,6 +3,7 @@
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
+#include <wlr/config.h>
#include <wlr/interfaces/wlr_buffer.h>
#include <wlr/render/allocator.h>
#include <wlr/util/log.h>
@@ -11,10 +12,13 @@
#include "backend/backend.h"
#include "render/allocator/allocator.h"
#include "render/allocator/drm_dumb.h"
-#include "render/allocator/gbm.h"
#include "render/allocator/shm.h"
#include "render/wlr_renderer.h"
+#if WLR_HAS_GBM_ALLOCATOR
+#include "render/allocator/gbm.h"
+#endif
+
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);
@@ -94,6 +98,8 @@ struct wlr_allocator *allocator_autocreate_with_drm_fd(
uint32_t renderer_caps = renderer_get_render_buffer_caps(renderer);
struct wlr_allocator *alloc = NULL;
+
+#if WLR_HAS_GBM_ALLOCATOR
uint32_t gbm_caps = WLR_BUFFER_CAP_DMABUF;
if ((backend_caps & gbm_caps) && (renderer_caps & gbm_caps)
&& drm_fd >= 0) {
@@ -108,6 +114,7 @@ struct wlr_allocator *allocator_autocreate_with_drm_fd(
close(gbm_fd);
wlr_log(WLR_DEBUG, "Failed to create gbm allocator");
}
+#endif
uint32_t shm_caps = WLR_BUFFER_CAP_SHM | WLR_BUFFER_CAP_DATA_PTR;
if ((backend_caps & shm_caps) && (renderer_caps & shm_caps)) {