qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/7] ui patch queue
@ 2016-06-03  7:04 Gerd Hoffmann
  2016-06-03  7:04 ` [Qemu-devel] [PULL 1/7] ui: egl: Replace fprintf with error_report Gerd Hoffmann
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Gerd Hoffmann @ 2016-06-03  7:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  Hi,

Here comes the ui patch queue, with some small vnc improvements
and a collection of bugfixes.

please apply,
  Gerd

The following changes since commit 2c107d7684f9e3c4db4780d0756bbf35b06aec07:

  Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging (2016-06-02 14:26:57 +0100)

are available in the git repository at:


  git://git.kraxel.org/qemu tags/pull-ui-20160603-1

for you to fetch changes up to c5ce83334465ee5acb6789a2f22d125273761c9e:

  vnc: add configurable keyboard delay (2016-06-03 08:23:26 +0200)

----------------------------------------------------------------
vnc: keyboard delay, colormap support
ui: misc bugfixes

----------------------------------------------------------------
Alexander Graf (1):
      vnc: Add support for color map

Cole Robinson (2):
      ui: egl: Replace fprintf with error_report
      ui: spice: Exit if gl=on EGL init fails

Gerd Hoffmann (3):
      gtk: fix unchecked vc dereference
      sdl2: skip init without outputs
      vnc: add configurable keyboard delay

Pavel Dovgalyuk (1):
      SDL2: add bgrx pixel format

 qemu-options.hx  |  8 ++++++++
 ui/egl-helpers.c | 27 ++++++++++++++-------------
 ui/gtk.c         |  3 ++-
 ui/sdl2-2d.c     |  3 +++
 ui/sdl2.c        |  3 +++
 ui/spice-core.c  |  6 ++++--
 ui/vnc.c         | 46 ++++++++++++++++++++++++++++++++++++++++++----
 ui/vnc.h         |  1 +
 8 files changed, 77 insertions(+), 20 deletions(-)

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

* [Qemu-devel] [PULL 1/7] ui: egl: Replace fprintf with error_report
  2016-06-03  7:04 [Qemu-devel] [PULL 0/7] ui patch queue Gerd Hoffmann
@ 2016-06-03  7:04 ` Gerd Hoffmann
  2016-06-03  7:04 ` [Qemu-devel] [PULL 2/7] ui: spice: Exit if gl=on EGL init fails Gerd Hoffmann
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Gerd Hoffmann @ 2016-06-03  7:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cole Robinson, Gerd Hoffmann

From: Cole Robinson <crobinso@redhat.com>

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: c880920f6e40a506394d89dbbe1f67c63d359c17.1463588606.git.crobinso@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/egl-helpers.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
index 22835c0..79cee05 100644
--- a/ui/egl-helpers.c
+++ b/ui/egl-helpers.c
@@ -2,6 +2,7 @@
 #include <glob.h>
 #include <dirent.h>
 
+#include "qemu/error-report.h"
 #include "ui/egl-helpers.h"
 
 EGLDisplay *qemu_egl_display;
@@ -74,13 +75,13 @@ int egl_rendernode_init(void)
 
     qemu_egl_rn_fd = qemu_egl_rendernode_open();
     if (qemu_egl_rn_fd == -1) {
-        fprintf(stderr, "egl: no drm render node available\n");
+        error_report("egl: no drm render node available");
         goto err;
     }
 
     qemu_egl_rn_gbm_dev = gbm_create_device(qemu_egl_rn_fd);
     if (!qemu_egl_rn_gbm_dev) {
-        fprintf(stderr, "egl: gbm_create_device failed\n");
+        error_report("egl: gbm_create_device failed");
         goto err;
     }
 
@@ -88,18 +89,18 @@ int egl_rendernode_init(void)
 
     if (!epoxy_has_egl_extension(qemu_egl_display,
                                  "EGL_KHR_surfaceless_context")) {
-        fprintf(stderr, "egl: EGL_KHR_surfaceless_context not supported\n");
+        error_report("egl: EGL_KHR_surfaceless_context not supported");
         goto err;
     }
     if (!epoxy_has_egl_extension(qemu_egl_display,
                                  "EGL_MESA_image_dma_buf_export")) {
-        fprintf(stderr, "egl: EGL_MESA_image_dma_buf_export not supported\n");
+        error_report("egl: EGL_MESA_image_dma_buf_export not supported");
         goto err;
     }
 
     qemu_egl_rn_ctx = qemu_egl_init_ctx();
     if (!qemu_egl_rn_ctx) {
-        fprintf(stderr, "egl: egl_init_ctx failed\n");
+        error_report("egl: egl_init_ctx failed");
         goto err;
     }
 
@@ -156,13 +157,13 @@ EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, Window win)
                                       qemu_egl_config,
                                       (EGLNativeWindowType)win, NULL);
     if (esurface == EGL_NO_SURFACE) {
-        fprintf(stderr, "egl: eglCreateWindowSurface failed\n");
+        error_report("egl: eglCreateWindowSurface failed");
         return NULL;
     }
 
     b = eglMakeCurrent(qemu_egl_display, esurface, esurface, ectx);
     if (b == EGL_FALSE) {
-        fprintf(stderr, "egl: eglMakeCurrent failed\n");
+        error_report("egl: eglMakeCurrent failed");
         return NULL;
     }
 
@@ -204,21 +205,21 @@ int qemu_egl_init_dpy(EGLNativeDisplayType dpy, bool gles, bool debug)
     egl_dbg("eglGetDisplay (dpy %p) ...\n", dpy);
     qemu_egl_display = eglGetDisplay(dpy);
     if (qemu_egl_display == EGL_NO_DISPLAY) {
-        fprintf(stderr, "egl: eglGetDisplay failed\n");
+        error_report("egl: eglGetDisplay failed");
         return -1;
     }
 
     egl_dbg("eglInitialize ...\n");
     b = eglInitialize(qemu_egl_display, &major, &minor);
     if (b == EGL_FALSE) {
-        fprintf(stderr, "egl: eglInitialize failed\n");
+        error_report("egl: eglInitialize failed");
         return -1;
     }
 
     egl_dbg("eglBindAPI ...\n");
     b = eglBindAPI(gles ? EGL_OPENGL_ES_API : EGL_OPENGL_API);
     if (b == EGL_FALSE) {
-        fprintf(stderr, "egl: eglBindAPI failed\n");
+        error_report("egl: eglBindAPI failed");
         return -1;
     }
 
@@ -227,7 +228,7 @@ int qemu_egl_init_dpy(EGLNativeDisplayType dpy, bool gles, bool debug)
                         gles ? conf_att_gles : conf_att_gl,
                         &qemu_egl_config, 1, &n);
     if (b == EGL_FALSE || n != 1) {
-        fprintf(stderr, "egl: eglChooseConfig failed\n");
+        error_report("egl: eglChooseConfig failed");
         return -1;
     }
 
@@ -252,13 +253,13 @@ EGLContext qemu_egl_init_ctx(void)
     ectx = eglCreateContext(qemu_egl_display, qemu_egl_config, EGL_NO_CONTEXT,
                             egl_gles ? ctx_att_gles : ctx_att_gl);
     if (ectx == EGL_NO_CONTEXT) {
-        fprintf(stderr, "egl: eglCreateContext failed\n");
+        error_report("egl: eglCreateContext failed");
         return NULL;
     }
 
     b = eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, ectx);
     if (b == EGL_FALSE) {
-        fprintf(stderr, "egl: eglMakeCurrent failed\n");
+        error_report("egl: eglMakeCurrent failed");
         return NULL;
     }
 
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 2/7] ui: spice: Exit if gl=on EGL init fails
  2016-06-03  7:04 [Qemu-devel] [PULL 0/7] ui patch queue Gerd Hoffmann
  2016-06-03  7:04 ` [Qemu-devel] [PULL 1/7] ui: egl: Replace fprintf with error_report Gerd Hoffmann
