Author: emaste
Date: Mon Jan 12 18:38:09 2015
New Revision: 277083
URL: https://svnweb.freebsd.org/changeset/base/277083

Log:
  Avoid crash in vt_blank() and improve performance
  
  MFC of r268771 (partial), r268796
  
  PR:           196510
  Reported by:  Andre Albsmeier
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/9/sys/dev/vt/hw/fb/vt_fb.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/vt/hw/fb/vt_fb.c
==============================================================================
--- stable/9/sys/dev/vt/hw/fb/vt_fb.c   Mon Jan 12 18:32:45 2015        
(r277082)
+++ stable/9/sys/dev/vt/hw/fb/vt_fb.c   Mon Jan 12 18:38:09 2015        
(r277083)
@@ -143,41 +143,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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to