From 3e4456baa41632ca64a4d140729863a49906da54 Mon Sep 17 00:00:00 2001 From: Max Staudt Date: Mon, 7 Nov 2016 12:12:30 +0100 Subject: [PATCH] radeon_mode_hotplug: Discern GPU/non-GPU screens NOTE: This is a DRAFT patch. It does not work because Xorg does not export the symbols xf86NumGPUScreens and xf86GPUScreens. When hot-plugging a display on a dual-Radeon machine machine, the GNOME 3 shell (gnome-shell) will try to reconfigure the screens and either crash or misconfigure the virtual screen. This is because since c801f9f10a5d, radeon_mode_hotplug() walks over the list of all screens, but forgets about GPU-only (hidden) screens. In other words, if radeon_mode_hotplug() is called with a scrn that has scrn->is_gpu set, the loop over xf86Screens will never find it. This patch takes note of whether scrn->is_gpu is set, and looks for scrn in the correct list. --- src/drmmode_display.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 44615d3..374d76e 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -2621,9 +2621,13 @@ restart_destroy: /* find new output ids we don't have outputs for */ for (i = 0; i < mode_res->count_connectors; i++) { found = FALSE; + int numScreens = scrn->is_gpu ? xf86NumGPUScreens + : xf86NumScreens; + ScrnInfoPtr *screenList = scrn->is_gpu ? xf86GPUScreens[s] + : xf86Screens[s]; - for (s = 0; !found && s < xf86NumScreens; s++) { - ScrnInfoPtr loop_scrn = xf86Screens[s]; + for (s = 0; !found && s < numScreens; s++) { + ScrnInfoPtr loop_scrn = screenList[s]; xf86CrtcConfigPtr loop_config = XF86_CRTC_CONFIG_PTR(loop_scrn); -- 2.6.6