Use pAMDGPUEnt to find both screens of a GPU in amdgpu_mode_hotplug

Fixes misbehaviour when hotplugging DisplayPort connectors on secondary
GPUs.

Fixes: 14606e127f ("Handle Zaphod mode correctly in amdgpu_mode_hotplug")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98626
(Ported from radeon commit 9760ef33cba5795eddeda4d5c2fcbe2dcce21689)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Michel Dänzer
2016-11-10 12:30:10 +09:00
committed by Michel Dänzer
parent 257be5b085
commit 24e36c7044
3 changed files with 15 additions and 15 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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,