All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/3] Ui 20200123 patches
@ 2020-01-23 14:21 Gerd Hoffmann
  2020-01-23 14:21 ` [PULL 1/3] Revert "vnc: allow fall back to RAW encoding" Gerd Hoffmann
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2020-01-23 14:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

The following changes since commit 43d1455cf84283466e5c22a217db5ef4b8197b14:

  qapi: Fix code generation with Python 3.5 (2020-01-20 12:17:38 +0000)

are available in the Git repository at:

  git://git.kraxel.org/qemu tags/ui-20200123-pull-request

for you to fetch changes up to a1e8853ed2acbda29a52533abc91b035b723952e:

  ui/console: Display the 'none' backend in '-display help' (2020-01-21 07:29:40 +0100)

----------------------------------------------------------------
vnc: fix zlib compression artifacts.
ui: add "none" to -display help.

----------------------------------------------------------------

Cameron Esfahani (1):
  vnc: prioritize ZRLE compression over ZLIB

Gerd Hoffmann (1):
  Revert "vnc: allow fall back to RAW encoding"

Philippe Mathieu-Daudé (1):
  ui/console: Display the 'none' backend in '-display help'

 ui/console.c      |  1 +
 ui/vnc-enc-zrle.c |  4 ++--
 ui/vnc.c          | 31 +++++++++++--------------------
 3 files changed, 14 insertions(+), 22 deletions(-)

-- 
2.18.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PULL 1/3] Revert "vnc: allow fall back to RAW encoding"
  2020-01-23 14:21 [PULL 0/3] Ui 20200123 patches Gerd Hoffmann
@ 2020-01-23 14:21 ` Gerd Hoffmann
  2020-01-23 14:21 ` [PULL 2/3] vnc: prioritize ZRLE compression over ZLIB Gerd Hoffmann
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2020-01-23 14:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Cameron Esfahani

This reverts commit de3f7de7f4e257ce44cdabb90f5f17ee99624557.

Remove VNC optimization to reencode framebuffer update as raw if it's
smaller than the default encoding.

QEMU's implementation was naive and didn't account for the ZLIB z_stream
mutating with each compression.  Because of the mutation, simply
resetting the output buffer's offset wasn't sufficient to "rewind" the
operation.  The mutated z_stream would generate future zlib blocks which
referred to symbols in past blocks which weren't sent.  This would lead
to artifacting.

Considering that ZRLE is never larger than raw and even though ZLIB can
occasionally be fractionally larger than raw, the overhead of
implementing this optimization correctly isn't worth it.

Signed-off-by: Cameron Esfahani <dirty@apple.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/vnc.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index 4100d6e4048c..3e8d1f120710 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -898,8 +898,6 @@ int vnc_raw_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
 int vnc_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
 {
     int n = 0;
-    bool encode_raw = false;
-    size_t saved_offs = vs->output.offset;
 
     switch(vs->vnc_encoding) {
         case VNC_ENCODING_ZLIB:
@@ -922,24 +920,10 @@ int vnc_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
             n = vnc_zywrle_send_framebuffer_update(vs, x, y, w, h);
             break;
         default:
-            encode_raw = true;
+            vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_RAW);
+            n = vnc_raw_send_framebuffer_update(vs, x, y, w, h);
             break;
     }
-
-    /* If the client has the same pixel format as our internal buffer and
-     * a RAW encoding would need less space fall back to RAW encoding to
-     * save bandwidth and processing power in the client. */
-    if (!encode_raw && vs->write_pixels == vnc_write_pixels_copy &&
-        12 + h * w * VNC_SERVER_FB_BYTES <= (vs->output.offset - saved_offs)) {
-        vs->output.offset = saved_offs;
-        encode_raw = true;
-    }
-
-    if (encode_raw) {
-        vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_RAW);
-        n = vnc_raw_send_framebuffer_update(vs, x, y, w, h);
-    }
-
     return n;
 }
 
-- 
2.18.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 2/3] vnc: prioritize ZRLE compression over ZLIB
  2020-01-23 14:21 [PULL 0/3] Ui 20200123 patches Gerd Hoffmann
  2020-01-23 14:21 ` [PULL 1/3] Revert "vnc: allow fall back to RAW encoding" Gerd Hoffmann
