diff options
author | Dave Airlie <airlied@redhat.com> | 2014-11-10 14:17:54 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2014-11-11 08:39:58 +1000 |
commit | c88424d1f4aaa78b569e5d44f0b4a47de2f422f4 (patch) | |
tree | 6c595fcd85e0d026dab98db362386de435d0c15a /src/drmmode_display.c | |
parent | 32b003cb7657e07d5af6338ad44d768eda87fd33 (diff) |
radeon: move output name creation to its own function
The secondary indent is deliberate to make the next patch more
parseable for mst support.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/drmmode_display.c')
-rw-r--r-- | src/drmmode_display.c | 85 |
1 files changed, 47 insertions, 38 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index c69abbf5..dd79db51 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -1195,6 +1195,52 @@ 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 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 - 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 void drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_res, int num, int *num_dvi, int *num_hdmi) { RADEONInfoPtr info = RADEONPTR(pScrn); @@ -1223,44 +1269,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 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 - 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); - } - } + drmmode_create_name(pScrn, koutput, name, num_dvi, num_hdmi); if (xf86IsEntityShared(pScrn->entityList[0])) { if ((s = xf86GetOptValString(info->Options, OPTION_ZAPHOD_HEADS))) { |