Message ID | 1403565068-15229-12-git-send-email-benh@kernel.crashing.org |
---|---|
State | New |
Headers | show |
On 24 June 2014 00:11, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote: > And initialize it based on target endian > @@ -155,6 +155,7 @@ typedef struct VGACommonState { > const GraphicHwOps *hw_ops; > bool full_update_text; > bool full_update_gfx; > + bool big_endian_fb; Don't we need to migrate this new state somehow? thanks -- PMM
On Tue, 2014-06-24 at 00:24 +0100, Peter Maydell wrote: > On 24 June 2014 00:11, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote: > > And initialize it based on target endian > > @@ -155,6 +155,7 @@ typedef struct VGACommonState { > > const GraphicHwOps *hw_ops; > > bool full_update_text; > > bool full_update_gfx; > > + bool big_endian_fb; > > Don't we need to migrate this new state somehow? Only when it can change, which is done in patch 13 This patch (11) just moves it around to the state but its value is still fixed at this point in the series. Cheers, Ben.
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);
And initialize it based on target endian Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- hw/display/vga.c | 17 ++++++++++++++--- hw/display/vga_int.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-)