drm: properly check master node after 05219d5287 (#17)

[LOG] [AQ] reopenDRMNode: drmModeCreateLease failed, falling back to open
[LOG] [AQ] reopenDRMNode: opening node /dev/dri/renderD128
[ERR] [AQ] reopenDRMNode: drmGetMagic failed: Permission denied
This commit is contained in:
Jan Beich 2024-07-16 09:53:50 +00:00 committed by GitHub
parent 1dd44c85e7
commit d6791cc5ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -311,7 +311,7 @@ int Aquamarine::CBackend::reopenDRMNode(int drmFD, bool allowRenderNode) {
free(name); free(name);
// We need to authenticate if we are using a DRM primary node and are the master // We need to authenticate if we are using a DRM primary node and are the master
if (drmIsMaster(drmFD) && drmGetNodeTypeFromFd(drmFD) == DRM_NODE_PRIMARY) { if (drmIsMaster(drmFD) && drmGetNodeTypeFromFd(newFD) == DRM_NODE_PRIMARY) {
drm_magic_t magic; drm_magic_t magic;
if (int ret = drmGetMagic(newFD, &magic); ret < 0) { if (int ret = drmGetMagic(newFD, &magic); ret < 0) {
log(AQ_LOG_ERROR, std::format("reopenDRMNode: drmGetMagic failed: {}", strerror(-ret))); log(AQ_LOG_ERROR, std::format("reopenDRMNode: drmGetMagic failed: {}", strerror(-ret)));
@ -319,7 +319,7 @@ int Aquamarine::CBackend::reopenDRMNode(int drmFD, bool allowRenderNode) {
return -1; return -1;
} }
if (int ret = drmAuthMagic(newFD, magic); ret < 0) { if (int ret = drmAuthMagic(drmFD, magic); ret < 0) {
log(AQ_LOG_ERROR, std::format("reopenDRMNode: drmAuthMagic failed: {}", strerror(-ret))); log(AQ_LOG_ERROR, std::format("reopenDRMNode: drmAuthMagic failed: {}", strerror(-ret)));
close(newFD); close(newFD);
return -1; return -1;