Commit aee72b29 authored by Tom Denis's avatar Tom Denis Committed by Michel Dänzer
Browse files

move output name creation to its own function



Based on radeon commit c88424d1f4aaa78b569e5d44f0b4a47de2f422f4

> The secondary indent is deliberate to make the next patch more
> parseable for mst support.
Signed-off-by: Tom Denis's avatarTom St Denis <tom.stdenis@amd.com>
Reviewed-by: Michel Dänzer's avatarMichel Dänzer <michel.daenzer@amd.com>
parent 0846abea
......@@ -1337,6 +1337,47 @@ const char *output_names[] = { "None",
#define NUM_OUTPUT_NAMES (sizeof(output_names) / sizeof(output_names[0]))
static void
drmmode_create_name(ScrnInfoPtr pScrn, drmModeConnectorPtr koutput, char *name,
int *num_dvi, int *num_hdmi)
{
if (koutput->connector_type >= NUM_OUTPUT_NAMES)
snprintf(name, 32, "Unknown%d-%d", koutput->connector_type, koutput->connector_type_id - 1);
#ifdef AMDGPU_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 - 1);
#endif
else {
/* 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);
}
}
}
static unsigned int
drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_res, int num, int *num_dvi, int *num_hdmi)
{
......@@ -1369,20 +1410,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
}
}
if (koutput->connector_type >= NUM_OUTPUT_NAMES)
snprintf(name, 32, "Unknown%d-%d", koutput->connector_type,
koutput->connector_type_id - 1);
#ifdef AMDGPU_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 - 1);
#endif
else
snprintf(name, 32, "%s-%d",
output_names[koutput->connector_type],
koutput->connector_type_id - 1);
drmmode_create_name(pScrn, koutput, name, num_dvi, num_hdmi);
if (xf86IsEntityShared(pScrn->entityList[0])) {
if ((s =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment