qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC 11/14] vga: Make fb endian a common state variable


From: Benjamin Herrenschmidt
Subject: [Qemu-devel] [RFC 11/14] vga: Make fb endian a common state variable
Date: Tue, 24 Jun 2014 09:11:05 +1000

And initialize it based on target endian

Signed-off-by: Benjamin Herrenschmidt <address@hidden>
---
 hw/display/vga.c     | 17 ++++++++++++++---
 hw/display/vga_int.h |  1 +
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/hw/display/vga.c b/hw/display/vga.c
index 909518c..e0c8dc7 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -1418,10 +1418,10 @@ static void vga_draw_graphic(VGACommonState *s, int 
full_update)
     uint8_t *d;
     uint32_t v, addr1, addr;
     vga_draw_line_func *vga_draw_line = NULL;
-#if defined(HOST_WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN)
-    static const bool byteswap = false;
+#ifdef HOST_WORDS_BIGENDIAN
+    bool byteswap = !s->big_endian_fb;
 #else
-    static const bool byteswap = true;
+    bool byteswap = s->big_endian_fb;
 #endif
 
     full_update |= update_basic_params(s);
@@ -2082,6 +2082,17 @@ void vga_common_init(VGACommonState *s, Object *obj, 
bool global_vmstate)
         s->update_retrace_info = vga_precise_update_retrace_info;
         break;
     }
+
+    /*
+     * Set default fb endian based on target, should probably be turned
+     * into a device attribute set by the machine/platform to remove
+     * all target endian dependencies from this file.
+     */
+#ifdef TARGET_WORDS_BIGENDIAN
+    s->big_endian_fb = true;
+#else
+    s->big_endian_fb = false;
+#endif
     vga_dirty_log_start(s);
 }
 
diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h
index 14e777a..ae64321 100644
--- a/hw/display/vga_int.h
+++ b/hw/display/vga_int.h
@@ -155,6 +155,7 @@ typedef struct VGACommonState {
     const GraphicHwOps *hw_ops;
     bool full_update_text;
     bool full_update_gfx;
+    bool big_endian_fb;
     /* hardware mouse cursor support */
     uint32_t invalidated_y_table[VGA_MAX_HEIGHT / 32];
     void (*cursor_invalidate)(struct VGACommonState *s);
-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]