Add a mode name generation wrapper to make name format changes easier.

This commit is contained in:
Jesse Barnes 2007-04-20 16:32:58 -07:00
parent 2d1de1fc6b
commit 9ca4932054
4 changed files with 12 additions and 6 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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)
{

View file

@ -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;