allocator: only use DRM auth if we are master

Legacy DRM auth will only work if we are DRM master. Keep using an
unauthenticated DRM FD if we are not DRM master. This should be
enough for GBM.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3674
This commit is contained in:
Simon Ser 2023-06-19 11:43:04 +02:00 committed by Alexander Orzechowski
parent e8887f76ed
commit be73da28b2
1 changed files with 5 additions and 5 deletions

View File

@ -69,11 +69,11 @@ static int reopen_drm_node(int drm_fd, bool allow_render_node) {
free(name); free(name);
// If we're using a DRM primary node (e.g. because we're running under the // If we're using a DRM primary node and we are DRM master (e.g. because
// DRM backend, or because we're on split render/display machine), we need // we're running under the DRM backend), we need to use the legacy DRM
// to use the legacy DRM authentication mechanism to have the permission to // authentication mechanism to have the permission to manipulate DRM dumb
// manipulate buffers. // buffers.
if (drmGetNodeTypeFromFd(new_fd) == DRM_NODE_PRIMARY) { if (drmIsMaster(drm_fd) && drmGetNodeTypeFromFd(new_fd) == DRM_NODE_PRIMARY) {
drm_magic_t magic; drm_magic_t magic;
if (drmGetMagic(new_fd, &magic) < 0) { if (drmGetMagic(new_fd, &magic) < 0) {
wlr_log_errno(WLR_ERROR, "drmGetMagic failed"); wlr_log_errno(WLR_ERROR, "drmGetMagic failed");