render/allocator: re-open GBM FD

Using the same DRM file description for the DRM backend and for the
GBM allocator will result in GEM handle ref'counting issues [1].
Re-open the DRM FD to fix these issues.

[1]: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/110
This commit is contained in:
Simon Ser 2021-09-01 19:05:18 +02:00 committed by Simon Zeni
parent c8d97e2791
commit d9d8fc1ab9
3 changed files with 42 additions and 32 deletions

View file

@ -163,13 +163,7 @@ static struct wlr_gbm_allocator *get_gbm_alloc_from_alloc(
return (struct wlr_gbm_allocator *)alloc;
}
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;
}
struct wlr_allocator *wlr_gbm_allocator_create(int fd) {
uint64_t cap;
if (drmGetCap(fd, DRM_CAP_PRIME, &cap) ||
!(cap & DRM_PRIME_CAP_EXPORT)) {