summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-08-17 01:44:53 +0000
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-08-17 01:44:53 +0000
commit3c489c1a036c1cefe017c552957dcd97bbf0bc82 (patch)
tree8fc78c7c71394708c385f480c6b4c9ac7c182234 /hw
parent53122daae162c5a8a16b7371ba45835231edd90e (diff)
downloadqemu-3c489c1a036c1cefe017c552957dcd97bbf0bc82.tar.gz
qemu-3c489c1a036c1cefe017c552957dcd97bbf0bc82.tar.bz2
qemu-3c489c1a036c1cefe017c552957dcd97bbf0bc82.zip
Fix g364fb video emulation
(Hervé Poussineau) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5016 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r--hw/g364fb.c26
-rw-r--r--hw/g364fb_template.h6
2 files changed, 15 insertions, 17 deletions
diff --git a/hw/g364fb.c b/hw/g364fb.c
index 3dfc8e1cdc..be045bf9e5 100644
--- a/hw/g364fb.c
+++ b/hw/g364fb.c
@@ -36,7 +36,6 @@ typedef struct G364State {
QEMUConsole *console;
int graphic_mode;
uint32_t scr_width, scr_height; /* in pixels */
- uint32_t last_scr_width, last_scr_height; /* in pixels */
} G364State;
/*
@@ -73,9 +72,6 @@ typedef struct G364State {
static void g364fb_draw_graphic(G364State *s, int full_update)
{
- if (s->scr_width == 0 || s->scr_height == 0)
- return;
-
switch (s->ds->depth) {
case 8:
g364fb_draw_graphic8(s, full_update);
@@ -94,7 +90,7 @@ static void g364fb_draw_graphic(G364State *s, int full_update)
return;
}
- dpy_update(s->ds, 0, 0, s->last_scr_width, s->last_scr_height);
+ dpy_update(s->ds, 0, 0, s->scr_width, s->scr_height);
}
static void g364fb_draw_blank(G364State *s, int full_update)
@@ -104,17 +100,15 @@ static void g364fb_draw_blank(G364State *s, int full_update)
if (!full_update)
return;
- if (s->last_scr_width <= 0 || s->last_scr_height <= 0)
- return;
- w = s->last_scr_width * ((s->ds->depth + 7) >> 3);
+ w = s->scr_width * ((s->ds->depth + 7) >> 3);
d = s->ds->data;
- for(i = 0; i < s->last_scr_height; i++) {
+ for(i = 0; i < s->scr_height; i++) {
memset(d, 0, w);
d += s->ds->linesize;
}
- dpy_update(s->ds, 0, 0,
- s->last_scr_width, s->last_scr_height);
+
+ dpy_update(s->ds, 0, 0, s->scr_width, s->scr_height);
}
#define GMODE_GRAPH 0
@@ -125,6 +119,9 @@ static void g364fb_update_display(void *opaque)
G364State *s = opaque;
int full_update, graphic_mode;
+ if (s->scr_width == 0 || s->scr_height == 0)
+ return;
+
if (s->ctla & CTLA_FORCE_BLANK)
graphic_mode = GMODE_BLANK;
else
@@ -134,6 +131,10 @@ static void g364fb_update_display(void *opaque)
s->graphic_mode = graphic_mode;
full_update = 1;
}
+ if (s->scr_width != s->ds->width || s->scr_height != s->ds->height) {
+ qemu_console_resize(s->console, s->scr_width, s->scr_height);
+ full_update = 1;
+ }
switch(graphic_mode) {
case GMODE_GRAPH:
g364fb_draw_graphic(s, full_update);
@@ -158,7 +159,6 @@ static void g364fb_reset(void *opaque)
memset(s->palette, 0, sizeof(s->palette));
s->scr_width = s->scr_height = 0;
- s->last_scr_width = s->last_scr_height = 0;
memset(s->vram_buffer, 0, s->vram_size);
s->graphic_mode = -1; /* force full update */
}
@@ -266,8 +266,6 @@ static void g364fb_ctrl_writeb(void *opaque, target_phys_addr_t addr, uint32_t v
#endif
break;
}
- if (s->scr_width && s->scr_height)
- qemu_console_resize(s->console, s->scr_width, s->scr_height);
}
s->graphic_mode = -1; /* force full update */
}
diff --git a/hw/g364fb_template.h b/hw/g364fb_template.h
index f16f5e609f..43755966e0 100644
--- a/hw/g364fb_template.h
+++ b/hw/g364fb_template.h
@@ -27,11 +27,11 @@ static void glue(g364fb_draw_graphic, BPP)(G364State *s, int full_update)
uint8_t *data_display, *dd;
data_buffer = s->vram_buffer;
- w_display = s->last_scr_width * PIXEL_WIDTH / 8;
+ w_display = s->scr_width * PIXEL_WIDTH / 8;
data_display = s->ds->data;
- for(i = 0; i < s->last_scr_height; i++) {
+ for(i = 0; i < s->scr_height; i++) {
dd = data_display;
- for (j = 0; j < s->last_scr_width; j++, dd += PIXEL_WIDTH / 8, data_buffer++) {
+ for (j = 0; j < s->scr_width; j++, dd += PIXEL_WIDTH / 8, data_buffer++) {
uint8_t index = *data_buffer;
*((glue(glue(uint, PIXEL_WIDTH), _t) *)dd) = glue(rgb_to_pixel, BPP)(
s->palette[index][0],