Skip to contentSkip to conversation

ui patch queue

GIT PULL Applied Gerd Hoffmann 3 participants 9 messages Nov 3, 2015 – Nov 5, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

Trying something new -- a unified patch queue for ui bugfix patches, featuring fixes for vnc, opengl and curses. That way I don't have to do three tiny pull requests.

Anything larger (like the vnc buffering series in the works atm) will continue to come as separate per-ui pull request.

please pull,
Gerd

The following changes since commit 3d861a01093f8eedfac9889746ccafcfd32039b7:

Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-11-02' into staging (2015-11-02 11:11:39 +0000)

are available in the git repository at:

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

for you to fetch changes up to 4d77b1f23877b579b94421d0cab2bebc79f4e171:

vnc: fix bug: vnc server can't start when 'to' is specified (2015-11-03 10:21:49 +0100)

----------------------------------------------------------------
ui: fixes for vnc, opengl and curses.

----------------------------------------------------------------
OGAWA Hirofumi (4):
ui/curses: Fix monitor color with -curses when 256 colors ui/curses: Support line graphics chars on -curses mode ui/curses: Fix pageup/pagedown on -curses ui/opengl: Reduce build required libraries for opengl

Peter Lieven (1):
vnc: allow fall back to RAW encoding

Yang Hongyang (1):
vnc: fix bug: vnc server can't start when 'to' is specified

 configure                   | 20 +++---------------
 hw/display/milkymist-tmu2.c |  4 ++--
 hw/lm32/milkymist-hw.h      |  3 ++-
 include/ui/console.h        | 12 ++++++++++-
 ui/curses.c                 | 51 ++++++++++++++++++++++++++++++++++++++++++++-
 ui/curses_keys.h            |  8 +++++--
 ui/vnc.c                    | 22 +++++++++++++++++--
 7 files changed, 94 insertions(+), 26 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/6] ui/curses: Fix monitor color with -curses when 256 colors

From: OGAWA Hirofumi <[email protected]>

If TERM=xterm-256color, COLOR_PAIRS==256 and monitor passes chtype like 0x74xx. Then, the code uses uninitialized color pair. As result, monitor uses black for both of fg and bg color, i.e. terminal is filled by black.

To fix, this initialize above than 64 with default color (fg=white,bg=black).

FIXME: on 256 color, curses may be possible better vga color emulation.

---
 ui/curses.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
ui/curses.c +6 -1
index 8edb038..35edd5e 100644
@@ -341,8 +341,13 @@ static void curses_setup(void)
     nodelay(stdscr, TRUE); nonl(); keypad(stdscr, TRUE);
     start_color(); raw(); scrollok(stdscr, FALSE);
 
-    for (i = 0; i < 64; i ++)
+    for (i = 0; i < 64; i++) {
         init_pair(i, colour_default[i & 7], colour_default[i >> 3]);
+    }
+    /* Set default color for more than 64. (monitor uses 0x74xx for example) */
+    for (i = 64; i < COLOR_PAIRS; i++) {
+        init_pair(i, COLOR_WHITE, COLOR_BLACK);
+    }
 }
 
 static void curses_keyboard_setup(void)
Signature · 1 line
1.8.3.1
#2 lore raw

[Qemu-devel] [PULL 2/6] ui/curses: Support line graphics chars on -curses mode

In reply to Gerd Hoffmann

From: OGAWA Hirofumi <[email protected]>

This converts vga code to curses code in console_write_bh().

With this changes, we can see line graphics (for example, dialog uses) correctly.

---
 include/ui/console.h | 12 +++++++++++-
 ui/curses.c          | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 1 deletion(-)
include/ui/console.h +11 -1
index d887f91..c249db4 100644
@@ -321,13 +321,23 @@ static inline pixman_format_code_t surface_format(DisplaySurface *s)
 #ifdef CONFIG_CURSES
 #include <curses.h>
 typedef chtype console_ch_t;
+extern chtype vga_to_curses[];
 #else
 typedef unsigned long console_ch_t;
 #endif
 static inline void console_write_ch(console_ch_t *dest, uint32_t ch)
 {
-    if (!(ch & 0xff))
+    uint8_t c = ch;
+#ifdef CONFIG_CURSES
+    if (vga_to_curses[c]) {
+        ch &= ~(console_ch_t)0xff;
+        ch |= vga_to_curses[c];
+    }
+#else
+    if (c == '\0') {
         ch |= ' ';
+    }
+#endif
     *dest = ch;
 }
 
ui/curses.c +44 -0

56 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#3 lore raw

[Qemu-devel] [PULL 4/6] ui/opengl: Reduce build required libraries for opengl

In reply to Gerd Hoffmann

From: OGAWA Hirofumi <[email protected]>

We now use epoxy to load opengl libraries. This means we don't need to link opengl libraries directly if interfaces handled by epoxy. With this, we just need epoxy headers and epoxy's *.so to build.

Tested with epoxy-1.3.1.

- sdl2/gtk/console egl stuff doesn't require other than epoxy
- milkymist-tmu2 glx stuff doesn't require other than epoxy

