Commit 167bc3d2fa100590b5a9d8fd9f19ae0207197447
1 parent
ab7d9131
MusicPal: Restore display size after invalidation (Jan Kiszka).
Make sure that the MusicPal display is set to the correct size again after some other console may have used a different size. Signed-off-by: Jan Kiszka <jan.kiszka@web.de> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4646 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
15 additions
and
2 deletions
hw/musicpal.c
| @@ -759,6 +759,7 @@ typedef struct musicpal_lcd_state { | @@ -759,6 +759,7 @@ typedef struct musicpal_lcd_state { | ||
| 759 | int page_off; | 759 | int page_off; |
| 760 | DisplayState *ds; | 760 | DisplayState *ds; |
| 761 | uint8_t video_ram[128*64/8]; | 761 | uint8_t video_ram[128*64/8]; |
| 762 | + int invalidate; | ||
| 762 | } musicpal_lcd_state; | 763 | } musicpal_lcd_state; |
| 763 | 764 | ||
| 764 | static uint32_t lcd_brightness; | 765 | static uint32_t lcd_brightness; |
| @@ -817,6 +818,11 @@ static void lcd_refresh(void *opaque) | @@ -817,6 +818,11 @@ static void lcd_refresh(void *opaque) | ||
| 817 | musicpal_lcd_state *s = opaque; | 818 | musicpal_lcd_state *s = opaque; |
| 818 | int x, y, col; | 819 | int x, y, col; |
| 819 | 820 | ||
| 821 | + if (s->invalidate && (s->ds->width != 128*3 || s->ds->height != 64*3)) { | ||
| 822 | + dpy_resize(s->ds, 128*3, 64*3); | ||
| 823 | + s->invalidate = 0; | ||
| 824 | + } | ||
| 825 | + | ||
| 820 | switch (s->ds->depth) { | 826 | switch (s->ds->depth) { |
| 821 | case 0: | 827 | case 0: |
| 822 | return; | 828 | return; |
| @@ -843,6 +849,13 @@ static void lcd_refresh(void *opaque) | @@ -843,6 +849,13 @@ static void lcd_refresh(void *opaque) | ||
| 843 | dpy_update(s->ds, 0, 0, 128*3, 64*3); | 849 | dpy_update(s->ds, 0, 0, 128*3, 64*3); |
| 844 | } | 850 | } |
| 845 | 851 | ||
| 852 | +static void lcd_invalidate(void *opaque) | ||
| 853 | +{ | ||
| 854 | + musicpal_lcd_state *s = opaque; | ||
| 855 | + | ||
| 856 | + s->invalidate = 1; | ||
| 857 | +} | ||
| 858 | + | ||
| 846 | static uint32_t musicpal_lcd_read(void *opaque, target_phys_addr_t offset) | 859 | static uint32_t musicpal_lcd_read(void *opaque, target_phys_addr_t offset) |
| 847 | { | 860 | { |
| 848 | musicpal_lcd_state *s = opaque; | 861 | musicpal_lcd_state *s = opaque; |
| @@ -919,12 +932,12 @@ static void musicpal_lcd_init(DisplayState *ds, uint32_t base) | @@ -919,12 +932,12 @@ static void musicpal_lcd_init(DisplayState *ds, uint32_t base) | ||
| 919 | return; | 932 | return; |
| 920 | s->base = base; | 933 | s->base = base; |
| 921 | s->ds = ds; | 934 | s->ds = ds; |
| 935 | + s->invalidate = 1; | ||
| 922 | iomemtype = cpu_register_io_memory(0, musicpal_lcd_readfn, | 936 | iomemtype = cpu_register_io_memory(0, musicpal_lcd_readfn, |
| 923 | musicpal_lcd_writefn, s); | 937 | musicpal_lcd_writefn, s); |
| 924 | cpu_register_physical_memory(base, MP_LCD_SIZE, iomemtype); | 938 | cpu_register_physical_memory(base, MP_LCD_SIZE, iomemtype); |
| 925 | 939 | ||
| 926 | - graphic_console_init(ds, lcd_refresh, NULL, NULL, NULL, s); | ||
| 927 | - dpy_resize(ds, 128*3, 64*3); | 940 | + graphic_console_init(ds, lcd_refresh, lcd_invalidate, NULL, NULL, s); |
| 928 | } | 941 | } |
| 929 | 942 | ||
| 930 | /* PIC register offsets */ | 943 | /* PIC register offsets */ |