24 and 32bpp surfaces are always shared, we never "draw" them anymore
Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> --- hw/display/vga.c | 29 +++++++++++------------- hw/display/vga_template.h | 56 ----------------------------------------------- 2 files changed, 13 insertions(+), 72 deletions(-) diff --git a/hw/display/vga.c b/hw/display/vga.c index b46e42d..e98f7da 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -1344,8 +1344,6 @@ enum { VGA_DRAW_LINE8, VGA_DRAW_LINE15, VGA_DRAW_LINE16, - VGA_DRAW_LINE24, - VGA_DRAW_LINE32, VGA_DRAW_LINE_NB, }; @@ -1358,8 +1356,6 @@ static vga_draw_line_func * const vga_draw_line_table[VGA_DRAW_LINE_NB] = { vga_draw_line8, vga_draw_line15, vga_draw_line16, - vga_draw_line24, - vga_draw_line32, }; static int vga_get_bpp(VGACommonState *s) @@ -1431,7 +1427,7 @@ static void vga_draw_graphic(VGACommonState *s, int full_update) int disp_width, multi_scan, multi_run; uint8_t *d; uint32_t v, addr1, addr; - vga_draw_line_func *vga_draw_line; + vga_draw_line_func *vga_draw_line = NULL; #if defined(HOST_WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN) static const bool byteswap = false; #else @@ -1528,7 +1524,7 @@ static void vga_draw_graphic(VGACommonState *s, int full_update) } bits = 4; } else { - switch(s->get_bpp(s)) { + switch(depth) { default: case 0: full_update |= update_palette256(s); @@ -1549,19 +1545,20 @@ static void vga_draw_graphic(VGACommonState *s, int full_update) bits = 16; break; case 24: - v = VGA_DRAW_LINE24; - bits = 24; - break; case 32: - v = VGA_DRAW_LINE32; - bits = 32; - break; + if (!is_buffer_shared(surface)) { + fprintf(stderr, + "vga: Non-shared surface at %dbpp unsupported !\n", depth); + return; + } + bits = depth; } } - vga_draw_line = vga_draw_line_table[v]; - - if (!is_buffer_shared(surface) && s->cursor_invalidate) { - s->cursor_invalidate(s); + if (!is_buffer_shared(surface)) { + vga_draw_line = vga_draw_line_table[v]; + if (s->cursor_invalidate) { + s->cursor_invalidate(s); + } } line_offset = s->line_offset; diff --git a/hw/display/vga_template.h b/hw/display/vga_template.h index 41fc764..e7cd9e0 100644 --- a/hw/display/vga_template.h +++ b/hw/display/vga_template.h @@ -323,59 +323,3 @@ static void vga_draw_line16(VGACommonState *s1, uint8_t *d, } while (--w != 0); } -/* - * 24 bit color - */ -static void vga_draw_line24(VGACommonState *s1, uint8_t *d, - const uint8_t *s, int width) -{ - int w; - uint32_t r, g, b; - - w = width; - do { -#if defined(TARGET_WORDS_BIGENDIAN) - r = s[0]; - g = s[1]; - b = s[2]; -#else - b = s[0]; - g = s[1]; - r = s[2]; -#endif - ((uint32_t *)d)[0] = rgb_to_pixel32(r, g, b); - s += 3; - d += 4; - } while (--w != 0); -} - -/* - * 32 bit color - */ -static void vga_draw_line32(VGACommonState *s1, uint8_t *d, - const uint8_t *s, int width) -{ -#if defined(HOST_WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN) - memcpy(d, s, width * 4); -#else - int w; - uint32_t r, g, b; - - w = width; - do { -#if defined(TARGET_WORDS_BIGENDIAN) - r = s[1]; - g = s[2]; - b = s[3]; -#else - b = s[0]; - g = s[1]; - r = s[2]; -#endif - ((uint32_t *)d)[0] = rgb_to_pixel32(r, g, b); - s += 4; - d += 4; - } while (--w != 0); -#endif -} - -- 1.9.1