summaryrefslogtreecommitdiff
path: root/hw/vmware_vga.c
diff options
context:
space:
mode:
authorBALATON Zoltan <balaton@eik.bme.hu>2012-11-03 12:47:08 +0100
committerBlue Swirl <blauwirbel@gmail.com>2012-11-03 13:26:54 +0000
commitb51d7b2e10564aedc83513d3961a69f22509eaa9 (patch)
tree387492e24df89c4643466815d7004e7f0654e067 /hw/vmware_vga.c
parent5b9575c8b7873dee4ab233e065888bbce6dfbaa8 (diff)
downloadqemu-b51d7b2e10564aedc83513d3961a69f22509eaa9.tar.gz
vmware_vga: Allow simple drivers to work without using the fifo
Postpone stopping the dirty log to the point where the command fifo is configured to allow drivers which don't use the fifo to work too. (Without this the picture rendered into the vram never got to the screen and the DIRECT_VRAM option meant to support this case was removed a year ago.) Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/vmware_vga.c')
-rw-r--r--hw/vmware_vga.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index 038994e705..7c766fb3da 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -317,14 +317,6 @@ static inline void vmsvga_update_rect(struct vmsvga_state_s *s,
dpy_gfx_update(s->vga.ds, x, y, w, h);
}
-static inline void vmsvga_update_screen(struct vmsvga_state_s *s)
-{
- memcpy(ds_get_data(s->vga.ds), s->vga.vram_ptr,
- ds_get_linesize(s->vga.ds) * ds_get_height(s->vga.ds));
- dpy_gfx_update(s->vga.ds, 0, 0,
- ds_get_width(s->vga.ds), ds_get_height(s->vga.ds));
-}
-
static inline void vmsvga_update_rect_delayed(struct vmsvga_state_s *s,
int x, int y, int w, int h)
{
@@ -843,11 +835,10 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value)
break;
case SVGA_REG_ENABLE:
- s->enable = value;
- s->config &= !!value;
+ s->enable = !!value;
s->invalidated = 1;
s->vga.invalidate(&s->vga);
- if (s->enable) {
+ if (s->enable && s->config) {
vga_dirty_log_stop(&s->vga);
} else {
vga_dirty_log_start(&s->vga);
@@ -895,6 +886,7 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value)
if (CMD(max) < CMD(min) + 10 * 1024) {
break;
}
+ vga_dirty_log_stop(&s->vga);
}
s->config = !!value;
break;
@@ -977,6 +969,8 @@ static inline void vmsvga_check_size(struct vmsvga_state_s *s)
static void vmsvga_update_display(void *opaque)
{
struct vmsvga_state_s *s = opaque;
+ bool dirty = false;
+
if (!s->enable) {
s->vga.update(&s->vga);
return;
@@ -991,9 +985,23 @@ static void vmsvga_update_display(void *opaque)
* Is it more efficient to look at vram VGA-dirty bits or wait
* for the driver to issue SVGA_CMD_UPDATE?
*/
- if (s->invalidated) {
+ if (memory_region_is_logging(&s->vga.vram)) {
+ vga_sync_dirty_bitmap(&s->vga);
+ dirty = memory_region_get_dirty(&s->vga.vram, 0,
+ ds_get_linesize(s->vga.ds) * ds_get_height(s->vga.ds),
+ DIRTY_MEMORY_VGA);
+ }
+ if (s->invalidated || dirty) {
s->invalidated = 0;
- vmsvga_update_screen(s);
+ memcpy(ds_get_data(s->vga.ds), s->vga.vram_ptr,
+ ds_get_linesize(s->vga.ds) * ds_get_height(s->vga.ds));
+ dpy_gfx_update(s->vga.ds, 0, 0,
+ ds_get_width(s->vga.ds), ds_get_height(s->vga.ds));
+ }
+ if (dirty) {
+ memory_region_reset_dirty(&s->vga.vram, 0,
+ ds_get_linesize(s->vga.ds) * ds_get_height(s->vga.ds),
+ DIRTY_MEMORY_VGA);
}
}