diff options
Diffstat (limited to 'sys/dev/syscons/logo')
-rw-r--r-- | sys/dev/syscons/logo/logo_saver.c | 79 |
1 files changed, 31 insertions, 48 deletions
diff --git a/sys/dev/syscons/logo/logo_saver.c b/sys/dev/syscons/logo/logo_saver.c index ff42be0..105fcae 100644 --- a/sys/dev/syscons/logo/logo_saver.c +++ b/sys/dev/syscons/logo/logo_saver.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: logo_saver.c,v 1.1 1998/12/28 14:22:57 des Exp $ + * $Id: logo_saver.c,v 1.2 1999/01/01 14:40:49 des Exp $ */ #include <sys/param.h> @@ -34,26 +34,24 @@ #include <sys/module.h> #include <sys/syslog.h> -#include <machine/md_var.h> - #include <saver.h> static u_char *vid; static int banksize, scrmode, scrw, scrh; -static u_char save_pal[768]; +static int blanked; #include "logo.c" -#define set_origin(scp, o) (*biosvidsw.set_win_org)((scp)->adp, o) +#define set_origin(adp, o) (*vidsw[(adp)->va_index]->set_win_org)(adp, o) static void -logo_blit(int x, int y) +logo_blit(video_adapter_t *adp, int x, int y) { int d, l, o, p; for (o = 0, p = y * scrw + x; p > banksize; p -= banksize) o += banksize; - set_origin(cur_console, o); + set_origin(adp, o); for (d = 0; d < sizeof logo_img; d += logo_w) { if (p + logo_w < banksize) { @@ -62,12 +60,12 @@ logo_blit(int x, int y) } else if (p < banksize) { l = banksize - p; bcopy(logo_img + d, vid + p, l); - set_origin(cur_console, (o += banksize)); + set_origin(adp, (o += banksize)); bcopy(logo_img + d + l, vid, logo_w - l); p += scrw - banksize; } else { p -= banksize; - set_origin(cur_console, (o += banksize)); + set_origin(adp, (o += banksize)); bcopy(logo_img + d, vid + p, logo_w); p += scrw; } @@ -75,7 +73,7 @@ logo_blit(int x, int y) } static void -logo_update(void) +logo_update(video_adapter_t *adp) { static int xpos = 0, ypos = 0; static int xinc = 1, yinc = 1; @@ -89,62 +87,42 @@ logo_update(void) ypos += yinc; /* XXX Relies on margin around logo to erase trail */ - logo_blit(xpos, ypos); + logo_blit(adp, xpos, ypos); } -static void -logo_saver(int blank) +static int +logo_saver(video_adapter_t *adp, int blank) { - scr_stat *scp = cur_console; - static int saved_mode; int i, pl; if (blank) { /* switch to graphics mode */ - if (scrn_blanked <= 0) { + if (blanked <= 0) { pl = splhigh(); - saved_mode = scp->mode; - scp->mode = scrmode; - scp->status |= SAVER_RUNNING|GRAPHICS_MODE; - save_palette(scp, (char *)save_pal); - set_mode(scp); - load_palette(scp, (char *)logo_pal); - scrn_blanked++; - vid = (u_char *)Crtat; + set_video_mode(adp, scrmode, logo_pal, 0); + blanked++; + vid = (u_char *)adp->va_window; splx(pl); for (i = 0; i < scrw*scrh; i += banksize) { - set_origin(scp, i); + set_origin(adp, i); bzero(vid, banksize); } } - logo_update(); + logo_update(adp); } else { - /* return to previous video mode */ - if (scrn_blanked > 0) { - if (saved_mode) { - pl = splhigh(); - scrn_blanked = 0; - scp->mode = saved_mode; - scp->status &= ~(SAVER_RUNNING|GRAPHICS_MODE); - set_mode(scp); - load_palette(scp, (char *)save_pal); - saved_mode = 0; - splx(pl); - } - } + blanked = 0; } + return 0; } static int -logo_saver_load(void) +logo_init(video_adapter_t *adp) { video_info_t info; - int adp; - adp = cur_console->adp; - if (!(*biosvidsw.get_info)(adp, M_VESA_CG800x600, &info)) { + if (!get_mode_info(adp, M_VESA_CG800x600, &info)) { scrmode = M_VESA_CG800x600; - } else if (!(*biosvidsw.get_info)(adp, M_VGA_CG320, &info)) { + } else if (!get_mode_info(adp, M_VGA_CG320, &info)) { scrmode = M_VGA_CG320; } else { log(LOG_NOTICE, "logo_saver: no suitable graphics mode\n"); @@ -154,14 +132,19 @@ logo_saver_load(void) banksize = info.vi_window_size; scrw = info.vi_width; scrh = info.vi_height; + blanked = 0; - return add_scrn_saver(logo_saver); + return 0; } static int -logo_saver_unload(void) +logo_term(video_adapter_t *adp) { - return remove_scrn_saver(logo_saver); + return 0; } -SAVER_MODULE(logo_saver); +static scrn_saver_t logo_module = { + "logo_saver", logo_init, logo_term, logo_saver, NULL, +}; + +SAVER_MODULE(logo_saver, logo_module); |