From owner-svn-src-head@FreeBSD.ORG Sat Aug 23 15:00:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C19C8D06; Sat, 23 Aug 2014 15:00:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC1263C4C; Sat, 23 Aug 2014 15:00:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7NF0mBx061287; Sat, 23 Aug 2014 15:00:48 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7NF0lpW061281; Sat, 23 Aug 2014 15:00:47 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201408231500.s7NF0lpW061281@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: Jean-Sebastien Pedron Date: Sat, 23 Aug 2014 15:00:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270411 - in head/sys: dev/vt/hw/efifb dev/vt/hw/fb powerpc/ps3 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Aug 2014 15:00:49 -0000 Author: dumbbell Date: Sat Aug 23 15:00:47 2014 New Revision: 270411 URL: http://svnweb.freebsd.org/changeset/base/270411 Log: vt_fb: Implement vd_bitblt_text_t for vt_fb and derivatives MFC after: 1 week Modified: head/sys/dev/vt/hw/efifb/efifb.c head/sys/dev/vt/hw/fb/vt_early_fb.c head/sys/dev/vt/hw/fb/vt_fb.c head/sys/dev/vt/hw/fb/vt_fb.h head/sys/powerpc/ps3/ps3_syscons.c Modified: head/sys/dev/vt/hw/efifb/efifb.c ============================================================================== --- head/sys/dev/vt/hw/efifb/efifb.c Sat Aug 23 14:58:31 2014 (r270410) +++ head/sys/dev/vt/hw/efifb/efifb.c Sat Aug 23 15:00:47 2014 (r270411) @@ -60,7 +60,7 @@ static struct vt_driver vt_efifb_driver .vd_probe = vt_efifb_probe, .vd_init = vt_efifb_init, .vd_blank = vt_fb_blank, - .vd_bitbltchr = vt_fb_bitbltchr, + .vd_bitblt_text = vt_fb_bitblt_text, .vd_fb_ioctl = vt_fb_ioctl, .vd_fb_mmap = vt_fb_mmap, /* Better than VGA, but still generic driver. */ Modified: head/sys/dev/vt/hw/fb/vt_early_fb.c ============================================================================== --- head/sys/dev/vt/hw/fb/vt_early_fb.c Sat Aug 23 14:58:31 2014 (r270410) +++ head/sys/dev/vt/hw/fb/vt_early_fb.c Sat Aug 23 15:00:47 2014 (r270411) @@ -59,7 +59,7 @@ static struct vt_driver vt_fb_early_driv .vd_probe = vt_efb_probe, .vd_init = vt_efb_init, .vd_blank = vt_fb_blank, - .vd_bitbltchr = vt_fb_bitbltchr, + .vd_bitblt_text = vt_fb_bitblt_text, .vd_priority = VD_PRIORITY_GENERIC, }; Modified: head/sys/dev/vt/hw/fb/vt_fb.c ============================================================================== --- head/sys/dev/vt/hw/fb/vt_fb.c Sat Aug 23 14:58:31 2014 (r270410) +++ head/sys/dev/vt/hw/fb/vt_fb.c Sat Aug 23 15:00:47 2014 (r270411) @@ -41,15 +41,14 @@ __FBSDID("$FreeBSD$"); #include #include -void vt_fb_drawrect(struct vt_device *vd, int x1, int y1, int x2, int y2, - int fill, term_color_t color); -void vt_fb_setpixel(struct vt_device *vd, int x, int y, term_color_t color); +static vd_drawrect_t vt_fb_drawrect; +static vd_setpixel_t vt_fb_setpixel; static struct vt_driver vt_fb_driver = { .vd_name = "fb", .vd_init = vt_fb_init, .vd_blank = vt_fb_blank, - .vd_bitbltchr = vt_fb_bitbltchr, + .vd_bitblt_text = vt_fb_bitblt_text, .vd_drawrect = vt_fb_drawrect, .vd_setpixel = vt_fb_setpixel, .vd_postswitch = vt_fb_postswitch, @@ -146,7 +145,7 @@ vt_fb_mmap(struct vt_device *vd, vm_ooff return (EINVAL); } -void +static void vt_fb_setpixel(struct vt_device *vd, int x, int y, term_color_t color) { struct fb_info *info; @@ -181,7 +180,7 @@ vt_fb_setpixel(struct vt_device *vd, int } -void +static void vt_fb_drawrect(struct vt_device *vd, int x1, int y1, int x2, int y2, int fill, term_color_t color) { @@ -243,14 +242,15 @@ vt_fb_blank(struct vt_device *vd, term_c } } -void -vt_fb_bitbltchr(struct vt_device *vd, const uint8_t *src, const uint8_t *mask, - int bpl, vt_axis_t top, vt_axis_t left, unsigned int width, - unsigned int height, term_color_t fg, term_color_t bg) +static void +vt_fb_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw, + const uint8_t *pattern, const uint8_t *mask, + unsigned int width, unsigned int height, + unsigned int x, unsigned int y, term_color_t fg, term_color_t bg) { struct fb_info *info; uint32_t fgc, bgc, cc, o; - int c, l, bpp; + int c, l, bpp, bpl; u_long line; uint8_t b, m; const uint8_t *ch; @@ -260,19 +260,18 @@ vt_fb_bitbltchr(struct vt_device *vd, co fgc = info->fb_cmap[fg]; bgc = info->fb_cmap[bg]; b = m = 0; - if (bpl == 0) - bpl = (width + 7) >> 3; /* Bytes per sorce line. */ + bpl = (width + 7) >> 3; /* Bytes per source line. */ /* Don't try to put off screen pixels */ - if (((left + width) > info->fb_width) || ((top + height) > + if (((x + width) > info->fb_width) || ((y + height) > info->fb_height)) return; KASSERT((info->fb_vbase != 0), ("Unmapped framebuffer")); - line = (info->fb_stride * top) + (left * bpp); + line = (info->fb_stride * y) + (x * bpp); for (l = 0; l < height; l++) { - ch = src; + ch = pattern; for (c = 0; c < width; c++) { if (c % 8 == 0) b = *ch++; @@ -312,8 +311,62 @@ vt_fb_bitbltchr(struct vt_device *vd, co } } line += info->fb_stride; - src += bpl; + pattern += bpl; + } +} + +void +vt_fb_bitblt_text(struct vt_device *vd, const struct vt_window *vw, + const term_rect_t *area) +{ + unsigned int col, row, x, y; + struct vt_font *vf; + term_char_t c; + term_color_t fg, bg; + const uint8_t *pattern; + + vf = vw->vw_font; + + 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) { + x = col * vf->vf_width + vw->vw_offset.tp_col; + y = row * vf->vf_height + vw->vw_offset.tp_row; + + c = VTBUF_GET_FIELD(&vw->vw_buf, row, col); + pattern = vtfont_lookup(vf, c); + vt_determine_colors(c, + VTBUF_ISCURSOR(&vw->vw_buf, row, col), &fg, &bg); + + vt_fb_bitblt_bitmap(vd, vw, + pattern, NULL, vf->vf_width, vf->vf_height, + x, y, fg, bg); + } + } + +#ifndef SC_NO_CUTPASTE + if (!vd->vd_mshown) + return; + + term_rect_t drawn_area; + + drawn_area.tr_begin.tp_col = area->tr_begin.tp_col * vf->vf_width + + vw->vw_offset.tp_col; + drawn_area.tr_begin.tp_row = area->tr_begin.tp_row * vf->vf_height + + vw->vw_offset.tp_row; + drawn_area.tr_end.tp_col = area->tr_end.tp_col * vf->vf_width + + vw->vw_offset.tp_col; + drawn_area.tr_end.tp_row = area->tr_end.tp_row * vf->vf_height + + vw->vw_offset.tp_row; + + if (vt_is_cursor_in_area(vd, &drawn_area)) { + vt_fb_bitblt_bitmap(vd, vw, + vd->vd_mcursor->map, vd->vd_mcursor->mask, + vd->vd_mcursor->width, vd->vd_mcursor->height, + vd->vd_mx_drawn, vd->vd_my_drawn, + vd->vd_mcursor_fg, vd->vd_mcursor_bg); } +#endif } void Modified: head/sys/dev/vt/hw/fb/vt_fb.h ============================================================================== --- head/sys/dev/vt/hw/fb/vt_fb.h Sat Aug 23 14:58:31 2014 (r270410) +++ head/sys/dev/vt/hw/fb/vt_fb.h Sat Aug 23 15:00:47 2014 (r270411) @@ -36,11 +36,11 @@ int vt_fb_attach(struct fb_info *info); void vt_fb_resume(void); void vt_fb_suspend(void); -vd_init_t vt_fb_init; -vd_blank_t vt_fb_blank; -vd_bitbltchr_t vt_fb_bitbltchr; -vd_postswitch_t vt_fb_postswitch; -vd_fb_ioctl_t vt_fb_ioctl; -vd_fb_mmap_t vt_fb_mmap; +vd_init_t vt_fb_init; +vd_blank_t vt_fb_blank; +vd_bitblt_text_t vt_fb_bitblt_text; +vd_postswitch_t vt_fb_postswitch; +vd_fb_ioctl_t vt_fb_ioctl; +vd_fb_mmap_t vt_fb_mmap; #endif /* _DEV_VT_HW_FB_VT_FB_H_ */ Modified: head/sys/powerpc/ps3/ps3_syscons.c ============================================================================== --- head/sys/powerpc/ps3/ps3_syscons.c Sat Aug 23 14:58:31 2014 (r270410) +++ head/sys/powerpc/ps3/ps3_syscons.c Sat Aug 23 15:00:47 2014 (r270411) @@ -76,7 +76,7 @@ static struct vt_driver vt_ps3fb_driver .vd_probe = ps3fb_probe, .vd_init = ps3fb_init, .vd_blank = vt_fb_blank, - .vd_bitbltchr = vt_fb_bitbltchr, + .vd_bitblt_text = vt_fb_bitblt_text, .vd_fb_ioctl = vt_fb_ioctl, .vd_fb_mmap = vt_fb_mmap, /* Better than VGA, but still generic driver. */