Commit 546fa6abd13240365ffd7afb5fd8795617a9131e
1 parent
e875c40a
vga font change detection
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1141 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
17 additions
and
5 deletions
hw/vga.c
@@ -662,7 +662,7 @@ static uint32_t vga_mem_readl(void *opaque, target_phys_addr_t addr) | @@ -662,7 +662,7 @@ static uint32_t vga_mem_readl(void *opaque, target_phys_addr_t addr) | ||
662 | void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) | 662 | void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) |
663 | { | 663 | { |
664 | VGAState *s = opaque; | 664 | VGAState *s = opaque; |
665 | - int memory_map_mode, plane, write_mode, b, func_select; | 665 | + int memory_map_mode, plane, write_mode, b, func_select, mask; |
666 | uint32_t write_mask, bit_mask, set_mask; | 666 | uint32_t write_mask, bit_mask, set_mask; |
667 | 667 | ||
668 | #ifdef DEBUG_VGA_MEM | 668 | #ifdef DEBUG_VGA_MEM |
@@ -695,22 +695,26 @@ void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) | @@ -695,22 +695,26 @@ void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) | ||
695 | if (s->sr[4] & 0x08) { | 695 | if (s->sr[4] & 0x08) { |
696 | /* chain 4 mode : simplest access */ | 696 | /* chain 4 mode : simplest access */ |
697 | plane = addr & 3; | 697 | plane = addr & 3; |
698 | - if (s->sr[2] & (1 << plane)) { | 698 | + mask = (1 << plane); |
699 | + if (s->sr[2] & mask) { | ||
699 | s->vram_ptr[addr] = val; | 700 | s->vram_ptr[addr] = val; |
700 | #ifdef DEBUG_VGA_MEM | 701 | #ifdef DEBUG_VGA_MEM |
701 | printf("vga: chain4: [0x%x]\n", addr); | 702 | printf("vga: chain4: [0x%x]\n", addr); |
702 | #endif | 703 | #endif |
704 | + s->plane_updated |= mask; /* only used to detect font change */ | ||
703 | cpu_physical_memory_set_dirty(s->vram_offset + addr); | 705 | cpu_physical_memory_set_dirty(s->vram_offset + addr); |
704 | } | 706 | } |
705 | } else if (s->gr[5] & 0x10) { | 707 | } else if (s->gr[5] & 0x10) { |
706 | /* odd/even mode (aka text mode mapping) */ | 708 | /* odd/even mode (aka text mode mapping) */ |
707 | plane = (s->gr[4] & 2) | (addr & 1); | 709 | plane = (s->gr[4] & 2) | (addr & 1); |
708 | - if (s->sr[2] & (1 << plane)) { | 710 | + mask = (1 << plane); |
711 | + if (s->sr[2] & mask) { | ||
709 | addr = ((addr & ~1) << 1) | plane; | 712 | addr = ((addr & ~1) << 1) | plane; |
710 | s->vram_ptr[addr] = val; | 713 | s->vram_ptr[addr] = val; |
711 | #ifdef DEBUG_VGA_MEM | 714 | #ifdef DEBUG_VGA_MEM |
712 | printf("vga: odd/even: [0x%x]\n", addr); | 715 | printf("vga: odd/even: [0x%x]\n", addr); |
713 | #endif | 716 | #endif |
717 | + s->plane_updated |= mask; /* only used to detect font change */ | ||
714 | cpu_physical_memory_set_dirty(s->vram_offset + addr); | 718 | cpu_physical_memory_set_dirty(s->vram_offset + addr); |
715 | } | 719 | } |
716 | } else { | 720 | } else { |
@@ -775,7 +779,9 @@ void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) | @@ -775,7 +779,9 @@ void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val) | ||
775 | 779 | ||
776 | do_write: | 780 | do_write: |
777 | /* mask data according to sr[2] */ | 781 | /* mask data according to sr[2] */ |
778 | - write_mask = mask16[s->sr[2]]; | 782 | + mask = s->sr[2]; |
783 | + s->plane_updated |= mask; /* only used to detect font change */ | ||
784 | + write_mask = mask16[mask]; | ||
779 | ((uint32_t *)s->vram_ptr)[addr] = | 785 | ((uint32_t *)s->vram_ptr)[addr] = |
780 | (((uint32_t *)s->vram_ptr)[addr] & ~write_mask) | | 786 | (((uint32_t *)s->vram_ptr)[addr] & ~write_mask) | |
781 | (val & write_mask); | 787 | (val & write_mask); |
@@ -1088,7 +1094,12 @@ static void vga_draw_text(VGAState *s, int full_update) | @@ -1088,7 +1094,12 @@ static void vga_draw_text(VGAState *s, int full_update) | ||
1088 | s->font_offsets[1] = offset; | 1094 | s->font_offsets[1] = offset; |
1089 | full_update = 1; | 1095 | full_update = 1; |
1090 | } | 1096 | } |
1091 | - | 1097 | + if (s->plane_updated & (1 << 2)) { |
1098 | + /* if the plane 2 was modified since the last display, it | ||
1099 | + indicates the font may have been modified */ | ||
1100 | + s->plane_updated = 0; | ||
1101 | + full_update = 1; | ||
1102 | + } | ||
1092 | full_update |= update_basic_params(s); | 1103 | full_update |= update_basic_params(s); |
1093 | 1104 | ||
1094 | line_offset = s->line_offset; | 1105 | line_offset = s->line_offset; |
hw/vga_int.h
@@ -116,6 +116,7 @@ | @@ -116,6 +116,7 @@ | ||
116 | uint32_t line_offset; \ | 116 | uint32_t line_offset; \ |
117 | uint32_t line_compare; \ | 117 | uint32_t line_compare; \ |
118 | uint32_t start_addr; \ | 118 | uint32_t start_addr; \ |
119 | + uint32_t plane_updated; \ | ||
119 | uint8_t last_cw, last_ch; \ | 120 | uint8_t last_cw, last_ch; \ |
120 | uint32_t last_width, last_height; /* in chars or pixels */ \ | 121 | uint32_t last_width, last_height; /* in chars or pixels */ \ |
121 | uint32_t last_scr_width, last_scr_height; /* in pixels */ \ | 122 | uint32_t last_scr_width, last_scr_height; /* in pixels */ \ |