diff -Naur dev.orig/syscons/dragon/dragon_saver.c dev/syscons/dragon/dragon_saver.c --- dev.orig/syscons/dragon/dragon_saver.c 2010-06-14 11:09:06.000000000 +0900 +++ dev/syscons/dragon/dragon_saver.c 2010-11-14 19:45:09.000000000 +0900 @@ -41,23 +41,23 @@ #include #include #include +#include #define SAVER_NAME "dragon_saver" static u_char *vid; -static int blanked; +static int blanked, scrw=0, scrh=0; + +#ifndef VIDEO_MODE #ifdef PC98 #define VIDEO_MODE M_PC98_EGC640x400 -#define VIDEO_MODE_NAME "M_PC98_EGC640x400" -#define SCRW 640 -#define SCRH 400 #else -#define VIDEO_MODE M_VGA_CG320 -#define VIDEO_MODE_NAME "M_VGA_CG320" -#define SCRW 320 -#define SCRH 200 +#define VIDEO_MODE M_VESA_CG640x480 #endif + +#endif // #ifndef VIDEO_MODE + #define ORDER 13 #define CURVE 3 #define OUT 100 @@ -69,13 +69,13 @@ static __inline int gpset(int x, int y, int val) { - if (x < 0 || y < 0 || SCRW <= x || SCRH <= y) { + if (x < 0 || y < 0 || scrw <= x || scrh <= y) { return 0; } #ifdef PC98 - vid[(x + y * SCRW) >> 3] = (0x80 >> (x & 7)); /* write new dot */ + vid[(x + y * scrw) >> 3] = (0x80 >> (x & 7)); /* write new dot */ #else - vid[x + y * SCRW] = val; + vid[x + y * scrw] = val; #endif return 1; } @@ -143,8 +143,8 @@ } vidd_load_palette(adp, dragon_pal); - mul = ((random() & 7) + 1) * (SCRW / 320); - org_x = random() % SCRW; org_y = random() % SCRH; + mul = ((random() & 7) + 1) * (scrw / 320); + org_x = random() % scrw; org_y = random() % scrh; curve = 0; order = ORDER; @@ -231,10 +231,15 @@ /* check that the console is capable of running in 320x200x256 */ if (vidd_get_info(adp, VIDEO_MODE, &info)) { log(LOG_NOTICE, - "%s: the console does not support " VIDEO_MODE_NAME "\n", + "%s: the console does not support any of video modes it probes\n", SAVER_NAME); return ENODEV; } + + printf("%d is the video mode chosen for %s\n", VIDEO_MODE, SAVER_NAME); + + scrw=info.vi_width; + scrh=info.vi_height; blanked = 0; return 0; diff -Naur dev.orig/syscons/fire/fire_saver.c dev/syscons/fire/fire_saver.c --- dev.orig/syscons/fire/fire_saver.c 2010-06-14 11:09:06.000000000 +0900 +++ dev/syscons/fire/fire_saver.c 2010-11-14 19:45:23.000000000 +0900 @@ -45,6 +45,7 @@ #include #include #include +#include #define SAVER_NAME "fire_saver" @@ -58,6 +59,10 @@ vidd_set_win_org(adp, last_origin = oo); \ } while (0) +#ifndef VIDEO_MODE +#define VIDEO_MODE M_VESA_CG640x480 +#endif + static u_char *buf; static u_char *vid; static int banksize, scrmode, bpsl, scrw, scrh; @@ -141,7 +146,9 @@ video_info_t info; int i, red, green, blue; - if (!vidd_get_info(adp, M_VGA_CG320, &info)) { + if (!vidd_get_info(adp, VIDEO_MODE, &info)) { + scrmode = VIDEO_MODE; + } else if (!vidd_get_info(adp, M_VGA_CG320, &info)) { scrmode = M_VGA_CG320; } else if (!vidd_get_info(adp, M_PC98_PEGC640x480, &info)) { scrmode = M_PC98_PEGC640x480; @@ -149,7 +156,7 @@ scrmode = M_PC98_PEGC640x400; } else { log(LOG_NOTICE, - "%s: the console does not support M_VGA_CG320\n", + "%s: the console does not support any of video modes it probes.\n", SAVER_NAME); return (ENODEV); } diff -Naur dev.orig/syscons/logo/logo_saver.c dev/syscons/logo/logo_saver.c --- dev.orig/syscons/logo/logo_saver.c 2010-06-14 11:09:06.000000000 +0900 +++ dev/syscons/logo/logo_saver.c 2010-11-14 19:45:40.000000000 +0900 @@ -39,6 +39,7 @@ #include #include #include +#include #define SAVER_NAME "logo_saver" @@ -48,6 +49,10 @@ vidd_set_win_org(adp, last_origin = oo); \ } while (0) +#ifndef VIDEO_MODE +#define VIDEO_MODE M_VESA_CG640x480 +#endif + extern unsigned int logo_w; extern unsigned int logo_h; extern unsigned char logo_pal[]; @@ -136,7 +141,9 @@ { video_info_t info; - if (!vidd_get_info(adp, M_VESA_CG800x600, &info)) { + if (!vidd_get_info(adp, VIDEO_MODE, &info)) { + scrmode = VIDEO_MODE; + } else if (!vidd_get_info(adp, M_VESA_CG800x600, &info)) { scrmode = M_VESA_CG800x600; } else if (!vidd_get_info(adp, M_VGA_CG320, &info)) { scrmode = M_VGA_CG320; @@ -146,7 +153,7 @@ scrmode = M_PC98_PEGC640x400; } else { log(LOG_NOTICE, - "%s: the console does not support M_VGA_CG320\n", + "%s: the console does not support any of video modes it probes\n", SAVER_NAME); return (ENODEV); } diff -Naur dev.orig/syscons/rain/rain_saver.c dev/syscons/rain/rain_saver.c --- dev.orig/syscons/rain/rain_saver.c 2010-06-14 11:09:06.000000000 +0900 +++ dev/syscons/rain/rain_saver.c 2010-11-14 19:46:03.000000000 +0900 @@ -39,6 +39,7 @@ #include #include #include +#include #define SAVER_NAME "rain_saver" #ifdef MAX @@ -57,6 +58,10 @@ vidd_set_win_org(adp, last_origin = oo); \ } while (0) +#ifndef VIDEO_MODE +#define VIDEO_MODE M_VESA_CG640x480 +#endif + static u_char *vid; static int banksize, scrmode, bpsl, scrw, scrh; static u_char rain_pal[768]; @@ -141,7 +146,9 @@ video_info_t info; int i; - if (!vidd_get_info(adp, M_VGA_CG320, &info)) { + if (!vidd_get_info(adp, VIDEO_MODE, &info)) { + scrmode = VIDEO_MODE; + } else if (!vidd_get_info(adp, M_VGA_CG320, &info)) { scrmode = M_VGA_CG320; } else if (!vidd_get_info(adp, M_PC98_PEGC640x480, &info)) { scrmode = M_PC98_PEGC640x480; @@ -149,7 +156,7 @@ scrmode = M_PC98_PEGC640x400; } else { log(LOG_NOTICE, - "%s: the console does not support M_VGA_CG320\n", + "%s: the console does not support any of video modes it probes\n", SAVER_NAME); return (ENODEV); } diff -Naur dev.orig/syscons/videomode.h dev/syscons/videomode.h --- dev.orig/syscons/videomode.h 1970-01-01 09:00:00.000000000 +0900 +++ dev/syscons/videomode.h 2010-11-14 19:54:26.000000000 +0900 @@ -0,0 +1,14 @@ +#ifndef _videomode_ +#define _videomode_ + +#include + +// VIDEO_MODE should be one of 8bit VGA modes +// because screensavers assume 8bit mode screen. +// The current value of VIDEO_MODE is just an example. +// Change it to whatever 8bit mode shown in "vidcontrol -i mode" +// Many of those numeral mode values are defined as +// #define macros in /usr/src/sys/sys/fbio.h +#define VIDEO_MODE M_VESA_CG640x480 + +#endif diff -Naur dev.orig/syscons/warp/warp_saver.c dev/syscons/warp/warp_saver.c --- dev.orig/syscons/warp/warp_saver.c 2010-06-14 11:09:06.000000000 +0900 +++ dev/syscons/warp/warp_saver.c 2010-11-14 19:46:20.000000000 +0900 @@ -39,6 +39,7 @@ #include #include #include +#include #define SAVER_NAME "warp_saver" #define SPP 15 @@ -50,6 +51,10 @@ vidd_set_win_org(adp, last_origin = oo); \ } while (0) +#ifndef VIDEO_MODE +#define VIDEO_MODE M_VESA_CG640x480 +#endif + static u_char *vid; static int banksize, scrmode, bpsl, scrw, scrh; static int blanked; @@ -127,7 +132,9 @@ video_info_t info; int i; - if (!vidd_get_info(adp, M_VGA_CG320, &info)) { + if (!vidd_get_info(adp, VIDEO_MODE, &info)) { + scrmode = VIDEO_MODE; + } else if (!vidd_get_info(adp, M_VGA_CG320, &info)) { scrmode = M_VGA_CG320; } else if (!vidd_get_info(adp, M_PC98_PEGC640x480, &info)) { scrmode = M_PC98_PEGC640x480; @@ -135,7 +142,7 @@ scrmode = M_PC98_PEGC640x400; } else { log(LOG_NOTICE, - "%s: the console does not support M_VGA_CG320\n", + "%s: the console does not support any of video modes it probes\n", SAVER_NAME); return (ENODEV); }