summary refs log tree commit diff stats
path: root/hw/vga.c
diff options
context:
space:
mode:
authormalc <malc@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-23 19:56:19 +0000
committermalc <malc@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-23 19:56:19 +0000
commit0da2ea1b37622ea6608031b5cd9dcca8f1b0e12d (patch)
tree2f1c16df46ad69dcc772442e308a617d002462bd /hw/vga.c
parent1a6f0dbcc0fe79e7bbd35c6e995fec24d32968af (diff)
downloadfocaccia-qemu-0da2ea1b37622ea6608031b5cd9dcca8f1b0e12d.tar.gz
focaccia-qemu-0da2ea1b37622ea6608031b5cd9dcca8f1b0e12d.zip
fix endianness problem sharing the videoram buffer
[ The following text is in the "UTF-8" character set. ]

    [ Your display is set for the "koi8-r" character set.  ]

    [ Some characters may be displayed incorrectly. ]

This patch fixes vga rendering when the guest endianness differs from
the host endianness: in this case we can only share the buffer if the
bpp is 32 and we must change the pixelformat accordingly.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6413 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/vga.c')
-rw-r--r--hw/vga.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/vga.c b/hw/vga.c
index 776ead0bfb..c9fef86edb 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -1623,12 +1623,19 @@ static void vga_draw_graphic(VGAState *s, int full_update)
         disp_width != s->last_width ||
         height != s->last_height ||
         s->last_depth != depth) {
+#if defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN)
         if (depth == 16 || depth == 32) {
+#else
+        if (depth == 32) {
+#endif
             if (is_graphic_console()) {
                 qemu_free_displaysurface(s->ds->surface);
                 s->ds->surface = qemu_create_displaysurface_from(disp_width, height, depth,
                                                                s->line_offset,
                                                                s->vram_ptr + (s->start_addr * 4));
+#if defined(WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
+                s->ds->surface->pf = qemu_different_endianness_pixelformat(depth);
+#endif
                 dpy_resize(s->ds);
             } else {
                 qemu_console_resize(s->ds, disp_width, height);