From b868c0fb32bd61bad57ad2a3b7288f06d11d1b0ade1a1b721938ca631526e1b3 Mon Sep 17 00:00:00 2001 From: Max Staudt Date: Thu, 10 Nov 2016 11:31:07 +0000 Subject: [PATCH] Accepting request 439508 from home:mstaudt:branches:X11:XOrg - U_21-Refactor-radeon_mode_hotplug.patch U_22-Use-pRADEONEnt-to-find-both-screens-of-a-GPU-in-radeon_mode_hotplug.patch Fix enumeration of connectors per GPU (bsc#1008200). OBS-URL: https://build.opensuse.org/request/show/439508 OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xf86-video-ati?expand=0&rev=54 --- U_21-Refactor-radeon_mode_hotplug.patch | 97 +++++++++++++++++++ ...eens-of-a-GPU-in-radeon_mode_hotplug.patch | 91 +++++++++++++++++ xf86-video-ati.changes | 8 ++ xf86-video-ati.spec | 4 + 4 files changed, 200 insertions(+) create mode 100644 U_21-Refactor-radeon_mode_hotplug.patch create mode 100644 U_22-Use-pRADEONEnt-to-find-both-screens-of-a-GPU-in-radeon_mode_hotplug.patch diff --git a/U_21-Refactor-radeon_mode_hotplug.patch b/U_21-Refactor-radeon_mode_hotplug.patch new file mode 100644 index 0000000..dd96212 --- /dev/null +++ b/U_21-Refactor-radeon_mode_hotplug.patch @@ -0,0 +1,97 @@ +From: Michel Dänzer +Date: Tue Nov 8 13:01:58 2016 +0900 +Subject: [PATCH 1/2]Refactor radeon_mode_hotplug +Patch-mainline: Upstream +Git-repo: git://anongit.freedesktop.org/xorg/driver/xf86-video-ati +Git-commit: 35bec4937d89b48a79acfcb4f814b7370cb631b2 +References: bsc#1008200 +Signed-off-by: Max Staudt + +Preparation for the next change, no functional change intended. + +Reviewed-by: Alex Deucher +--- + src/drmmode_display.c | 58 ++++++++++++++++++++++++++++++--------------------- + 1 file changed, 34 insertions(+), 24 deletions(-) + +diff --git a/src/drmmode_display.c b/src/drmmode_display.c +index 44615d3..574003c 100644 +--- a/src/drmmode_display.c ++++ b/src/drmmode_display.c +@@ -2577,6 +2577,37 @@ Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn) + return TRUE; + } + ++static Bool ++drmmode_find_output(ScrnInfoPtr scrn, int output_id, int *num_dvi, ++ int *num_hdmi) ++{ ++ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); ++ int i; ++ ++ for (i = 0; i < config->num_output; i++) { ++ xf86OutputPtr output = config->output[i]; ++ drmmode_output_private_ptr drmmode_output = output->driver_private; ++ ++ if (drmmode_output->output_id == output_id) { ++ switch(drmmode_output->mode_output->connector_type) { ++ case DRM_MODE_CONNECTOR_DVII: ++ case DRM_MODE_CONNECTOR_DVID: ++ case DRM_MODE_CONNECTOR_DVIA: ++ (*num_dvi)++; ++ break; ++ case DRM_MODE_CONNECTOR_HDMIA: ++ case DRM_MODE_CONNECTOR_HDMIB: ++ (*num_hdmi)++; ++ break; ++ } ++ ++ return TRUE; ++ } ++ } ++ ++ return FALSE; ++} ++ + void + radeon_mode_hotplug(ScrnInfoPtr scrn, drmmode_ptr drmmode) + { +@@ -2624,35 +2655,14 @@ restart_destroy: + + for (s = 0; !found && s < xf86NumScreens; s++) { + ScrnInfoPtr loop_scrn = xf86Screens[s]; +- xf86CrtcConfigPtr loop_config = +- XF86_CRTC_CONFIG_PTR(loop_scrn); + + if (strcmp(loop_scrn->driverName, scrn->driverName) || + RADEONEntPriv(loop_scrn) != pRADEONEnt) + continue; + +- for (j = 0; !found && j < loop_config->num_output; j++) { +- xf86OutputPtr output = loop_config->output[j]; +- drmmode_output_private_ptr drmmode_output; +- +- drmmode_output = output->driver_private; +- if (mode_res->connectors[i] == +- drmmode_output->output_id) { +- found = TRUE; +- +- switch(drmmode_output->mode_output->connector_type) { +- case DRM_MODE_CONNECTOR_DVII: +- case DRM_MODE_CONNECTOR_DVID: +- case DRM_MODE_CONNECTOR_DVIA: +- num_dvi++; +- break; +- case DRM_MODE_CONNECTOR_HDMIA: +- case DRM_MODE_CONNECTOR_HDMIB: +- num_hdmi++; +- break; +- } +- } +- } ++ found = drmmode_find_output(loop_scrn, ++ mode_res->connectors[i], ++ &num_dvi, &num_hdmi); + } + if (found) + continue; diff --git a/U_22-Use-pRADEONEnt-to-find-both-screens-of-a-GPU-in-radeon_mode_hotplug.patch b/U_22-Use-pRADEONEnt-to-find-both-screens-of-a-GPU-in-radeon_mode_hotplug.patch new file mode 100644 index 0000000..e182829 --- /dev/null +++ b/U_22-Use-pRADEONEnt-to-find-both-screens-of-a-GPU-in-radeon_mode_hotplug.patch @@ -0,0 +1,91 @@ +From: Michel Dänzer +Date: Tue Nov 8 13:02:43 2016 +0900 +Subject: [PATCH 2/2]Use pRADEONEnt to find both screens of a GPU in radeon_mode_hotplug +Patch-mainline: Upstream +Git-repo: git://anongit.freedesktop.org/xorg/driver/xf86-video-ati +Git-commit: 9760ef33cba5795eddeda4d5c2fcbe2dcce21689 +References: bsc#1008200 +Signed-off-by: Max Staudt + +Fixes misbehaviour when hotplugging DisplayPort connectors on secondary +GPUs. + +Fixes: c801f9f10a5d ("Handle Zaphod mode correctly in radeon_mode_hotplug") +Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98626 +Reviewed-by: Alex Deucher +--- + src/drmmode_display.c | 23 ++++++++--------------- + src/radeon_kms.c | 5 +++++ + src/radeon_probe.h | 2 ++ + 3 files changed, 15 insertions(+), 15 deletions(-) + +diff --git a/src/drmmode_display.c b/src/drmmode_display.c +index 574003c..4eb7b77 100644 +--- a/src/drmmode_display.c ++++ b/src/drmmode_display.c +@@ -2614,7 +2614,7 @@ radeon_mode_hotplug(ScrnInfoPtr scrn, drmmode_ptr drmmode) + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn); + drmModeResPtr mode_res; +- int i, j, s; ++ int i, j; + Bool found; + Bool changed = FALSE; + int num_dvi = 0, num_hdmi = 0; +@@ -2651,20 +2651,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) || +- RADEONEntPriv(loop_scrn) != pRADEONEnt) +- continue; +- +- found = drmmode_find_output(loop_scrn, +- mode_res->connectors[i], +- &num_dvi, &num_hdmi); +- } +- if (found) ++ if (drmmode_find_output(pRADEONEnt->primary_scrn, ++ mode_res->connectors[i], ++ &num_dvi, &num_hdmi) || ++ (pRADEONEnt->secondary_scrn && ++ drmmode_find_output(pRADEONEnt->secondary_scrn, ++ mode_res->connectors[i], ++ &num_dvi, &num_hdmi))) + continue; + + if (drmmode_output_init(scrn, drmmode, mode_res, i, &num_dvi, +diff --git a/src/radeon_kms.c b/src/radeon_kms.c +index 9bcf657..d4399b8 100644 +--- a/src/radeon_kms.c ++++ b/src/radeon_kms.c +@@ -1638,6 +1638,11 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags) + } + } + ++ if (info->IsSecondary) ++ pRADEONEnt->secondary_scrn = pScrn; ++ else ++ pRADEONEnt->primary_scrn = pScrn; ++ + info->PciInfo = xf86GetPciInfoForEntity(info->pEnt->index); + pScrn->monitor = pScrn->confScreen->monitor; + +diff --git a/src/radeon_probe.h b/src/radeon_probe.h +index 258c7be..573d988 100644 +--- a/src/radeon_probe.h ++++ b/src/radeon_probe.h +@@ -139,6 +139,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; + #ifdef XSERVER_PLATFORM_BUS + struct xf86_platform_device *platform_dev; + #endif diff --git a/xf86-video-ati.changes b/xf86-video-ati.changes index dc063b0..d045a72 100644 --- a/xf86-video-ati.changes +++ b/xf86-video-ati.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Nov 10 11:21:31 UTC 2016 - mstaudt@suse.com + +- U_21-Refactor-radeon_mode_hotplug.patch + U_22-Use-pRADEONEnt-to-find-both-screens-of-a-GPU-in-radeon_mode_hotplug.patch + + Fix enumeration of connectors per GPU (bsc#1008200). + ------------------------------------------------------------------- Fri Oct 14 15:12:36 UTC 2016 - mstaudt@suse.com diff --git a/xf86-video-ati.spec b/xf86-video-ati.spec index f110536..90cd485 100644 --- a/xf86-video-ati.spec +++ b/xf86-video-ati.spec @@ -48,6 +48,8 @@ Patch17: U_17-Factor-out-transform_region-helper.patch Patch18: U_18-Move-up-radeon_scanout_extents_intersect.patch Patch19: U_19-Synchronize-scanout-pixmaps-for-TearFree.patch Patch20: U_20-Make-TearFree-effective-with-PRIME-slave-scanout.patch +Patch21: U_21-Refactor-radeon_mode_hotplug.patch +Patch22: U_22-Use-pRADEONEnt-to-find-both-screens-of-a-GPU-in-radeon_mode_hotplug.patch BuildRequires: Mesa-devel BuildRequires: autoconf >= 2.60 @@ -109,6 +111,8 @@ driver as appropriate. %patch18 -p1 %patch19 -p1 %patch20 -p1 +%patch21 -p1 +%patch22 -p1 %build autoreconf -fiv