aboutsummaryrefslogtreecommitdiff
path: root/render/gbm_allocator.c
diff options
context:
space:
mode:
Diffstat (limited to 'render/gbm_allocator.c')
-rw-r--r--render/gbm_allocator.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/render/gbm_allocator.c b/render/gbm_allocator.c
index 33fbf954..4006b66d 100644
--- a/render/gbm_allocator.c
+++ b/render/gbm_allocator.c
@@ -159,7 +159,13 @@ static struct wlr_gbm_allocator *get_gbm_alloc_from_alloc(
return (struct wlr_gbm_allocator *)alloc;
}
-struct wlr_allocator *wlr_gbm_allocator_create(int fd) {
+struct wlr_allocator *wlr_gbm_allocator_create(int drm_fd) {
+ int fd = fcntl(drm_fd, F_DUPFD_CLOEXEC, 0);
+ if (fd < 0) {
+ wlr_log(WLR_ERROR, "fcntl(F_DUPFD_CLOEXEC) failed");
+ return NULL;
+ }
+
uint64_t cap;
if (drmGetCap(fd, DRM_CAP_PRIME, &cap) ||
!(cap & DRM_PRIME_CAP_EXPORT)) {