From 9ca4932054a5bde5dda500ea346ad101bb5c80a0 Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Fri, 20 Apr 2007 16:32:58 -0700 Subject: Add a mode name generation wrapper to make name format changes easier. --- linux-core/drm_crtc.h | 1 + linux-core/drm_edid.c | 5 ++--- linux-core/drm_modes.c | 7 +++++++ linux-core/intel_display.c | 5 ++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/linux-core/drm_crtc.h b/linux-core/drm_crtc.h index 7128afe1..e5a89b17 100644 --- a/linux-core/drm_crtc.h +++ b/linux-core/drm_crtc.h @@ -437,6 +437,7 @@ extern void drm_mode_debug_printmodeline(struct drm_device *dev, struct drm_display_mode *mode); extern void drm_mode_config_init(struct drm_device *dev); extern void drm_mode_config_cleanup(struct drm_device *dev); +extern void drm_mode_set_name(struct drm_display_mode *mode); extern void drm_disable_unused_functions(struct drm_device *dev); extern struct drm_display_mode *drm_mode_create(struct drm_device *dev); diff --git a/linux-core/drm_edid.c b/linux-core/drm_edid.c index a9cf23a1..0d067929 100644 --- a/linux-core/drm_edid.c +++ b/linux-core/drm_edid.c @@ -79,7 +79,7 @@ struct drm_display_mode *drm_mode_std(struct drm_device *dev, else vsize = (hsize * 9) / 16; - snprintf(mode->name, DRM_DISPLAY_MODE_LEN, "%dx%d", hsize, vsize); + drm_mode_set_name(mode); return mode; } @@ -132,8 +132,7 @@ struct drm_display_mode *drm_mode_detailed(drm_device_t *dev, pt->vsync_pulse_width_lo); mode->vtotal = mode->vdisplay + ((pt->vblank_hi << 8) | pt->vblank_lo); - snprintf(mode->name, DRM_DISPLAY_MODE_LEN, "%dx%d", mode->hdisplay, - mode->vdisplay); + drm_mode_set_name(mode); if (pt->interlaced) mode->flags |= V_INTERLACE; diff --git a/linux-core/drm_modes.c b/linux-core/drm_modes.c index 7d976d9f..44498c5e 100644 --- a/linux-core/drm_modes.c +++ b/linux-core/drm_modes.c @@ -45,6 +45,13 @@ void drm_mode_debug_printmodeline(struct drm_device *dev, } EXPORT_SYMBOL(drm_mode_debug_printmodeline); +void drm_mode_set_name(struct drm_display_mode *mode) +{ + snprintf(mode->name, DRM_DISPLAY_MODE_LEN, "%dx%d", mode->hdisplay, + mode->vdisplay); +} +EXPORT_SYMBOL(drm_mode_set_name); + void drm_mode_list_concat(struct list_head *head, struct list_head *new) { diff --git a/linux-core/intel_display.c b/linux-core/intel_display.c index d0a3a465..a6f94fb1 100644 --- a/linux-core/intel_display.c +++ b/linux-core/intel_display.c @@ -1057,9 +1057,8 @@ struct drm_display_mode *intel_crtc_mode_get(drm_device_t *dev, mode->vtotal = ((vtot & 0xffff0000) >> 16) + 1; mode->vsync_start = (vsync & 0xffff) + 1; mode->vsync_end = ((vsync & 0xffff0000) >> 16) + 1; - /* FIXME: pull name generation into a common routine */ - snprintf(mode->name, DRM_DISPLAY_MODE_LEN, "%dx%d", mode->hdisplay, - mode->vdisplay); + + drm_mode_set_name(mode); drm_mode_set_crtcinfo(mode, 0); return mode; -- cgit v1.2.3