Commit 130d0bc6 authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20151103-1' into staging



ui: fixes for vnc, opengl and curses.

# gpg: Signature made Tue 03 Nov 2015 09:53:24 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-ui-20151103-1:
  vnc: fix bug: vnc server can't start when 'to' is specified
  vnc: allow fall back to RAW encoding
  ui/opengl: Reduce build required libraries for opengl
  ui/curses: Fix pageup/pagedown on -curses
  ui/curses: Support line graphics chars on -curses mode
  ui/curses: Fix monitor color with -curses when 256 colors

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 3d861a01 4d77b1f2
Loading
Loading
Loading
Loading
+3 −17
Original line number Diff line number Diff line
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -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,
+2 −1
Original line number Diff line number Diff line
@@ -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,
+11 −1
Original line number Diff line number Diff line
@@ -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;
}

+50 −1
Original line number Diff line number Diff line
@@ -42,6 +42,8 @@ static WINDOW *screenpad = NULL;
static int width, height, gwidth, gheight, invalidate;
static int px, py, sminx, sminy, smaxx, smaxy;

chtype vga_to_curses[256];

static void curses_update(DisplayChangeListener *dcl,
                          int x, int y, int w, int h)
{
@@ -341,9 +343,56 @@ 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);
    }

    /*
     * Setup mapping for vga to curses line graphics.
     * FIXME: for better font, have to use ncursesw and setlocale()
     */
#if 0
    /* FIXME: map from where? */
    ACS_S1;
    ACS_S3;
    ACS_S7;
    ACS_S9;
#endif
    /* ACS_* is not constant. So, we can't initialize statically. */
    vga_to_curses['\0'] = ' ';
    vga_to_curses[0x04] = ACS_DIAMOND;
    vga_to_curses[0x0a] = ACS_RARROW;
    vga_to_curses[0x0b] = ACS_LARROW;
    vga_to_curses[0x18] = ACS_UARROW;
    vga_to_curses[0x19] = ACS_DARROW;
    vga_to_curses[0x9c] = ACS_STERLING;
    vga_to_curses[0xb0] = ACS_BOARD;
    vga_to_curses[0xb1] = ACS_CKBOARD;
    vga_to_curses[0xb3] = ACS_VLINE;
    vga_to_curses[0xb4] = ACS_RTEE;
    vga_to_curses[0xbf] = ACS_URCORNER;
    vga_to_curses[0xc0] = ACS_LLCORNER;
    vga_to_curses[0xc1] = ACS_BTEE;
    vga_to_curses[0xc2] = ACS_TTEE;
    vga_to_curses[0xc3] = ACS_LTEE;
    vga_to_curses[0xc4] = ACS_HLINE;
    vga_to_curses[0xc5] = ACS_PLUS;
    vga_to_curses[0xce] = ACS_LANTERN;
    vga_to_curses[0xd8] = ACS_NEQUAL;
    vga_to_curses[0xd9] = ACS_LRCORNER;
    vga_to_curses[0xda] = ACS_ULCORNER;
    vga_to_curses[0xdb] = ACS_BLOCK;
    vga_to_curses[0xe3] = ACS_PI;
    vga_to_curses[0xf1] = ACS_PLMINUS;
    vga_to_curses[0xf2] = ACS_GEQUAL;
    vga_to_curses[0xf3] = ACS_LEQUAL;
    vga_to_curses[0xf8] = ACS_DEGREE;
    vga_to_curses[0xfe] = ACS_BULLET;
}

static void curses_keyboard_setup(void)
{
Loading