* Detailed mode info for a standard 640x480@60Hz monitor
*/
static struct drm_display_mode std_mode[] = {
- { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25200, 640, 656,
+ { DRM_MODE("640x480", DRM_MODE_TYPE_DEFAULT, 25200, 640, 656,
752, 800, 0, 480, 490, 492, 525, 0,
V_NHSYNC | V_NVSYNC) }, /* 640x480@60Hz */
};
break;
}
+
+ /* No preferred mode, let's select another which should pick
+ * the default 640x480 if nothing else is here.
+ *
+ */
+ if (!des_mode || !(des_mode->flags & DRM_MODE_TYPE_PREFERRED)) {
+ list_for_each_entry(des_mode, &output->modes, head) {
+ if (des_mode->flags & DRM_MODE_TYPE_DEFAULT)
+ break;
+ }
+ }
+
c = -1;
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
c++;
output->crtc->desired_mode = des_mode;
output->initial_x = 0;
output->initial_y = 0;
- DRM_DEBUG("Desired mode for CRTC %d is %dx%x\n",c,des_mode->hdisplay,des_mode->vdisplay);
+ DRM_DEBUG("Desired mode for CRTC %d is %s\n",c,des_mode->name);
break;
}
}
info->var.vsync_len = mode->vsync_end - mode->vsync_start;
info->var.upper_margin = mode->vtotal - mode->vsync_end;
info->var.pixclock = 10000000 / mode->htotal * 1000 /
- mode->vtotal * 100000 / mode->vrefresh;
+ mode->vtotal * 100;
+ /* avoid overflow */
+ info->var.pixclock = info->var.pixclock * 1000 / mode->vrefresh;
DRM_DEBUG("fb depth is %d\n", fb->depth);
switch(fb->depth) {