mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 14:45:58 +01:00
render/allocator: use legacy authentication for primary nodes
Closes: https://github.com/swaywm/wlroots/issues/3156
This commit is contained in:
parent
00c2bae1d3
commit
7df2ae88fa
1 changed files with 23 additions and 0 deletions
|
@ -35,8 +35,31 @@ static int reopen_drm_node(int drm_fd) {
|
||||||
int new_fd = open(name, O_RDWR | O_CLOEXEC);
|
int new_fd = open(name, O_RDWR | O_CLOEXEC);
|
||||||
if (new_fd < 0) {
|
if (new_fd < 0) {
|
||||||
wlr_log_errno(WLR_ERROR, "Failed to open DRM node '%s'", name);
|
wlr_log_errno(WLR_ERROR, "Failed to open DRM node '%s'", name);
|
||||||
}
|
|
||||||
free(name);
|
free(name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(name);
|
||||||
|
|
||||||
|
// If we're using a DRM primary node (e.g. because we're running under the
|
||||||
|
// DRM backend, or because we're on split render/display machine), we need
|
||||||
|
// to use the legacy DRM authentication mechanism to have the permission to
|
||||||
|
// manipulate buffers.
|
||||||
|
if (drmGetNodeTypeFromFd(new_fd) == DRM_NODE_PRIMARY) {
|
||||||
|
drm_magic_t magic;
|
||||||
|
if (drmGetMagic(new_fd, &magic) < 0) {
|
||||||
|
wlr_log_errno(WLR_ERROR, "drmGetMagic failed");
|
||||||
|
close(new_fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drmAuthMagic(drm_fd, magic) < 0) {
|
||||||
|
wlr_log_errno(WLR_ERROR, "drmAuthMagic failed");
|
||||||
|
close(new_fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new_fd;
|
return new_fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue