aboutsummaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorBhanu Chetlapalli <bhanu@mips.com>2012-01-31 16:36:59 -0800
committerBhanu Chetlapalli <bhanu@mips.com>2012-01-31 16:36:59 -0800
commit832b23a22ac81ccd339b468402ee69750e351ad2 (patch)
tree8b880a7318a4c39365f7f72d0609959248a54a31 /hw
parent828b135787a028f6befe56470e7233329cc45e3f (diff)
downloadexternal_qemu-832b23a22ac81ccd339b468402ee69750e351ad2.zip
external_qemu-832b23a22ac81ccd339b468402ee69750e351ad2.tar.gz
external_qemu-832b23a22ac81ccd339b468402ee69750e351ad2.tar.bz2
[ENDIAN] Fix goldfish fb for bigendian targets
Swap bytes in the display buffer if the host endianess does not match the target endianess. This fixes a problem with the wrong colour being displayed in the text framebuffer console. Not sure if the is the correct place to fix it.. It might be better to have the kernel goldfish framebuffer driver swap the bytes. Change-Id: I8c7ada6e5cb6de7745511f3b83f07f0ac95276af Signed-off-by: Chris Dearman <chris@mips.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/goldfish_fb.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/hw/goldfish_fb.c b/hw/goldfish_fb.c
index d74d797..16450b3 100644
--- a/hw/goldfish_fb.c
+++ b/hw/goldfish_fb.c
@@ -319,7 +319,11 @@ compute_fb_update_rect_linear(FbUpdateState* fbs,
xx1 = 0;
DUFF4(width, {
- if (src[xx1] != dst[xx1])
+ uint16_t spix = src[xx1];
+#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
+ spix = (uint16_t)((spix << 8) | (spix >> 8));
+#endif
+ if (spix != dst[xx1])
break;
xx1++;
});
@@ -332,8 +336,8 @@ compute_fb_update_rect_linear(FbUpdateState* fbs,
break;
xx2--;
});
-#if HOST_WORDS_BIGENDIAN
- /* Convert the guest little-endian pixels into big-endian ones */
+#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
+ /* Convert the guest pixels into host ones */
int xx = xx1;
DUFF4(xx2-xx1+1,{
unsigned spix = src[xx];
@@ -382,7 +386,12 @@ compute_fb_update_rect_linear(FbUpdateState* fbs,
xx1 = 0;
DUFF4(width, {
- if (src[xx1] != dst[xx1]) {
+ uint32_t spix = src[xx1];
+#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
+ spix = (spix << 16) | (spix >> 16);
+ spix = ((spix << 8) & 0xff00ff00) | ((spix >> 8) & 0x00ff00ff);
+#endif
+ if (spix != dst[xx1]) {
break;
}
xx1++;
@@ -397,8 +406,8 @@ compute_fb_update_rect_linear(FbUpdateState* fbs,
}
xx2--;
});
-#if HOST_WORDS_BIGENDIAN
- /* Convert the guest little-endian pixels into big-endian ones */
+#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
+ /* Convert the guest pixels into host ones */
int xx = xx1;
DUFF4(xx2-xx1+1,{
uint32_t spix = src[xx];