Lines Matching refs:fb
106 #define DPR_READ(fb, reg) \
107 bus_space_read_4((fb)->memt, (fb)->dprh, (reg))
108 #define DPR_WRITE(fb, reg, val) \
109 bus_space_write_4((fb)->memt, (fb)->dprh, (reg), (val))
173 struct lynxfb fb;
199 struct rasops_info *ri = &lynxfb_console.fb.vcs.scr_ri;
200 struct lynxfb *fb;
219 fb = &lynxfb_console.fb;
220 fb->memt = memt;
221 fb->memh = memh;
222 fb->width = lynxfb_default_width;
223 fb->height = lynxfb_default_height;
224 fb->depth = lynxfb_default_depth;
225 fb->stride = lynxfb_default_stride;
226 if (fb->stride == 0)
227 fb->stride = fb->width * fb->depth / 8;
228 fb->flags = lynxfb_default_flags;
229 error = lynxfb_setup(fb);
240 wsdisplay_preattach(&fb->wsd, ri, 0, 0, defattr);
271 struct lynxfb *fb;
285 fb = is_console ? &lynxfb_console.fb : &sc->sc_fb_store;
286 sc->sc_fb = fb;
287 fb->sc = sc;
294 BUS_SPACE_MAP_LINEAR, &fb->memt, &fb->memh, &sc->sc_fbaddr,
301 if (!prop_dictionary_get_uint32(dict, "width", &fb->width))
302 fb->width = lynxfb_default_width;
303 if (!prop_dictionary_get_uint32(dict, "height", &fb->height))
304 fb->height = lynxfb_default_height;
305 if (!prop_dictionary_get_uint32(dict, "depth", &fb->depth))
306 fb->depth = lynxfb_default_depth;
307 if (!prop_dictionary_get_uint32(dict, "linebytes", &fb->stride)) {
309 fb->stride = fb->width * fb->depth / 8;
311 fb->stride = lynxfb_default_stride;
313 if (!prop_dictionary_get_uint32(dict, "flags", &fb->flags))
314 fb->flags = lynxfb_default_flags;
316 if (lynxfb_setup(fb)) {
318 bus_space_unmap(fb->memt, fb->memh, sc->sc_fbsize);
322 sc->sc_memt = fb->memt;
323 sc->sc_memh = fb->memh;
325 aprint_normal_dev(self, "%d x %d, %d bpp, stride %d\n", fb->width,
326 fb->height, fb->depth, fb->stride);
328 fb->wsd = (struct wsscreen_descr) {
336 sc->sc_screens[0] = &fb->wsd;
340 vcons_init(&sc->sc_vd, sc, &fb->wsd, &lynxfb_accessops);
343 ri = &fb->vcs.scr_ri;
345 vcons_init_screen(&sc->sc_vd, &fb->vcs, 1, &defattr);
346 fb->vcs.scr_flags |= VCONS_SCREEN_IS_STATIC;
348 fb->wsd.textops = &ri->ri_ops;
349 fb->wsd.capabilities = ri->ri_caps;
350 fb->wsd.nrows = ri->ri_rows;
351 fb->wsd.ncols = ri->ri_cols;
352 wsdisplay_cnattach(&fb->wsd, ri, 0, 0, defattr);
353 vcons_replay_msgbuf(&fb->vcs);
374 lynxfb_vgats_read(struct lynxfb *fb, uint regno)
377 bus_space_write_1(fb->mmiot, fb->mmioh, IO_VGA + VGA_TS_INDEX, regno);
378 return bus_space_read_1(fb->mmiot, fb->mmioh, IO_VGA + VGA_TS_DATA);
382 lynxfb_vgats_write(struct lynxfb *fb, uint regno, uint8_t value)
385 bus_space_write_1(fb->mmiot, fb->mmioh, IO_VGA + VGA_TS_INDEX, regno);
386 bus_space_write_1(fb->mmiot, fb->mmioh, IO_VGA + VGA_TS_DATA, value);
398 struct lynxfb *fb = sc->sc_fb;
429 *(uint *)data = fb->stride;
433 *(int *)data = fb->blank ? WSDISPLAYIO_VIDEO_OFF :
438 lynxfb_blank(fb, *(int *)data);
447 param->curval = fb->blank;
456 lynxfb_blank(fb, param->curval);
508 struct lynxfb *fb = sc->sc_fb;
511 ri->ri_width = fb->width;
512 ri->ri_height = fb->height;
513 ri->ri_depth = fb->depth;
514 ri->ri_stride = fb->stride;
516 ri->ri_bits = fb->fbaddr;
527 rasops_reconfig(ri, fb->height / ri->ri_font->fontheight,
528 fb->width / ri->ri_font->fontwidth);
532 if (fb->accel) {
544 lynxfb_setup(struct lynxfb *fb)
546 struct rasops_info *ri = &fb->vcs.scr_ri;
549 fb->dprt = fb->memt;
550 error = bus_space_subregion(fb->memt, fb->memh, SM7XX_DPR_BASE,
551 SMXXX_DPR_SIZE, &fb->dprh);
555 fb->mmiot = fb->memt;
556 error = bus_space_subregion(fb->mmiot, fb->memh, SM7XX_MMIO_BASE,
557 SM7XX_MMIO_SIZE, &fb->mmioh);
561 ri->ri_width = fb->width;
562 ri->ri_height = fb->height;
563 ri->ri_depth = fb->depth;
564 ri->ri_stride = fb->stride;
566 fb->fbaddr = ri->ri_bits = (void *)bus_space_vaddr(fb->memt, fb->memh);
567 ri->ri_hw = fb;
569 if (fb->flags & LYNXFB_FLAG_SWAPBR) {
570 switch (fb->depth) {
586 fb->wsd.name = "std";
587 fb->wsd.ncols = ri->ri_cols;
588 fb->wsd.nrows = ri->ri_rows;
589 fb->wsd.textops = &ri->ri_ops;
590 fb->wsd.fontwidth = ri->ri_font->fontwidth;
591 fb->wsd.fontheight = ri->ri_font->fontheight;
592 fb->wsd.capabilities = ri->ri_caps;
597 if (lynxfb_wait(fb) == 0) {
598 fb->accel = 1;
600 DPR_WRITE(fb, DPR_CROP_TOPLEFT_COORDS, DPR_COORDS(0, 0));
602 DPR_WRITE(fb, DPR_PITCH,
604 DPR_WRITE(fb, DPR_SRC_WINDOW,
606 DPR_WRITE(fb, DPR_BYTE_BIT_MASK, 0xffffffff);
607 DPR_WRITE(fb, DPR_COLOR_COMPARE_MASK, 0);
608 DPR_WRITE(fb, DPR_COLOR_COMPARE, 0);
609 DPR_WRITE(fb, DPR_SRC_BASE, 0);
610 DPR_WRITE(fb, DPR_DST_BASE, 0);
611 DPR_READ(fb, DPR_DST_BASE);
623 lynxfb_wait(struct lynxfb *fb)
629 reg = lynxfb_vgats_read(fb, 0x16);
638 lynxfb_copyrect(struct lynxfb *fb, int sx, int sy, int dx, int dy, int w, int h)
652 DPR_WRITE(fb, DPR_SRC_COORDS, DPR_COORDS(sx, sy));
653 DPR_WRITE(fb, DPR_DST_COORDS, DPR_COORDS(dx, dy));
654 DPR_WRITE(fb, DPR_SPAN_COORDS, DPR_COORDS(w, h));
655 DPR_WRITE(fb, DPR_DE_CTRL, DE_CTRL_START | DE_CTRL_ROP_ENABLE | dir |
658 DPR_READ(fb, DPR_DE_CTRL);
660 lynxfb_wait(fb);
664 lynxfb_fillrect(struct lynxfb *fb, int x, int y, int w, int h, int bg)
666 struct rasops_info *ri = &fb->vcs.scr_ri;
668 DPR_WRITE(fb, DPR_FG_COLOR, ri->ri_devcmap[bg]);
669 DPR_WRITE(fb, DPR_DST_COORDS, DPR_COORDS(x, y));
670 DPR_WRITE(fb, DPR_SPAN_COORDS, DPR_COORDS(w, h));
671 DPR_WRITE(fb, DPR_DE_CTRL, DE_CTRL_START | DE_CTRL_ROP_ENABLE |
674 DPR_READ(fb, DPR_DE_CTRL);
676 lynxfb_wait(fb);
681 struct lynxfb *fb)
689 lynxfb_copyrect(fb, ri->ri_xorigin, ri->ri_yorigin + src,
695 struct lynxfb *fb)
704 lynxfb_copyrect(fb, ri->ri_xorigin + src, ri->ri_yorigin + row,
710 struct lynxfb *fb)
720 lynxfb_fillrect(fb, ri->ri_xorigin + col, ri->ri_yorigin + row,
726 struct lynxfb *fb)
743 lynxfb_fillrect(fb, x, y, w, num, bg);
750 struct lynxfb *fb = ri->ri_hw;
752 lynxfb_copyrows1(ri, src, dst, num, fb);
759 struct lynxfb *fb = ri->ri_hw;
761 lynxfb_copycols1(ri, row, src, dst, num, fb);
768 struct lynxfb *fb = ri->ri_hw;
770 lynxfb_erasecols1(ri, row, col, num, attr, fb);
777 struct lynxfb *fb = ri->ri_hw;
779 lynxfb_eraserows1(ri, row, num, attr, fb);
788 struct lynxfb *fb = sc->sc_fb;
790 lynxfb_copyrows1(ri, src, dst, num, fb);
799 struct lynxfb *fb = sc->sc_fb;
801 lynxfb_copycols1(ri, row, src, dst, num, fb);
810 struct lynxfb *fb = sc->sc_fb;
812 lynxfb_erasecols1(ri, row, col, num, attr, fb);
821 struct lynxfb *fb = sc->sc_fb;
823 lynxfb_eraserows1(ri, row, num, attr, fb);
827 lynxfb_blank(struct lynxfb *fb, int enable)
830 fb->blank = !enable;
832 lynxfb_vgats_write(fb, 0x31,
833 lynxfb_vgats_read(fb, 0x31) | 0x01);
835 lynxfb_vgats_write(fb, 0x21,
836 lynxfb_vgats_read(fb, 0x21) | 0x30);
837 lynxfb_vgats_write(fb, 0x31,
838 lynxfb_vgats_read(fb, 0x31) & ~0x01);