mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-10 23:25:57 +01:00
fix possible crash 3
This commit is contained in:
parent
78d11c456a
commit
aa1ebc51fc
2 changed files with 12 additions and 11 deletions
|
@ -425,8 +425,8 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
|
||||||
auto dev = devIDFromFD(rendererFD);
|
auto dev = devIDFromFD(rendererFD);
|
||||||
|
|
||||||
if (!dev.has_value()) {
|
if (!dev.has_value()) {
|
||||||
LOGM(ERR, "failed to get drm dev");
|
protoLog(ERR, "failed to get drm dev, disabling linux dmabuf");
|
||||||
PROTO::linuxDma.reset();
|
removeGlobal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,8 +477,8 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
|
||||||
|
|
||||||
drmDevice* device = nullptr;
|
drmDevice* device = nullptr;
|
||||||
if (drmGetDeviceFromDevId(mainDevice, 0, &device) != 0) {
|
if (drmGetDeviceFromDevId(mainDevice, 0, &device) != 0) {
|
||||||
LOGM(ERR, "failed to get drm dev");
|
protoLog(ERR, "failed to get drm dev, disabling linux dmabuf");
|
||||||
PROTO::linuxDma.reset();
|
removeGlobal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,13 +487,14 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
|
||||||
mainDeviceFD = open(name, O_RDWR | O_CLOEXEC);
|
mainDeviceFD = open(name, O_RDWR | O_CLOEXEC);
|
||||||
drmFreeDevice(&device);
|
drmFreeDevice(&device);
|
||||||
if (mainDeviceFD < 0) {
|
if (mainDeviceFD < 0) {
|
||||||
LOGM(ERR, "failed to open drm dev");
|
protoLog(ERR, "failed to open drm dev, disabling linux dmabuf");
|
||||||
PROTO::linuxDma.reset();
|
removeGlobal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOGM(ERR, "DRM device {} has no render node!!", device->nodes[DRM_NODE_PRIMARY] ? device->nodes[DRM_NODE_PRIMARY] : "null");
|
protoLog(ERR, "DRM device {} has no render node, disabling linux dmabuf", device->nodes[DRM_NODE_PRIMARY] ? device->nodes[DRM_NODE_PRIMARY] : "null");
|
||||||
drmFreeDevice(&device);
|
drmFreeDevice(&device);
|
||||||
|
removeGlobal();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,8 +115,8 @@ CMesaDRMProtocol::CMesaDRMProtocol(const wl_interface* iface, const int& ver, co
|
||||||
drmDevice* dev = nullptr;
|
drmDevice* dev = nullptr;
|
||||||
int drmFD = g_pCompositor->m_iDRMFD;
|
int drmFD = g_pCompositor->m_iDRMFD;
|
||||||
if (drmGetDevice2(drmFD, 0, &dev) != 0) {
|
if (drmGetDevice2(drmFD, 0, &dev) != 0) {
|
||||||
LOGM(ERR, "Failed to get device");
|
protoLog(ERR, "Failed to get device, disabling MesaDRM");
|
||||||
PROTO::mesaDRM.reset();
|
removeGlobal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,13 +126,13 @@ CMesaDRMProtocol::CMesaDRMProtocol(const wl_interface* iface, const int& ver, co
|
||||||
ASSERT(dev->available_nodes & (1 << DRM_NODE_PRIMARY));
|
ASSERT(dev->available_nodes & (1 << DRM_NODE_PRIMARY));
|
||||||
|
|
||||||
if (!dev->nodes[DRM_NODE_PRIMARY]) {
|
if (!dev->nodes[DRM_NODE_PRIMARY]) {
|
||||||
LOGM(ERR, "No DRM render node available, both render and primary are null, disabling MesaDRM");
|
protoLog(ERR, "No DRM render node available, both render and primary are null, disabling MesaDRM");
|
||||||
drmFreeDevice(&dev);
|
drmFreeDevice(&dev);
|
||||||
removeGlobal();
|
removeGlobal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGM(WARN, "No DRM render node, falling back to primary {}", dev->nodes[DRM_NODE_PRIMARY]);
|
protoLog(WARN, "No DRM render node, falling back to primary {}", dev->nodes[DRM_NODE_PRIMARY]);
|
||||||
nodeName = dev->nodes[DRM_NODE_PRIMARY];
|
nodeName = dev->nodes[DRM_NODE_PRIMARY];
|
||||||
}
|
}
|
||||||
drmFreeDevice(&dev);
|
drmFreeDevice(&dev);
|
||||||
|
|
Loading…
Reference in a new issue