[PATCH] modesetting: fail PreInit() if the device has zero connectors
tobias.jakobi1 at uni-bielefeld.de
tobias.jakobi1 at uni-bielefeld.de
Fri Oct 20 17:08:50 UTC 2017
On laptop systems with a dedicated (powerful) GPU A, you usually
have all connectors routed to another (less-powerful) GPU B.
With my setup (GPU A = Nvidia, GPU B = Intel) I keep GPU A switched
off by not loading the nouveau kernel driver during boot.
Loading nouveau while X is running then crashes the server:
[ 540.775] (EE) 0: /usr/bin/X (xorg_backtrace+0x41) [0x57fa31]
[ 540.775] (EE) 1: /usr/bin/X (0x400000+0x183429) [0x583429]
[ 540.775] (EE) 2: /lib64/libpthread.so.0 (0x7ff02d508000+0x10ec0) [0x7ff02d518ec0]
[ 540.775] (EE) 3: /lib64/libc.so.6 (gsignal+0x38) [0x7ff02d1a2178]
[ 540.775] (EE) 4: /lib64/libc.so.6 (abort+0x16a) [0x7ff02d1a35fa]
[ 540.775] (EE) 5: /lib64/libc.so.6 (0x7ff02d16f000+0x2c0b7) [0x7ff02d19b0b7]
[ 540.775] (EE) 6: /lib64/libc.so.6 (0x7ff02d16f000+0x2c162) [0x7ff02d19b162]
[ 540.775] (EE) 7: /usr/bin/X (dixRegisterPrivateKey+0x247) [0x452197]
[ 540.775] (EE) 8: /usr/lib64/xorg/modules/libglamoregl.so (glamor_init+0x160) [0x7ff00ee564d0]
[ 540.775] (EE) 9: /usr/lib64/xorg/modules/drivers/modesetting_drv.so (0x7ff01c19a000+0x83e1) [0x7ff01c1a23e1]
[ 540.775] (EE) 10: /usr/bin/X (AddGPUScreen+0xf3) [0x4348b3]
[ 540.775] (EE) 11: /usr/bin/X (0x400000+0x90271) [0x490271]
[ 540.775] (EE) 12: /usr/bin/X (0x400000+0x9547b) [0x49547b]
[ 540.775] (EE) 13: /usr/bin/X (0x400000+0x905d7) [0x4905d7]
[ 540.775] (EE) 14: /usr/bin/X (xf86VTEnter+0x1bb) [0x47399b]
[ 540.775] (EE) 15: /usr/bin/X (WakeupHandler+0xda) [0x438e3a]
[ 540.775] (EE) 16: /usr/bin/X (WaitForSomething+0x1ce) [0x57d6fe]
[ 540.775] (EE) 17: /usr/bin/X (0x400000+0x34221) [0x434221]
[ 540.775] (EE) 18: /usr/bin/X (0x400000+0x382f8) [0x4382f8]
[ 540.775] (EE) 19: /lib64/libc.so.6 (__libc_start_main+0xf0) [0x7ff02d18f670]
[ 540.776] (EE) 20: /usr/bin/X (_start+0x29) [0x4235b9]
In particular note that GLAMOR is initialized for GPU A, which
makes no sense since it has no connectors.
Fix this by bailing out early in the modesetting DDX when a setup
with zero connectors is detected.
Signed-off-by: Tobias Jakobi <tjakobi at math.uni-bielefeld.de>
---
hw/xfree86/drivers/modesetting/driver.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index 9afb344c8..8a5f63685 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -920,6 +920,12 @@ PreInit(ScrnInfoPtr pScrn, int flags)
if (!check_outputs(ms->fd, &connector_count))
return FALSE;
+ if (!connector_count) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Device is headless (no connectors available)\n");
+ return FALSE;
+ }
+
drmmode_get_default_bpp(pScrn, &ms->drmmode, &defaultdepth, &defaultbpp);
if (defaultdepth == 24 && defaultbpp == 24) {
ms->drmmode.force_24_32 = TRUE;
--
2.13.6
More information about the xorg-devel
mailing list