Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/vt/hw/fb/vt_fb.c
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
static struct vt_driver vt_fb_driver = { | static struct vt_driver vt_fb_driver = { | ||||
.vd_name = "fb", | .vd_name = "fb", | ||||
.vd_init = vt_fb_init, | .vd_init = vt_fb_init, | ||||
.vd_fini = vt_fb_fini, | .vd_fini = vt_fb_fini, | ||||
.vd_blank = vt_fb_blank, | .vd_blank = vt_fb_blank, | ||||
.vd_bitblt_text = vt_fb_bitblt_text, | .vd_bitblt_text = vt_fb_bitblt_text, | ||||
.vd_invalidate_text = vt_fb_invalidate_text, | |||||
.vd_bitblt_bmp = vt_fb_bitblt_bitmap, | .vd_bitblt_bmp = vt_fb_bitblt_bitmap, | ||||
.vd_drawrect = vt_fb_drawrect, | .vd_drawrect = vt_fb_drawrect, | ||||
.vd_setpixel = vt_fb_setpixel, | .vd_setpixel = vt_fb_setpixel, | ||||
.vd_postswitch = vt_fb_postswitch, | .vd_postswitch = vt_fb_postswitch, | ||||
.vd_priority = VD_PRIORITY_GENERIC+10, | .vd_priority = VD_PRIORITY_GENERIC+10, | ||||
.vd_fb_ioctl = vt_fb_ioctl, | .vd_fb_ioctl = vt_fb_ioctl, | ||||
.vd_fb_mmap = vt_fb_mmap, | .vd_fb_mmap = vt_fb_mmap, | ||||
.vd_suspend = vt_fb_suspend, | .vd_suspend = vt_fb_suspend, | ||||
▲ Show 20 Lines • Show All 269 Lines • ▼ Show 20 Lines | |||||
vt_fb_bitblt_text(struct vt_device *vd, const struct vt_window *vw, | vt_fb_bitblt_text(struct vt_device *vd, const struct vt_window *vw, | ||||
const term_rect_t *area) | const term_rect_t *area) | ||||
{ | { | ||||
unsigned int col, row, x, y; | unsigned int col, row, x, y; | ||||
struct vt_font *vf; | struct vt_font *vf; | ||||
term_char_t c; | term_char_t c; | ||||
term_color_t fg, bg; | term_color_t fg, bg; | ||||
const uint8_t *pattern; | const uint8_t *pattern; | ||||
size_t z; | |||||
vf = vw->vw_font; | vf = vw->vw_font; | ||||
for (row = area->tr_begin.tp_row; row < area->tr_end.tp_row; ++row) { | for (row = area->tr_begin.tp_row; row < area->tr_end.tp_row; ++row) { | ||||
for (col = area->tr_begin.tp_col; col < area->tr_end.tp_col; | for (col = area->tr_begin.tp_col; col < area->tr_end.tp_col; | ||||
++col) { | ++col) { | ||||
x = col * vf->vf_width + | x = col * vf->vf_width + | ||||
vw->vw_draw_area.tr_begin.tp_col; | vw->vw_draw_area.tr_begin.tp_col; | ||||
y = row * vf->vf_height + | y = row * vf->vf_height + | ||||
vw->vw_draw_area.tr_begin.tp_row; | vw->vw_draw_area.tr_begin.tp_row; | ||||
c = VTBUF_GET_FIELD(&vw->vw_buf, row, col); | c = VTBUF_GET_FIELD(&vw->vw_buf, row, col); | ||||
pattern = vtfont_lookup(vf, c); | pattern = vtfont_lookup(vf, c); | ||||
vt_determine_colors(c, | vt_determine_colors(c, | ||||
VTBUF_ISCURSOR(&vw->vw_buf, row, col), &fg, &bg); | VTBUF_ISCURSOR(&vw->vw_buf, row, col), &fg, &bg); | ||||
z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; | |||||
if (vd->vd_drawn && (vd->vd_drawn[z] == c) && | |||||
vd->vd_drawnfg && (vd->vd_drawnfg[z] == fg) && | |||||
vd->vd_drawnbg && (vd->vd_drawnbg[z] == bg)) | |||||
continue; | |||||
vt_fb_bitblt_bitmap(vd, vw, | vt_fb_bitblt_bitmap(vd, vw, | ||||
pattern, NULL, vf->vf_width, vf->vf_height, | pattern, NULL, vf->vf_width, vf->vf_height, | ||||
x, y, fg, bg); | x, y, fg, bg); | ||||
if (vd->vd_drawn) | |||||
vd->vd_drawn[z] = c; | |||||
if (vd->vd_drawnfg) | |||||
vd->vd_drawnfg[z] = fg; | |||||
if (vd->vd_drawnbg) | |||||
vd->vd_drawnbg[z] = bg; | |||||
} | } | ||||
} | } | ||||
#ifndef SC_NO_CUTPASTE | #ifndef SC_NO_CUTPASTE | ||||
if (!vd->vd_mshown) | if (!vd->vd_mshown) | ||||
return; | return; | ||||
term_rect_t drawn_area; | term_rect_t drawn_area; | ||||
drawn_area.tr_begin.tp_col = area->tr_begin.tp_col * vf->vf_width; | drawn_area.tr_begin.tp_col = area->tr_begin.tp_col * vf->vf_width; | ||||
drawn_area.tr_begin.tp_row = area->tr_begin.tp_row * vf->vf_height; | drawn_area.tr_begin.tp_row = area->tr_begin.tp_row * vf->vf_height; | ||||
drawn_area.tr_end.tp_col = area->tr_end.tp_col * vf->vf_width; | drawn_area.tr_end.tp_col = area->tr_end.tp_col * vf->vf_width; | ||||
drawn_area.tr_end.tp_row = area->tr_end.tp_row * vf->vf_height; | drawn_area.tr_end.tp_row = area->tr_end.tp_row * vf->vf_height; | ||||
if (vt_is_cursor_in_area(vd, &drawn_area)) { | if (vt_is_cursor_in_area(vd, &drawn_area)) { | ||||
vt_fb_bitblt_bitmap(vd, vw, | vt_fb_bitblt_bitmap(vd, vw, | ||||
vd->vd_mcursor->map, vd->vd_mcursor->mask, | vd->vd_mcursor->map, vd->vd_mcursor->mask, | ||||
vd->vd_mcursor->width, vd->vd_mcursor->height, | vd->vd_mcursor->width, vd->vd_mcursor->height, | ||||
vd->vd_mx_drawn + vw->vw_draw_area.tr_begin.tp_col, | vd->vd_mx_drawn + vw->vw_draw_area.tr_begin.tp_col, | ||||
vd->vd_my_drawn + vw->vw_draw_area.tr_begin.tp_row, | vd->vd_my_drawn + vw->vw_draw_area.tr_begin.tp_row, | ||||
vd->vd_mcursor_fg, vd->vd_mcursor_bg); | vd->vd_mcursor_fg, vd->vd_mcursor_bg); | ||||
} | } | ||||
#endif | #endif | ||||
} | |||||
void | |||||
vt_fb_invalidate_text(struct vt_device *vd, const term_rect_t *area) | |||||
{ | |||||
unsigned int col, row; | |||||
size_t z; | |||||
for (row = area->tr_begin.tp_row; row < area->tr_end.tp_row; ++row) { | |||||
for (col = area->tr_begin.tp_col; col < area->tr_end.tp_col; | |||||
++col) { | |||||
z = row * PIXEL_WIDTH(VT_FB_MAX_WIDTH) + col; | |||||
if (vd->vd_drawn) | |||||
vd->vd_drawn[z] = 0; | |||||
if (vd->vd_drawnfg) | |||||
vd->vd_drawnfg[z] = 0; | |||||
if (vd->vd_drawnbg) | |||||
vd->vd_drawnbg[z] = 0; | |||||
} | |||||
} | |||||
} | } | ||||
void | void | ||||
vt_fb_postswitch(struct vt_device *vd) | vt_fb_postswitch(struct vt_device *vd) | ||||
{ | { | ||||
struct fb_info *info; | struct fb_info *info; | ||||
info = vd->vd_softc; | info = vd->vd_softc; | ||||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |