diff options
author | Riku Voipio <riku.voipio@nokia.com> | 2013-02-18 16:58:22 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2015-05-03 20:45:19 +0100 |
commit | f0fed7e31f7681ef4343e32445faaa6192b28161 (patch) | |
tree | d00aec382f6841cc1ebd03d488cd43699f3ebfbb | |
parent | 5bccbb04a4abba7af4398de992bf06d585fd1333 (diff) |
blizzard: fix for non-32bpp host displays
TODO: I'm not sure how to trigger this bug, or if the fix is correct
(the comments say it's a hack)
-rw-r--r-- | hw/display/blizzard.c | 105 |
1 files changed, 57 insertions, 48 deletions
diff --git a/hw/display/blizzard.c b/hw/display/blizzard.c index 5019bbbef..4f100b9a1 100644 --- a/hw/display/blizzard.c +++ b/hw/display/blizzard.c @@ -69,7 +69,6 @@ typedef struct { uint8_t iformat; uint8_t source; QemuConsole *con; - blizzard_fn_t *line_fn_tab[2]; void *fb; uint8_t hssi_config[3]; @@ -115,7 +114,6 @@ typedef struct { uint16_t *ptr; int angle; int pitch; - blizzard_fn_t line_fn; } data; } BlizzardState; @@ -133,6 +131,17 @@ static const int blizzard_iformat_bpp[0x10] = { 0, 0, 0, 0, 0, 0, }; +#define DEPTH 8 +#include "blizzard_template.h" +#define DEPTH 15 +#include "blizzard_template.h" +#define DEPTH 16 +#include "blizzard_template.h" +#define DEPTH 24 +#include "blizzard_template.h" +#define DEPTH 32 +#include "blizzard_template.h" + static void blizzard_window(BlizzardState *s) { DisplaySurface *surface = qemu_console_surface(s->con); @@ -140,8 +149,49 @@ static void blizzard_window(BlizzardState *s) int bypp[2]; int bypl[3]; int y; - blizzard_fn_t fn = s->data.line_fn; + blizzard_fn_t fn = 0; + +#if 0 + /* FIXME: this is a hack - but nseries.c will use this function + * before correct DisplayState is initialized so we need a way to + * avoid drawing something when we actually have no clue about host bpp */ + /* XXX PMM : this is no longer possible after the changes to use + * DisplaySurfaces -- need to check if it is still a problem... + */ + if (QLIST_EMPTY(&s->state->listeners)) { + return; + } +#endif + switch (surface_bits_per_pixel(surface)) { + case 8: + fn = s->data.angle + ? blizzard_draw_fn_r_8[s->iformat] + : blizzard_draw_fn_8[s->iformat]; + break; + case 15: + fn = s->data.angle + ? blizzard_draw_fn_r_15[s->iformat] + : blizzard_draw_fn_15[s->iformat]; + break; + case 16: + fn = s->data.angle + ? blizzard_draw_fn_r_16[s->iformat] + : blizzard_draw_fn_16[s->iformat]; + break; + case 24: + fn = s->data.angle + ? blizzard_draw_fn_r_24[s->iformat] + : blizzard_draw_fn_24[s->iformat]; + break; + case 32: + fn = s->data.angle + ? blizzard_draw_fn_r_32[s->iformat] + : blizzard_draw_fn_32[s->iformat]; + break; + default: + break; + } if (!fn) return; if (s->mx[0] > s->data.x) @@ -172,7 +222,6 @@ static int blizzard_transfer_setup(BlizzardState *s) return 0; s->data.angle = s->effect & 3; - s->data.line_fn = s->line_fn_tab[!!s->data.angle][s->iformat]; s->data.x = s->ix[0]; s->data.y = s->iy[0]; s->data.dx = s->ix[1] - s->ix[0] + 1; @@ -924,17 +973,6 @@ static void blizzard_update_display(void *opaque) s->my[1] = 0; } -#define DEPTH 8 -#include "blizzard_template.h" -#define DEPTH 15 -#include "blizzard_template.h" -#define DEPTH 16 -#include "blizzard_template.h" -#define DEPTH 24 -#include "blizzard_template.h" -#define DEPTH 32 -#include "blizzard_template.h" - static const GraphicHwOps blizzard_ops = { .invalidate = blizzard_invalidate_display, .gfx_update = blizzard_update_display, @@ -943,44 +981,15 @@ static const GraphicHwOps blizzard_ops = { void *s1d13745_init(qemu_irq gpio_int) { BlizzardState *s = (BlizzardState *) g_malloc0(sizeof(*s)); - DisplaySurface *surface; s->fb = g_malloc(0x180000); + /* Fill the framebuffer with white color here because the corresponding + * code in nseries.c is broken since the DisplayState change in QEMU. + * This is supposedly ok since nseries.c is the only user of blizzard.c */ + memset(s->fb, 0xff, 0x180000); s->con = graphic_console_init(NULL, 0, &blizzard_ops, s); - surface = qemu_console_surface(s->con); - - switch (surface_bits_per_pixel(surface)) { - case 0: - s->line_fn_tab[0] = s->line_fn_tab[1] = - g_malloc0(sizeof(blizzard_fn_t) * 0x10); - break; - case 8: - s->line_fn_tab[0] = blizzard_draw_fn_8; - s->line_fn_tab[1] = blizzard_draw_fn_r_8; - break; - case 15: - s->line_fn_tab[0] = blizzard_draw_fn_15; - s->line_fn_tab[1] = blizzard_draw_fn_r_15; - break; - case 16: - s->line_fn_tab[0] = blizzard_draw_fn_16; - s->line_fn_tab[1] = blizzard_draw_fn_r_16; - break; - case 24: - s->line_fn_tab[0] = blizzard_draw_fn_24; - s->line_fn_tab[1] = blizzard_draw_fn_r_24; - break; - case 32: - s->line_fn_tab[0] = blizzard_draw_fn_32; - s->line_fn_tab[1] = blizzard_draw_fn_r_32; - break; - default: - fprintf(stderr, "%s: Bad color depth\n", __FUNCTION__); - exit(1); - } blizzard_reset(s); - return s; } |