From: BALATON Zoltan <balaton@eik.bme.hu>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 4/4 v3] vmware_vga: Allow simple drivers to work without using the fifo
Date: Sat, 6 Oct 2012 20:35:53 +0200 (CEST) [thread overview]
Message-ID: <alpine.GSO.2.00.1210062035070.13558@mono> (raw)
In-Reply-To: <alpine.GSO.2.00.1210031114580.19707@mono>
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 <balaton@eik.bme.hu>
---
hw/vga.c | 2 +-
hw/vga_int.h | 1 +
hw/vmware_vga.c | 34 +++++++++++++++++++++-------------
3 files changed, 23 insertions(+), 14 deletions(-)
v3: Split off coding style fixes and explicitely inline update function here
diff --git a/hw/vga.c b/hw/vga.c
index afaef0d..8f7df0b 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 330a32f..c01d07d 100644
--- a/hw/vga_int.h
+++ b/hw/vga_int.h
@@ -196,6 +196,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 c3ef924..d46d5ba 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -318,14 +318,6 @@ static inline void vmsvga_update_rect(struct vmsvga_state_s *s,
dpy_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_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)
{
@@ -846,11 +838,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);
@@ -898,6 +889,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;
@@ -980,6 +972,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;
@@ -994,9 +988,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_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);
}
}
--
1.7.10
prev parent reply other threads:[~2012-10-06 18:35 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-03 9:22 [Qemu-devel] [PATCH 0/3] vmware_vga: Cleanup and allow simple drivers to work without the fifo BALATON Zoltan
2012-10-03 9:30 ` [Qemu-devel] [PATCH 1/3 v2] vmware_vga: Cleanup and remove duplicated info from local state BALATON Zoltan
2012-10-03 9:42 ` Paolo Bonzini
2012-10-03 9:30 ` [Qemu-devel] [PATCH 2/3 v2] vmware_vga: Return a value for FB_SIZE before the device is enabled BALATON Zoltan
2012-10-03 9:43 ` Paolo Bonzini
2012-10-03 9:31 ` [Qemu-devel] [PATCH 3/3 v2] vmware_vga: Allow simple drivers to work without using the fifo BALATON Zoltan
2012-10-03 9:46 ` Paolo Bonzini
2012-10-06 18:33 ` [Qemu-devel] [PATCH 1/4 v3] vmware_vga: Coding style cleanup BALATON Zoltan
2012-10-18 19:07 ` BALATON Zoltan
2012-10-29 10:38 ` BALATON Zoltan
2012-10-30 18:50 ` Blue Swirl
2012-10-31 1:08 ` [Qemu-devel] [PATCH 1/4 v4] " BALATON Zoltan
2012-11-02 1:20 ` [Qemu-devel] [PATCH 1/4 v5] " BALATON Zoltan
2012-11-02 1:20 ` [Qemu-devel] [PATCH 2/4 v5] vmware_vga: Remove duplicated info from local state BALATON Zoltan
2012-11-02 1:21 ` [Qemu-devel] [PATCH 3/4 v5] vmware_vga: Return a value for FB_SIZE before the device is enabled BALATON Zoltan
2012-11-02 1:21 ` [Qemu-devel] [PATCH 4/4 v5] vmware_vga: Allow simple drivers to work without using the fifo BALATON Zoltan
2012-11-03 9:51 ` [Qemu-devel] [PATCH 1/4 v5] vmware_vga: Coding style cleanup Blue Swirl
2012-11-03 12:51 ` BALATON Zoltan
2012-11-03 10:58 ` BALATON Zoltan
2012-11-03 10:58 ` [Qemu-devel] [PATCH 2/4 v5] vmware_vga: Remove duplicated info from local state BALATON Zoltan
2012-11-04 6:39 ` Jan Kiszka
2012-11-04 10:20 ` BALATON Zoltan
2012-11-04 17:58 ` BALATON Zoltan
2012-11-03 10:58 ` [Qemu-devel] [PATCH 3/4 v5] vmware_vga: Return a value for FB_SIZE before the device is enabled BALATON Zoltan
2012-11-03 10:59 ` [Qemu-devel] [PATCH 4/4 v5] vmware_vga: Allow simple drivers to work without using the fifo BALATON Zoltan
2012-11-03 11:47 ` [Qemu-devel] [PATCH 2/4 v5] vmware_vga: Remove duplicated info from local state BALATON Zoltan
2012-11-03 11:47 ` [Qemu-devel] [PATCH 1/4 v5] vmware_vga: Coding style cleanup BALATON Zoltan
2012-11-03 11:47 ` [Qemu-devel] [PATCH 3/4 v5] vmware_vga: Return a value for FB_SIZE before the device is enabled BALATON Zoltan
2012-11-03 11:47 ` [Qemu-devel] [PATCH 1/4 v5] vmware_vga: Coding style cleanup BALATON Zoltan
2012-11-03 15:20 ` Blue Swirl
2012-11-03 11:47 ` [Qemu-devel] [PATCH 4/4 v5] vmware_vga: Allow simple drivers to work without using the fifo BALATON Zoltan
2012-11-03 11:47 ` [Qemu-devel] [PATCH 3/4 v5] vmware_vga: Return a value for FB_SIZE before the device is enabled BALATON Zoltan
2012-11-03 11:47 ` [Qemu-devel] [PATCH 2/4 v5] vmware_vga: Remove duplicated info from local state BALATON Zoltan
2012-11-03 11:47 ` [Qemu-devel] [PATCH 4/4 v5] vmware_vga: Allow simple drivers to work without using the fifo BALATON Zoltan
2012-10-31 1:08 ` [Qemu-devel] [PATCH 2/4 v4] vmware_vga: Remove duplicated info from local state BALATON Zoltan
2012-10-31 1:09 ` [Qemu-devel] [PATCH 3/4 v4] vmware_vga: Return a value for FB_SIZE before the device is enabled BALATON Zoltan
2012-10-31 1:10 ` [Qemu-devel] [PATCH 4/4 v4] vmware_vga: Allow simple drivers to work without using the fifo BALATON Zoltan
2012-10-31 1:12 ` [Qemu-devel] [PATCH 1/4 v3] vmware_vga: Coding style cleanup BALATON Zoltan
2012-10-06 18:34 ` [Qemu-devel] [PATCH 2/4 v3] vmware_vga: Remove duplicated info from local state BALATON Zoltan
2012-10-06 18:35 ` [Qemu-devel] [PATCH 3/4 v3] vmware_vga: Return a value for FB_SIZE before the device is enabled BALATON Zoltan
2012-10-06 18:35 ` BALATON Zoltan [this message]
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=alpine.GSO.2.00.1210062035070.13558@mono \
--to=balaton@eik.bme.hu \
--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).