(lm32 test is limited, because can't find mmone-bios.bin, so just test to load libGL with "./lm32-softmmu/qemu-system-lm32 -M milkymist,accel=qtest")

[ lm32 tested by kraxel ]

---
 configure                   | 20 +++-----------------
 hw/display/milkymist-tmu2.c |  4 ++--
 hw/lm32/milkymist-hw.h      |  3 ++-
 3 files changed, 7 insertions(+), 20 deletions(-)
configure +3 -17
index 7a1d08d..b4a3488 100755
@@ -3286,25 +3286,11 @@ fi
 libs_softmmu="$libs_softmmu $fdt_libs"
 
 ##########################################
-# opengl probe (for sdl2, milkymist-tmu2)
-
-# GLX probe, used by milkymist-tmu2
-# this is temporary, code will be switched to egl mid-term.
-cat > $TMPC << EOF
-#include <X11/Xlib.h>
-#include <GL/gl.h>
-#include <GL/glx.h>
-int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
-EOF
-if compile_prog "" "-lGL -lX11" ; then
-  have_glx=yes
-else
-  have_glx=no
-fi
+# opengl probe (for sdl2, gtk, milkymist-tmu2)
 
 if test "$opengl" != "no" ; then
-  opengl_pkgs="gl glesv2 epoxy egl"
-  if $pkg_config $opengl_pkgs x11 && test "$have_glx" = "yes"; then
+  opengl_pkgs="epoxy"
+  if $pkg_config $opengl_pkgs x11; then
     opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags"
     opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs"
     opengl=yes
hw/display/milkymist-tmu2.c +2 -2
index 3e1d0b9..e2de281 100644
@@ -30,8 +30,8 @@
 #include "qemu/error-report.h"
 
 #include <X11/Xlib.h>
-#include <GL/gl.h>
-#include <GL/glx.h>
+#include <epoxy/gl.h>
+#include <epoxy/glx.h>
 
 enum {
     R_CTL = 0,
hw/lm32/milkymist-hw.h +2 -1
index 8d20cac..c8dfb4d 100644
@@ -88,7 +88,8 @@ static inline DeviceState *milkymist_pfpu_create(hwaddr base,
 
 #ifdef CONFIG_OPENGL
 #include <X11/Xlib.h>
-#include <GL/glx.h>
+#include <epoxy/gl.h>
+#include <epoxy/glx.h>
 static const int glx_fbconfig_attr[] = {
     GLX_GREEN_SIZE, 5,
     GLX_GREEN_SIZE, 6,
Signature · 1 line
1.8.3.1
#4 lore raw

[Qemu-devel] [PULL 6/6] vnc: fix bug: vnc server can't start when 'to' is specified

In reply to Gerd Hoffmann

From: Yang Hongyang <[email protected]>

commit e0d03b8ceb52 converted VNC startup to use SocketAddress, the interface socket_listen don't have a port_offset param, so we need to add the port offset (5900) to both 'port' and 'to' opts. currently only 'port' is added by offset.
This patch add the port offset to 'to' opts.

Message-id: [email protected]

Cc Daniel P. Berrange <[email protected]>
Cc Eric Blake <[email protected]>
Cc Gerd Hoffmann <[email protected]>
---
 ui/vnc.c | 2 ++
 1 file changed, 2 insertions(+)
ui/vnc.c +2 -0
index 166d1b5..a47f2b3 100644
@@ -3572,6 +3572,8 @@ void vnc_display_open(const char *id, Error **errp)
             if (to) {
                 saddr->u.inet->has_to = true;
                 saddr->u.inet->to = to;
+                saddr->u.inet->has_to = true;
+                saddr->u.inet->to = to + 5900;
             }
             saddr->u.inet->ipv4 = saddr->u.inet->has_ipv4 = has_ipv4;
             saddr->u.inet->ipv6 = saddr->u.inet->has_ipv6 = has_ipv6;
Signature · 1 line
1.8.3.1
#5 lore raw

Re: [Qemu-devel] [PULL 6/6] vnc: fix bug: vnc server can't start when 'to' is specified

Quoted 24 lines · Gerd Hoffmann

From: Yang Hongyang <[email protected]>

commit e0d03b8ceb52 converted VNC startup to use SocketAddress, the interface socket_listen don't have a port_offset param, so we need to add the port offset (5900) to both 'port' and 'to' opts. currently only 'port' is added by offset.
This patch add the port offset to 'to' opts.

Message-id: [email protected]

Cc Daniel P. Berrange <[email protected]>
Cc Eric Blake <[email protected]>
Cc Gerd Hoffmann <[email protected]>
---
 ui/vnc.c | 2 ++
 1 file changed, 2 insertions(+)
ui/vnc.c +0 -0
index 166d1b5..a47f2b3 100644

ui/vnc.c void vnc_display_open(const char *id, Error **errp) · line 3579

Quoted 8 lines
ui/vnc.c +2 -0
@@ -3572,6 +3572,8 @@ void vnc_display_open(const char *id, Error **errp)
             if (to) {
                 saddr->u.inet->has_to = true;
                 saddr->u.inet->to = to;
+                saddr->u.inet->has_to = true;
+                saddr->u.inet->to = to + 5900;
             }
             saddr->u.inet->ipv4 = saddr->u.inet->has_ipv4 = has_ipv4;
             saddr->u.inet->ipv6 = saddr->u.inet->has_ipv6 = has_ipv6;

Mismerge!

Message-id in the commit message points to the original patch:

  diff --git a/ui/vnc.c b/ui/vnc.c
  index faff054..db24545 100644
  --- a/ui/vnc.c
  +++ b/ui/vnc.c
  @@ -3545,7 +3545,7 @@ void vnc_display_open(const char *id, Error **errp)
               if (to) {
                   saddr->inet->has_to = true;
  -                saddr->inet->to = to;
  +                saddr->inet->to = to + 5900;
               }
               saddr->inet->ipv4 = saddr->inet->has_ipv4 = has_ipv4;
               saddr->inet->ipv6 = saddr->inet->has_ipv6 = has_ipv6;

--
2.5.0

Please fix.

#6 lore raw

[Qemu-devel] [PULL 3/6] ui/curses: Fix pageup/pagedown on -curses

In reply to Gerd Hoffmann

From: OGAWA Hirofumi <[email protected]>

Current KEY_NPAGE/KEY_PPAGE handling is broken on -curses. Those uses "GREY", but "KEY_MASK" masked out "GREY".

To fix, we have to use correct mask value - SCANCODE_KEYMASK.

Then, this adds support of "shift + pageup/pagedown". With this, -curses mode can use scroll-up/down as usual like other display modes.

---
 ui/curses_keys.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
ui/curses_keys.h +6 -2
index 18ce6dc..f746744 100644
@@ -29,8 +29,7 @@
 #include "keymaps.h"
 
 
-#define KEY_RELEASE         0x80
-#define KEY_MASK            0x7f
+#define KEY_MASK            SCANCODE_KEYMASK
 #define GREY_CODE           0xe0
 #define GREY                SCANCODE_GREY
 #define SHIFT_CODE          0x2a
@@ -60,6 +59,8 @@ static const int curses2keysym[CURSES_KEYS] = {
     ['\n'] = KEY_ENTER,
     [27] = 27,
     [KEY_BTAB] = '\t' | KEYSYM_SHIFT,
+    [KEY_SPREVIOUS] = KEY_PPAGE | KEYSYM_SHIFT,
+    [KEY_SNEXT] = KEY_NPAGE | KEYSYM_SHIFT,
 };
 
 static const int curses2keycode[CURSES_KEYS] = {
@@ -149,6 +150,9 @@ static const int curses2keycode[CURSES_KEYS] = {
     [KEY_IC] = 82 | GREY, /* Insert */
     [KEY_DC] = 83 | GREY, /* Delete */
 
+    [KEY_SPREVIOUS] = 73 | GREY | SHIFT, /* Shift + Page Up */
+    [KEY_SNEXT] = 81 | GREY | SHIFT, /* Shift + Page Down */
+
     ['!'] = 2 | SHIFT,
     ['@'] = 3 | SHIFT,
     ['#'] = 4 | SHIFT,
Signature · 1 line
1.8.3.1
#7 lore raw

[Qemu-devel] [PULL 5/6] vnc: allow fall back to RAW encoding

In reply to Gerd Hoffmann

From: Peter Lieven <[email protected]>

I have observed that depending on the contents and the encoding it happens that sending data as RAW sometimes would take less space than the encoded data. This is especially the case for small updates or areas with high color images. If sending RAW encoded data is beneficial allow a fall back to RAW encoding for the framebuffer update.

---
 ui/vnc.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
ui/vnc.c +18 -2
index 7b37e3b..166d1b5 100644
@@ -840,6 +840,8 @@ 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:
@@ -862,10 +864,24 @@ 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:
-            vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_RAW);
-            n = vnc_raw_send_framebuffer_update(vs, x, y, w, h);
+            encode_raw = true;
             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;
 }
 
Signature · 1 line
1.8.3.1
#8 lore raw
In reply to Gerd Hoffmann
Quoted 19 lines · Gerd Hoffmann

Hi,

Trying something new -- a unified patch queue for ui bugfix patches, featuring fixes for vnc, opengl and curses. That way I don't have to do three tiny pull requests.

Anything larger (like the vnc buffering series in the works atm) will continue to come as separate per-ui pull request.

please pull,
Gerd

The following changes since commit 3d861a01093f8eedfac9889746ccafcfd32039b7:

Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-11-02' into staging (2015-11-02 11:11:39 +0000)

are available in the git repository at:

Quoted 9 lines

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

for you to fetch changes up to 4d77b1f23877b579b94421d0cab2bebc79f4e171:

vnc: fix bug: vnc server can't start when 'to' is specified (2015-11-03 10:21:49 +0100)

----------------------------------------------------------------
ui: fixes for vnc, opengl and curses.

Applied, thanks.

-- PMM