@ 2016-06-03  7:04 ` Gerd Hoffmann
  2016-06-03  7:04 ` [Qemu-devel] [PULL 3/7] gtk: fix unchecked vc dereference Gerd Hoffmann
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Gerd Hoffmann @ 2016-06-03  7:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cole Robinson, Gerd Hoffmann

From: Cole Robinson <crobinso@redhat.com>

The user explicitly requested spice GL, so if we know it isn't
going to work we should exit

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: e3789e35b16f9e3cc6f2652f91c52d88ba6d6936.1463588606.git.crobinso@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/spice-core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ui/spice-core.c b/ui/spice-core.c
index 61db3c1..da05054 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -833,9 +833,11 @@ void qemu_spice_init(void)
                          "incompatible with -spice port/tls-port");
             exit(1);
         }
-        if (egl_rendernode_init() == 0) {
-            display_opengl = 1;
+        if (egl_rendernode_init() != 0) {
+            error_report("Failed to initialize EGL render node for SPICE GL");
+            exit(1);
         }
+        display_opengl = 1;
     }
 #endif
 }
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 3/7] gtk: fix unchecked vc dereference
  2016-06-03  7:04 [Qemu-devel] [PULL 0/7] ui patch queue Gerd Hoffmann
  2016-06-03  7:04 ` [Qemu-devel] [PULL 1/7] ui: egl: Replace fprintf with error_report Gerd Hoffmann
  2016-06-03  7:04 ` [Qemu-devel] [PULL 2/7] ui: spice: Exit if gl=on EGL init fails Gerd Hoffmann
