diff options
author | Simon Ser <contact@emersion.fr> | 2021-05-31 21:39:37 +0200 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-05-31 15:50:13 -0400 |
commit | 5c30cf3d9441f7121acadd834ac610bff610eca1 (patch) | |
tree | 5deaae341a3e856462d441cc799690a81c396acd | |
parent | 6605d7c390279faa77f959bc3ad83148226daea8 (diff) |
render/drm_dumb_allocator: check for DRM master
If we aren't the DRM master, allocating dumb buffers will fail with
EPERM.
-rw-r--r-- | render/drm_dumb_allocator.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/render/drm_dumb_allocator.c b/render/drm_dumb_allocator.c index 0bb642ca..c0605593 100644 --- a/render/drm_dumb_allocator.c +++ b/render/drm_dumb_allocator.c @@ -195,6 +195,11 @@ static const struct wlr_allocator_interface allocator_impl = { }; struct wlr_allocator *wlr_drm_dumb_allocator_create(int fd) { + if (!drmIsMaster(fd)) { + wlr_log(WLR_ERROR, "Cannot use DRM dumb buffers with non-master DRM FD"); + return NULL; + } + /* 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, |