aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/render/allocator.h3
-rw-r--r--render/allocator.c13
2 files changed, 13 insertions, 3 deletions
diff --git a/include/render/allocator.h b/include/render/allocator.h
index 4d8e68f4..4f1cbd0f 100644
--- a/include/render/allocator.h
+++ b/include/render/allocator.h
@@ -46,4 +46,7 @@ struct wlr_buffer *wlr_allocator_create_buffer(struct wlr_allocator *alloc,
void wlr_allocator_init(struct wlr_allocator *alloc,
const struct wlr_allocator_interface *impl);
+struct wlr_allocator *allocator_autocreate_with_drm_fd(
+ struct wlr_backend *backend, struct wlr_renderer *renderer, int drm_fd);
+
#endif
diff --git a/render/allocator.c b/render/allocator.c
index 1c076bfd..46d7b2de 100644
--- a/render/allocator.c
+++ b/render/allocator.c
@@ -18,11 +18,11 @@ void wlr_allocator_init(struct wlr_allocator *alloc,
wl_signal_init(&alloc->events.destroy);
}
-struct wlr_allocator *wlr_allocator_autocreate(struct wlr_backend *backend,
- struct wlr_renderer *renderer) {
+struct wlr_allocator *allocator_autocreate_with_drm_fd(
+ struct wlr_backend *backend, struct wlr_renderer *renderer,
+ int drm_fd) {
uint32_t backend_caps = backend_get_buffer_caps(backend);
uint32_t renderer_caps = renderer_get_render_buffer_caps(renderer);
- int drm_fd = wlr_backend_get_drm_fd(backend);
struct wlr_allocator *alloc = NULL;
uint32_t gbm_caps = WLR_BUFFER_CAP_DMABUF;
@@ -51,6 +51,13 @@ struct wlr_allocator *wlr_allocator_autocreate(struct wlr_backend *backend,
return NULL;
}
+struct wlr_allocator *wlr_allocator_autocreate(struct wlr_backend *backend,
+ struct wlr_renderer *renderer) {
+ // Note, drm_fd may be negative if unavailable
+ int drm_fd = wlr_backend_get_drm_fd(backend);
+ return allocator_autocreate_with_drm_fd(backend, renderer, drm_fd);
+}
+
void wlr_allocator_destroy(struct wlr_allocator *alloc) {
if (alloc == NULL) {
return;