Home | History | Annotate | Line # | Download | only in splash
splash.c revision 1.5
      1  1.5    martin /* $NetBSD: splash.c,v 1.5 2008/04/28 20:23:58 martin Exp $ */
      2  1.1  jmcneill 
      3  1.1  jmcneill /*-
      4  1.1  jmcneill  * Copyright (c) 2006 Jared D. McNeill <jmcneill (at) invisible.ca>
      5  1.1  jmcneill  * All rights reserved.
      6  1.1  jmcneill  *
      7  1.1  jmcneill  * Redistribution and use in source and binary forms, with or without
      8  1.1  jmcneill  * modification, are permitted provided that the following conditions
      9  1.1  jmcneill  * are met:
     10  1.1  jmcneill  * 1. Redistributions of source code must retain the above copyright
     11  1.1  jmcneill  *    notice, this list of conditions and the following disclaimer.
     12  1.1  jmcneill  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  jmcneill  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  jmcneill  *    documentation and/or other materials provided with the distribution.
     15  1.1  jmcneill  *
     16  1.1  jmcneill  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     17  1.1  jmcneill  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     18  1.1  jmcneill  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     19  1.1  jmcneill  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     20  1.1  jmcneill  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21  1.1  jmcneill  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22  1.1  jmcneill  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     23  1.1  jmcneill  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     24  1.1  jmcneill  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     25  1.1  jmcneill  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26  1.1  jmcneill  * POSSIBILITY OF SUCH DAMAGE.
     27  1.1  jmcneill  */
     28  1.1  jmcneill 
     29  1.1  jmcneill #include <sys/cdefs.h>
     30  1.5    martin __KERNEL_RCSID(0, "$NetBSD: splash.c,v 1.5 2008/04/28 20:23:58 martin Exp $");
     31  1.1  jmcneill 
     32  1.1  jmcneill #include "opt_splash.h"
     33  1.1  jmcneill 
     34  1.1  jmcneill /* XXX */
     35  1.1  jmcneill #define	NSPLASH8 1
     36  1.1  jmcneill #define	NSPLASH16 1
     37  1.1  jmcneill #define	NSPLASH32 1
     38  1.1  jmcneill 
     39  1.1  jmcneill #include <sys/param.h>
     40  1.1  jmcneill #include <sys/systm.h>
     41  1.1  jmcneill #include <sys/types.h>
     42  1.1  jmcneill #include <sys/kernel.h>
     43  1.1  jmcneill #include <sys/kthread.h>
     44  1.1  jmcneill 
     45  1.1  jmcneill #include <dev/splash/splash.h>
     46  1.1  jmcneill 
     47  1.1  jmcneill #if !defined(SPLASHSCREEN) && defined(SPLASHSCREEN_PROGRESS)
     48  1.1  jmcneill #error "options SPLASHSCREEN_PROGRESS requires SPLASHSCREEN"
     49  1.1  jmcneill #endif
     50  1.1  jmcneill 
     51  1.1  jmcneill #ifdef __HAVE_CPU_COUNTER
     52  1.4        ad #include <sys/cpu.h>
     53  1.1  jmcneill #include <machine/cpu_counter.h>
     54  1.1  jmcneill #endif
     55  1.1  jmcneill 
     56  1.1  jmcneill #ifndef SPLASHSCREEN_IMAGE
     57  1.1  jmcneill #define SPLASHSCREEN_IMAGE "dev/splash/images/netbsd.h"
     58  1.1  jmcneill #endif
     59  1.1  jmcneill 
     60  1.1  jmcneill #ifdef SPLASHSCREEN
     61  1.1  jmcneill #include SPLASHSCREEN_IMAGE
     62  1.1  jmcneill 
     63  1.1  jmcneill #ifdef SPLASHSCREEN_PROGRESS
     64  1.1  jmcneill struct splash_progress *splash_progress_state;
     65  1.1  jmcneill #ifdef __HAVE_CPU_COUNTER
     66  1.1  jmcneill static uint64_t splash_last_update;
     67  1.1  jmcneill #endif
     68  1.1  jmcneill #endif
     69  1.1  jmcneill 
     70  1.1  jmcneill #if NSPLASH8 > 0
     71  1.1  jmcneill static void	splash_render8(struct splash_info *, const char *, int,
     72  1.1  jmcneill 			       int, int, int, int);
     73  1.1  jmcneill #endif
     74  1.1  jmcneill #if NSPLASH16 > 0
     75  1.1  jmcneill static void	splash_render16(struct splash_info *, const char *, int,
     76  1.1  jmcneill 				int, int, int, int);
     77  1.1  jmcneill #endif
     78  1.1  jmcneill #if NSPLASH32 > 0
     79  1.1  jmcneill static void	splash_render32(struct splash_info *, const char *, int,
     80  1.1  jmcneill 				int, int, int, int);
     81  1.1  jmcneill #endif
     82  1.1  jmcneill 
     83  1.1  jmcneill void
     84  1.1  jmcneill splash_render(struct splash_info *si, int flg)
     85  1.1  jmcneill {
     86  1.1  jmcneill 	int xoff, yoff;
     87  1.1  jmcneill 
     88  1.1  jmcneill 	/* XXX */
     89  1.1  jmcneill 	if (flg & SPLASH_F_CENTER) {
     90  1.1  jmcneill 		xoff = (si->si_width - _splash_width) / 2;
     91  1.1  jmcneill 		yoff = (si->si_height - _splash_height) / 2;
     92  1.1  jmcneill 	} else
     93  1.1  jmcneill 		xoff = yoff = 0;
     94  1.1  jmcneill 
     95  1.1  jmcneill 	switch (si->si_depth) {
     96  1.1  jmcneill #if NSPLASH8 > 0
     97  1.1  jmcneill 	case 8:
     98  1.1  jmcneill 		splash_render8(si, _splash_header_data, xoff, yoff,
     99  1.1  jmcneill 		    _splash_width, _splash_height, flg);
    100  1.1  jmcneill 		break;
    101  1.1  jmcneill #endif
    102  1.1  jmcneill #if NSPLASH16 > 0
    103  1.1  jmcneill 	case 16:
    104  1.1  jmcneill 		splash_render16(si, _splash_header_data, xoff, yoff,
    105  1.1  jmcneill 		    _splash_width, _splash_height, flg);
    106  1.1  jmcneill 		break;
    107  1.1  jmcneill #endif
    108  1.1  jmcneill #if NSPLASH32 > 0
    109  1.1  jmcneill 	case 32:
    110  1.1  jmcneill 		splash_render32(si, _splash_header_data, xoff, yoff,
    111  1.1  jmcneill 		    _splash_width, _splash_height, flg);
    112  1.1  jmcneill 		break;
    113  1.1  jmcneill #endif
    114  1.1  jmcneill 	default:
    115  1.1  jmcneill 		aprint_error("WARNING: Splash not supported at %dbpp\n",
    116  1.1  jmcneill 		    si->si_depth);
    117  1.1  jmcneill 		break;
    118  1.1  jmcneill 	}
    119  1.1  jmcneill 
    120  1.1  jmcneill 	return;
    121  1.1  jmcneill }
    122  1.1  jmcneill 
    123  1.1  jmcneill #if NSPLASH8 > 0
    124  1.1  jmcneill static void
    125  1.1  jmcneill splash_render8(struct splash_info *si, const char *data, int xoff, int yoff,
    126  1.1  jmcneill 	       int swidth, int sheight, int flg)
    127  1.1  jmcneill {
    128  1.1  jmcneill 	const char *p;
    129  1.1  jmcneill 	u_char *fb, pix;
    130  1.1  jmcneill 	int x, y, i;
    131  1.1  jmcneill 	int filled;
    132  1.1  jmcneill 
    133  1.1  jmcneill 	fb = si->si_bits;
    134  1.1  jmcneill 	if (flg & SPLASH_F_FILL)
    135  1.1  jmcneill 		filled = 0;
    136  1.1  jmcneill 	else
    137  1.1  jmcneill 		filled = 1;
    138  1.1  jmcneill 
    139  1.1  jmcneill 	p = data;
    140  1.1  jmcneill 	fb += xoff + (yoff * si->si_width);
    141  1.1  jmcneill 	for (y = 0; y < sheight; y++) {
    142  1.1  jmcneill 		for (x = 0; x < swidth; x++) {
    143  1.1  jmcneill 			pix = *p++;
    144  1.1  jmcneill 			pix += SPLASH_CMAP_OFFSET;
    145  1.1  jmcneill 			if (filled == 0) {
    146  1.1  jmcneill 				for (i = 0; i < (si->si_width * si->si_height);
    147  1.1  jmcneill 				     i++)
    148  1.1  jmcneill 					si->si_bits[i] = pix;
    149  1.1  jmcneill 				filled = 1;
    150  1.1  jmcneill 			}
    151  1.1  jmcneill 			fb[x] = pix;
    152  1.1  jmcneill 		}
    153  1.1  jmcneill 		fb += si->si_width;
    154  1.1  jmcneill 	}
    155  1.1  jmcneill 
    156  1.1  jmcneill 	/* If we've just written to the shadow fb, copy it to the display */
    157  1.1  jmcneill 	if (si->si_hwbits) {
    158  1.1  jmcneill 		if (flg & SPLASH_F_FILL) {
    159  1.1  jmcneill 			memcpy(si->si_hwbits, si->si_bits,
    160  1.1  jmcneill 			    si->si_width*si->si_height);
    161  1.1  jmcneill 		} else {
    162  1.1  jmcneill 			u_char *rp, *hrp;
    163  1.1  jmcneill 
    164  1.1  jmcneill 			rp = si->si_bits + xoff + (yoff * si->si_width);
    165  1.1  jmcneill 			hrp = si->si_hwbits + xoff + (yoff * si->si_width);
    166  1.1  jmcneill 
    167  1.1  jmcneill 			for (y = 0; y < sheight; y++) {
    168  1.1  jmcneill 				memcpy(hrp, rp, swidth);
    169  1.1  jmcneill 				hrp += si->si_stride;
    170  1.1  jmcneill 				rp += si->si_stride;
    171  1.1  jmcneill 			}
    172  1.1  jmcneill 		}
    173  1.1  jmcneill 	}
    174  1.1  jmcneill 
    175  1.1  jmcneill 	return;
    176  1.1  jmcneill }
    177  1.1  jmcneill #endif /* !NSPLASH8 > 0 */
    178  1.1  jmcneill 
    179  1.1  jmcneill #if NSPLASH16 > 0
    180  1.1  jmcneill #define RGBTO16(b, o, x, c)					\
    181  1.1  jmcneill 	do {							\
    182  1.1  jmcneill 		uint16_t *_ptr = (uint16_t *)(&(b)[(o)]);	\
    183  1.1  jmcneill 		*_ptr = (((c)[(x)*3+0] / 8) << 11) |		\
    184  1.1  jmcneill 			(((c)[(x)*3+1] / 4) << 5) |		\
    185  1.1  jmcneill 			(((c)[(x)*3+2] / 8) << 0);		\
    186  1.1  jmcneill 	} while (0)
    187  1.1  jmcneill 
    188  1.1  jmcneill static void
    189  1.1  jmcneill splash_render16(struct splash_info *si, const char *data, int xoff, int yoff,
    190  1.1  jmcneill 		int swidth, int sheight, int flg)
    191  1.1  jmcneill {
    192  1.1  jmcneill 	const char *d;
    193  1.1  jmcneill 	u_char *fb, *p;
    194  1.1  jmcneill 	u_char pix[3];
    195  1.1  jmcneill 	int x, y, i;
    196  1.1  jmcneill 	int filled;
    197  1.1  jmcneill 
    198  1.1  jmcneill 	fb = si->si_bits;
    199  1.1  jmcneill 
    200  1.1  jmcneill 	if (flg & SPLASH_F_FILL)
    201  1.1  jmcneill 		filled = 0;
    202  1.1  jmcneill 	else
    203  1.1  jmcneill 		filled = 1;
    204  1.1  jmcneill 
    205  1.1  jmcneill 	d = data;
    206  1.1  jmcneill 	fb += xoff * 2 + yoff * si->si_stride;
    207  1.1  jmcneill 
    208  1.1  jmcneill 	for (y = 0; y < sheight; y++) {
    209  1.1  jmcneill 		for (x = 0; x < swidth; x++) {
    210  1.1  jmcneill 			_SPLASH_HEADER_PIXEL(d, pix);
    211  1.1  jmcneill 			if (filled == 0) {
    212  1.1  jmcneill 				p = si->si_bits;
    213  1.1  jmcneill 				i = 0;
    214  1.1  jmcneill 				while (i < si->si_height*si->si_stride) {
    215  1.1  jmcneill 					RGBTO16(p, i, 0, pix);
    216  1.1  jmcneill 					i += 2;
    217  1.1  jmcneill 				}
    218  1.1  jmcneill 				filled = 1;
    219  1.1  jmcneill 			}
    220  1.1  jmcneill 			RGBTO16(fb, x*2, 0, pix);
    221  1.1  jmcneill 		}
    222  1.1  jmcneill 		fb += si->si_stride;
    223  1.1  jmcneill 	}
    224  1.1  jmcneill 
    225  1.1  jmcneill 	/* If we've just written to the shadow fb, copy it to the display */
    226  1.1  jmcneill 	if (si->si_hwbits) {
    227  1.1  jmcneill 		if (flg & SPLASH_F_FILL) {
    228  1.1  jmcneill 			memcpy(si->si_hwbits, si->si_bits,
    229  1.1  jmcneill 			    si->si_height*si->si_stride);
    230  1.1  jmcneill 		} else {
    231  1.1  jmcneill 			u_char *rp, *hrp;
    232  1.1  jmcneill 
    233  1.1  jmcneill 			rp = si->si_bits + (xoff * 2) + (yoff * si->si_stride);
    234  1.1  jmcneill 			hrp = si->si_hwbits + (xoff * 2) +
    235  1.1  jmcneill 			    (yoff * si->si_stride);
    236  1.1  jmcneill 
    237  1.1  jmcneill 			for (y = 0; y < sheight; y++) {
    238  1.1  jmcneill 				memcpy(hrp, rp, swidth * 2);
    239  1.1  jmcneill 				rp += si->si_stride;
    240  1.1  jmcneill 				hrp += si->si_stride;
    241  1.1  jmcneill 			}
    242  1.1  jmcneill 		}
    243  1.1  jmcneill 	}
    244  1.1  jmcneill 
    245  1.1  jmcneill 	return;
    246  1.1  jmcneill }
    247  1.1  jmcneill #undef RGBTO16
    248  1.1  jmcneill #endif /* !NSPLASH16 > 0 */
    249  1.1  jmcneill 
    250  1.1  jmcneill #if NSPLASH32 > 0
    251  1.1  jmcneill static void
    252  1.1  jmcneill splash_render32(struct splash_info *si, const char *data, int xoff, int yoff,
    253  1.1  jmcneill 		int swidth, int sheight, int flg)
    254  1.1  jmcneill {
    255  1.1  jmcneill 	const char *d;
    256  1.1  jmcneill 	u_char *fb, *p;
    257  1.1  jmcneill 	u_char pix[3];
    258  1.1  jmcneill 	int x, y, i;
    259  1.1  jmcneill 	int filled;
    260  1.1  jmcneill 
    261  1.1  jmcneill 	fb = si->si_bits;
    262  1.1  jmcneill 
    263  1.1  jmcneill 	if (flg & SPLASH_F_FILL)
    264  1.1  jmcneill 		filled = 0;
    265  1.1  jmcneill 	else
    266  1.1  jmcneill 		filled = 1;
    267  1.1  jmcneill 
    268  1.1  jmcneill 	d = data;
    269  1.1  jmcneill 	fb += xoff * 4 + yoff * si->si_stride;
    270  1.1  jmcneill 
    271  1.1  jmcneill 	for (y = 0; y < sheight; y++) {
    272  1.1  jmcneill 		for (x = 0; x < swidth; x++) {
    273  1.1  jmcneill 			_SPLASH_HEADER_PIXEL(d, pix);
    274  1.1  jmcneill 			if (filled == 0) {
    275  1.1  jmcneill 				p = si->si_bits;
    276  1.1  jmcneill 				i = 0;
    277  1.1  jmcneill 				while (i < si->si_height*si->si_stride) {
    278  1.1  jmcneill 					p[i++] = pix[2];
    279  1.1  jmcneill 					p[i++] = pix[1];
    280  1.1  jmcneill 					p[i++] = pix[0];
    281  1.1  jmcneill 					p[i++] = 0;
    282  1.1  jmcneill 				}
    283  1.1  jmcneill 				filled = 1;
    284  1.1  jmcneill 			}
    285  1.1  jmcneill 			fb[x*4+0] = pix[2];
    286  1.1  jmcneill 			fb[x*4+1] = pix[1];
    287  1.1  jmcneill 			fb[x*4+2] = pix[0];
    288  1.1  jmcneill 			fb[x*4+3] = 0;
    289  1.1  jmcneill 		}
    290  1.1  jmcneill 		fb += si->si_stride;
    291  1.1  jmcneill 	}
    292  1.1  jmcneill 
    293  1.1  jmcneill 	/* If we've just written to the shadow fb, copy it to the display */
    294  1.1  jmcneill 	if (si->si_hwbits) {
    295  1.1  jmcneill 		if (flg & SPLASH_F_FILL) {
    296  1.1  jmcneill 			memcpy(si->si_hwbits, si->si_bits,
    297  1.1  jmcneill 			    si->si_height*si->si_stride);
    298  1.1  jmcneill 		} else {
    299  1.1  jmcneill 			u_char *rp, *hrp;
    300  1.1  jmcneill 
    301  1.1  jmcneill 			rp = si->si_bits + (xoff * 4) + (yoff * si->si_stride);
    302  1.1  jmcneill 			hrp = si->si_hwbits + (xoff * 4) +
    303  1.1  jmcneill 			    (yoff * si->si_stride);
    304  1.1  jmcneill 
    305  1.1  jmcneill 			for (y = 0; y < sheight; y++) {
    306  1.1  jmcneill 				memcpy(hrp, rp, swidth * 4);
    307  1.1  jmcneill 				rp += si->si_stride;
    308  1.1  jmcneill 				hrp += si->si_stride;
    309  1.1  jmcneill 			}
    310  1.1  jmcneill 		}
    311  1.1  jmcneill 	}
    312  1.1  jmcneill 
    313  1.1  jmcneill 	return;
    314  1.1  jmcneill }
    315  1.1  jmcneill #endif /* !NSPLASH32 > 0 */
    316  1.1  jmcneill 
    317  1.1  jmcneill #ifdef SPLASHSCREEN_PROGRESS
    318  1.1  jmcneill 
    319  1.1  jmcneill static void
    320  1.1  jmcneill splash_progress_render(struct splash_progress *sp)
    321  1.1  jmcneill {
    322  1.1  jmcneill 	struct splash_info *si;
    323  1.1  jmcneill 	int i;
    324  1.1  jmcneill 	int w;
    325  1.1  jmcneill 	int spacing;
    326  1.1  jmcneill 	int xoff;
    327  1.1  jmcneill 	int yoff;
    328  1.1  jmcneill 	int flg;
    329  1.1  jmcneill 
    330  1.1  jmcneill 	si = sp->sp_si;
    331  1.1  jmcneill 	flg = 0;
    332  1.1  jmcneill 
    333  1.1  jmcneill 	/* where should we draw the pulsers? */
    334  1.1  jmcneill 	yoff = (si->si_height / 8) * 7;
    335  1.1  jmcneill 	w = _pulse_off_width * SPLASH_PROGRESS_NSTATES;
    336  1.1  jmcneill 	xoff = (si->si_width / 4) * 3;
    337  1.1  jmcneill 	spacing = _pulse_off_width; /* XXX */
    338  1.1  jmcneill 
    339  1.1  jmcneill 	for (i = 0; i < SPLASH_PROGRESS_NSTATES; i++) {
    340  1.1  jmcneill 		const char *d = (sp->sp_state == i ? _pulse_on_header_data :
    341  1.1  jmcneill 				 _pulse_off_header_data);
    342  1.1  jmcneill 		switch (si->si_depth) {
    343  1.1  jmcneill #if NSPLASH8 > 0
    344  1.1  jmcneill 		case 8:
    345  1.1  jmcneill 			splash_render8(si, d, (xoff + (i * spacing)),
    346  1.1  jmcneill 			    yoff, _pulse_off_width, _pulse_off_height, flg);
    347  1.1  jmcneill 			break;
    348  1.1  jmcneill #endif
    349  1.1  jmcneill #if NSPLASH16 > 0
    350  1.1  jmcneill 		case 16:
    351  1.1  jmcneill 			splash_render16(si, d, (xoff + (i * spacing)),
    352  1.1  jmcneill 			    yoff, _pulse_off_width, _pulse_off_height, flg);
    353  1.1  jmcneill 			break;
    354  1.1  jmcneill #endif
    355  1.1  jmcneill #if NSPLASH32 > 0
    356  1.1  jmcneill 		case 32:
    357  1.1  jmcneill 			splash_render32(si, d, (xoff + (i * spacing)),
    358  1.1  jmcneill 			    yoff, _pulse_off_width, _pulse_off_height, flg);
    359  1.1  jmcneill 			break;
    360  1.1  jmcneill #endif
    361  1.1  jmcneill 		default:
    362  1.1  jmcneill 			/* do nothing */
    363  1.1  jmcneill 			break;
    364  1.1  jmcneill 		}
    365  1.1  jmcneill 	}
    366  1.1  jmcneill }
    367  1.1  jmcneill 
    368  1.1  jmcneill static int
    369  1.1  jmcneill splash_progress_stop(struct device *dev)
    370  1.1  jmcneill {
    371  1.1  jmcneill 	struct splash_progress *sp;
    372  1.1  jmcneill 
    373  1.1  jmcneill 	sp = (struct splash_progress *)dev;
    374  1.1  jmcneill 	sp->sp_running = 0;
    375  1.1  jmcneill 
    376  1.1  jmcneill 	return 0;
    377  1.1  jmcneill }
    378  1.1  jmcneill 
    379  1.1  jmcneill void
    380  1.1  jmcneill splash_progress_init(struct splash_progress *sp)
    381  1.1  jmcneill {
    382  1.1  jmcneill #ifdef __HAVE_CPU_COUNTER
    383  1.1  jmcneill 	if (cpu_hascounter())
    384  1.1  jmcneill 		splash_last_update = cpu_counter();
    385  1.1  jmcneill 	else
    386  1.1  jmcneill 		splash_last_update = 0;
    387  1.1  jmcneill #endif
    388  1.1  jmcneill 
    389  1.1  jmcneill 	sp->sp_running = 1;
    390  1.1  jmcneill 	sp->sp_force = 0;
    391  1.1  jmcneill 	splash_progress_state = sp;
    392  1.1  jmcneill 	splash_progress_render(sp);
    393  1.1  jmcneill 	config_finalize_register((struct device *)sp, splash_progress_stop);
    394  1.1  jmcneill 
    395  1.1  jmcneill 	return;
    396  1.1  jmcneill }
    397  1.1  jmcneill 
    398  1.1  jmcneill void
    399  1.1  jmcneill splash_progress_update(struct splash_progress *sp)
    400  1.1  jmcneill {
    401  1.1  jmcneill 	if (sp->sp_running == 0 && sp->sp_force == 0)
    402  1.1  jmcneill 		return;
    403  1.1  jmcneill 
    404  1.1  jmcneill #ifdef __HAVE_CPU_COUNTER
    405  1.1  jmcneill 	if (cpu_hascounter()) {
    406  1.1  jmcneill 		uint64_t now;
    407  1.1  jmcneill 
    408  1.1  jmcneill 		if (splash_last_update == 0) {
    409  1.1  jmcneill 			splash_last_update = cpu_counter();
    410  1.1  jmcneill 		} else {
    411  1.1  jmcneill 			now = cpu_counter();
    412  1.3     freza 			if (splash_last_update + cpu_frequency(curcpu())/4 >
    413  1.3     freza 			    now)
    414  1.1  jmcneill 				return;
    415  1.1  jmcneill 			splash_last_update = now;
    416  1.1  jmcneill 		}
    417  1.1  jmcneill 	}
    418  1.1  jmcneill #endif
    419  1.1  jmcneill 	sp->sp_state++;
    420  1.1  jmcneill 	if (sp->sp_state >= SPLASH_PROGRESS_NSTATES)
    421  1.1  jmcneill 		sp->sp_state = 0;
    422  1.1  jmcneill 
    423  1.1  jmcneill 	splash_progress_render(sp);
    424  1.1  jmcneill }
    425  1.1  jmcneill 
    426  1.1  jmcneill #endif /* !SPLASHSCREEN_PROGRESS */
    427  1.1  jmcneill 
    428  1.1  jmcneill #endif /* !SPLASHSCREEN */
    429