From patchwork Fri Nov 2 01:21:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: BALATON Zoltan X-Patchwork-Id: 196434 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AB3592C031B for ; Fri, 2 Nov 2012 12:21:52 +1100 (EST) Received: from localhost ([::1]:56891 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU5xG-00049P-Q9 for incoming@patchwork.ozlabs.org; Thu, 01 Nov 2012 21:21:50 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU5x9-00047R-R9 for qemu-devel@nongnu.org; Thu, 01 Nov 2012 21:21:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TU5x8-0003sA-KE for qemu-devel@nongnu.org; Thu, 01 Nov 2012 21:21:43 -0400 Received: from mono.eik.bme.hu ([152.66.115.2]:47544) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU5x8-0003s5-D1 for qemu-devel@nongnu.org; Thu, 01 Nov 2012 21:21:42 -0400 Received: from localhost (localhost [127.0.0.1]) by mono.eik.bme.hu (Postfix) with ESMTP id E98594E5 for ; Fri, 2 Nov 2012 02:21:41 +0100 (CET) X-Virus-Scanned: amavisd-new at eik.bme.hu Received: from mono.eik.bme.hu ([127.0.0.1]) by localhost (mono.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ByVp81RRHvVw for ; Fri, 2 Nov 2012 02:21:41 +0100 (CET) Received: by mono.eik.bme.hu (Postfix, from userid 432) id B3738918; Fri, 2 Nov 2012 02:21:41 +0100 (CET) Date: Fri, 2 Nov 2012 02:21:41 +0100 (CET) From: BALATON Zoltan X-X-Sender: balaton@mono To: qemu-devel@nongnu.org In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (GSO 1167 2008-08-23) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 152.66.115.2 Subject: [Qemu-devel] [PATCH 4/4 v5] vmware_vga: Allow simple drivers to work without using the fifo X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Postpone stopping the dirty log to the point where the command fifo is configured to allow drivers which don't use the fifo to work too. (Without this the picture rendered into the vram never got to the screen and the DIRECT_VRAM option meant to support this case was removed a year ago.) Signed-off-by: BALATON Zoltan --- hw/vga.c | 2 +- hw/vga_int.h | 1 + hw/vmware_vga.c | 34 +++++++++++++++++++++------------- 3 files changed, 23 insertions(+), 14 deletions(-) v5: rebased again diff --git a/hw/vga.c b/hw/vga.c index 023134e..81aa76b 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -1616,7 +1616,7 @@ void vga_invalidate_scanlines(VGACommonState *s, int y1, int y2) } } -static void vga_sync_dirty_bitmap(VGACommonState *s) +void vga_sync_dirty_bitmap(VGACommonState *s) { memory_region_sync_dirty_bitmap(&s->vram); } diff --git a/hw/vga_int.h b/hw/vga_int.h index d4da777..bcb738d 100644 --- a/hw/vga_int.h +++ b/hw/vga_int.h @@ -186,6 +186,7 @@ MemoryRegion *vga_init_io(VGACommonState *s, const MemoryRegionPortio **vbe_ports); void vga_common_reset(VGACommonState *s); +void vga_sync_dirty_bitmap(VGACommonState *s); void vga_dirty_log_start(VGACommonState *s); void vga_dirty_log_stop(VGACommonState *s); diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c index 038994e..7c766fb 100644 --- a/hw/vmware_vga.c +++ b/hw/vmware_vga.c @@ -317,14 +317,6 @@ static inline void vmsvga_update_rect(struct vmsvga_state_s *s, dpy_gfx_update(s->vga.ds, x, y, w, h); } -static inline void vmsvga_update_screen(struct vmsvga_state_s *s) -{ - memcpy(ds_get_data(s->vga.ds), s->vga.vram_ptr, - ds_get_linesize(s->vga.ds) * ds_get_height(s->vga.ds)); - dpy_gfx_update(s->vga.ds, 0, 0, - ds_get_width(s->vga.ds), ds_get_height(s->vga.ds)); -} - static inline void vmsvga_update_rect_delayed(struct vmsvga_state_s *s, int x, int y, int w, int h) { @@ -843,11 +835,10 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) break; case SVGA_REG_ENABLE: - s->enable = value; - s->config &= !!value; + s->enable = !!value; s->invalidated = 1; s->vga.invalidate(&s->vga); - if (s->enable) { + if (s->enable && s->config) { vga_dirty_log_stop(&s->vga); } else { vga_dirty_log_start(&s->vga); @@ -895,6 +886,7 @@ static void vmsvga_value_write(void *opaque, uint32_t address, uint32_t value) if (CMD(max) < CMD(min) + 10 * 1024) { break; } + vga_dirty_log_stop(&s->vga); } s->config = !!value; break; @@ -977,6 +969,8 @@ static inline void vmsvga_check_size(struct vmsvga_state_s *s) static void vmsvga_update_display(void *opaque) { struct vmsvga_state_s *s = opaque; + bool dirty = false; + if (!s->enable) { s->vga.update(&s->vga); return; @@ -991,9 +985,23 @@ static void vmsvga_update_display(void *opaque) * Is it more efficient to look at vram VGA-dirty bits or wait * for the driver to issue SVGA_CMD_UPDATE? */ - if (s->invalidated) { + if (memory_region_is_logging(&s->vga.vram)) { + vga_sync_dirty_bitmap(&s->vga); + dirty = memory_region_get_dirty(&s->vga.vram, 0, + ds_get_linesize(s->vga.ds) * ds_get_height(s->vga.ds), + DIRTY_MEMORY_VGA); + } + if (s->invalidated || dirty) { s->invalidated = 0; - vmsvga_update_screen(s); + memcpy(ds_get_data(s->vga.ds), s->vga.vram_ptr, + ds_get_linesize(s->vga.ds) * ds_get_height(s->vga.ds)); + dpy_gfx_update(s->vga.ds, 0, 0, + ds_get_width(s->vga.ds), ds_get_height(s->vga.ds)); + } + if (dirty) { + memory_region_reset_dirty(&s->vga.vram, 0, + ds_get_linesize(s->vga.ds) * ds_get_height(s->vga.ds), + DIRTY_MEMORY_VGA); } }