modesetting: add virtual connector support

[airlied: also make sure we don't crash in future.]

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Alon Levy 2012-08-28 11:46:47 +10:00 committed by Dave Airlie
parent 5eb697d88f
commit f8eb8c1cb4
2 changed files with 8 additions and 2 deletions

View File

@ -882,7 +882,8 @@ const char *output_names[] = { "None",
"HDMI",
"HDMI",
"TV",
"eDP"
"eDP",
"Virtual"
};
static void
@ -913,7 +914,10 @@ 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 */
snprintf(name, 32, "%s-%d", output_names[koutput->connector_type], koutput->connector_type_id - 1);
if (koutput->connector_type >= MS_ARRAY_SIZE(output_names))
snprintf(name, 32, "Unknown-%d", koutput->connector_type_id - 1);
else
snprintf(name, 32, "%s-%d", output_names[koutput->connector_type], koutput->connector_type_id - 1);
output = xf86OutputCreate (pScrn, &drmmode_output_funcs, name);
if (!output) {

View File

@ -139,5 +139,7 @@ void drmmode_get_default_bpp(ScrnInfoPtr pScrn, drmmode_ptr drmmmode, int *depth
#define DRM_CAP_DUMB_PREFER_SHADOW 4
#endif
#define MS_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#endif