Some EFI framebuffers are very slow, so rather than sending every
pixel of a character one at a time, send one row at a time.

Under VMWare fusion, this change makes a kernel boot to userland
more than 10 seconds faster.

It also helps a noticeable bit on my MacBook Air before inteldrm
takes over.


Index: sys/dev/rasops/rasops32.c
===================================================================
RCS file: /cvs/src/sys/dev/rasops/rasops32.c,v
retrieving revision 1.7
diff -u -p -u -p -r1.7 rasops32.c
--- sys/dev/rasops/rasops32.c   28 Aug 2010 12:48:14 -0000      1.7
+++ sys/dev/rasops/rasops32.c   19 Feb 2017 16:34:28 -0000
@@ -69,6 +69,7 @@ rasops32_putchar(void *cookie, int row, 
        struct rasops_info *ri;
        int32_t *dp, *rp;
        u_char *fr;
+       uint32_t buffer[64];
 
        ri = (struct rasops_info *)cookie;
 
@@ -90,12 +91,13 @@ rasops32_putchar(void *cookie, int row, 
        clr[1] = ri->ri_devcmap[(attr >> 24) & 0xf];
 
        if (uc == ' ') {
+               for (cnt = 0; cnt < width; cnt++)
+                       buffer[cnt] = clr[0];
                while (height--) {
                        dp = rp;
                        DELTA(rp, ri->ri_stride, int32_t *);
 
-                       for (cnt = width; cnt; cnt--)
-                               *dp++ = clr[0];
+                       memcpy(dp, buffer, width << 2);
                }
        } else {
                uc -= ri->ri_font->firstchar;
@@ -109,10 +111,11 @@ rasops32_putchar(void *cookie, int row, 
                        fr += fs;
                        DELTA(rp, ri->ri_stride, int32_t *);
 
-                       for (cnt = width; cnt; cnt--) {
-                               *dp++ = clr[(fb >> 31) & 1];
+                       for (cnt = 0; cnt < width; cnt++) {
+                               buffer[cnt] = clr[(fb >> 31) & 1];
                                fb <<= 1;
                        }
+                       memcpy(dp, buffer, width << 2);
                }
        }
 

Reply via email to