Revision c78f7137 hw/tc6393xb.c
b/hw/tc6393xb.c | ||
---|---|---|
125 | 125 |
DeviceState *flash; |
126 | 126 |
ECCState ecc; |
127 | 127 |
|
128 |
DisplayState *ds;
|
|
128 |
QemuConsole *con;
|
|
129 | 129 |
MemoryRegion vram; |
130 | 130 |
uint16_t *vram_ptr; |
131 | 131 |
uint32_t scr_width, scr_height; /* in pixels */ |
... | ... | |
433 | 433 |
|
434 | 434 |
static void tc6393xb_draw_graphic(TC6393xbState *s, int full_update) |
435 | 435 |
{ |
436 |
switch (ds_get_bits_per_pixel(s->ds)) { |
|
436 |
DisplaySurface *surface = qemu_console_surface(s->con); |
|
437 |
|
|
438 |
switch (surface_bits_per_pixel(surface)) { |
|
437 | 439 |
case 8: |
438 | 440 |
tc6393xb_draw_graphic8(s); |
439 | 441 |
break; |
... | ... | |
450 | 452 |
tc6393xb_draw_graphic32(s); |
451 | 453 |
break; |
452 | 454 |
default: |
453 |
printf("tc6393xb: unknown depth %d\n", ds_get_bits_per_pixel(s->ds)); |
|
455 |
printf("tc6393xb: unknown depth %d\n", |
|
456 |
surface_bits_per_pixel(surface)); |
|
454 | 457 |
return; |
455 | 458 |
} |
456 | 459 |
|
457 |
dpy_gfx_update(s->ds, 0, 0, s->scr_width, s->scr_height);
|
|
460 |
dpy_gfx_update(s->con, 0, 0, s->scr_width, s->scr_height);
|
|
458 | 461 |
} |
459 | 462 |
|
460 | 463 |
static void tc6393xb_draw_blank(TC6393xbState *s, int full_update) |
461 | 464 |
{ |
465 |
DisplaySurface *surface = qemu_console_surface(s->con); |
|
462 | 466 |
int i, w; |
463 | 467 |
uint8_t *d; |
464 | 468 |
|
465 | 469 |
if (!full_update) |
466 | 470 |
return; |
467 | 471 |
|
468 |
w = s->scr_width * ((ds_get_bits_per_pixel(s->ds) + 7) >> 3);
|
|
469 |
d = ds_get_data(s->ds);
|
|
472 |
w = s->scr_width * surface_bytes_per_pixel(surface);
|
|
473 |
d = surface_data(surface);
|
|
470 | 474 |
for(i = 0; i < s->scr_height; i++) { |
471 | 475 |
memset(d, 0, w); |
472 |
d += ds_get_linesize(s->ds);
|
|
476 |
d += surface_stride(surface);
|
|
473 | 477 |
} |
474 | 478 |
|
475 |
dpy_gfx_update(s->ds, 0, 0, s->scr_width, s->scr_height);
|
|
479 |
dpy_gfx_update(s->con, 0, 0, s->scr_width, s->scr_height);
|
|
476 | 480 |
} |
477 | 481 |
|
478 | 482 |
static void tc6393xb_update_display(void *opaque) |
479 | 483 |
{ |
480 | 484 |
TC6393xbState *s = opaque; |
485 |
DisplaySurface *surface = qemu_console_surface(s->con); |
|
481 | 486 |
int full_update; |
482 | 487 |
|
483 | 488 |
if (s->scr_width == 0 || s->scr_height == 0) |
... | ... | |
488 | 493 |
s->blanked = s->blank; |
489 | 494 |
full_update = 1; |
490 | 495 |
} |
491 |
if (s->scr_width != ds_get_width(s->ds) || s->scr_height != ds_get_height(s->ds)) { |
|
492 |
qemu_console_resize(s->ds, s->scr_width, s->scr_height); |
|
496 |
if (s->scr_width != surface_width(surface) || |
|
497 |
s->scr_height != surface_height(surface)) { |
|
498 |
qemu_console_resize(s->con, s->scr_width, s->scr_height); |
|
493 | 499 |
full_update = 1; |
494 | 500 |
} |
495 | 501 |
if (s->blanked) |
... | ... | |
577 | 583 |
memory_region_add_subregion(sysmem, base + 0x100000, &s->vram); |
578 | 584 |
s->scr_width = 480; |
579 | 585 |
s->scr_height = 640; |
580 |
s->ds = graphic_console_init(tc6393xb_update_display,
|
|
586 |
s->con = graphic_console_init(tc6393xb_update_display,
|
|
581 | 587 |
NULL, /* invalidate */ |
582 | 588 |
NULL, /* screen_dump */ |
583 | 589 |
NULL, /* text_update */ |
Also available in: Unified diff