[OpenBIOS] [commit] r1180 - in trunk/openbios-devel: include/libopenbios libopenbios packages
repository service
svn at openbios.org
Sat Jul 27 12:14:39 CEST 2013
Author: mcayland
Date: Sat Jul 27 12:14:38 2013
New Revision: 1180
URL: http://tracker.coreboot.org/trac/openbios/changeset/1180
Log:
video_common.c: Move osi_fb_info_t struct contents directly into the video_info struct
Despite the name, osi_fb_info_t doesn't seem to be used by MOL and is just a general
holder for video parameters. So let's move everything into a single struct to make
future dereferencing easier.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
Modified:
trunk/openbios-devel/include/libopenbios/video.h
trunk/openbios-devel/libopenbios/video_common.c
trunk/openbios-devel/packages/molvideo.c
Modified: trunk/openbios-devel/include/libopenbios/video.h
==============================================================================
--- trunk/openbios-devel/include/libopenbios/video.h Sat Jul 27 12:14:34 2013 (r1179)
+++ trunk/openbios-devel/include/libopenbios/video.h Sat Jul 27 12:14:38 2013 (r1180)
@@ -7,14 +7,12 @@
void video_invert_rect(void);
void video_fill_rect(void);
-typedef struct osi_fb_info {
- unsigned long mphys;
+extern struct video_info {
+ int has_video;
+
+ phys_addr_t mphys;
unsigned long mvirt;
int rb, w, h, depth;
-} osi_fb_info_t;
-extern struct video_info {
- int has_video;
- osi_fb_info_t fb;
unsigned long *pal; /* 256 elements */
} video;
Modified: trunk/openbios-devel/libopenbios/video_common.c
==============================================================================
--- trunk/openbios-devel/libopenbios/video_common.c Sat Jul 27 12:14:34 2013 (r1179)
+++ trunk/openbios-devel/libopenbios/video_common.c Sat Jul 27 12:14:38 2013 (r1180)
@@ -31,12 +31,12 @@
unsigned long col;
if( !video.has_video || col_ind < 0 || col_ind > 255 )
return 0;
- if( video.fb.depth == 8 )
+ if( video.depth == 8 )
return col_ind;
col = video.pal[col_ind];
- if( video.fb.depth == 24 || video.fb.depth == 32 )
+ if( video.depth == 24 || video.depth == 32 )
return col;
- if( video.fb.depth == 15 )
+ if( video.depth == 15 )
return ((col>>9) & 0x7c00) | ((col>>6) & 0x03e0) | ((col>>3) & 0x1f);
return 0;
}
@@ -49,11 +49,11 @@
video.pal[ind] = color;
#ifdef CONFIG_MOL
- if( video.fb.depth == 8 )
+ if( video.depth == 8 )
OSI_SetColor( ind, color );
#elif defined(CONFIG_SPARC32)
#if defined(CONFIG_DEBUG_CONSOLE_VIDEO)
- if( video.fb.depth == 8 ) {
+ if( video.depth == 8 ) {
dac[0] = ind << 24;
dac[1] = ((color >> 16) & 0xff) << 24; // Red
dac[1] = ((color >> 8) & 0xff) << 24; // Green
@@ -74,8 +74,8 @@
*w = *h = 0;
return -1;
}
- *w = video.fb.w;
- *h = video.fb.h;
+ *w = video.w;
+ *h = video.h;
return 0;
}
@@ -97,8 +97,8 @@
fgcolor = video_get_color(fgcolor);
bgcolor = video_get_color(bgcolor);
- d = video.fb.depth;
- depthbytes = (video.fb.depth + 1) >> 3;
+ d = video.depth;
+ depthbytes = (video.depth + 1) >> 3;
dst = fbaddr;
for( y = 0; y < height; y++) {
@@ -125,7 +125,7 @@
mask++;
}
dst = rowdst;
- dst += video.fb.rb;
+ dst += video.rb;
}
}
@@ -146,13 +146,13 @@
fgcolor = video_get_color(fgcolor);
if (!video.has_video || x < 0 || y < 0 || w <= 0 || h <= 0 ||
- x + w > video.fb.w || y + h > video.fb.h)
+ x + w > video.w || y + h > video.h)
return;
- pp = (char*)video.fb.mvirt + video.fb.rb * y;
- for( ; h--; pp += video.fb.rb ) {
+ pp = (char*)video.mvirt + video.rb * y;
+ for( ; h--; pp += video.rb ) {
int ww = w;
- if( video.fb.depth == 24 || video.fb.depth == 32 ) {
+ if( video.depth == 24 || video.depth == 32 ) {
unsigned long *p = (unsigned long*)pp + x;
while( ww-- ) {
if (*p == fgcolor) {
@@ -161,7 +161,7 @@
*p++ = fgcolor;
}
}
- } else if( video.fb.depth == 16 || video.fb.depth == 15 ) {
+ } else if( video.depth == 16 || video.depth == 15 ) {
unsigned short *p = (unsigned short*)pp + x;
while( ww-- ) {
if (*p == (unsigned short)fgcolor) {
@@ -198,17 +198,17 @@
unsigned long col = video_get_color(col_ind);
if (!video.has_video || x < 0 || y < 0 || w <= 0 || h <= 0 ||
- x + w > video.fb.w || y + h > video.fb.h)
+ x + w > video.w || y + h > video.h)
return;
- pp = (char*)video.fb.mvirt + video.fb.rb * y;
- for( ; h--; pp += video.fb.rb ) {
+ pp = (char*)video.mvirt + video.rb * y;
+ for( ; h--; pp += video.rb ) {
int ww = w;
- if( video.fb.depth == 24 || video.fb.depth == 32 ) {
+ if( video.depth == 24 || video.depth == 32 ) {
unsigned long *p = (unsigned long*)pp + x;
while( ww-- )
*p++ = col;
- } else if( video.fb.depth == 16 || video.fb.depth == 15 ) {
+ } else if( video.depth == 16 || video.depth == 15 ) {
unsigned short *p = (unsigned short*)pp + x;
while( ww-- )
*p++ = col;
@@ -230,25 +230,25 @@
#endif
phandle_t ph=0, saved_ph=0;
- video.fb.mphys = video.fb.mvirt = fb;
+ video.mphys = video.mvirt = fb;
#if defined(CONFIG_SPARC64)
/* Fix virtual address on SPARC64 somewhere else */
- video.fb.mvirt = 0xfe000000;
+ video.mvirt = 0xfe000000;
#endif
- video.fb.w = width;
- video.fb.h = height;
- video.fb.depth = depth;
- video.fb.rb = rb;
+ video.w = width;
+ video.h = height;
+ video.depth = depth;
+ video.rb = rb;
saved_ph = get_cur_dev();
while( (ph=dt_iterate_type(ph, "display")) ) {
- set_int_property( ph, "width", video.fb.w );
- set_int_property( ph, "height", video.fb.h );
- set_int_property( ph, "depth", video.fb.depth );
- set_int_property( ph, "linebytes", video.fb.rb );
- set_int_property( ph, "address", video.fb.mvirt );
+ set_int_property( ph, "width", video.w );
+ set_int_property( ph, "height", video.h );
+ set_int_property( ph, "depth", video.depth );
+ set_int_property( ph, "linebytes", video.rb );
+ set_int_property( ph, "address", video.mvirt );
activate_dev(ph);
@@ -258,7 +258,7 @@
video.pal = malloc( 256 * sizeof(unsigned long) );
activate_dev(saved_ph);
- PUSH(video.fb.mvirt);
+ PUSH(video.mvirt);
feval("to frame-buffer-adr");
/* Set global variables ready for fb8-install */
@@ -272,9 +272,9 @@
fword("is-noname-cfunc");
feval("to fb8-invertrect");
- PUSH((video.fb.depth + 1) >> 3);
+ PUSH((video.depth + 1) >> 3);
feval("to depth-bytes");
- PUSH(video.fb.rb);
+ PUSH(video.rb);
feval("to line-bytes");
PUSH((ucell)fontdata);
feval("to (romfont)");
@@ -282,19 +282,19 @@
feval("to (romfont-height)");
PUSH(FONT_WIDTH);
feval("to (romfont-width)");
- PUSH(video.fb.mvirt);
+ PUSH(video.mvirt);
feval("to qemu-video-addr");
- PUSH(video.fb.w);
+ PUSH(video.w);
feval("to qemu-video-width");
- PUSH(video.fb.h);
+ PUSH(video.h);
feval("to qemu-video-height");
#if defined(CONFIG_OFMEM) && defined(CONFIG_DRIVER_PCI)
- size = ((video.fb.h * video.fb.rb) + 0xfff) & ~0xfff;
+ size = ((video.h * video.rb) + 0xfff) & ~0xfff;
- ofmem_claim_phys( video.fb.mphys, size, 0 );
- ofmem_claim_virt( video.fb.mvirt, size, 0 );
- ofmem_map( video.fb.mphys, video.fb.mvirt, size, ofmem_arch_io_translation_mode(video.fb.mphys) );
+ ofmem_claim_phys( video.mphys, size, 0 );
+ ofmem_claim_virt( video.mvirt, size, 0 );
+ ofmem_map( video.mphys, video.mvirt, size, ofmem_arch_io_translation_mode(video.mphys) );
#endif
for( i=0; i<256; i++ )
Modified: trunk/openbios-devel/packages/molvideo.c
==============================================================================
--- trunk/openbios-devel/packages/molvideo.c Sat Jul 27 12:14:34 2013 (r1179)
+++ trunk/openbios-devel/packages/molvideo.c Sat Jul 27 12:14:38 2013 (r1180)
@@ -35,7 +35,7 @@
molvideo_refresh_palette( void )
{
#ifdef CONFIG_MOL
- if( video.fb.depth == 8 )
+ if( video.depth == 8 )
OSI_RefreshPalette();
#endif
}
@@ -99,7 +99,7 @@
#endif
/* only draw logo in 24-bit mode (for now) */
- if( video.fb.depth < 15 )
+ if( video.depth < 15 )
return;
#ifdef CONFIG_MOL
for( i=0; i<2; i++ ) {
@@ -117,17 +117,17 @@
printk("bootlogo size error\n");
close_io( fd );
- dx = (video.fb.w - width)/2;
- dy = (video.fb.h - height)/3;
+ dx = (video.w - width)/2;
+ dy = (video.h - height)/3;
- pp = (char*)video.fb.mvirt + dy * video.fb.rb + dx * (video.fb.depth >= 24 ? 4 : 2);
+ pp = (char*)video.mvirt + dy * video.rb + dx * (video.depth >= 24 ? 4 : 2);
- for( y=0 ; y<height; y++, pp += video.fb.rb ) {
- if( video.fb.depth >= 24 ) {
+ for( y=0 ; y<height; y++, pp += video.rb ) {
+ if( video.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 ) {
+ } else if( video.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];
More information about the OpenBIOS
mailing list