Changeset View
Changeset View
Standalone View
Standalone View
udev.cpp
Show First 20 Lines • Show All 133 Lines • ▼ Show 20 Line(s) | 106 | { | |||
---|---|---|---|---|---|
134 | return firstFound; | 134 | return firstFound; | ||
135 | } | 135 | } | ||
136 | 136 | | |||
137 | UdevDevice::Ptr Udev::primaryGpu() | 137 | UdevDevice::Ptr Udev::primaryGpu() | ||
138 | { | 138 | { | ||
139 | if (!m_udev) { | 139 | if (!m_udev) { | ||
140 | return UdevDevice::Ptr(); | 140 | return UdevDevice::Ptr(); | ||
141 | } | 141 | } | ||
142 | #if defined(Q_OS_FREEBSD) | ||||
143 | return deviceFromSyspath("/dev/dri/card0"); | ||||
144 | #else | ||||
142 | UdevEnumerate enumerate(this); | 145 | UdevEnumerate enumerate(this); | ||
143 | enumerate.addMatch(UdevEnumerate::Match::SubSystem, "drm"); | 146 | enumerate.addMatch(UdevEnumerate::Match::SubSystem, "drm"); | ||
144 | enumerate.addMatch(UdevEnumerate::Match::SysName, "card[0-9]*"); | 147 | enumerate.addMatch(UdevEnumerate::Match::SysName, "card[0-9]*"); | ||
145 | enumerate.scan(); | 148 | enumerate.scan(); | ||
146 | return enumerate.find([](const UdevDevice::Ptr &device) { | 149 | return enumerate.find([](const UdevDevice::Ptr &device) { | ||
147 | auto pci = device->getParentWithSubsystemDevType("pci"); | 150 | auto pci = device->getParentWithSubsystemDevType("pci"); | ||
148 | if (!pci) { | 151 | if (!pci) { | ||
149 | return false; | 152 | return false; | ||
150 | } | 153 | } | ||
151 | const char *systAttrValue = udev_device_get_sysattr_value(pci, "boot_vga"); | 154 | const char *systAttrValue = udev_device_get_sysattr_value(pci, "boot_vga"); | ||
152 | if (systAttrValue && qstrcmp(systAttrValue, "1") == 0) { | 155 | if (systAttrValue && qstrcmp(systAttrValue, "1") == 0) { | ||
153 | return true; | 156 | return true; | ||
154 | } | 157 | } | ||
155 | return false; | 158 | return false; | ||
156 | }); | 159 | }); | ||
160 | #endif | ||||
157 | } | 161 | } | ||
158 | 162 | | |||
159 | UdevDevice::Ptr Udev::virtualGpu() | 163 | UdevDevice::Ptr Udev::virtualGpu() | ||
160 | { | 164 | { | ||
161 | if (!m_udev) { | 165 | if (!m_udev) { | ||
162 | return UdevDevice::Ptr(); | 166 | return UdevDevice::Ptr(); | ||
163 | } | 167 | } | ||
164 | UdevEnumerate enumerate(this); | 168 | UdevEnumerate enumerate(this); | ||
▲ Show 20 Lines • Show All 159 Lines • Show Last 20 Lines |