From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzDP5-00078G-Ue for qemu-devel@nongnu.org; Mon, 23 Jun 2014 19:12:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WzDP0-0003Rb-Tq for qemu-devel@nongnu.org; Mon, 23 Jun 2014 19:11:59 -0400 Received: from gate.crashing.org ([63.228.1.57]:40458) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzDP0-0003RD-Dq for qemu-devel@nongnu.org; Mon, 23 Jun 2014 19:11:54 -0400 From: Benjamin Herrenschmidt Date: Tue, 24 Jun 2014 09:11:05 +1000 Message-Id: <1403565068-15229-12-git-send-email-benh@kernel.crashing.org> In-Reply-To: <1403565068-15229-1-git-send-email-benh@kernel.crashing.org> References: <1403565068-15229-1-git-send-email-benh@kernel.crashing.org> Subject: [Qemu-devel] [RFC 11/14] vga: Make fb endian a common state variable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann And initialize it based on target endian Signed-off-by: Benjamin Herrenschmidt --- 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