static int sun3fbcon_switch(int con, struct fb_info *info) { int x_margin, y_margin; struct fb_info_sbusfb *fb = sbusfbinfo(info); int lastconsole; /* Do we have to save the colormap? */ if (fb_display[info->currcon].cmap.len) fb_get_cmap(&fb_display[info->currcon].cmap, 1, sun3fb_getcolreg, info); if (info->display_fg) { lastconsole = info->display_fg->vc_num; if (lastconsole != con && (fontwidth(&fb_display[lastconsole]) != fontwidth(&fb_display[con]) || fontheight(&fb_display[lastconsole]) != fontheight(&fb_display[con]))) fb->cursor.mode |= CURSOR_SHAPE; } x_margin = (fb_display[con].var.xres_virtual - fb_display[con].var.xres) / 2; y_margin = (fb_display[con].var.yres_virtual - fb_display[con].var.yres) / 2; if (fb->margins) fb->margins(fb, &fb_display[con], x_margin, y_margin); if (fb->graphmode || fb->x_margin != x_margin || fb->y_margin != y_margin) { fb->x_margin = x_margin; fb->y_margin = y_margin; sun3fb_clear_margin(&fb_display[con], 0); } info->currcon = con; /* Install new colormap */ do_install_cmap(con, info); return 0; }
static int sun3fb_get_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) { struct fb_info_sbusfb *fb = sbusfbinfo(info); memcpy(var, &fb->var, sizeof(struct fb_var_screeninfo)); return 0; }
static int sun3fb_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *info) { struct fb_info_sbusfb *fb = sbusfbinfo(info); memcpy(fix, &fb->fix, sizeof(struct fb_fix_screeninfo)); return 0; }
static int sun3fb_blank(int blank, struct fb_info *info) { struct fb_info_sbusfb *fb = sbusfbinfo(info); if (blank && fb->blank) return fb->blank(fb); else if (!blank && fb->unblank) return fb->unblank(fb); return 0; }
static int sun3fb_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue, u_int *transp, struct fb_info *info) { struct fb_info_sbusfb *fb = sbusfbinfo(info); if (!fb->color_map || regno > 255) return 1; *red = (fb->color_map CM(regno, 0)<<8) | fb->color_map CM(regno, 0); *green = (fb->color_map CM(regno, 1)<<8) | fb->color_map CM(regno, 1); *blue = (fb->color_map CM(regno, 2)<<8) | fb->color_map CM(regno, 2); *transp = 0; return 0; }
static int sun3fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) { struct fb_info_sbusfb *fb = sbusfbinfo(info); if (!fb->color_map || regno > 255) return 1; red >>= 8; green >>= 8; blue >>= 8; fb->color_map CM(regno, 0) = red; fb->color_map CM(regno, 1) = green; fb->color_map CM(regno, 2) = blue; return 0; }
static int sun3fb_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) { struct fb_info_sbusfb *fb = sbusfbinfo(info); if (var->xres > fb->var.xres || var->yres > fb->var.yres || var->xres_virtual > fb->var.xres_virtual || var->yres_virtual > fb->var.yres_virtual || var->bits_per_pixel != fb->var.bits_per_pixel || var->nonstd || (var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED) return -EINVAL; memcpy(var, &fb->var, sizeof(struct fb_var_screeninfo)); return 0; }
static int __init leo_rasterimg (struct fb_info *info, int start) { struct fb_info_sbusfb *fb = sbusfbinfo(info); register struct leo_lc_ss0_usr *us = fb->s.leo.lc_ss0_usr; register struct leo_ld *ss = (struct leo_ld *) fb->s.leo.ld_ss0; if (start) { sbus_writel(1, &ss->wid); sbus_writel(0xffffff, &ss->planemask); sbus_writel(0x310b90, &ss->rop); sbus_writel(0, &us->addrspace); } else { sbus_writel(0xffffffff, &ss->wid); sbus_writel(0xff000000, &ss->planemask); sbus_writel(0x310850, &ss->rop); sbus_writel(4, &us->addrspace); } return 0; }
static int sun3fb_set_cmap(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info) { int err; if (!fb_display[con].cmap.len) { /* no colormap allocated? */ if ((err = fb_alloc_cmap(&fb_display[con].cmap, 1<<fb_display[con].var.bits_per_pixel, 0))) return err; } if (con == info->currcon) { /* current console? */ err = fb_set_cmap(cmap, kspc, info); if (!err) { struct fb_info_sbusfb *fb = sbusfbinfo(info); if (fb->loadcmap) (*fb->loadcmap)(fb, &fb_display[con], cmap->start, cmap->len); } return err; } else fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1); return 0; }
static int __init ffb_rasterimg (struct fb_info *info, int start) { ffb_switch_from_graph (sbusfbinfo(info)); return 0; }