From 98a737cf8fe2ce470c3793bbbb889ad4fdabdf8d Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Tue, 6 Aug 2013 03:09:44 +0000 Subject: [PATCH] Micro-optimize OFW syscons 8-bit blank. MFC after: 1 week --- sys/powerpc/ofw/ofw_syscons.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sys/powerpc/ofw/ofw_syscons.c b/sys/powerpc/ofw/ofw_syscons.c index 0820d7329e5f..84ba302f61c3 100644 --- a/sys/powerpc/ofw/ofw_syscons.c +++ b/sys/powerpc/ofw/ofw_syscons.c @@ -586,14 +586,22 @@ ofwfb_blank_display8(video_adapter_t *adp, int mode) { struct ofwfb_softc *sc; int i; - uint8_t *addr; + uint32_t *addr; + uint32_t color; + uint32_t end; sc = (struct ofwfb_softc *)adp; - addr = (uint8_t *) sc->sc_addr; + addr = (uint32_t *) sc->sc_addr; + end = (sc->sc_stride/4) * sc->sc_height; - /* Could be done a lot faster e.g. 32-bits, or Altivec'd */ - for (i = 0; i < sc->sc_stride*sc->sc_height; i++) - *(addr + i) = ofwfb_background(SC_NORM_ATTR); + /* Splat 4 pixels at once. */ + color = (ofwfb_background(SC_NORM_ATTR) << 24) | + (ofwfb_background(SC_NORM_ATTR) << 16) | + (ofwfb_background(SC_NORM_ATTR) << 8) | + (ofwfb_background(SC_NORM_ATTR)); + + for (i = 0; i < end; i++) + *(addr + i) = color; return (0); }