@ 2020-01-23 14:21 ` Gerd Hoffmann
  2020-01-23 14:21 ` [PULL 3/3] ui/console: Display the 'none' backend in '-display help' Gerd Hoffmann
  2020-01-24  9:58 ` [PULL 0/3] Ui 20200123 patches Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2020-01-23 14:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Cameron Esfahani

From: Cameron Esfahani <dirty@apple.com>

In my investigation, ZRLE always compresses better than ZLIB so
prioritize ZRLE over ZLIB, even if the client hints that ZLIB is
preferred.

zlib buffer is always reset in zrle_compress_data(), so using offset to
calculate next_out and avail_out is useless.

Signed-off-by: Cameron Esfahani <dirty@apple.com>
Message-Id: <b5d129895d08a90d0a2a6183b95875bacfa998b8.1579582674.git.dirty@apple.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/vnc-enc-zrle.c |  4 ++--
 ui/vnc.c          | 11 +++++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/ui/vnc-enc-zrle.c b/ui/vnc-enc-zrle.c
index 17fd28a2e2b0..b4f71e32cfe8 100644
--- a/ui/vnc-enc-zrle.c
+++ b/ui/vnc-enc-zrle.c
@@ -98,8 +98,8 @@ static int zrle_compress_data(VncState *vs, int level)
     /* set pointers */
     zstream->next_in = vs->zrle->zrle.buffer;
     zstream->avail_in = vs->zrle->zrle.offset;
-    zstream->next_out = vs->zrle->zlib.buffer + vs->zrle->zlib.offset;
-    zstream->avail_out = vs->zrle->zlib.capacity - vs->zrle->zlib.offset;
+    zstream->next_out = vs->zrle->zlib.buffer;
+    zstream->avail_out = vs->zrle->zlib.capacity;
     zstream->data_type = Z_BINARY;
 
     /* start encoding */
diff --git a/ui/vnc.c b/ui/vnc.c
index 3e8d1f120710..1d7138a3a073 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2071,8 +2071,15 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
             break;
 #endif
         case VNC_ENCODING_ZLIB:
-            vs->features |= VNC_FEATURE_ZLIB_MASK;
-            vs->vnc_encoding = enc;
+            /*
+             * VNC_ENCODING_ZRLE compresses better than VNC_ENCODING_ZLIB.
+             * So prioritize ZRLE, even if the client hints that it prefers
+             * ZLIB.
+             */
+            if ((vs->features & VNC_FEATURE_ZRLE_MASK) == 0) {
+                vs->features |= VNC_FEATURE_ZLIB_MASK;
+                vs->vnc_encoding = enc;
+            }
             break;
         case VNC_ENCODING_ZRLE:
             vs->features |= VNC_FEATURE_ZRLE_MASK;
-- 
2.18.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 3/3] ui/console: Display the 'none' backend in '-display help'
  2020-01-23 14:21 [PULL 0/3] Ui 20200123 patches Gerd Hoffmann
  2020-01-23 14:21 ` [PULL 1/3] Revert "vnc: allow fall back to RAW encoding" Gerd Hoffmann
  2020-01-23 14:21 ` [PULL 2/3] vnc: prioritize ZRLE compression over ZLIB Gerd Hoffmann
@ 2020-01-23 14:21 ` Gerd Hoffmann
  2020-01-24  9:58 ` [PULL 0/3] Ui 20200123 patches Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2020-01-23 14:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Gerd Hoffmann

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Commit c388f408b5 added the possibility to list the display
backends using '-display help'. Since the 'none' backend is
is not implemented as a DisplayChangeListenerOps, it is not
registered to the dpys[] array with qemu_display_register(),
and is not listed in the help output.

This might be confusing, as we list it in the man page:

  -display type
      Select type of display to use. This option is a replacement for
      the old style -sdl/-curses/... options. Valid values for type are

      none
          Do not display video output. The guest will still see an
          emulated graphics card, but its output will not be displayed
          to the QEMU user. This option differs from the -nographic
          option in that it only affects what is done with video
          output; -nographic also changes the destination of the serial
          and parallel port data.

Fix by manually listing the special 'none' backend in the help.

Suggested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20200120192947.31613-1-philmd@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/console.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ui/console.c b/ui/console.c
index 69339b028bb2..179901c35e0d 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -2338,6 +2338,7 @@ void qemu_display_help(void)
     int idx;
 
     printf("Available display backend types:\n");
+    printf("none\n");
     for (idx = DISPLAY_TYPE_NONE; idx < DISPLAY_TYPE__MAX; idx++) {
         if (!dpys[idx]) {
             ui_module_load_one(DisplayType_str(idx));
-- 
2.18.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PULL 0/3] Ui 20200123 patches
  2020-01-23 14:21 [PULL 0/3] Ui 20200123 patches Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2020-01-23 14:21 ` [PULL 3/3] ui/console: Display the 'none' backend in '-display help' Gerd Hoffmann
@ 2020-01-24  9:58 ` Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2020-01-24  9:58 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On Thu, 23 Jan 2020 at 17:41, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> The following changes since commit 43d1455cf84283466e5c22a217db5ef4b8197b14:
>
>   qapi: Fix code generation with Python 3.5 (2020-01-20 12:17:38 +0000)
>
> are available in the Git repository at:
>
>   git://git.kraxel.org/qemu tags/ui-20200123-pull-request
>
> for you to fetch changes up to a1e8853ed2acbda29a52533abc91b035b723952e:
>
>   ui/console: Display the 'none' backend in '-display help' (2020-01-21 07:29:40 +0100)
>
> ----------------------------------------------------------------
> vnc: fix zlib compression artifacts.
> ui: add "none" to -display help.
>
> ----------------------------------------------------------------
>
> Cameron Esfahani (1):
>   vnc: prioritize ZRLE compression over ZLIB
>
> Gerd Hoffmann (1):
>   Revert "vnc: allow fall back to RAW encoding"
>
> Philippe Mathieu-Daudé (1):
>   ui/console: Display the 'none' backend in '-display help'


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.0
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-24  9:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-23 14:21 [PULL 0/3] Ui 20200123 patches Gerd Hoffmann
2020-01-23 14:21 ` [PULL 1/3] Revert "vnc: allow fall back to RAW encoding" Gerd Hoffmann
2020-01-23 14:21 ` [PULL 2/3] vnc: prioritize ZRLE compression over ZLIB Gerd Hoffmann
2020-01-23 14:21 ` [PULL 3/3] ui/console: Display the 'none' backend in '-display help' Gerd Hoffmann
2020-01-24  9:58 ` [PULL 0/3] Ui 20200123 patches Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.