diff options
author | Alon Levy <alevy@redhat.com> | 2012-08-28 11:46:47 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-09-14 10:40:44 +1000 |
commit | fcf9ddf3c6ddb531020b532123118ab0216e6e65 (patch) | |
tree | 8c4d6f7af107cb56682700a4f665205c41e3f2b6 | |
parent | e00ef802391af73310c0ee0ee78254228bc29075 (diff) |
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>
-rw-r--r-- | src/drmmode_display.c | 8 | ||||
-rw-r--r-- | src/drmmode_display.h | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 5e38265..8d760c2 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -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) { diff --git a/src/drmmode_display.h b/src/drmmode_display.h index 24f7960..1d5522b 100644 --- a/src/drmmode_display.h +++ b/src/drmmode_display.h @@ -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 |