summaryrefslogtreecommitdiffstats
path: root/ui/vnc.c
diff options
context:
space:
mode:
authorPeter Maydell2022-03-19 12:28:54 +0100
committerPeter Maydell2022-03-19 12:28:54 +0100
commit2058fdbe81e2985c226a026851dd26b146d3395c (patch)
tree2a9ad1887e77a9e0de8ff52ae28d7b5e23940f09 /ui/vnc.c
parentMerge tag 'trivial-branch-for-7.0-pull-request' of https://gitlab.com/laurent... (diff)
parenthw/display/vga: Report a proper error when adding a 2nd ISA VGA (diff)
downloadqemu-2058fdbe81e2985c226a026851dd26b146d3395c.tar.gz
qemu-2058fdbe81e2985c226a026851dd26b146d3395c.tar.xz
qemu-2058fdbe81e2985c226a026851dd26b146d3395c.zip
Merge tag 'fixes-20220318-pull-request' of git://git.kraxel.org/qemu into staging
bugfixes for vga, audio, vnc # gpg: Signature made Fri 18 Mar 2022 13:56:22 GMT # gpg: using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * tag 'fixes-20220318-pull-request' of git://git.kraxel.org/qemu: hw/display/vga: Report a proper error when adding a 2nd ISA VGA hw/display: Allow vga_common_init() to return errors hw/display/cirrus_vga: Clean up indentation in pci_cirrus_vga_realize() audio/mixeng: Do not declare unused variables ui: avoid unnecessary memory operations in vnc_refresh_server_surface() ui/gtk: Ignore 2- and 3-button press events Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui/vnc.c')
-rw-r--r--ui/vnc.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/ui/vnc.c b/ui/vnc.c
index 3ccd33dedc..310a873c21 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3098,6 +3098,9 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
VncState *vs;
int has_dirty = 0;
pixman_image_t *tmpbuf = NULL;
+ unsigned long offset;
+ int x;
+ uint8_t *guest_ptr, *server_ptr;
struct timeval tv = { 0, 0 };
@@ -3106,6 +3109,13 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
has_dirty = vnc_update_stats(vd, &tv);
}
+ offset = find_next_bit((unsigned long *) &vd->guest.dirty,
+ height * VNC_DIRTY_BPL(&vd->guest), 0);
+ if (offset == height * VNC_DIRTY_BPL(&vd->guest)) {
+ /* no dirty bits in guest surface */
+ return has_dirty;
+ }
+
/*
* Walk through the guest dirty map.
* Check and copy modified bits from guest to server surface.
@@ -3130,15 +3140,6 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
line_bytes = MIN(server_stride, guest_ll);
for (;;) {
- int x;
- uint8_t *guest_ptr, *server_ptr;
- unsigned long offset = find_next_bit((unsigned long *) &vd->guest.dirty,
- height * VNC_DIRTY_BPL(&vd->guest),
- y * VNC_DIRTY_BPL(&vd->guest));
- if (offset == height * VNC_DIRTY_BPL(&vd->guest)) {
- /* no more dirty bits */
- break;
- }
y = offset / VNC_DIRTY_BPL(&vd->guest);
x = offset % VNC_DIRTY_BPL(&vd->guest);
@@ -3177,6 +3178,13 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
}
y++;
+ offset = find_next_bit((unsigned long *) &vd->guest.dirty,
+ height * VNC_DIRTY_BPL(&vd->guest),
+ y * VNC_DIRTY_BPL(&vd->guest));
+ if (offset == height * VNC_DIRTY_BPL(&vd->guest)) {
+ /* no more dirty bits */
+ break;
+ }
}
qemu_pixman_image_unref(tmpbuf);
return has_dirty;