Commit b115bb3febe985bbc81d4dcfd82966fe94c54277
1 parent
28e10711
Eliminate spurous screen updates.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4857 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
106 additions
and
102 deletions
hw/ssd0303.c
... | ... | @@ -203,55 +203,57 @@ static void ssd0303_update_display(void *opaque) |
203 | 203 | int dest_width; |
204 | 204 | uint8_t mask; |
205 | 205 | |
206 | - if (s->redraw) { | |
207 | - switch (s->ds->depth) { | |
208 | - case 0: | |
209 | - return; | |
210 | - case 15: | |
211 | - dest_width = 2; | |
212 | - break; | |
213 | - case 16: | |
214 | - dest_width = 2; | |
215 | - break; | |
216 | - case 24: | |
217 | - dest_width = 3; | |
218 | - break; | |
219 | - case 32: | |
220 | - dest_width = 4; | |
221 | - break; | |
222 | - default: | |
223 | - BADF("Bad color depth\n"); | |
224 | - return; | |
225 | - } | |
226 | - dest_width *= MAGNIFY; | |
227 | - memset(colortab, 0xff, dest_width); | |
228 | - memset(colortab + dest_width, 0, dest_width); | |
229 | - if (s->flash) { | |
230 | - colors[0] = colortab; | |
231 | - colors[1] = colortab; | |
232 | - } else if (s->inverse) { | |
233 | - colors[0] = colortab; | |
234 | - colors[1] = colortab + dest_width; | |
235 | - } else { | |
236 | - colors[0] = colortab + dest_width; | |
237 | - colors[1] = colortab; | |
206 | + if (!s->redraw) | |
207 | + return; | |
208 | + | |
209 | + switch (s->ds->depth) { | |
210 | + case 0: | |
211 | + return; | |
212 | + case 15: | |
213 | + dest_width = 2; | |
214 | + break; | |
215 | + case 16: | |
216 | + dest_width = 2; | |
217 | + break; | |
218 | + case 24: | |
219 | + dest_width = 3; | |
220 | + break; | |
221 | + case 32: | |
222 | + dest_width = 4; | |
223 | + break; | |
224 | + default: | |
225 | + BADF("Bad color depth\n"); | |
226 | + return; | |
227 | + } | |
228 | + dest_width *= MAGNIFY; | |
229 | + memset(colortab, 0xff, dest_width); | |
230 | + memset(colortab + dest_width, 0, dest_width); | |
231 | + if (s->flash) { | |
232 | + colors[0] = colortab; | |
233 | + colors[1] = colortab; | |
234 | + } else if (s->inverse) { | |
235 | + colors[0] = colortab; | |
236 | + colors[1] = colortab + dest_width; | |
237 | + } else { | |
238 | + colors[0] = colortab + dest_width; | |
239 | + colors[1] = colortab; | |
240 | + } | |
241 | + dest = s->ds->data; | |
242 | + for (y = 0; y < 16; y++) { | |
243 | + line = (y + s->start_line) & 63; | |
244 | + src = s->framebuffer + 132 * (line >> 3) + 36; | |
245 | + mask = 1 << (line & 7); | |
246 | + for (x = 0; x < 96; x++) { | |
247 | + memcpy(dest, colors[(*src & mask) != 0], dest_width); | |
248 | + dest += dest_width; | |
249 | + src++; | |
238 | 250 | } |
239 | - dest = s->ds->data; | |
240 | - for (y = 0; y < 16; y++) { | |
241 | - line = (y + s->start_line) & 63; | |
242 | - src = s->framebuffer + 132 * (line >> 3) + 36; | |
243 | - mask = 1 << (line & 7); | |
244 | - for (x = 0; x < 96; x++) { | |
245 | - memcpy(dest, colors[(*src & mask) != 0], dest_width); | |
246 | - dest += dest_width; | |
247 | - src++; | |
248 | - } | |
249 | - for (x = 1; x < MAGNIFY; x++) { | |
250 | - memcpy(dest, dest - dest_width * 96, dest_width * 96); | |
251 | - dest += dest_width * 96; | |
252 | - } | |
251 | + for (x = 1; x < MAGNIFY; x++) { | |
252 | + memcpy(dest, dest - dest_width * 96, dest_width * 96); | |
253 | + dest += dest_width * 96; | |
253 | 254 | } |
254 | 255 | } |
256 | + s->redraw = 0; | |
255 | 257 | dpy_update(s->ds, 0, 0, 96 * MAGNIFY, 16 * MAGNIFY); |
256 | 258 | } |
257 | 259 | ... | ... |
hw/ssd0323.c
... | ... | @@ -184,78 +184,80 @@ static void ssd0323_update_display(void *opaque) |
184 | 184 | char *p; |
185 | 185 | int dest_width; |
186 | 186 | |
187 | - if (s->redraw) { | |
187 | + if (!s->redraw) | |
188 | + return; | |
189 | + | |
190 | + switch (s->ds->depth) { | |
191 | + case 0: | |
192 | + return; | |
193 | + case 15: | |
194 | + dest_width = 2; | |
195 | + break; | |
196 | + case 16: | |
197 | + dest_width = 2; | |
198 | + break; | |
199 | + case 24: | |
200 | + dest_width = 3; | |
201 | + break; | |
202 | + case 32: | |
203 | + dest_width = 4; | |
204 | + break; | |
205 | + default: | |
206 | + BADF("Bad color depth\n"); | |
207 | + return; | |
208 | + } | |
209 | + p = colortab; | |
210 | + for (i = 0; i < 16; i++) { | |
211 | + int n; | |
212 | + colors[i] = p; | |
188 | 213 | switch (s->ds->depth) { |
189 | - case 0: | |
190 | - return; | |
191 | 214 | case 15: |
192 | - dest_width = 2; | |
215 | + n = i * 2 + (i >> 3); | |
216 | + p[0] = n | (n << 5); | |
217 | + p[1] = (n << 2) | (n >> 3); | |
193 | 218 | break; |
194 | 219 | case 16: |
195 | - dest_width = 2; | |
220 | + n = i * 2 + (i >> 3); | |
221 | + p[0] = n | (n << 6) | ((n << 1) & 0x20); | |
222 | + p[1] = (n << 3) | (n >> 2); | |
196 | 223 | break; |
197 | 224 | case 24: |
198 | - dest_width = 3; | |
199 | - break; | |
200 | 225 | case 32: |
201 | - dest_width = 4; | |
226 | + n = (i << 4) | i; | |
227 | + p[0] = p[1] = p[2] = n; | |
202 | 228 | break; |
203 | 229 | default: |
204 | 230 | BADF("Bad color depth\n"); |
205 | 231 | return; |
206 | 232 | } |
207 | - p = colortab; | |
208 | - for (i = 0; i < 16; i++) { | |
209 | - int n; | |
210 | - colors[i] = p; | |
211 | - switch (s->ds->depth) { | |
212 | - case 15: | |
213 | - n = i * 2 + (i >> 3); | |
214 | - p[0] = n | (n << 5); | |
215 | - p[1] = (n << 2) | (n >> 3); | |
216 | - break; | |
217 | - case 16: | |
218 | - n = i * 2 + (i >> 3); | |
219 | - p[0] = n | (n << 6) | ((n << 1) & 0x20); | |
220 | - p[1] = (n << 3) | (n >> 2); | |
221 | - break; | |
222 | - case 24: | |
223 | - case 32: | |
224 | - n = (i << 4) | i; | |
225 | - p[0] = p[1] = p[2] = n; | |
226 | - break; | |
227 | - default: | |
228 | - BADF("Bad color depth\n"); | |
229 | - return; | |
230 | - } | |
231 | - p += dest_width; | |
232 | - } | |
233 | - /* TODO: Implement row/column remapping. */ | |
234 | - dest = s->ds->data; | |
235 | - for (y = 0; y < 64; y++) { | |
236 | - line = y; | |
237 | - src = s->framebuffer + 64 * line; | |
238 | - for (x = 0; x < 64; x++) { | |
239 | - int val; | |
240 | - val = *src >> 4; | |
241 | - for (i = 0; i < MAGNIFY; i++) { | |
242 | - memcpy(dest, colors[val], dest_width); | |
243 | - dest += dest_width; | |
244 | - } | |
245 | - val = *src & 0xf; | |
246 | - for (i = 0; i < MAGNIFY; i++) { | |
247 | - memcpy(dest, colors[val], dest_width); | |
248 | - dest += dest_width; | |
249 | - } | |
250 | - src++; | |
233 | + p += dest_width; | |
234 | + } | |
235 | + /* TODO: Implement row/column remapping. */ | |
236 | + dest = s->ds->data; | |
237 | + for (y = 0; y < 64; y++) { | |
238 | + line = y; | |
239 | + src = s->framebuffer + 64 * line; | |
240 | + for (x = 0; x < 64; x++) { | |
241 | + int val; | |
242 | + val = *src >> 4; | |
243 | + for (i = 0; i < MAGNIFY; i++) { | |
244 | + memcpy(dest, colors[val], dest_width); | |
245 | + dest += dest_width; | |
251 | 246 | } |
252 | - for (i = 1; i < MAGNIFY; i++) { | |
253 | - memcpy(dest, dest - dest_width * MAGNIFY * 128, | |
254 | - dest_width * 128 * MAGNIFY); | |
255 | - dest += dest_width * 128 * MAGNIFY; | |
247 | + val = *src & 0xf; | |
248 | + for (i = 0; i < MAGNIFY; i++) { | |
249 | + memcpy(dest, colors[val], dest_width); | |
250 | + dest += dest_width; | |
256 | 251 | } |
252 | + src++; | |
253 | + } | |
254 | + for (i = 1; i < MAGNIFY; i++) { | |
255 | + memcpy(dest, dest - dest_width * MAGNIFY * 128, | |
256 | + dest_width * 128 * MAGNIFY); | |
257 | + dest += dest_width * 128 * MAGNIFY; | |
257 | 258 | } |
258 | 259 | } |
260 | + s->redraw = 0; | |
259 | 261 | dpy_update(s->ds, 0, 0, 128 * MAGNIFY, 64 * MAGNIFY); |
260 | 262 | } |
261 | 263 | ... | ... |