From owner-svn-src-all@FreeBSD.ORG Tue Sep 2 19:56:38 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 92D50E79; Tue, 2 Sep 2014 19:56:38 +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 7CF7E1BE0; Tue, 2 Sep 2014 19:56:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s82JucQS027573; Tue, 2 Sep 2014 19:56:38 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s82Jub4G027568; Tue, 2 Sep 2014 19:56:37 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201409021956.s82Jub4G027568@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 2 Sep 2014 19:56:37 +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: r270980 - in stable/10/sys: dev/fb dev/vt/hw/fb sys 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.18-1 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: Tue, 02 Sep 2014 19:56:38 -0000 Author: emaste Date: Tue Sep 2 19:56:37 2014 New Revision: 270980 URL: http://svnweb.freebsd.org/changeset/base/270980 Log: MFC r268771, r268796 by nwhitehorn: r268771: Allow console drivers active from early boot to be used with xf86-video-scfb, rather than only drivers attached later on. This involves a small amount of code duplication with dev/fb/fbd.c, which will fixed later on. Also improve performance of vt_blank() by making it not read from the framebuffer unnecessarily. r268796: Fix embarassing typos I made. Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/dev/fb/fbd.c stable/10/sys/dev/vt/hw/fb/vt_fb.c stable/10/sys/dev/vt/hw/fb/vt_fb.h stable/10/sys/sys/fbio.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/fb/fbd.c ============================================================================== --- stable/10/sys/dev/fb/fbd.c Tue Sep 2 19:48:37 2014 (r270979) +++ stable/10/sys/dev/fb/fbd.c Tue Sep 2 19:56:37 2014 (r270980) @@ -257,9 +257,6 @@ fb_probe(struct fb_info *info) } else if (info->fb_vbase != 0) { if (info->fb_pbase == 0) { info->fb_flags |= FB_FLAG_NOMMAP; - } else { - if (info->fb_mmap == NULL) - info->fb_mmap = &fb_mmap; } info->wr1 = &vt_fb_mem_wr1; info->wr2 = &vt_fb_mem_wr2; @@ -268,10 +265,6 @@ fb_probe(struct fb_info *info) } else return (ENXIO); - if (info->fb_ioctl == NULL) - info->fb_ioctl = &fb_ioctl; - - return (0); } Modified: stable/10/sys/dev/vt/hw/fb/vt_fb.c ============================================================================== --- stable/10/sys/dev/vt/hw/fb/vt_fb.c Tue Sep 2 19:48:37 2014 (r270979) +++ stable/10/sys/dev/vt/hw/fb/vt_fb.c Tue Sep 2 19:56:37 2014 (r270980) @@ -41,10 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include -static int vt_fb_ioctl(struct vt_device *vd, u_long cmd, caddr_t data, - struct thread *td); -static int vt_fb_mmap(struct vt_device *vd, vm_ooffset_t offset, - vm_paddr_t *paddr, int prot, vm_memattr_t *memattr); 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); @@ -65,20 +61,47 @@ static struct vt_driver vt_fb_driver = { VT_DRIVER_DECLARE(vt_fb, vt_fb_driver); -static int +int vt_fb_ioctl(struct vt_device *vd, u_long cmd, caddr_t data, struct thread *td) { struct fb_info *info; + int error = 0; info = vd->vd_softc; - if (info->fb_ioctl == NULL) - return (-1); + switch (cmd) { + case FBIOGTYPE: + bcopy(info, (struct fbtype *)data, sizeof(struct fbtype)); + break; + + case FBIO_GETWINORG: /* get frame buffer window origin */ + *(u_int *)data = 0; + break; + + case FBIO_GETDISPSTART: /* get display start address */ + ((video_display_start_t *)data)->x = 0; + ((video_display_start_t *)data)->y = 0; + break; + + case FBIO_GETLINEWIDTH: /* get scan line width in bytes */ + *(u_int *)data = info->fb_stride; + break; - return (info->fb_ioctl(info->fb_cdev, cmd, data, 0, td)); + case FBIO_BLANK: /* blank display */ + if (vd->vd_driver->vd_blank == NULL) + return (ENODEV); + vd->vd_driver->vd_blank(vd, TC_BLACK); + break; + + default: + error = ENOIOCTL; + break; + } + + return (error); } -static int +int vt_fb_mmap(struct vt_device *vd, vm_ooffset_t offset, vm_paddr_t *paddr, int prot, vm_memattr_t *memattr) { @@ -86,10 +109,18 @@ vt_fb_mmap(struct vt_device *vd, vm_ooff info = vd->vd_softc; - if (info->fb_ioctl == NULL) - return (ENXIO); + if (info->fb_flags & FB_FLAG_NOMMAP) + return (ENODEV); - return (info->fb_mmap(info->fb_cdev, offset, paddr, prot, memattr)); + if (offset >= 0 && offset < info->fb_size) { + *paddr = info->fb_pbase + offset; + #ifdef VM_MEMATTR_WRITE_COMBINING + *memattr = VM_MEMATTR_WRITE_COMBINING; + #endif + return (0); + } + + return (EINVAL); } void @@ -147,41 +178,42 @@ vt_fb_blank(struct vt_device *vd, term_c { struct fb_info *info; uint32_t c; - u_int o; + u_int o, h; info = vd->vd_softc; c = info->fb_cmap[color]; switch (FBTYPE_GET_BYTESPP(info)) { case 1: - for (o = 0; o < info->fb_stride; o++) - info->wr1(info, o, c); + for (h = 0; h < info->fb_height; h++) + for (o = 0; o < info->fb_stride; o++) + info->wr1(info, h*info->fb_stride + o, c); break; case 2: - for (o = 0; o < info->fb_stride; o += 2) - info->wr2(info, o, c); + for (h = 0; h < info->fb_height; h++) + for (o = 0; o < info->fb_stride; o += 2) + info->wr2(info, h*info->fb_stride + o, c); break; case 3: - /* line 0 */ - for (o = 0; o < info->fb_stride; o += 3) { - info->wr1(info, o, (c >> 16) & 0xff); - info->wr1(info, o + 1, (c >> 8) & 0xff); - info->wr1(info, o + 2, c & 0xff); - } + for (h = 0; h < info->fb_height; h++) + for (o = 0; o < info->fb_stride; o += 3) { + info->wr1(info, h*info->fb_stride + o, + (c >> 16) & 0xff); + info->wr1(info, h*info->fb_stride + o + 1, + (c >> 8) & 0xff); + info->wr1(info, h*info->fb_stride + o + 2, + c & 0xff); + } break; case 4: - for (o = 0; o < info->fb_stride; o += 4) - info->wr4(info, o, c); + for (h = 0; h < info->fb_height; h++) + for (o = 0; o < info->fb_stride; o += 4) + info->wr4(info, h*info->fb_stride + o, c); break; default: /* panic? */ return; } - /* Copy line0 to all other lines. */ - /* XXX will copy with borders. */ - for (o = info->fb_stride; o < info->fb_size; o += info->fb_stride) { - info->copy(info, o, 0, info->fb_stride); - } } void Modified: stable/10/sys/dev/vt/hw/fb/vt_fb.h ============================================================================== --- stable/10/sys/dev/vt/hw/fb/vt_fb.h Tue Sep 2 19:48:37 2014 (r270979) +++ stable/10/sys/dev/vt/hw/fb/vt_fb.h Tue Sep 2 19:56:37 2014 (r270980) @@ -43,5 +43,7 @@ vd_blank_t vt_fb_blank; vd_bitbltchr_t vt_fb_bitbltchr; vd_maskbitbltchr_t vt_fb_maskbitbltchr; 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: stable/10/sys/sys/fbio.h ============================================================================== --- stable/10/sys/sys/fbio.h Tue Sep 2 19:48:37 2014 (r270979) +++ stable/10/sys/sys/fbio.h Tue Sep 2 19:56:37 2014 (r270980) @@ -141,8 +141,6 @@ struct fb_info { /* Methods. */ fb_write_t *fb_write; /* if NULL, direct mem write. */ fb_read_t *fb_read; /* if NULL, direct mem read. */ - fb_ioctl_t *fb_ioctl; /* Can be NULL. */ - fb_mmap_t *fb_mmap; /* Can be NULL. */ struct cdev *fb_cdev;