From: Michel Dänzer <michel.daenzer@xxxxxxx> Fixes misbehaviour when hotplugging DisplayPort connectors on secondary GPUs. Fixes: 14606e127f4b ("Handle Zaphod mode correctly in amdgpu_mode_hotplug") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98626 (Ported from radeon commit 9760ef33cba5795eddeda4d5c2fcbe2dcce21689) Signed-off-by: Michel Dänzer <michel.daenzer at amd.com> --- src/amdgpu_kms.c | 5 +++++ src/amdgpu_probe.h | 2 ++ src/drmmode_display.c | 23 ++++++++--------------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c index b21cd37..bf9058e 100644 --- a/src/amdgpu_kms.c +++ b/src/amdgpu_kms.c @@ -1313,6 +1313,11 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags) } } + if (info->IsSecondary) + pAMDGPUEnt->secondary_scrn = pScrn; + else + pAMDGPUEnt->primary_scrn = pScrn; + info->PciInfo = xf86GetPciInfoForEntity(info->pEnt->index); pScrn->monitor = pScrn->confScreen->monitor; diff --git a/src/amdgpu_probe.h b/src/amdgpu_probe.h index e6af3a2..802df12 100644 --- a/src/amdgpu_probe.h +++ b/src/amdgpu_probe.h @@ -93,6 +93,8 @@ typedef struct { unsigned long fd_wakeup_registered; /* server generation for which fd has been registered for wakeup handling */ int fd_wakeup_ref; unsigned int assigned_crtcs; + ScrnInfoPtr primary_scrn; + ScrnInfoPtr secondary_scrn; struct xf86_platform_device *platform_dev; } AMDGPUEntRec, *AMDGPUEntPtr; diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 0ca78e0..a75cc5c 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -2402,7 +2402,7 @@ amdgpu_mode_hotplug(ScrnInfoPtr scrn, drmmode_ptr drmmode) xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn); drmModeResPtr mode_res; - int i, j, s; + int i, j; Bool found; Bool changed = FALSE; int num_dvi = 0, num_hdmi = 0; @@ -2439,20 +2439,13 @@ restart_destroy: /* find new output ids we don't have outputs for */ for (i = 0; i < mode_res->count_connectors; i++) { - found = FALSE; - - for (s = 0; !found && s < xf86NumScreens; s++) { - ScrnInfoPtr loop_scrn = xf86Screens[s]; - - if (strcmp(loop_scrn->driverName, scrn->driverName) || - AMDGPUEntPriv(loop_scrn) != pAMDGPUEnt) - continue; - - found = drmmode_find_output(loop_scrn, - mode_res->connectors[i], - &num_dvi, &num_hdmi); - } - if (found) + if (drmmode_find_output(pAMDGPUEnt->primary_scrn, + mode_res->connectors[i], + &num_dvi, &num_hdmi) || + (pAMDGPUEnt->secondary_scrn && + drmmode_find_output(pAMDGPUEnt->secondary_scrn, + mode_res->connectors[i], + &num_dvi, &num_hdmi))) continue; if (drmmode_output_init(scrn, drmmode, mode_res, i, &num_dvi, -- 2.10.2