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