[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
- [Qemu-devel] [RFC 08/14] vga: Simplify vga_draw_blank() a bit, (continued)
- [Qemu-devel] [RFC 08/14] vga: Simplify vga_draw_blank() a bit, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 10/14] vga: Remove some "should be done in BIOS" comments, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 07/14] vga: Remove rgb_to_pixel indirection, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 13/14] vga: Add endian control register, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 12/14] vga: Rename vga_template.h to vga-helpers.h, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 05/14] vga: Remove unused vga_draw_line24() and vga_draw_line32(), Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 11/14] vga: Make fb endian a common state variable,
Benjamin Herrenschmidt <=
- [Qemu-devel] [RFC 14/14] ppc/spapr/vga: Switch VGA endian on H_SET_MODE, Benjamin Herrenschmidt, 2014/06/23
- [Qemu-devel] [RFC 02/14] ui: Remove unused QEMU_BIG_ENDIAN_FLAG, Benjamin Herrenschmidt, 2014/06/23
- Re: [Qemu-devel] [RFC 00/14] VGA cleanups and endian control, Gerd Hoffmann, 2014/06/30