int vt_fb_init(struct vt_device *vd) { struct fb_info *info; int err; info = vd->vd_softc; vd->vd_height = info->fb_height; vd->vd_width = info->fb_width; if (info->fb_size == 0) return (CN_DEAD); if (info->fb_pbase == 0) info->fb_flags |= FB_FLAG_NOMMAP; if (info->fb_cmsize <= 0) { err = vt_fb_init_cmap(info->fb_cmap, FBTYPE_GET_BPP(info)); if (err) return (CN_DEAD); info->fb_cmsize = 16; } /* Clear the screen. */ vd->vd_driver->vd_blank(vd, TC_BLACK); /* Wakeup screen. KMS need this. */ vt_fb_postswitch(vd); return (CN_INTERNAL); }
int vt_fb_init(struct vt_device *vd) { struct fb_info *info; u_int margin; int err; info = vd->vd_softc; vd->vd_height = MIN(VT_FB_MAX_HEIGHT, info->fb_height); margin = (info->fb_height - vd->vd_height) >> 1; vd->vd_transpose = margin * info->fb_stride; vd->vd_width = MIN(VT_FB_MAX_WIDTH, info->fb_width); margin = (info->fb_width - vd->vd_width) >> 1; vd->vd_transpose += margin * (info->fb_bpp / NBBY); vd->vd_video_dev = info->fb_video_dev; if (info->fb_size == 0) return (CN_DEAD); if (info->fb_pbase == 0 && info->fb_vbase == 0) info->fb_flags |= FB_FLAG_NOMMAP; if (info->fb_cmsize <= 0) { err = vt_fb_init_cmap(info->fb_cmap, FBTYPE_GET_BPP(info)); if (err) return (CN_DEAD); info->fb_cmsize = 16; } /* Clear the screen. */ vd->vd_driver->vd_blank(vd, TC_BLACK); /* Wakeup screen. KMS need this. */ vt_fb_postswitch(vd); return (CN_INTERNAL); }