@ 2016-06-03  7:04 ` Gerd Hoffmann
  2016-06-03  7:04 ` [Qemu-devel] [PULL 4/7] SDL2: add bgrx pixel format Gerd Hoffmann
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Gerd Hoffmann @ 2016-06-03  7:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Paolo Bonzini

Spotted by Coverity.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1463737748-1062-1-git-send-email-kraxel@redhat.com
---
 ui/gtk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index 7572cec..01b8216 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1477,13 +1477,14 @@ static void gd_grab_pointer(VirtualConsole *vc, const char *reason)
 static void gd_ungrab_pointer(GtkDisplayState *s)
 {
     VirtualConsole *vc = s->ptr_owner;
-    GdkDisplay *display = gtk_widget_get_display(vc->gfx.drawing_area);
+    GdkDisplay *display;
 
     if (vc == NULL) {
         return;
     }
     s->ptr_owner = NULL;
 
+    display = gtk_widget_get_display(vc->gfx.drawing_area);
 #if GTK_CHECK_VERSION(3, 20, 0)
     gd_grab_update(vc, vc->s->kbd_owner == vc, false);
     gdk_device_warp(gd_get_pointer(display),
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 4/7] SDL2: add bgrx pixel format
  2016-06-03  7:04 [Qemu-devel] [PULL 0/7] ui patch queue Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2016-06-03  7:04 ` [Qemu-devel] [PULL 3/7] gtk: fix unchecked vc dereference Gerd Hoffmann
@ 2016-06-03  7:04 ` Gerd Hoffmann
  2016-06-03  7:04 ` [Qemu-devel] [PULL 5/7] vnc: Add support for color map Gerd Hoffmann
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Gerd Hoffmann @ 2016-06-03  7:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: Pavel Dovgalyuk, Gerd Hoffmann

From: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>

This patch adds support of b8g8r8x8 pixel format for SDL2.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-id: 20160517072848.4540.34695.stgit@PASHA-ISP
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/sdl2-2d.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/sdl2-2d.c b/ui/sdl2-2d.c
index 9593006..8ab68d6 100644
--- a/ui/sdl2-2d.c
+++ b/ui/sdl2-2d.c
@@ -116,6 +116,9 @@ void sdl2_2d_switch(DisplayChangeListener *dcl,
     case PIXMAN_r8g8b8x8:
         format = SDL_PIXELFORMAT_RGBA8888;
         break;
+    case PIXMAN_b8g8r8x8:
+        format = SDL_PIXELFORMAT_BGRX8888;
+        break;
     default:
         g_assert_not_reached();
     }
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 5/7] vnc: Add support for color map
  2016-06-03  7:04 [Qemu-devel] [PULL 0/7] ui patch queue Gerd Hoffmann
                   ` (3 preceding siblings ...)
  2016-06-03  7:04 ` [Qemu-devel] [PULL 4/7] SDL2: add bgrx pixel format Gerd Hoffmann
@ 2016-06-03  7:04 ` Gerd Hoffmann
  2016-06-06  8:35   ` Paolo Bonzini
  2016-06-03  7:04 ` [Qemu-devel] [PULL 6/7] sdl2: skip init without outputs Gerd Hoffmann
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 10+ messages in thread
From: Gerd Hoffmann @ 2016-06-03  7:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alexander Graf, Pavel Butsykin, Denis V. Lunev, Gerd Hoffmann,
	Paolo Bonzini

From: Alexander Graf <agraf@suse.de>

Our current VNC code does not handle color maps (aka non-true-color) at all
and aborts if a client requests them. There are 2 major issues with this:

 1) A VNC viewer on an 8-bit X11 system may request color maps
 2) RealVNC _always_ starts requesting color maps, then moves on to full color

