Author: mcayland Date: Sat Jul 27 12:14:56 2013 New Revision: 1186 URL: http://tracker.coreboot.org/trac/openbios/changeset/1186
Log: video_common.c: fix 32-bit display modes on 64-bit architectures
Switch from using unsigned long to uint32_t in the 32-bit primitives and unsigned short to uint16_t in the 16-bit primitives. While not a complete fix (endian-swapping, 24-bit mode) it does fix 32-bit display depth on 64-bit architectures such as SPARC64.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Modified: trunk/openbios-devel/libopenbios/video_common.c
Modified: trunk/openbios-devel/libopenbios/video_common.c ============================================================================== --- trunk/openbios-devel/libopenbios/video_common.c Sat Jul 27 12:14:53 2013 (r1185) +++ trunk/openbios-devel/libopenbios/video_common.c Sat Jul 27 12:14:56 2013 (r1186) @@ -107,9 +107,9 @@ }
if( d >= 24 ) - *((unsigned long*)dst) = color; + *((uint32_t*)dst) = color; else if( d >= 15 ) - *((short*)dst) = color; + *((uint16_t*)dst) = color; else *dst = color;
@@ -146,7 +146,7 @@ for( ; h--; pp += *(video.rb) ) { int ww = w; if( VIDEO_DICT_VALUE(video.depth) == 24 || VIDEO_DICT_VALUE(video.depth) == 32 ) { - unsigned long *p = (unsigned long*)pp + x; + uint32_t *p = (uint32_t*)pp + x; while( ww-- ) { if (*p == fgcolor) { *p++ = bgcolor; @@ -155,11 +155,11 @@ } } } else if( VIDEO_DICT_VALUE(video.depth) == 16 || VIDEO_DICT_VALUE(video.depth) == 15 ) { - unsigned short *p = (unsigned short*)pp + x; + uint16_t *p = (uint16_t*)pp + x; while( ww-- ) { - if (*p == (unsigned short)fgcolor) { + if (*p == (uint16_t)fgcolor) { *p++ = bgcolor; - } else if (*p == (unsigned short)bgcolor) { + } else if (*p == (uint16_t)bgcolor) { *p++ = fgcolor; } } @@ -198,11 +198,11 @@ for( ; h--; pp += VIDEO_DICT_VALUE(video.rb) ) { int ww = w; if( VIDEO_DICT_VALUE(video.depth) == 24 || VIDEO_DICT_VALUE(video.depth) == 32 ) { - unsigned long *p = (unsigned long*)pp + x; + uint32_t *p = (uint32_t*)pp + x; while( ww-- ) *p++ = col; } else if( VIDEO_DICT_VALUE(video.depth) == 16 || VIDEO_DICT_VALUE(video.depth) == 15 ) { - unsigned short *p = (unsigned short*)pp + x; + uint16_t *p = (uint16_t*)pp + x; while( ww-- ) *p++ = col; } else {