Revision c78f7137 hw/arm/musicpal.c
b/hw/arm/musicpal.c | ||
---|---|---|
462 | 462 |
uint32_t irqctrl; |
463 | 463 |
uint32_t page; |
464 | 464 |
uint32_t page_off; |
465 |
DisplayState *ds;
|
|
465 |
QemuConsole *con;
|
|
466 | 466 |
uint8_t video_ram[128*64/8]; |
467 | 467 |
} musicpal_lcd_state; |
468 | 468 |
|
... | ... | |
483 | 483 |
(musicpal_lcd_state *s, int x, int y, type col) \ |
484 | 484 |
{ \ |
485 | 485 |
int dx, dy; \ |
486 |
type *pixel = &((type *) ds_get_data(s->ds))[(y * 128 * 3 + x) * 3]; \ |
|
486 |
DisplaySurface *surface = qemu_console_surface(s->con); \ |
|
487 |
type *pixel = &((type *) surface_data(surface))[(y * 128 * 3 + x) * 3]; \ |
|
487 | 488 |
\ |
488 | 489 |
for (dy = 0; dy < 3; dy++, pixel += 127 * 3) \ |
489 | 490 |
for (dx = 0; dx < 3; dx++, pixel++) \ |
... | ... | |
496 | 497 |
static void lcd_refresh(void *opaque) |
497 | 498 |
{ |
498 | 499 |
musicpal_lcd_state *s = opaque; |
500 |
DisplaySurface *surface = qemu_console_surface(s->con); |
|
499 | 501 |
int x, y, col; |
500 | 502 |
|
501 |
switch (ds_get_bits_per_pixel(s->ds)) {
|
|
503 |
switch (surface_bits_per_pixel(surface)) {
|
|
502 | 504 |
case 0: |
503 | 505 |
return; |
504 | 506 |
#define LCD_REFRESH(depth, func) \ |
... | ... | |
518 | 520 |
break; |
519 | 521 |
LCD_REFRESH(8, rgb_to_pixel8) |
520 | 522 |
LCD_REFRESH(16, rgb_to_pixel16) |
521 |
LCD_REFRESH(32, (is_surface_bgr(s->ds->surface) ?
|
|
523 |
LCD_REFRESH(32, (is_surface_bgr(surface) ? |
|
522 | 524 |
rgb_to_pixel32bgr : rgb_to_pixel32)) |
523 | 525 |
default: |
524 | 526 |
hw_error("unsupported colour depth %i\n", |
525 |
ds_get_bits_per_pixel(s->ds));
|
|
527 |
surface_bits_per_pixel(surface));
|
|
526 | 528 |
} |
527 | 529 |
|
528 |
dpy_gfx_update(s->ds, 0, 0, 128*3, 64*3);
|
|
530 |
dpy_gfx_update(s->con, 0, 0, 128*3, 64*3);
|
|
529 | 531 |
} |
530 | 532 |
|
531 | 533 |
static void lcd_invalidate(void *opaque) |
... | ... | |
609 | 611 |
"musicpal-lcd", MP_LCD_SIZE); |
610 | 612 |
sysbus_init_mmio(dev, &s->iomem); |
611 | 613 |
|
612 |
s->ds = graphic_console_init(lcd_refresh, lcd_invalidate,
|
|
613 |
NULL, NULL, s); |
|
614 |
qemu_console_resize(s->ds, 128*3, 64*3);
|
|
614 |
s->con = graphic_console_init(lcd_refresh, lcd_invalidate,
|
|
615 |
NULL, NULL, s);
|
|
616 |
qemu_console_resize(s->con, 128*3, 64*3);
|
|
615 | 617 |
|
616 | 618 |
qdev_init_gpio_in(&dev->qdev, musicpal_lcd_gpio_brigthness_in, 3); |
617 | 619 |
|
Also available in: Unified diff