[PATCH 1/3] radeon: fix naming clashes with multiple GPUs (v2)

alexdeucher at gmail.com alexdeucher at gmail.com
Wed Jul 31 06:04:02 PDT 2013


From: Alex Deucher <alexander.deucher at amd.com>

The compat naming code for UMS causes problems
with multiple GPU as you may end up with the same
output name on multiple GPUs.

This may break compatibilty with certain old setups
but it's necessary to properly handles multiple GPUs.

v2: integrate Dave's fixes for nouveau

Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 src/drmmode_display.c |   45 +++++++++++++++++----------------------------
 1 files changed, 17 insertions(+), 28 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 3a0187e..5a1876f 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1108,8 +1108,10 @@ const char *output_names[] = { "None",
 			       "eDP"
 };
 
+#define NUM_OUTPUT_NAMES (sizeof(output_names) / sizeof(output_names[0]))
+
 static void
-drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num, int *num_dvi, int *num_hdmi)
+drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
 {
 	RADEONInfoPtr info = RADEONPTR(pScrn);
 	xf86OutputPtr output;
@@ -1137,31 +1139,18 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num, int *num_dv
 		}
 	}
 
-	/* need to do smart conversion here for compat with non-kms ATI driver */
-	if (koutput->connector_type_id == 1) {
-	    switch(koutput->connector_type) {
-	    case DRM_MODE_CONNECTOR_DVII:
-	    case DRM_MODE_CONNECTOR_DVID:
-	    case DRM_MODE_CONNECTOR_DVIA:
-		snprintf(name, 32, "%s-%d", output_names[koutput->connector_type], *num_dvi);
-		(*num_dvi)++;
-		break;
-	    case DRM_MODE_CONNECTOR_HDMIA:
-	    case DRM_MODE_CONNECTOR_HDMIB:
-		snprintf(name, 32, "%s-%d", output_names[koutput->connector_type], *num_hdmi);
-		(*num_hdmi)++;
-		break;
-	    case DRM_MODE_CONNECTOR_VGA:
-	    case DRM_MODE_CONNECTOR_DisplayPort:
-		snprintf(name, 32, "%s-%d", output_names[koutput->connector_type], koutput->connector_type_id - 1);
-		break;
-	    default:
-		snprintf(name, 32, "%s", output_names[koutput->connector_type]);
-		break;
-	    }
-	} else {
-	    snprintf(name, 32, "%s-%d", output_names[koutput->connector_type], koutput->connector_type_id - 1);
-	}
+	if (koutput->connector_type >= NUM_OUTPUT_NAMES)
+		snprintf(name, 32, "Unknown%d-%d", koutput->connector_type,
+			 koutput->connector_type_id);
+#ifdef RADEON_PIXMAP_SHARING
+	else if (pScrn->is_gpu)
+		snprintf(name, 32, "%s-%d-%d",
+			 output_names[koutput->connector_type], pScrn->scrnIndex - GPU_SCREEN_OFFSET + 1,
+			 koutput->connector_type_id);
+#endif
+	else
+		snprintf(name, 32, "%s-%d", output_names[koutput->connector_type],
+			 koutput->connector_type_id - 1);
 
 	if (xf86IsEntityShared(pScrn->entityList[0])) {
 		if ((s = xf86GetOptValString(info->Options, OPTION_ZAPHOD_HEADS))) {
@@ -1627,7 +1616,7 @@ drm_wakeup_handler(pointer data, int err, pointer p)
 
 Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 {
-	int i, num_dvi = 0, num_hdmi = 0;
+	int i;
 
 	xf86CrtcConfigInit(pScrn, &drmmode_xf86crtc_config_funcs);
 
@@ -1643,7 +1632,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 			drmmode_crtc_init(pScrn, drmmode, i);
 
 	for (i = 0; i < drmmode->mode_res->count_connectors; i++)
-		drmmode_output_init(pScrn, drmmode, i, &num_dvi, &num_hdmi);
+		drmmode_output_init(pScrn, drmmode, i);
 
 	/* workout clones */
 	drmmode_clones_init(pScrn, drmmode);
-- 
1.7.7.5



More information about the xorg-driver-ati mailing list