From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbBkA-0005Gl-VI for qemu-devel@nongnu.org; Thu, 26 Mar 2015 13:38:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbBkA-0003Xt-2q for qemu-devel@nongnu.org; Thu, 26 Mar 2015 13:38:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51982) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbBk9-0003Xp-QD for qemu-devel@nongnu.org; Thu, 26 Mar 2015 13:38:58 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2QHcvnU026977 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 26 Mar 2015 13:38:57 -0400 Received: from donizetti.redhat.com (ovpn-112-86.ams2.redhat.com [10.36.112.86]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2QHcflD025898 for ; Thu, 26 Mar 2015 13:38:55 -0400 From: Paolo Bonzini Date: Thu, 26 Mar 2015 18:38:25 +0100 Message-Id: <1427391520-29497-8-git-send-email-pbonzini@redhat.com> In-Reply-To: <1427391520-29497-1-git-send-email-pbonzini@redhat.com> References: <1427391520-29497-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 07/22] ui/console: check memory_region_is_logging List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org dpy_gfx_update_dirty expects DIRTY_MEMORY_VGA logging to be always on, but that will not be the case soon. Because it computes the memory region on the fly for every update (with memory_region_find), it cannot enable/disable logging by itself. Instead, always treat updates as invalidations if dirty logging is not enabled, assuming that the board will enable logging on the RAM region that includes the framebuffer. To simplify the code, replace memory_region_get_dirty with memory_region_test_and_clear_dirty. Then memory_region_reset_dirty is only needed in the invalidate case. Signed-off-by: Paolo Bonzini --- ui/console.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ui/console.c b/ui/console.c index b15ca87..2241b32 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1627,14 +1627,22 @@ void dpy_gfx_update_dirty(QemuConsole *con, } assert(mem); - memory_region_sync_dirty_bitmap(mem); + if (memory_region_is_logging(mem)) { + memory_region_sync_dirty_bitmap(mem); + if (invalidate) { + memory_region_reset_dirty(mem, mem_section.offset_within_region, size, + DIRTY_MEMORY_VGA); + } + } else { + invalidate = true; + } addr = mem_section.offset_within_region; first = -1; last = -1; for (i = 0; i < height; i++, addr += width) { dirty = invalidate || - memory_region_get_dirty(mem, addr, width, DIRTY_MEMORY_VGA); + memory_region_test_and_clear_dirty(mem, addr, width, DIRTY_MEMORY_VGA); if (dirty) { if (first == -1) { first = i; @@ -1654,8 +1662,6 @@ void dpy_gfx_update_dirty(QemuConsole *con, last - first + 1); } - memory_region_reset_dirty(mem, mem_section.offset_within_region, size, - DIRTY_MEMORY_VGA); out: memory_region_unref(mem); } -- 2.3.3