Commit 7801afdd authored by Nerdopolis Turfwalker's avatar Nerdopolis Turfwalker Committed by Martin Flöser
Browse files

udev: Add the ability to query the current framebuffer.

This adds the ability for kwin's udev handler to detect a usable framebuffer device.
This is very similar to the function that queries the primary GPU.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: rkflx, kwin

Tags: #kwin

Differential Revision:
parent d318cb3b
......@@ -178,6 +178,28 @@ UdevDevice::Ptr Udev::renderNode()
UdevDevice::Ptr Udev::primaryFramebuffer()
if (!m_udev) {
return UdevDevice::Ptr();
UdevEnumerate enumerate(this);
enumerate.addMatch(UdevEnumerate::Match::SubSystem, "graphics");
enumerate.addMatch(UdevEnumerate::Match::SysName, "fb[0-9]*");
return enumerate.find([](const UdevDevice::Ptr &device) {
auto pci = device->getParentWithSubsystemDevType("pci");
if (!pci) {
return false;
const char *systAttrValue = udev_device_get_sysattr_value(pci, "boot_vga");
if (systAttrValue && qstrcmp(systAttrValue, "1") == 0) {
return true;
return false;
UdevDevice::Ptr Udev::deviceFromSyspath(const char *syspath)
return UdevDevice::Ptr(new UdevDevice(udev_device_new_from_syspath(m_udev, syspath)));
......@@ -82,6 +82,7 @@ public:
return m_udev != nullptr;
UdevDevice::Ptr primaryGpu();
UdevDevice::Ptr primaryFramebuffer();
UdevDevice::Ptr virtualGpu();
UdevDevice::Ptr renderNode();
UdevDevice::Ptr deviceFromSyspath(const char *syspath);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment