Skip to content

Commit

Permalink
spice/gl: add unblock timer
Browse files Browse the repository at this point in the history
Pure debug aid, print a warning in case unblocking
doesn't happen within one second.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
  • Loading branch information
kraxel committed Feb 23, 2016
1 parent 474114b commit 8e388e9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/ui/spice-display.h
Expand Up @@ -117,6 +117,7 @@ struct SimpleSpiceDisplay {
#ifdef HAVE_SPICE_GL
/* opengl rendering */
QEMUBH *gl_unblock_bh;
QEMUTimer *gl_unblock_timer;
int dmabuf_fd;
#endif
};
Expand Down
16 changes: 16 additions & 0 deletions ui/spice-display.c
Expand Up @@ -797,6 +797,15 @@ static const DisplayChangeListenerOps display_listener_ops = {

static void qemu_spice_gl_block(SimpleSpiceDisplay *ssd, bool block)
{
uint64_t timeout;

if (block) {
timeout = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
timeout += 1000; /* one sec */
timer_mod(ssd->gl_unblock_timer, timeout);
} else {
timer_del(ssd->gl_unblock_timer);
}
graphic_hw_gl_block(ssd->dcl.con, block);
}

Expand All @@ -807,6 +816,11 @@ static void qemu_spice_gl_unblock_bh(void *opaque)
qemu_spice_gl_block(ssd, false);
}

static void qemu_spice_gl_block_timer(void *opaque)
{
fprintf(stderr, "WARNING: spice: no gl-draw-done within one second\n");
}

static QEMUGLContext qemu_spice_gl_create_context(DisplayChangeListener *dcl,
QEMUGLParams *params)
{
Expand Down Expand Up @@ -888,6 +902,8 @@ static void qemu_spice_display_init_one(QemuConsole *con)
ssd->dcl.ops = &display_listener_gl_ops;
ssd->dmabuf_fd = -1;
ssd->gl_unblock_bh = qemu_bh_new(qemu_spice_gl_unblock_bh, ssd);
ssd->gl_unblock_timer = timer_new_ms(QEMU_CLOCK_REALTIME,
qemu_spice_gl_block_timer, ssd);
}
#endif
ssd->dcl.con = con;
Expand Down

0 comments on commit 8e388e9

Please sign in to comment.