Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

render/allocator: re-open GBM FD #3153

Merged
merged 1 commit into from
Sep 1, 2021

Conversation

emersion
Copy link
Member

@emersion emersion commented Sep 1, 2021

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.

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
Copy link
Contributor

@subdiff subdiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. You're moving out functionality from wlr_drm_dumb_allocator_create into the reopen_drm_node as you wanna reuse it for the wlr_gbm_allocator_create case in the allocator_autocreate_with_drm_fd call too.

@bl4ckb0ne
Copy link
Contributor

LGTM

@bl4ckb0ne bl4ckb0ne merged commit d9d8fc1 into swaywm:master Sep 1, 2021
@emersion emersion deleted the reopen-allocator-fd branch September 1, 2021 20:03
/* Re-open the DRM node to avoid GEM handle ref'counting issues. See:
* https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/110
* TODO: don't assume we have the permission to just open the DRM node,
* find another way to re-open it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does dup(2) work or do we have to reopen by name?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately dup(2) doesn't work here, because the GEM handlers are per file description. dup(2) only gives a new file descriptor, but shares the same file description on the kernel side. See the linked libdrm discussion above.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants