These routines are MOL-specific and currently not required anywhere else.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/forth/device/display.fs | 6 +++ openbios-devel/include/libopenbios/video.h | 1 - openbios-devel/libopenbios/video_common.c | 67 -------------------------- openbios-devel/packages/molvideo.c | 71 +++++++++++++++++++++++++++- 4 files changed, 75 insertions(+), 70 deletions(-)
diff --git a/openbios-devel/forth/device/display.fs b/openbios-devel/forth/device/display.fs index b6e8bb8..7a0e4fa 100644 --- a/openbios-devel/forth/device/display.fs +++ b/openbios-devel/forth/device/display.fs @@ -375,4 +375,10 @@ defer fb8-invertrect 0 to foreground-color
fb8-erase-screen + + \ If we have a startup splash then display it + [IFDEF] CONFIG_MOL + startup-splash 2000 ms + fb8-erase-screen + [THEN] ; diff --git a/openbios-devel/include/libopenbios/video.h b/openbios-devel/include/libopenbios/video.h index 668e3e4..ae82007 100644 --- a/openbios-devel/include/libopenbios/video.h +++ b/openbios-devel/include/libopenbios/video.h @@ -2,7 +2,6 @@ void init_video(unsigned long fb, int width, int height, int depth, int rb); unsigned long get_color(int col_ind); void set_color(int ind, unsigned long color); -void refresh_palette(void); int video_get_res(int *w, int *h); void draw_pixel(int x, int y, int colind); void video_scroll(int height); diff --git a/openbios-devel/libopenbios/video_common.c b/openbios-devel/libopenbios/video_common.c index 8649536..b853872 100644 --- a/openbios-devel/libopenbios/video_common.c +++ b/openbios-devel/libopenbios/video_common.c @@ -67,61 +67,6 @@ set_color( int ind, unsigned long color ) #endif }
-static void -startup_splash( void ) -{ -#ifdef CONFIG_MOL - int fd, s, i, y, x, dx, dy; - int width, height; - char *pp, *p; - char buf[64]; -#endif - - /* only draw logo in 24-bit mode (for now) */ - if( video.fb.depth < 15 ) - return; -#ifdef CONFIG_MOL - for( i=0; i<2; i++ ) { - if( !BootHGetStrResInd("bootlogo", buf, sizeof(buf), 0, i) ) - return; - *(!i ? &width : &height) = atol(buf); - } - - if( (s=width * height * 3) > 0x20000 ) - return; - - if( (fd=open_io("pseudo:,bootlogo")) >= 0 ) { - p = malloc( s ); - if( read_io(fd, p, s) != s ) - printk("bootlogo size error\n"); - close_io( fd ); - - dx = (video.fb.w - width)/2; - dy = (video.fb.h - height)/3; - - pp = (char*)video.fb.mvirt + dy * video.fb.rb + dx * (video.fb.depth >= 24 ? 4 : 2); - - for( y=0 ; y<height; y++, pp += video.fb.rb ) { - if( video.fb.depth >= 24 ) { - unsigned long *d = (unsigned long*)pp; - for( x=0; x<width; x++, p+=3, d++ ) - *d = ((int)p[0] << 16) | ((int)p[1] << 8) | p[2]; - } else if( video.fb.depth == 15 ) { - unsigned short *d = (unsigned short*)pp; - for( x=0; x<width; x++, p+=3, d++ ) { - int col = ((int)p[0] << 16) | ((int)p[1] << 8) | p[2]; - *d = ((col>>9) & 0x7c00) | ((col>>6) & 0x03e0) | ((col>>3) & 0x1f); - } - } - } - free( p ); - } -#else - /* No bootlogo support yet on other platforms */ - return; -#endif -} - int video_get_res( int *w, int *h ) { @@ -310,15 +255,6 @@ fill_rect( int col_ind, int x, int y, int w, int h ) } }
-void -refresh_palette( void ) -{ -#ifdef CONFIG_MOL - if( video.fb.depth == 8 ) - OSI_RefreshPalette(); -#endif -} - /* ( color_ind x y width height -- ) (?) */ void video_fill_rect(void) @@ -412,7 +348,4 @@ init_video( unsigned long fb, int width, int height, int depth, int rb ) set_color( i, i * 0x010101 );
set_color( 254, 0xffffcc ); - - refresh_palette(); - startup_splash(); } diff --git a/openbios-devel/packages/molvideo.c b/openbios-devel/packages/molvideo.c index 0e37cb5..3498056 100644 --- a/openbios-devel/packages/molvideo.c +++ b/openbios-devel/packages/molvideo.c @@ -31,6 +31,15 @@
DECLARE_NODE( video, 0, 0, "Tdisplay" );
+static void +molvideo_refresh_palette( void ) +{ +#ifdef CONFIG_MOL + if( video.fb.depth == 8 ) + OSI_RefreshPalette(); +#endif +} + /* ( -- width height ) (?) */ static void molvideo_dimensions( void ) @@ -54,7 +63,7 @@ molvideo_set_colors( void ) unsigned long col = (p[0] << 16) | (p[1] << 8) | p[2]; set_color( i + start, col ); } - refresh_palette(); + molvideo_refresh_palette(); }
/* ( r g b index -- ) */ @@ -68,7 +77,7 @@ molvideo_color_bang( void ) unsigned long col = ((r << 16) & 0xff0000) | ((g << 8) & 0x00ff00) | (b & 0xff); /* printk("color!: %08lx %08lx %08lx %08lx\n", r, g, b, index ); */ set_color( index, col ); - refresh_palette(); + molvideo_refresh_palette(); }
/* ( color_ind x y width height -- ) (?) */ @@ -78,11 +87,69 @@ molvideo_fill_rect ( void ) video_fill_rect(); }
+/* ( -- ) - really should be reworked as draw-logo */ +static void +molvideo_startup_splash( void ) +{ +#ifdef CONFIG_MOL + int fd, s, i, y, x, dx, dy; + int width, height; + char *pp, *p; + char buf[64]; +#endif + + /* only draw logo in 24-bit mode (for now) */ + if( video.fb.depth < 15 ) + return; +#ifdef CONFIG_MOL + for( i=0; i<2; i++ ) { + if( !BootHGetStrResInd("bootlogo", buf, sizeof(buf), 0, i) ) + return; + *(!i ? &width : &height) = atol(buf); + } + + if( (s=width * height * 3) > 0x20000 ) + return; + + if( (fd=open_io("pseudo:,bootlogo")) >= 0 ) { + p = malloc( s ); + if( read_io(fd, p, s) != s ) + printk("bootlogo size error\n"); + close_io( fd ); + + dx = (video.fb.w - width)/2; + dy = (video.fb.h - height)/3; + + pp = (char*)video.fb.mvirt + dy * video.fb.rb + dx * (video.fb.depth >= 24 ? 4 : 2); + + for( y=0 ; y<height; y++, pp += video.fb.rb ) { + if( video.fb.depth >= 24 ) { + unsigned long *d = (unsigned long*)pp; + for( x=0; x<width; x++, p+=3, d++ ) + *d = ((int)p[0] << 16) | ((int)p[1] << 8) | p[2]; + } else if( video.fb.depth == 15 ) { + unsigned short *d = (unsigned short*)pp; + for( x=0; x<width; x++, p+=3, d++ ) { + int col = ((int)p[0] << 16) | ((int)p[1] << 8) | p[2]; + *d = ((col>>9) & 0x7c00) | ((col>>6) & 0x03e0) | ((col>>3) & 0x1f); + } + } + } + free( p ); + } +#else + /* No bootlogo support yet on other platforms */ + return; +#endif +} + + NODE_METHODS( video ) = { {"dimensions", molvideo_dimensions }, {"set-colors", molvideo_set_colors }, {"fill-rectangle", molvideo_fill_rect }, {"color!", molvideo_color_bang }, + {"startup-splash", molvideo_startup_splash }, };