From owner-svn-src-all@FreeBSD.ORG Fri Apr 4 11:17:50 2014 Return-Path: Delivered-To: svn-src-all@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 B4083F6E; Fri, 4 Apr 2014 11:17:50 +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 9F675ED9; Fri, 4 Apr 2014 11:17:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s34BHoFY046729; Fri, 4 Apr 2014 11:17:50 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s34BHosS046726; Fri, 4 Apr 2014 11:17:50 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201404041117.s34BHosS046726@svn.freebsd.org> From: Aleksandr Rybalko Date: Fri, 4 Apr 2014 11:17:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r264112 - in stable/10/sys/dev/vt: . hw/vga X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Apr 2014 11:17:50 -0000 Author: ray Date: Fri Apr 4 11:17:49 2014 New Revision: 264112 URL: http://svnweb.freebsd.org/changeset/base/264112 Log: MFC r263885 o Add new vd_driver method to do bitblt with mask, named vd_maskbitbltchr. o Move vd_bitbltchr vga's driver method to vd_maskbitbltchr. o Implement new vd_bitbltchr method for vga driver. (It do single write for 8 pixels, have to be a bit faster). Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/dev/vt/hw/vga/vga.c stable/10/sys/dev/vt/vt.h stable/10/sys/dev/vt/vt_core.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/vt/hw/vga/vga.c ============================================================================== --- stable/10/sys/dev/vt/hw/vga/vga.c Fri Apr 4 10:33:59 2014 (r264111) +++ stable/10/sys/dev/vt/hw/vga/vga.c Fri Apr 4 11:17:49 2014 (r264112) @@ -74,6 +74,7 @@ struct vga_softc { static vd_init_t vga_init; static vd_blank_t vga_blank; static vd_bitbltchr_t vga_bitbltchr; +static vd_maskbitbltchr_t vga_maskbitbltchr; static vd_drawrect_t vga_drawrect; static vd_setpixel_t vga_setpixel; static vd_putchar_t vga_putchar; @@ -83,6 +84,7 @@ static const struct vt_driver vt_vga_dri .vd_init = vga_init, .vd_blank = vga_blank, .vd_bitbltchr = vga_bitbltchr, + .vd_maskbitbltchr = vga_maskbitbltchr, .vd_drawrect = vga_drawrect, .vd_setpixel = vga_setpixel, .vd_putchar = vga_putchar, @@ -204,6 +206,34 @@ vga_bitbltchr(struct vt_device *vd, cons int bpl, vt_axis_t top, vt_axis_t left, unsigned int width, unsigned int height, term_color_t fg, term_color_t bg) { + u_long dst, ldst; + int w; + + /* Don't try to put off screen pixels */ + if (((left + width) > VT_VGA_WIDTH) || ((top + height) > + VT_VGA_HEIGHT)) + return; + + dst = (VT_VGA_WIDTH * top + left) / 8; + + for (; height > 0; height--) { + ldst = dst; + for (w = width; w > 0; w -= 8) { + vga_bitblt_put(vd, ldst, fg, *src); + vga_bitblt_put(vd, ldst, bg, ~*src); + ldst++; + src++; + } + dst += VT_VGA_WIDTH / 8; + } +} + +/* Bitblt with mask support. Slow. */ +static void +vga_maskbitbltchr(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) +{ struct vga_softc *sc = vd->vd_softc; u_long dst; uint8_t shift; Modified: stable/10/sys/dev/vt/vt.h ============================================================================== --- stable/10/sys/dev/vt/vt.h Fri Apr 4 10:33:59 2014 (r264111) +++ stable/10/sys/dev/vt/vt.h Fri Apr 4 11:17:49 2014 (r264112) @@ -282,6 +282,9 @@ typedef void vd_blank_t(struct vt_device typedef void vd_bitbltchr_t(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); +typedef void vd_maskbitbltchr_t(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); typedef void vd_putchar_t(struct vt_device *vd, term_char_t, vt_axis_t top, vt_axis_t left, term_color_t fg, term_color_t bg); typedef int vd_fb_ioctl_t(struct vt_device *, u_long, caddr_t, struct thread *); @@ -298,6 +301,7 @@ struct vt_driver { /* Drawing. */ vd_blank_t *vd_blank; vd_bitbltchr_t *vd_bitbltchr; + vd_maskbitbltchr_t *vd_maskbitbltchr; vd_drawrect_t *vd_drawrect; vd_setpixel_t *vd_setpixel; Modified: stable/10/sys/dev/vt/vt_core.c ============================================================================== --- stable/10/sys/dev/vt/vt_core.c Fri Apr 4 10:33:59 2014 (r264111) +++ stable/10/sys/dev/vt/vt_core.c Fri Apr 4 11:17:49 2014 (r264112) @@ -775,7 +775,7 @@ vt_flush(struct vt_device *vd) if ((vd->vd_my + m->h) > (size.tp_row * vf->vf_height)) h = (size.tp_row * vf->vf_height) - vd->vd_my - 1; - vd->vd_driver->vd_bitbltchr(vd, m->map, m->mask, bpl, + vd->vd_driver->vd_maskbitbltchr(vd, m->map, m->mask, bpl, vd->vd_offset.tp_row + vd->vd_my, vd->vd_offset.tp_col + vd->vd_mx, w, h, TC_WHITE, TC_BLACK); @@ -1930,6 +1930,8 @@ vt_allocate(struct vt_driver *drv, void printf("%s: Replace existing VT driver.\n", __func__); } vd = main_vd; + if (drv->vd_maskbitbltchr == NULL) + drv->vd_maskbitbltchr = drv->vd_bitbltchr; /* Stop vt_flush periodic task. */ if (vd->vd_curwindow != NULL)