Commit 1b162409 authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20160223-1' into staging



spice: initial opengl/virgl support, postcopy migration fix.

# gpg: Signature made Tue 23 Feb 2016 12:30:40 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/spice/tags/pull-spice-20160223-1:
  Postcopy+spice: Pass spice migration data earlier
  spice/gl: tweak debug messages.
  spice/gl: add unblock timer
  spice: add opengl/virgl/dmabuf support
  spice: reset cursor on resize
  egl-helpers: add functions for render nodes and dma-buf passing
  configure: add dma-buf support detection.
  spice: init dcl before registering qxl interface

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 3174c64b b82fc321
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -279,6 +279,7 @@ smartcard=""
libusb=""
usb_redir=""
opengl=""
opengl_dmabuf="no"
zlib="yes"
lzo=""
snappy=""
@@ -3274,7 +3275,7 @@ libs_softmmu="$libs_softmmu $fdt_libs"
# opengl probe (for sdl2, gtk, milkymist-tmu2)

if test "$opengl" != "no" ; then
  opengl_pkgs="epoxy"
  opengl_pkgs="epoxy libdrm gbm"
  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"
@@ -3292,6 +3293,18 @@ if test "$opengl" != "no" ; then
  fi
fi

if test "$opengl" = "yes"; then
  cat > $TMPC << EOF
#include <epoxy/egl.h>
#ifndef EGL_MESA_image_dma_buf_export
# error mesa/epoxy lacks support for dmabufs (mesa 10.6+)
#endif
int main(void) { return 0; }
EOF
  if compile_prog "" "" ; then
    opengl_dmabuf=yes
  fi
fi

##########################################
# archipelago probe
@@ -4752,6 +4765,7 @@ echo "smartcard support $smartcard"
echo "libusb            $libusb"
echo "usb net redir     $usb_redir"
echo "OpenGL support    $opengl"
echo "OpenGL dmabufs    $opengl_dmabuf"
echo "libiscsi support  $libiscsi"
echo "libnfs support    $libnfs"
echo "build guest agent $guest_agent"
@@ -5050,6 +5064,7 @@ if test "$gtk" = "yes" ; then
  echo "CONFIG_GTK=y" >> $config_host_mak
  echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak
  echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
  echo "GTK_LIBS=$gtk_libs" >> $config_host_mak
  if test "$gtk_gl" = "yes" ; then
    echo "CONFIG_GTK_GL=y" >> $config_host_mak
  fi
@@ -5158,6 +5173,9 @@ if test "$opengl" = "yes" ; then
  echo "CONFIG_OPENGL=y" >> $config_host_mak
  echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak
  echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
  if test "$opengl_dmabuf" = "yes" ; then
    echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak
  fi
fi

if test "$lzo" = "yes" ; then
+4 −0
Original line number Diff line number Diff line
@@ -158,6 +158,8 @@ struct MigrationState

    /* Flag set once the migration has been asked to enter postcopy */
    bool start_postcopy;
    /* Flag set after postcopy has sent the device state */
    bool postcopy_after_devices;

    /* Flag set once the migration thread is running (and needs joining) */
    bool migration_thread_running;
@@ -211,6 +213,8 @@ bool migration_has_finished(MigrationState *);
bool migration_has_failed(MigrationState *);
/* True if outgoing migration has entered postcopy phase */
bool migration_in_postcopy(MigrationState *);
/* ...and after the device transmission */
bool migration_in_postcopy_after_devices(MigrationState *);
MigrationState *migrate_get_current(void);

void migrate_compress_threads_create(void);
+13 −0
Original line number Diff line number Diff line
@@ -3,10 +3,23 @@

#include <epoxy/gl.h>
#include <epoxy/egl.h>
#include <gbm.h>

extern EGLDisplay *qemu_egl_display;
extern EGLConfig qemu_egl_config;

#ifdef CONFIG_OPENGL_DMABUF

extern int qemu_egl_rn_fd;
extern struct gbm_device *qemu_egl_rn_gbm_dev;
extern EGLContext qemu_egl_rn_ctx;

int qemu_egl_rendernode_open(void);
int egl_rendernode_init(void);
int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc);

#endif

EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, Window win);

int qemu_egl_init_dpy(EGLNativeDisplayType dpy, bool gles, bool debug);
+16 −0
Original line number Diff line number Diff line
@@ -24,6 +24,14 @@
#include "ui/console.h"
#include "sysemu/sysemu.h"

#if defined(CONFIG_OPENGL_DMABUF)
# if SPICE_SERVER_VERSION >= 0x000d00 /* release 0.13.0 */
#  define HAVE_SPICE_GL 1
#  include "ui/egl-helpers.h"
#  include "ui/egl-context.h"
# endif
#endif

#define NUM_MEMSLOTS 8
#define MEMSLOT_GENERATION_BITS 8
#define MEMSLOT_SLOT_BITS 8
@@ -50,6 +58,7 @@ enum {
    QXL_COOKIE_TYPE_IO,
    QXL_COOKIE_TYPE_RENDER_UPDATE_AREA,
    QXL_COOKIE_TYPE_POST_LOAD_MONITORS_CONFIG,
    QXL_COOKIE_TYPE_GL_DRAW_DONE,
};

typedef struct QXLCookie {
@@ -104,6 +113,13 @@ struct SimpleSpiceDisplay {
    QEMUCursor *cursor;
    int mouse_x, mouse_y;
    QEMUBH *cursor_bh;

#ifdef HAVE_SPICE_GL
    /* opengl rendering */
    QEMUBH *gl_unblock_bh;
    QEMUTimer *gl_unblock_timer;
    int dmabuf_fd;
#endif
};

struct SimpleSpiceUpdate {
+14 −0
Original line number Diff line number Diff line
@@ -905,6 +905,11 @@ bool migration_in_postcopy(MigrationState *s)
    return (s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE);
}

bool migration_in_postcopy_after_devices(MigrationState *s)
{
    return migration_in_postcopy(s) && s->postcopy_after_devices;
}

MigrationState *migrate_init(const MigrationParams *params)
{
    MigrationState *s = migrate_get_current();
@@ -930,6 +935,7 @@ MigrationState *migrate_init(const MigrationParams *params)
    s->setup_time = 0;
    s->dirty_sync_count = 0;
    s->start_postcopy = false;
    s->postcopy_after_devices = false;
    s->migration_thread_running = false;
    s->last_req_rb = NULL;

@@ -1489,6 +1495,14 @@ static int postcopy_start(MigrationState *ms, bool *old_vm_running)
        goto fail_closefb;
    }
    qemu_fclose(fb);

    /* Send a notify to give a chance for anything that needs to happen
     * at the transition to postcopy and after the device state; in particular
     * spice needs to trigger a transition now
     */
    ms->postcopy_after_devices = true;
    notifier_list_notify(&migration_state_notifiers, ms);

    ms->downtime =  qemu_clock_get_ms(QEMU_CLOCK_REALTIME) - time_at_stop;

    qemu_mutex_unlock_iothread();
Loading