aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2018-05-22 18:50:56 +0200
committerGerd Hoffmann <kraxel@redhat.com>2018-05-24 10:42:13 +0200
commit33ebad54056f0e54b9db1d675d34eed097479c69 (patch)
tree9731dcf2de2b907c3536ad7ae4be3dacb9b8ee96 /hw
parent765c94290863eef1fc4a67819d452cc13b7854a1 (diff)
downloadqemu-33ebad54056f0e54b9db1d675d34eed097479c69.zip
qemu-33ebad54056f0e54b9db1d675d34eed097479c69.tar.gz
qemu-33ebad54056f0e54b9db1d675d34eed097479c69.tar.bz2
bochs-display: add dirty tracking support
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20180522165058.15404-5-kraxel@redhat.com
Diffstat (limited to 'hw')
-rw-r--r--hw/display/bochs-display.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/hw/display/bochs-display.c b/hw/display/bochs-display.c
index a523e81..9607df1 100644
--- a/hw/display/bochs-display.c
+++ b/hw/display/bochs-display.c
@@ -191,10 +191,13 @@ static int bochs_display_get_mode(BochsDisplayState *s,
static void bochs_display_update(void *opaque)
{
BochsDisplayState *s = opaque;
+ DirtyBitmapSnapshot *snap = NULL;
+ bool full_update = false;
BochsDisplayMode mode;
DisplaySurface *ds;
uint8_t *ptr;
- int ret;
+ bool dirty;
+ int y, ys, ret;
ret = bochs_display_get_mode(s, &mode);
if (ret < 0) {
@@ -212,9 +215,34 @@ static void bochs_display_update(void *opaque)
mode.stride,
ptr + mode.offset);
dpy_gfx_replace_surface(s->con, ds);
+ full_update = true;
}
- dpy_gfx_update_full(s->con);
+ if (full_update) {
+ dpy_gfx_update_full(s->con);
+ } else {
+ snap = memory_region_snapshot_and_clear_dirty(&s->vram,
+ mode.offset, mode.size,
+ DIRTY_MEMORY_VGA);
+ ys = -1;
+ for (y = 0; y < mode.height; y++) {
+ dirty = memory_region_snapshot_get_dirty(&s->vram, snap,
+ mode.offset + mode.stride * y,
+ mode.stride);
+ if (dirty && ys < 0) {
+ ys = y;
+ }
+ if (!dirty && ys >= 0) {
+ dpy_gfx_update(s->con, 0, ys,
+ mode.width, y - ys);
+ ys = -1;
+ }
+ }
+ if (ys >= 0) {
+ dpy_gfx_update(s->con, 0, ys,
+ mode.width, y - ys);
+ }
+ }
}
static const GraphicHwOps bochs_display_gfx_ops = {
@@ -251,6 +279,8 @@ static void bochs_display_realize(PCIDevice *dev, Error **errp)
pci_set_byte(&s->pci.config[PCI_REVISION_ID], 2);
pci_register_bar(&s->pci, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->vram);
pci_register_bar(&s->pci, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->mmio);
+
+ memory_region_set_log(&s->vram, true, DIRTY_MEMORY_VGA);
}
static bool bochs_display_get_big_endian_fb(Object *obj, Error **errp)