Received: from eggs.gnu.org ([2001:4830:134:3::10]:47220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWh9S-0005zt-IG 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-0003C2-JK for qemu-devel@nongnu.org; Fri, 19 Feb 2016 04:15:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48184) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWh9O-0003Ba-E8 for qemu-devel@nongnu.org; Fri, 19 Feb 2016 04:14:58 -0500 From: Gerd Hoffmann Date: Fri, 19 Feb 2016 10:14:45 +0100 Message-Id: <1455873289-349-9-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> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v2 08/12] console: track gl_block state in QemuConsole List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: spice-devel@lists.freedesktop.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann Keep track of gl_block state (added in bba19b8 console: block rendering until client is done) in QemuConsole and allow to query it. This way we can avoid state inconsistencies in case different code paths make use of this. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-Andr=C3=A9 Lureau --- include/ui/console.h | 1 + ui/console.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index c8f9f7e..9672ad9 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -382,6 +382,7 @@ QemuConsole *qemu_console_lookup_by_device(DeviceStat= e *dev, uint32_t head); bool qemu_console_is_visible(QemuConsole *con); bool qemu_console_is_graphic(QemuConsole *con); bool qemu_console_is_fixedsize(QemuConsole *con); +bool qemu_console_is_gl_blocked(QemuConsole *con); char *qemu_console_get_label(QemuConsole *con); int qemu_console_get_index(QemuConsole *con); uint32_t qemu_console_get_head(QemuConsole *con); diff --git a/ui/console.c b/ui/console.c index b739ae9..215c98d 100644 --- a/ui/console.c +++ b/ui/console.c @@ -123,6 +123,7 @@ struct QemuConsole { DisplaySurface *surface; int dcls; DisplayChangeListener *gl; + bool gl_block; =20 /* Graphic console state. */ Object *device; @@ -264,10 +265,10 @@ void graphic_hw_update(QemuConsole *con) =20 void graphic_hw_gl_block(QemuConsole *con, bool block) { - if (!con) { - con =3D active_console; - } - if (con && con->hw_ops->gl_block) { + assert(con !=3D NULL); + + con->gl_block =3D block; + if (con->hw_ops->gl_block) { con->hw_ops->gl_block(con->hw, block); } } @@ -1811,6 +1812,12 @@ bool qemu_console_is_fixedsize(QemuConsole *con) return con && (con->console_type !=3D TEXT_CONSOLE); } =20 +bool qemu_console_is_gl_blocked(QemuConsole *con) +{ + assert(con !=3D NULL); + return con->gl_block; +} + char *qemu_console_get_label(QemuConsole *con) { if (con->console_type =3D=3D GRAPHIC_CONSOLE) { --=20 1.8.3.1