static void mfb_common_init(struct rasops_info *ri) { char *base; int cookie; base = (void *)ri->ri_hw; /* initialize colormap and cursor hardware */ mfbhwinit(base); ri->ri_flg = RI_CENTER | RI_FORCEMONO; if (ri == &mfb_console_ri) ri->ri_flg |= RI_NO_AUTO; ri->ri_depth = 8; /* !! watch out !! */ ri->ri_width = 1280; ri->ri_height = 1024; ri->ri_stride = 2048; ri->ri_bits = base + MX_FB_OFFSET; /* clear the screen */ memset(ri->ri_bits, 0, ri->ri_stride * ri->ri_height); wsfont_init(); /* prefer 12 pixel wide font */ cookie = wsfont_find(NULL, 12, 0, 0, WSDISPLAY_FONTORDER_L2R, WSDISPLAY_FONTORDER_L2R, WSFONT_FIND_BITMAP); if (cookie <= 0) cookie = wsfont_find(NULL, 0, 0, 0, WSDISPLAY_FONTORDER_L2R, WSDISPLAY_FONTORDER_L2R, WSFONT_FIND_BITMAP); if (cookie <= 0) { printf("mfb: font table is empty\n"); return; } if (wsfont_lock(cookie, &ri->ri_font)) { printf("mfb: couldn't lock font\n"); return; } ri->ri_wsfcookie = cookie; rasops_init(ri, 34, 80); /* XXX shouldn't be global */ mfb_stdscreen.nrows = ri->ri_rows; mfb_stdscreen.ncols = ri->ri_cols; mfb_stdscreen.textops = &ri->ri_ops; mfb_stdscreen.capabilities = ri->ri_caps; }
static void newport_attach_common(struct newport_devconfig *dc, struct gio_attach_args *ga) { dc->dc_addr = ga->ga_addr; dc->dc_st = ga->ga_iot; dc->dc_sh = ga->ga_ioh; wsfont_init(); dc->dc_font = wsfont_find(NULL, 8, 16, 0, WSDISPLAY_FONTORDER_L2R, WSDISPLAY_FONTORDER_L2R, WSFONT_FIND_BITMAP); if (dc->dc_font < 0) panic("newport_attach_common: no suitable fonts"); if (wsfont_lock(dc->dc_font, &dc->dc_fontdata)) panic("newport_attach_common: unable to lock font data"); newport_setup_hw(dc); newport_get_resolution(dc); newport_fill_rectangle(dc, 0, 0, dc->dc_xres, dc->dc_yres, 0); dc->dc_screen = &newport_screen; dc->dc_mode = WSDISPLAYIO_MODE_EMUL; }
static void light_attach_common(struct light_devconfig *dc, struct gio_attach_args *ga) { dc->dc_addr = ga->ga_addr; dc->dc_st = ga->ga_iot; dc->dc_sh = ga->ga_ioh; dc->dc_boardrev = rex_revision(dc); wsfont_init(); dc->dc_font = wsfont_find(NULL, 8, 16, 0, WSDISPLAY_FONTORDER_L2R, WSDISPLAY_FONTORDER_L2R); if (dc->dc_font < 0) panic("light_attach_common: no suitable fonts"); if (wsfont_lock(dc->dc_font, &dc->dc_fontdata)) panic("light_attach_common: unable to lock font data"); rex_vc1_write(dc, rex_vc1_read(dc) & ~(VC1_SYSCTL_CURSOR | VC1_SYSCTL_CURSOR_ON)); rex_fill_rect(dc, 0, 0, LIGHT_XRES - 1, LIGHT_YRES - 1, 0); }
int p9100_pick_romfont(struct p9100_softc *sc) { struct rasops_info *ri = &sc->sc_sunfb.sf_ro; int *romwidth, *romheight; u_int8_t **romaddr; char buf[200]; /* * This code currently only works for PROM >= 2.9; see * autoconf.c romgetcursoraddr() for details. */ if (promvec->pv_romvec_vers < 2 || promvec->pv_printrev < 0x00020009) return (1); /* * Get the PROM font metrics and address */ if (snprintf(buf, sizeof buf, "stdout @ is my-self " "addr char-height %lx ! addr char-width %lx ! addr font-base %lx !", (vaddr_t)&romheight, (vaddr_t)&romwidth, (vaddr_t)&romaddr) >= sizeof buf) return (1); romheight = romwidth = NULL; rominterpret(buf); if (romheight == NULL || romwidth == NULL || romaddr == NULL || *romheight == 0 || *romwidth == 0 || *romaddr == NULL) return (1); p9100_romfont.fontwidth = *romwidth; p9100_romfont.fontheight = *romheight; p9100_romfont.stride = howmany(*romwidth, NBBY); p9100_romfont.data = *romaddr; #ifdef DEBUG printf("%s: PROM font %dx%d @%p", sc->sc_sunfb.sf_dev.dv_xname, *romwidth, *romheight, *romaddr); #endif /* * Build and add a wsfont structure */ wsfont_init(); /* if not done before */ if (wsfont_add(&p9100_romfont, 0) != 0) return (1); /* * Select this very font in our rasops structure */ ri->ri_wsfcookie = wsfont_find(ROMFONTNAME, 0, 0, 0); if (wsfont_lock(ri->ri_wsfcookie, &ri->ri_font, WSDISPLAY_FONTORDER_L2R, WSDISPLAY_FONTORDER_L2R) <= 0) { ri->ri_wsfcookie = 0; return (1); } return (0); }
void smg_attach(device_t parent, device_t self, void *aux) { struct wsemuldisplaydev_attach_args aa; struct wsdisplay_font *console_font; int fcookie; aprint_normal("\n"); sm_addr = (void *)vax_map_physmem(SMADDR, (SMSIZE/VAX_NBPG)); curaddr = (void *)vax_map_physmem(KA420_CUR_BASE, 1); if (sm_addr == 0) { aprint_error_dev(self, "Couldn't alloc graphics memory.\n"); return; } if (curscr == NULL) callout_init(&smg_cursor_ch, 0); curscr = &smg_conscreen; aa.console = (vax_confdata & (KA420_CFG_L3CON|KA420_CFG_MULTU)) == 0; aa.scrdata = &smg_screenlist; aa.accessops = &smg_accessops; callout_reset(&smg_cursor_ch, hz / 2, smg_crsr_blink, NULL); curcmd = CUR_CMD_HSHI; WRITECUR(CUR_CMD, curcmd); if ((fcookie = wsfont_find(NULL, 8, 15, 0, WSDISPLAY_FONTORDER_R2L, WSDISPLAY_FONTORDER_L2R, WSFONT_FIND_BITMAP)) < 0) { aprint_error_dev(self, "could not find 8x15 font\n"); return; } if (wsfont_lock(fcookie, &console_font) != 0) { aprint_error_dev(self, "could not lock 8x15 font\n"); return; } qf = console_font->data; config_found(self, &aa, wsemuldisplaydevprint); }
int s3c24x0_lcd_alloc_screen(void *v, const struct wsscreen_descr *_type, void **cookiep, int *curxp, int *curyp, long *attrp) { struct s3c24x0_lcd_softc *sc = v; struct s3c24x0_lcd_screen *scr; const struct s3c24x0_wsscreen_descr *type = (const struct s3c24x0_wsscreen_descr *)_type; int width, height; width = type->c.ncols * type->c.fontwidth; height = type->c.nrows * type->c.fontwidth; if (width < sc->panel_info->panel_width) width = sc->panel_info->panel_width; if (height < sc->panel_info->panel_height) height = sc->panel_info->panel_height; scr = s3c24x0_lcd_new_screen(sc, width, height, type->depth); if (scr == NULL) return -1; /* * initialize raster operation for this screen. */ scr->rinfo.ri_flg = 0; scr->rinfo.ri_depth = type->depth; scr->rinfo.ri_bits = scr->buf_va; scr->rinfo.ri_width = width; scr->rinfo.ri_height = height; scr->rinfo.ri_stride = scr->stride; if (type->c.fontwidth || type->c.fontheight) { /* * find a font with specified size */ int cookie; wsfont_init(); cookie = wsfont_find(NULL, type->c.fontwidth, type->c.fontheight, 0, WSDISPLAY_FONTORDER_L2R, WSDISPLAY_FONTORDER_L2R); if (cookie > 0) { if (wsfont_lock(cookie, &scr->rinfo.ri_font)) scr->rinfo.ri_wsfcookie = cookie; } } rasops_init(&scr->rinfo, type->c.nrows, type->c.ncols); (* scr->rinfo.ri_ops.allocattr)(&scr->rinfo, 0, 0, 0, attrp); if (type->c.nrows != scr->rinfo.ri_rows || type->c.ncols != scr->rinfo.ri_cols) { aprint_error("%s: can't allocate a screen with requested size:" "%d x %d -> %d x %d\n", sc->dev.dv_xname, type->c.ncols, type->c.nrows, scr->rinfo.ri_cols, scr->rinfo.ri_rows); } *cookiep = scr; *curxp = 0; *curyp = 0; return 0; }