In order to support these 2 use cases, let's just create a fake color map
that covers exactly our normal true color 8 bit color space. That way we don't
lose anything over a client that wants true color.

Reported-by: Sascha Wehnert <swehnert@suse.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Message-id: 1464099559-20789-1-git-send-email-den@openvz.org

Actually this is a very old patch originally submitted in 2013 by
Alexander. The situation is still the same with RealVNC, it does not
connect by default to QEMU VNC. The problem is that this client is
really popular. This is better to be kludged.

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Gerd Hoffmann <kraxel@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/vnc.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index d2ebf1f..ddd01fd 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2094,6 +2094,24 @@ static void set_pixel_conversion(VncState *vs)
     }
 }
 
+static void send_color_map(VncState *vs)
+{
+    int i;
+
+    vnc_write_u8(vs, VNC_MSG_SERVER_SET_COLOUR_MAP_ENTRIES);
+    vnc_write_u8(vs,  0);    /* padding     */
+    vnc_write_u16(vs, 0);    /* first color */
+    vnc_write_u16(vs, 256);  /* # of colors */
+
+    for (i = 0; i < 256; i++) {
+        PixelFormat *pf = &vs->client_pf;
+
+        vnc_write_u16(vs, (((i >> pf->rshift) & pf->rmax) << (16 - pf->rbits)));
+        vnc_write_u16(vs, (((i >> pf->gshift) & pf->gmax) << (16 - pf->gbits)));
+        vnc_write_u16(vs, (((i >> pf->bshift) & pf->bmax) << (16 - pf->bbits)));
+    }
+}
+
 static void set_pixel_format(VncState *vs,
                              int bits_per_pixel, int depth,
                              int big_endian_flag, int true_color_flag,
@@ -2101,8 +2119,15 @@ static void set_pixel_format(VncState *vs,
                              int red_shift, int green_shift, int blue_shift)
 {
     if (!true_color_flag) {
-        vnc_client_error(vs);
-        return;
+        /* Expose a reasonable default 256 color map */
+        bits_per_pixel = 8;
+        depth = 8;
+        red_max = 7;
+        green_max = 7;
+        blue_max = 3;
+        red_shift = 0;
+        green_shift = 3;
+        blue_shift = 6;
     }
 
     switch (bits_per_pixel) {
@@ -2132,6 +2157,10 @@ static void set_pixel_format(VncState *vs,
     vs->client_pf.depth = bits_per_pixel == 32 ? 24 : bits_per_pixel;
     vs->client_be = big_endian_flag;
 
+    if (!true_color_flag) {
+        send_color_map(vs);
+    }
+
     set_pixel_conversion(vs);
 
     graphic_hw_invalidate(vs->vd->dcl.con);
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 6/7] sdl2: skip init without outputs
  2016-06-03  7:04 [Qemu-devel] [PULL 0/7] ui patch queue Gerd Hoffmann
                   ` (4 preceding siblings ...)
  2016-06-03  7:04 ` [Qemu-devel] [PULL 5/7] vnc: Add support for color map Gerd Hoffmann
@ 2016-06-03  7:04 ` Gerd Hoffmann
  2016-06-03  7:04 ` [Qemu-devel] [PULL 7/7] vnc: add configurable keyboard delay Gerd Hoffmann
  2016-06-03 12:04 ` [Qemu-devel] [PULL 0/7] ui patch queue Peter Maydell
  7 siblings, 0 replies; 10+ messages in thread
From: Gerd Hoffmann @ 2016-06-03  7:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Cole Robinson <crobinso@redhat.com>
Message-id: 1464790116-32405-1-git-send-email-kraxel@redhat.com
---
 ui/sdl2.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/sdl2.c b/ui/sdl2.c
index 909038f..30d2a3c 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -794,6 +794,9 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
         }
     }
     sdl2_num_outputs = i;
+    if (sdl2_num_outputs == 0) {
+        return;
+    }
     sdl2_console = g_new0(struct sdl2_console, sdl2_num_outputs);
     for (i = 0; i < sdl2_num_outputs; i++) {
         QemuConsole *con = qemu_console_lookup_by_index(i);
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 7/7] vnc: add configurable keyboard delay
  2016-06-03  7:04 [Qemu-devel] [PULL 0/7] ui patch queue Gerd Hoffmann
                   ` (5 preceding siblings ...)
  2016-06-03  7:04 ` [Qemu-devel] [PULL 6/7] sdl2: skip init without outputs Gerd Hoffmann
@ 2016-06-03  7:04 ` Gerd Hoffmann
  2016-06-03 12:04 ` [Qemu-devel] [PULL 0/7] ui patch queue Peter Maydell
  7 siblings, 0 replies; 10+ messages in thread
From: Gerd Hoffmann @ 2016-06-03  7:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Limits the rate kbd events from the vnc server are forwarded to the
guest, so input devices which are typically low-bandwidth can keep
up even on bulky input.

v2: update documentation too.
v3: spell fixes.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Yang Hongyang <hongyang.yang@easystack.cn>
Message-id: 1464762150-25817-1-git-send-email-kraxel@redhat.com
---
 qemu-options.hx |  8 ++++++++
 ui/vnc.c        | 13 +++++++++++--
 ui/vnc.h        |  1 +
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index 6106520..9f33361 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1410,6 +1410,14 @@ everybody else.  'ignore' completely ignores the shared flag and
 allows everybody connect unconditionally.  Doesn't conform to the rfb
 spec but is traditional QEMU behavior.
 
+@item key-delay-ms
+
+Set keyboard delay, for key down and key up events, in milliseconds.
+Default is 1.  Keyboards are low-bandwidth devices, so this slowdown
+can help the device and guest to keep up and not lose events in case
+events are arriving in bulk.  Possible causes for the latter are flaky
+network connections, or scripts for automated testing.
+
 @end table
 ETEXI
 
diff --git a/ui/vnc.c b/ui/vnc.c
index ddd01fd..c862fdc 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1629,6 +1629,7 @@ static void reset_keys(VncState *vs)
     for(i = 0; i < 256; i++) {
         if (vs->modifiers_state[i]) {
             qemu_input_event_send_key_number(vs->vd->dcl.con, i, false);
+            qemu_input_event_send_key_delay(vs->vd->key_delay_ms);
             vs->modifiers_state[i] = 0;
         }
     }
@@ -1638,9 +1639,9 @@ static void press_key(VncState *vs, int keysym)
 {
     int keycode = keysym2scancode(vs->vd->kbd_layout, keysym) & SCANCODE_KEYMASK;
     qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, true);
-    qemu_input_event_send_key_delay(0);
+    qemu_input_event_send_key_delay(vs->vd->key_delay_ms);
     qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, false);
-    qemu_input_event_send_key_delay(0);
+    qemu_input_event_send_key_delay(vs->vd->key_delay_ms);
 }
 
 static int current_led_state(VncState *vs)
@@ -1792,6 +1793,7 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
 
     if (qemu_console_is_graphic(NULL)) {
         qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, down);
+        qemu_input_event_send_key_delay(vs->vd->key_delay_ms);
     } else {
         bool numlock = vs->modifiers_state[0x45];
         bool control = (vs->modifiers_state[0x1d] ||
@@ -1913,6 +1915,7 @@ static void vnc_release_modifiers(VncState *vs)
             continue;
         }
         qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, false);
+        qemu_input_event_send_key_delay(vs->vd->key_delay_ms);
     }
 }
 
@@ -3278,6 +3281,9 @@ static QemuOptsList qemu_vnc_opts = {
             .name = "lock-key-sync",
             .type = QEMU_OPT_BOOL,
         },{
+            .name = "key-delay-ms",
+            .type = QEMU_OPT_NUMBER,
+        },{
             .name = "sasl",
             .type = QEMU_OPT_BOOL,
         },{
@@ -3515,6 +3521,7 @@ void vnc_display_open(const char *id, Error **errp)
 #endif
     int acl = 0;
     int lock_key_sync = 1;
+    int key_delay_ms;
 
     if (!vs) {
         error_setg(errp, "VNC display not active");
@@ -3633,6 +3640,7 @@ void vnc_display_open(const char *id, Error **errp)
 
     reverse = qemu_opt_get_bool(opts, "reverse", false);
     lock_key_sync = qemu_opt_get_bool(opts, "lock-key-sync", true);
+    key_delay_ms = qemu_opt_get_number(opts, "key-delay-ms", 1);
     sasl = qemu_opt_get_bool(opts, "sasl", false);
 #ifndef CONFIG_VNC_SASL
     if (sasl) {
@@ -3764,6 +3772,7 @@ void vnc_display_open(const char *id, Error **errp)
     }
 #endif
     vs->lock_key_sync = lock_key_sync;
+    vs->key_delay_ms = key_delay_ms;
 
     device_id = qemu_opt_get(opts, "display");
     if (device_id) {
diff --git a/ui/vnc.h b/ui/vnc.h
index 81a3261..6568bca 100644
--- a/ui/vnc.h
+++ b/ui/vnc.h
@@ -155,6 +155,7 @@ struct VncDisplay
     DisplayChangeListener dcl;
     kbd_layout_t *kbd_layout;
     int lock_key_sync;
+    int key_delay_ms;
     QemuMutex mutex;
 
     QEMUCursor *cursor;
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PULL 0/7] ui patch queue
  2016-06-03  7:04 [Qemu-devel] [PULL 0/7] ui patch queue Gerd Hoffmann
                   ` (6 preceding siblings ...)
  2016-06-03  7:04 ` [Qemu-devel] [PULL 7/7] vnc: add configurable keyboard delay Gerd Hoffmann
@ 2016-06-03 12:04 ` Peter Maydell
  7 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2016-06-03 12:04 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On 3 June 2016 at 08:04, Gerd Hoffmann <kraxel@redhat.com> wrote:
>   Hi,
>
> Here comes the ui patch queue, with some small vnc improvements
> and a collection of bugfixes.
>
> please apply,
>   Gerd
>
> The following changes since commit 2c107d7684f9e3c4db4780d0756bbf35b06aec07:
>
>   Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging (2016-06-02 14:26:57 +0100)
>
> are available in the git repository at:
>
>
>   git://git.kraxel.org/qemu tags/pull-ui-20160603-1
>
> for you to fetch changes up to c5ce83334465ee5acb6789a2f22d125273761c9e:
>
>   vnc: add configurable keyboard delay (2016-06-03 08:23:26 +0200)
>

Applied, thanks.

-- PMM

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

* Re: [Qemu-devel] [PULL 5/7] vnc: Add support for color map
  2016-06-03  7:04 ` [Qemu-devel] [PULL 5/7] vnc: Add support for color map Gerd Hoffmann
@ 2016-06-06  8:35   ` Paolo Bonzini
  0 siblings, 0 replies; 10+ messages in thread
From: Paolo Bonzini @ 2016-06-06  8:35 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel; +Cc: Denis V. Lunev, Alexander Graf, Pavel Butsykin



On 03/06/2016 09:04, Gerd Hoffmann wrote:
>  static void set_pixel_format(VncState *vs,
>                               int bits_per_pixel, int depth,
>                               int big_endian_flag, int true_color_flag,
> @@ -2101,8 +2119,15 @@ static void set_pixel_format(VncState *vs,
>                               int red_shift, int green_shift, int blue_shift)
>  {
>      if (!true_color_flag) {
> -        vnc_client_error(vs);
> -        return;
> +        /* Expose a reasonable default 256 color map */
> +        bits_per_pixel = 8;
> +        depth = 8;
> +        red_max = 7;
> +        green_max = 7;
> +        blue_max = 3;
> +        red_shift = 0;
> +        green_shift = 3;
> +        blue_shift = 6;
>      }

Coverity now notes that the "depth" argument is unused.

It's not introduced by this patch, but now it notices because this hunk
introduces a dead write.

Thanks,

Paolo

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

end of thread, other threads:[~2016-06-06  8:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-03  7:04 [Qemu-devel] [PULL 0/7] ui patch queue Gerd Hoffmann
2016-06-03  7:04 ` [Qemu-devel] [PULL 1/7] ui: egl: Replace fprintf with error_report Gerd Hoffmann
2016-06-03  7:04 ` [Qemu-devel] [PULL 2/7] ui: spice: Exit if gl=on EGL init fails Gerd Hoffmann
2016-06-03  7:04 ` [Qemu-devel] [PULL 3/7] gtk: fix unchecked vc dereference Gerd Hoffmann
2016-06-03  7:04 ` [Qemu-devel] [PULL 4/7] SDL2: add bgrx pixel format Gerd Hoffmann
2016-06-03  7:04 ` [Qemu-devel] [PULL 5/7] vnc: Add support for color map Gerd Hoffmann
2016-06-06  8:35   ` Paolo Bonzini
2016-06-03  7:04 ` [Qemu-devel] [PULL 6/7] sdl2: skip init without outputs Gerd Hoffmann
2016-06-03  7:04 ` [Qemu-devel] [PULL 7/7] vnc: add configurable keyboard delay Gerd Hoffmann
2016-06-03 12:04 ` [Qemu-devel] [PULL 0/7] ui patch queue Peter Maydell

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).