When size and format of the display surface stays the same we can just
tag the guest display as dirty and be done with it.
There is no need need to resize the vnc server display or to touch the
vnc client dirty bits. On the next refresh cycle
vnc_refresh_server_surface() will check for actual display content
changes and update the client dirty bits as needed.
The desktop resize and framebuffer format notifications to the vnc
client will be skipped too.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/vnc.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/ui/vnc.c b/ui/vnc.c
index 9e4b2beb71..6002d09407 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -742,6 +742,17 @@ static void vnc_update_server_surface(VncDisplay *vd)
width, height);
}
+static bool vnc_check_pageflip(DisplaySurface *s1,
+ DisplaySurface *s2)
+{
+ return (s1 != NULL &&
+ s2 != NULL &&
+ surface_width(s1) == surface_width(s2) &&
+ surface_height(s1) == surface_height(s2) &&
+ surface_format(s1) == surface_format(s2));
+
+}
+
static void vnc_dpy_switch(DisplayChangeListener *dcl,
DisplaySurface *surface)
{
@@ -749,6 +760,7 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl,
"Display output is not active.";
static DisplaySurface *placeholder;
VncDisplay *vd = container_of(dcl, VncDisplay, dcl);
+ bool pageflip = vnc_check_pageflip(vd->ds, surface);
VncState *vs;
if (surface == NULL) {
@@ -761,14 +773,21 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl,
vnc_abort_display_jobs(vd);
vd->ds = surface;
- /* server surface */
- vnc_update_server_surface(vd);
-
/* guest surface */
qemu_pixman_image_unref(vd->guest.fb);
vd->guest.fb = pixman_image_ref(surface->image);
vd->guest.format = surface->format;
+ if (pageflip) {
+ vnc_set_area_dirty(vd->guest.dirty, vd, 0, 0,
+ surface_width(surface),
+ surface_height(surface));
+ return;
+ }
+
+ /* server surface */
+ vnc_update_server_surface(vd);
+
QTAILQ_FOREACH(vs, &vd->clients, next) {
vnc_colordepth(vs);
vnc_desktop_resize(vs);
--
2.9.3
On Wed, Jan 16, 2019 at 11:10:49AM +0100, Gerd Hoffmann wrote: > When size and format of the display surface stays the same we can just > tag the guest display as dirty and be done with it. > > There is no need need to resize the vnc server display or to touch the > vnc client dirty bits. On the next refresh cycle > vnc_refresh_server_surface() will check for actual display content > changes and update the client dirty bits as needed. > > The desktop resize and framebuffer format notifications to the vnc > client will be skipped too. > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> > --- > ui/vnc.c | 25 ++++++++++++++++++++++--- > 1 file changed, 22 insertions(+), 3 deletions(-) Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> > > diff --git a/ui/vnc.c b/ui/vnc.c > index 9e4b2beb71..6002d09407 100644 > --- a/ui/vnc.c > +++ b/ui/vnc.c > @@ -742,6 +742,17 @@ static void vnc_update_server_surface(VncDisplay *vd) > width, height); > } > > +static bool vnc_check_pageflip(DisplaySurface *s1, > + DisplaySurface *s2) > +{ > + return (s1 != NULL && > + s2 != NULL && > + surface_width(s1) == surface_width(s2) && > + surface_height(s1) == surface_height(s2) && > + surface_format(s1) == surface_format(s2)); > + > +} > + > static void vnc_dpy_switch(DisplayChangeListener *dcl, > DisplaySurface *surface) > { > @@ -749,6 +760,7 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl, > "Display output is not active."; > static DisplaySurface *placeholder; > VncDisplay *vd = container_of(dcl, VncDisplay, dcl); > + bool pageflip = vnc_check_pageflip(vd->ds, surface); > VncState *vs; > > if (surface == NULL) { > @@ -761,14 +773,21 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl, > vnc_abort_display_jobs(vd); > vd->ds = surface; > > - /* server surface */ > - vnc_update_server_surface(vd); > - > /* guest surface */ > qemu_pixman_image_unref(vd->guest.fb); > vd->guest.fb = pixman_image_ref(surface->image); > vd->guest.format = surface->format; > > + if (pageflip) { > + vnc_set_area_dirty(vd->guest.dirty, vd, 0, 0, > + surface_width(surface), > + surface_height(surface)); > + return; > + } > + > + /* server surface */ > + vnc_update_server_surface(vd); > + > QTAILQ_FOREACH(vs, &vd->clients, next) { > vnc_colordepth(vs); > vnc_desktop_resize(vs); > -- > 2.9.3 > > Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Patchew URL: https://patchew.org/QEMU/20190116101049.8929-1-kraxel@redhat.com/ Hi, This series failed the docker-mingw@fedora build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally. === TEST SCRIPT BEGIN === #!/bin/bash time make docker-test-mingw@fedora SHOW_ENV=1 J=14 === TEST SCRIPT END === CC hw/core/ptimer.o CC hw/core/sysbus.o /tmp/qemu-test/src/block/sheepdog.c: In function 'find_vdi_name': /tmp/qemu-test/src/block/sheepdog.c:1239:5: error: 'strncpy' specified bound 256 equals destination size [-Werror=stringop-truncation] strncpy(buf + SD_MAX_VDI_LEN, tag, SD_MAX_VDI_TAG_LEN); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors --- make: *** Waiting for unfinished jobs.... In function 'acpi_table_install', inlined from 'acpi_table_add' at /tmp/qemu-test/src/hw/acpi/core.c:296:5: /tmp/qemu-test/src/hw/acpi/core.c:184:9: error: 'strncpy' specified bound 4 equals destination size [-Werror=stringop-truncation] strncpy(ext_hdr->sig, hdrs->sig, sizeof ext_hdr->sig); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /tmp/qemu-test/src/hw/acpi/core.c:203:9: error: 'strncpy' specified bound 6 equals destination size [-Werror=stringop-truncation] strncpy(ext_hdr->oem_id, hdrs->oem_id, sizeof ext_hdr->oem_id); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /tmp/qemu-test/src/hw/acpi/core.c:207:9: error: 'strncpy' specified bound 8 equals destination size [-Werror=stringop-truncation] strncpy(ext_hdr->oem_table_id, hdrs->oem_table_id, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sizeof ext_hdr->oem_table_id); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /tmp/qemu-test/src/hw/acpi/core.c:216:9: error: 'strncpy' specified bound 4 equals destination size [-Werror=stringop-truncation] strncpy(ext_hdr->asl_compiler_id, hdrs->asl_compiler_id, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sizeof ext_hdr->asl_compiler_id); --- cc1: all warnings being treated as errors make: *** [/tmp/qemu-test/src/rules.mak:69: hw/acpi/core.o] Error 1 /tmp/qemu-test/src/hw/acpi/aml-build.c: In function 'build_header': /tmp/qemu-test/src/hw/acpi/aml-build.c:1535:9: error: 'strncpy' specified bound 6 equals destination size [-Werror=stringop-truncation] strncpy((char *)h->oem_id, oem_id, sizeof h->oem_id); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /tmp/qemu-test/src/hw/acpi/aml-build.c:1541:9: error: 'strncpy' specified bound 8 equals destination size [-Werror=stringop-truncation] strncpy((char *)h->oem_table_id, oem_table_id, sizeof(h->oem_table_id)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors The full log is available at http://patchew.org/logs/20190116101049.8929-1-kraxel@redhat.com/testing.docker-mingw@fedora/?type=message. --- Email generated automatically by Patchew [http://patchew.org/]. Please send your feedback to patchew-devel@redhat.com
© 2016 - 2025 Red Hat, Inc.