[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/10] cg3: make display updates thread safe
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 07/10] cg3: make display updates thread safe |
Date: |
Tue, 4 Apr 2017 12:23:12 +0200 |
From: Mark Cave-Ayland <address@hidden>
Signed-off-by: Mark Cave-Ayland <address@hidden>
---
hw/display/cg3.c | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/hw/display/cg3.c b/hw/display/cg3.c
index 6e19da0..9996567 100644
--- a/hw/display/cg3.c
+++ b/hw/display/cg3.c
@@ -95,7 +95,8 @@ static void cg3_update_display(void *opaque)
uint32_t dval;
int x, y, y_start;
unsigned int width, height;
- ram_addr_t page, page_min, page_max;
+ ram_addr_t page;
+ DirtyBitmapSnapshot *snap = NULL;
if (surface_bits_per_pixel(surface) != 32) {
return;
@@ -104,29 +105,32 @@ static void cg3_update_display(void *opaque)
height = s->height;
y_start = -1;
- page_min = -1;
- page_max = 0;
- page = 0;
pix = memory_region_get_ram_ptr(&s->vram_mem);
data = (uint32_t *)surface_data(surface);
- memory_region_sync_dirty_bitmap(&s->vram_mem);
+ if (!s->full_update) {
+ memory_region_sync_dirty_bitmap(&s->vram_mem);
+ snap = memory_region_snapshot_and_clear_dirty(&s->vram_mem, 0x0,
+
memory_region_size(&s->vram_mem),
+ DIRTY_MEMORY_VGA);
+ }
+
for (y = 0; y < height; y++) {
- int update = s->full_update;
+ int update;
page = y * width;
- update |= memory_region_get_dirty(&s->vram_mem, page, width - 1,
- DIRTY_MEMORY_VGA);
+
+ if (s->full_update) {
+ update = 1;
+ } else {
+ update = memory_region_snapshot_get_dirty(&s->vram_mem, snap, page,
+ width);
+ }
+
if (update) {
if (y_start < 0) {
y_start = y;
}
- if (page < page_min) {
- page_min = page;
- }
- if (page > page_max) {
- page_max = page;
- }
for (x = 0; x < width; x++) {
dval = *pix++;
@@ -146,15 +150,12 @@ static void cg3_update_display(void *opaque)
if (y_start >= 0) {
dpy_gfx_update(s->con, 0, y_start, s->width, y - y_start);
}
- if (page_max >= page_min) {
- memory_region_reset_dirty(&s->vram_mem,
- page_min, page_max - page_min, DIRTY_MEMORY_VGA);
- }
/* vsync interrupt? */
if (s->regs[0] & CG3_CR_ENABLE_INTS) {
s->regs[1] |= CG3_SR_PENDING_INT;
qemu_irq_raise(s->irq);
}
+ g_free(snap);
}
static void cg3_invalidate_display(void *opaque)
--
2.9.3
- Re: [Qemu-devel] [PATCH 02/10] memory: add support getting and using a dirty bitmap copy., (continued)
- [Qemu-devel] [PATCH 06/10] cg3: fix up size parameter for memory_region_get_dirty(), Gerd Hoffmann, 2017/04/04
- [Qemu-devel] [PATCH 10/10] [testing] console: remove do_safe_dpy_refresh, Gerd Hoffmann, 2017/04/04
- [Qemu-devel] [PATCH 03/10] vga: add vga_scanline_invalidated helper, Gerd Hoffmann, 2017/04/04
- [Qemu-devel] [PATCH 08/10] tcx: introduce tcx_check_dirty() function, Gerd Hoffmann, 2017/04/04
- [Qemu-devel] [PATCH 05/10] cg3: remove TARGET_PAGE_SIZE rounding on dirty page detection, Gerd Hoffmann, 2017/04/04
- [Qemu-devel] [PATCH 01/10] bitmap: add bitmap_copy_and_clear_atomic, Gerd Hoffmann, 2017/04/04
- [Qemu-devel] [PATCH 07/10] cg3: make display updates thread safe,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 04/10] vga: make display updates thread safe., Gerd Hoffmann, 2017/04/04
- Re: [Qemu-devel] [PATCH 00/10] make display updates thread safe., Mark Cave-Ayland, 2017/04/04