memory: hide memory_region_sync_dirty_bitmap behind DirtyBitmapSnapshot
Simplify the users of memory_region_snapshot_and_clear_dirty, so that they do not have to call memory_region_sync_dirty_bitmap explicitly. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
77302fb5df
commit
0fe1eca7dc
@ -108,7 +108,6 @@ static void cg3_update_display(void *opaque)
|
|||||||
data = (uint32_t *)surface_data(surface);
|
data = (uint32_t *)surface_data(surface);
|
||||||
|
|
||||||
if (!s->full_update) {
|
if (!s->full_update) {
|
||||||
memory_region_sync_dirty_bitmap(&s->vram_mem);
|
|
||||||
snap = memory_region_snapshot_and_clear_dirty(&s->vram_mem, 0x0,
|
snap = memory_region_snapshot_and_clear_dirty(&s->vram_mem, 0x0,
|
||||||
memory_region_size(&s->vram_mem),
|
memory_region_size(&s->vram_mem),
|
||||||
DIRTY_MEMORY_VGA);
|
DIRTY_MEMORY_VGA);
|
||||||
|
@ -1289,7 +1289,6 @@ static void exynos4210_fimd_update(void *opaque)
|
|||||||
scrn_width = w->virtpage_width;
|
scrn_width = w->virtpage_width;
|
||||||
/* Total width of virtual screen page in bytes */
|
/* Total width of virtual screen page in bytes */
|
||||||
inc_size = scrn_width + w->virtpage_offsize;
|
inc_size = scrn_width + w->virtpage_offsize;
|
||||||
memory_region_sync_dirty_bitmap(w->mem_section.mr);
|
|
||||||
host_fb_addr = w->host_fb_addr;
|
host_fb_addr = w->host_fb_addr;
|
||||||
fb_line_addr = w->mem_section.offset_within_region;
|
fb_line_addr = w->mem_section.offset_within_region;
|
||||||
snap = memory_region_snapshot_and_clear_dirty(w->mem_section.mr,
|
snap = memory_region_snapshot_and_clear_dirty(w->mem_section.mr,
|
||||||
|
@ -83,7 +83,6 @@ void framebuffer_update_display(
|
|||||||
if (!mem) {
|
if (!mem) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memory_region_sync_dirty_bitmap(mem);
|
|
||||||
|
|
||||||
addr = mem_section->offset_within_region;
|
addr = mem_section->offset_within_region;
|
||||||
src = memory_region_get_ram_ptr(mem) + addr;
|
src = memory_region_get_ram_ptr(mem) + addr;
|
||||||
|
@ -246,7 +246,6 @@ static void g364fb_update_display(void *opaque)
|
|||||||
qemu_console_resize(s->con, s->width, s->height);
|
qemu_console_resize(s->con, s->width, s->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
memory_region_sync_dirty_bitmap(&s->mem_vram);
|
|
||||||
if (s->ctla & CTLA_FORCE_BLANK) {
|
if (s->ctla & CTLA_FORCE_BLANK) {
|
||||||
g364fb_draw_blank(s);
|
g364fb_draw_blank(s);
|
||||||
} else if (s->depth == 8) {
|
} else if (s->depth == 8) {
|
||||||
|
@ -1508,7 +1508,6 @@ static void sm501_update_display(void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* draw each line according to conditions */
|
/* draw each line according to conditions */
|
||||||
memory_region_sync_dirty_bitmap(&s->local_mem_region);
|
|
||||||
snap = memory_region_snapshot_and_clear_dirty(&s->local_mem_region,
|
snap = memory_region_snapshot_and_clear_dirty(&s->local_mem_region,
|
||||||
offset, width * height * src_bpp, DIRTY_MEMORY_VGA);
|
offset, width * height * src_bpp, DIRTY_MEMORY_VGA);
|
||||||
for (y = 0, offset = 0; y < height; y++, offset += width * src_bpp) {
|
for (y = 0, offset = 0; y < height; y++, offset += width * src_bpp) {
|
||||||
|
@ -236,7 +236,6 @@ static void tcx_update_display(void *opaque)
|
|||||||
dd = surface_stride(surface);
|
dd = surface_stride(surface);
|
||||||
ds = 1024;
|
ds = 1024;
|
||||||
|
|
||||||
memory_region_sync_dirty_bitmap(&ts->vram_mem);
|
|
||||||
snap = memory_region_snapshot_and_clear_dirty(&ts->vram_mem, 0x0,
|
snap = memory_region_snapshot_and_clear_dirty(&ts->vram_mem, 0x0,
|
||||||
memory_region_size(&ts->vram_mem),
|
memory_region_size(&ts->vram_mem),
|
||||||
DIRTY_MEMORY_VGA);
|
DIRTY_MEMORY_VGA);
|
||||||
@ -292,7 +291,6 @@ static void tcx24_update_display(void *opaque)
|
|||||||
dd = surface_stride(surface);
|
dd = surface_stride(surface);
|
||||||
ds = 1024;
|
ds = 1024;
|
||||||
|
|
||||||
memory_region_sync_dirty_bitmap(&ts->vram_mem);
|
|
||||||
snap = memory_region_snapshot_and_clear_dirty(&ts->vram_mem, 0x0,
|
snap = memory_region_snapshot_and_clear_dirty(&ts->vram_mem, 0x0,
|
||||||
memory_region_size(&ts->vram_mem),
|
memory_region_size(&ts->vram_mem),
|
||||||
DIRTY_MEMORY_VGA);
|
DIRTY_MEMORY_VGA);
|
||||||
|
@ -1444,11 +1444,6 @@ static bool vga_scanline_invalidated(VGACommonState *s, int y)
|
|||||||
return s->invalidated_y_table[y >> 5] & (1 << (y & 0x1f));
|
return s->invalidated_y_table[y >> 5] & (1 << (y & 0x1f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void vga_sync_dirty_bitmap(VGACommonState *s)
|
|
||||||
{
|
|
||||||
memory_region_sync_dirty_bitmap(&s->vram);
|
|
||||||
}
|
|
||||||
|
|
||||||
void vga_dirty_log_start(VGACommonState *s)
|
void vga_dirty_log_start(VGACommonState *s)
|
||||||
{
|
{
|
||||||
memory_region_set_log(&s->vram, true, DIRTY_MEMORY_VGA);
|
memory_region_set_log(&s->vram, true, DIRTY_MEMORY_VGA);
|
||||||
@ -1638,7 +1633,6 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
|
|||||||
y1 = 0;
|
y1 = 0;
|
||||||
|
|
||||||
if (!full_update) {
|
if (!full_update) {
|
||||||
vga_sync_dirty_bitmap(s);
|
|
||||||
if (s->line_compare < height) {
|
if (s->line_compare < height) {
|
||||||
/* split screen mode */
|
/* split screen mode */
|
||||||
region_start = 0;
|
region_start = 0;
|
||||||
|
@ -1135,17 +1135,6 @@ bool memory_region_snapshot_get_dirty(MemoryRegion *mr,
|
|||||||
DirtyBitmapSnapshot *snap,
|
DirtyBitmapSnapshot *snap,
|
||||||
hwaddr addr, hwaddr size);
|
hwaddr addr, hwaddr size);
|
||||||
|
|
||||||
/**
|
|
||||||
* memory_region_sync_dirty_bitmap: Synchronize a region's dirty bitmap with
|
|
||||||
* any external TLBs (e.g. kvm)
|
|
||||||
*
|
|
||||||
* Flushes dirty information from accelerators such as kvm and vhost-net
|
|
||||||
* and makes it available to users of the memory API.
|
|
||||||
*
|
|
||||||
* @mr: the region being flushed.
|
|
||||||
*/
|
|
||||||
void memory_region_sync_dirty_bitmap(MemoryRegion *mr);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* memory_region_reset_dirty: Mark a range of pages as clean, for a specified
|
* memory_region_reset_dirty: Mark a range of pages as clean, for a specified
|
||||||
* client.
|
* client.
|
||||||
|
39
memory.c
39
memory.c
@ -1971,25 +1971,7 @@ void memory_region_set_dirty(MemoryRegion *mr, hwaddr addr,
|
|||||||
memory_region_get_dirty_log_mask(mr));
|
memory_region_get_dirty_log_mask(mr));
|
||||||
}
|
}
|
||||||
|
|
||||||
DirtyBitmapSnapshot *memory_region_snapshot_and_clear_dirty(MemoryRegion *mr,
|
static void memory_region_sync_dirty_bitmap(MemoryRegion *mr)
|
||||||
hwaddr addr,
|
|
||||||
hwaddr size,
|
|
||||||
unsigned client)
|
|
||||||
{
|
|
||||||
assert(mr->ram_block);
|
|
||||||
return cpu_physical_memory_snapshot_and_clear_dirty(
|
|
||||||
memory_region_get_ram_addr(mr) + addr, size, client);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool memory_region_snapshot_get_dirty(MemoryRegion *mr, DirtyBitmapSnapshot *snap,
|
|
||||||
hwaddr addr, hwaddr size)
|
|
||||||
{
|
|
||||||
assert(mr->ram_block);
|
|
||||||
return cpu_physical_memory_snapshot_get_dirty(snap,
|
|
||||||
memory_region_get_ram_addr(mr) + addr, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void memory_region_sync_dirty_bitmap(MemoryRegion *mr)
|
|
||||||
{
|
{
|
||||||
MemoryListener *listener;
|
MemoryListener *listener;
|
||||||
AddressSpace *as;
|
AddressSpace *as;
|
||||||
@ -2017,6 +1999,25 @@ void memory_region_sync_dirty_bitmap(MemoryRegion *mr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DirtyBitmapSnapshot *memory_region_snapshot_and_clear_dirty(MemoryRegion *mr,
|
||||||
|
hwaddr addr,
|
||||||
|
hwaddr size,
|
||||||
|
unsigned client)
|
||||||
|
{
|
||||||
|
assert(mr->ram_block);
|
||||||
|
memory_region_sync_dirty_bitmap(mr);
|
||||||
|
return cpu_physical_memory_snapshot_and_clear_dirty(
|
||||||
|
memory_region_get_ram_addr(mr) + addr, size, client);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool memory_region_snapshot_get_dirty(MemoryRegion *mr, DirtyBitmapSnapshot *snap,
|
||||||
|
hwaddr addr, hwaddr size)
|
||||||
|
{
|
||||||
|
assert(mr->ram_block);
|
||||||
|
return cpu_physical_memory_snapshot_get_dirty(snap,
|
||||||
|
memory_region_get_ram_addr(mr) + addr, size);
|
||||||
|
}
|
||||||
|
|
||||||
void memory_region_set_readonly(MemoryRegion *mr, bool readonly)
|
void memory_region_set_readonly(MemoryRegion *mr, bool readonly)
|
||||||
{
|
{
|
||||||
if (mr->readonly != readonly) {
|
if (mr->readonly != readonly) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user