aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-04-29 09:48:33 +0200
committerSimon Ser <contact@emersion.fr>2021-04-29 15:58:56 +0200
commit5be76bb047f7260882ba7930eebfe709950536ee (patch)
treedc6ae2ed5acf15a22d822d4922d249b23b3059e0 /render
parent619a9750251a1bff5bef7a1bcd22ee80a56a453f (diff)
render/allocator: add allocator_autocreate_with_drm_fd
Same as wlr_allocator_autocreate, but allows the caller to force a DRM FD. Similar to renderer_autocreate_with_drm_fd.
Diffstat (limited to 'render')
-rw-r--r--render/allocator.c13
1 files changed, 10 insertions, 3 deletions
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;