From patchwork Fri Feb 19 09:14:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 8358481 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3DA979F372 for ; Fri, 19 Feb 2016 09:15:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 99AC920411 for ; Fri, 19 Feb 2016 09:15:18 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DE20E20416 for ; Fri, 19 Feb 2016 09:15:17 +0000 (UTC) Received: from localhost ([::1]:50174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWh9g-000621-Qx for patchwork-qemu-devel@patchwork.kernel.org; Fri, 19 Feb 2016 04:15:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWh9S-0005zs-HX for qemu-devel@nongnu.org; Fri, 19 Feb 2016 04:15:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWh9O-0003CG-QK for qemu-devel@nongnu.org; Fri, 19 Feb 2016 04:15:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39108) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWh9O-0003Bc-EG for qemu-devel@nongnu.org; Fri, 19 Feb 2016 04:14:58 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 27769C0005CF; Fri, 19 Feb 2016 09:14:58 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-34.ams2.redhat.com [10.36.116.34]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1J9Euld008901; Fri, 19 Feb 2016 04:14:57 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 414DC80ECF; Fri, 19 Feb 2016 10:14:55 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 19 Feb 2016 10:14:43 +0100 Message-Id: <1455873289-349-7-git-send-email-kraxel@redhat.com> In-Reply-To: <1455873289-349-1-git-send-email-kraxel@redhat.com> References: <1455873289-349-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: spice-devel@lists.freedesktop.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Subject: [Qemu-devel] [PATCH v2 06/12] spice: add unblock timer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Pure debug aid, print a warning in case unblocking doesn't happen within one second. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau --- include/ui/spice-display.h | 1 + ui/spice-display.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/ui/spice-display.h b/include/ui/spice-display.h index 48dc8c4..69a222b 100644 --- a/include/ui/spice-display.h +++ b/include/ui/spice-display.h @@ -117,6 +117,7 @@ struct SimpleSpiceDisplay { #ifdef HAVE_SPICE_GL /* opengl rendering */ QEMUBH *gl_unblock_bh; + QEMUTimer *gl_unblock_timer; int dmabuf_fd; #endif }; diff --git a/ui/spice-display.c b/ui/spice-display.c index 904fb33..d6e31e4 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -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); } @@ -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) { @@ -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;