From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 5/7] bochs-display: add dirty tracking support
Date: Thu, 24 May 2018 17:45:54 +0200 [thread overview]
Message-ID: <20180524154556.17876-6-kraxel@redhat.com> (raw)
In-Reply-To: <20180524154556.17876-1-kraxel@redhat.com>
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
---
hw/display/bochs-display.c | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/hw/display/bochs-display.c b/hw/display/bochs-display.c
index a523e81d1d..9607df1c34 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)
--
2.9.3
next prev parent reply other threads:[~2018-05-24 15:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-24 15:45 [Qemu-devel] [PULL 0/7] Vga 20180524 patches Gerd Hoffmann
2018-05-24 15:45 ` [Qemu-devel] [PULL 1/7] vga: catch depth 0 Gerd Hoffmann
2018-05-24 15:45 ` [Qemu-devel] [PULL 2/7] vga: move bochs vbe defines to header file Gerd Hoffmann
2018-05-24 15:45 ` [Qemu-devel] [PULL 3/7] vga-pci: use PCI_VGA_MMIO_SIZE Gerd Hoffmann
2018-05-24 15:45 ` [Qemu-devel] [PULL 4/7] hw/display: add new bochs-display device Gerd Hoffmann
2018-05-24 15:45 ` Gerd Hoffmann [this message]
2018-05-24 15:45 ` [Qemu-devel] [PULL 6/7] bochs-display: add pcie support Gerd Hoffmann
2018-05-24 15:45 ` [Qemu-devel] [PULL 7/7] MAINTAINERS: add vga entries Gerd Hoffmann
2018-05-24 17:33 ` [Qemu-devel] [PULL 0/7] Vga 20180524 patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180524154556.17876-6-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).