Commit 221bb2d563aec566c6104ed1286aa2fd7f58c3f2
1 parent
e64995db
Fix g364fb video emulation
(Hervé Poussineau) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5016 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
15 additions
and
17 deletions
hw/g364fb.c
... | ... | @@ -36,7 +36,6 @@ typedef struct G364State { |
36 | 36 | QEMUConsole *console; |
37 | 37 | int graphic_mode; |
38 | 38 | uint32_t scr_width, scr_height; /* in pixels */ |
39 | - uint32_t last_scr_width, last_scr_height; /* in pixels */ | |
40 | 39 | } G364State; |
41 | 40 | |
42 | 41 | /* |
... | ... | @@ -73,9 +72,6 @@ typedef struct G364State { |
73 | 72 | |
74 | 73 | static void g364fb_draw_graphic(G364State *s, int full_update) |
75 | 74 | { |
76 | - if (s->scr_width == 0 || s->scr_height == 0) | |
77 | - return; | |
78 | - | |
79 | 75 | switch (s->ds->depth) { |
80 | 76 | case 8: |
81 | 77 | g364fb_draw_graphic8(s, full_update); |
... | ... | @@ -94,7 +90,7 @@ static void g364fb_draw_graphic(G364State *s, int full_update) |
94 | 90 | return; |
95 | 91 | } |
96 | 92 | |
97 | - dpy_update(s->ds, 0, 0, s->last_scr_width, s->last_scr_height); | |
93 | + dpy_update(s->ds, 0, 0, s->scr_width, s->scr_height); | |
98 | 94 | } |
99 | 95 | |
100 | 96 | static void g364fb_draw_blank(G364State *s, int full_update) |
... | ... | @@ -104,17 +100,15 @@ static void g364fb_draw_blank(G364State *s, int full_update) |
104 | 100 | |
105 | 101 | if (!full_update) |
106 | 102 | return; |
107 | - if (s->last_scr_width <= 0 || s->last_scr_height <= 0) | |
108 | - return; | |
109 | 103 | |
110 | - w = s->last_scr_width * ((s->ds->depth + 7) >> 3); | |
104 | + w = s->scr_width * ((s->ds->depth + 7) >> 3); | |
111 | 105 | d = s->ds->data; |
112 | - for(i = 0; i < s->last_scr_height; i++) { | |
106 | + for(i = 0; i < s->scr_height; i++) { | |
113 | 107 | memset(d, 0, w); |
114 | 108 | d += s->ds->linesize; |
115 | 109 | } |
116 | - dpy_update(s->ds, 0, 0, | |
117 | - s->last_scr_width, s->last_scr_height); | |
110 | + | |
111 | + dpy_update(s->ds, 0, 0, s->scr_width, s->scr_height); | |
118 | 112 | } |
119 | 113 | |
120 | 114 | #define GMODE_GRAPH 0 |
... | ... | @@ -125,6 +119,9 @@ static void g364fb_update_display(void *opaque) |
125 | 119 | G364State *s = opaque; |
126 | 120 | int full_update, graphic_mode; |
127 | 121 | |
122 | + if (s->scr_width == 0 || s->scr_height == 0) | |
123 | + return; | |
124 | + | |
128 | 125 | if (s->ctla & CTLA_FORCE_BLANK) |
129 | 126 | graphic_mode = GMODE_BLANK; |
130 | 127 | else |
... | ... | @@ -134,6 +131,10 @@ static void g364fb_update_display(void *opaque) |
134 | 131 | s->graphic_mode = graphic_mode; |
135 | 132 | full_update = 1; |
136 | 133 | } |
134 | + if (s->scr_width != s->ds->width || s->scr_height != s->ds->height) { | |
135 | + qemu_console_resize(s->console, s->scr_width, s->scr_height); | |
136 | + full_update = 1; | |
137 | + } | |
137 | 138 | switch(graphic_mode) { |
138 | 139 | case GMODE_GRAPH: |
139 | 140 | g364fb_draw_graphic(s, full_update); |
... | ... | @@ -158,7 +159,6 @@ static void g364fb_reset(void *opaque) |
158 | 159 | |
159 | 160 | memset(s->palette, 0, sizeof(s->palette)); |
160 | 161 | s->scr_width = s->scr_height = 0; |
161 | - s->last_scr_width = s->last_scr_height = 0; | |
162 | 162 | memset(s->vram_buffer, 0, s->vram_size); |
163 | 163 | s->graphic_mode = -1; /* force full update */ |
164 | 164 | } |
... | ... | @@ -266,8 +266,6 @@ static void g364fb_ctrl_writeb(void *opaque, target_phys_addr_t addr, uint32_t v |
266 | 266 | #endif |
267 | 267 | break; |
268 | 268 | } |
269 | - if (s->scr_width && s->scr_height) | |
270 | - qemu_console_resize(s->console, s->scr_width, s->scr_height); | |
271 | 269 | } |
272 | 270 | s->graphic_mode = -1; /* force full update */ |
273 | 271 | } | ... | ... |
hw/g364fb_template.h
... | ... | @@ -27,11 +27,11 @@ static void glue(g364fb_draw_graphic, BPP)(G364State *s, int full_update) |
27 | 27 | uint8_t *data_display, *dd; |
28 | 28 | |
29 | 29 | data_buffer = s->vram_buffer; |
30 | - w_display = s->last_scr_width * PIXEL_WIDTH / 8; | |
30 | + w_display = s->scr_width * PIXEL_WIDTH / 8; | |
31 | 31 | data_display = s->ds->data; |
32 | - for(i = 0; i < s->last_scr_height; i++) { | |
32 | + for(i = 0; i < s->scr_height; i++) { | |
33 | 33 | dd = data_display; |
34 | - for (j = 0; j < s->last_scr_width; j++, dd += PIXEL_WIDTH / 8, data_buffer++) { | |
34 | + for (j = 0; j < s->scr_width; j++, dd += PIXEL_WIDTH / 8, data_buffer++) { | |
35 | 35 | uint8_t index = *data_buffer; |
36 | 36 | *((glue(glue(uint, PIXEL_WIDTH), _t) *)dd) = glue(rgb_to_pixel, BPP)( |
37 | 37 | s->palette[index][0], | ... | ... |