From patchwork Thu Apr 4 07:28:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 233666 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 66A732C00E4 for ; Thu, 4 Apr 2013 18:39:49 +1100 (EST) Received: from localhost ([::1]:46579 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNelv-0005FG-9Z for incoming@patchwork.ozlabs.org; Thu, 04 Apr 2013 03:39:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42949) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNebv-0007OH-Vi for qemu-devel@nongnu.org; Thu, 04 Apr 2013 03:29:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNebj-0004xU-EL for qemu-devel@nongnu.org; Thu, 04 Apr 2013 03:29:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63610) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNebj-0004x4-6T for qemu-devel@nongnu.org; Thu, 04 Apr 2013 03:29:15 -0400 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 (8.14.4/8.14.4) with ESMTP id r347TDVF022954 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Apr 2013 03:29:14 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-57.ams2.redhat.com [10.36.116.57]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r347TAUN017587; Thu, 4 Apr 2013 03:29:12 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id D1B8540EE0; Thu, 4 Apr 2013 09:29:07 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 4 Apr 2013 09:28:58 +0200 Message-Id: <1365060546-24638-17-git-send-email-kraxel@redhat.com> In-Reply-To: <1365060546-24638-1-git-send-email-kraxel@redhat.com> References: <1365060546-24638-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: Anthony Liguori , Gerd Hoffmann Subject: [Qemu-devel] [PATCH 16/24] console: move gui_update+gui_setup_refresh from vl.c into console.c 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Pure code motion, no functional changes. Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 2 -- ui/console.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ vl.c | 49 ------------------------------------------------- 3 files changed, 50 insertions(+), 51 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index d6e3e92..d92626b 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -213,8 +213,6 @@ static inline int is_buffer_shared(DisplaySurface *surface) return !(surface->flags & QEMU_ALLOCATED_FLAG); } -void gui_setup_refresh(DisplayState *ds); - void register_displaychangelistener(DisplayState *ds, DisplayChangeListener *dcl); void unregister_displaychangelistener(DisplayChangeListener *dcl); diff --git a/ui/console.c b/ui/console.c index 29e9f43..1ca50fc 100644 --- a/ui/console.c +++ b/ui/console.c @@ -166,6 +166,56 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds); static void dpy_gfx_switch_surface(DisplayState *ds, DisplaySurface *surface); +static void gui_update(void *opaque) +{ + uint64_t interval = GUI_REFRESH_INTERVAL; + DisplayState *ds = opaque; + DisplayChangeListener *dcl; + + dpy_refresh(ds); + + QLIST_FOREACH(dcl, &ds->listeners, next) { + if (dcl->gui_timer_interval && + dcl->gui_timer_interval < interval) { + interval = dcl->gui_timer_interval; + } + } + qemu_mod_timer(ds->gui_timer, interval + qemu_get_clock_ms(rt_clock)); +} + +static void gui_setup_refresh(DisplayState *ds) +{ + DisplayChangeListener *dcl; + bool need_timer = false; + bool have_gfx = false; + bool have_text = false; + + QLIST_FOREACH(dcl, &ds->listeners, next) { + if (dcl->ops->dpy_refresh != NULL) { + need_timer = true; + } + if (dcl->ops->dpy_gfx_update != NULL) { + have_gfx = true; + } + if (dcl->ops->dpy_text_update != NULL) { + have_text = true; + } + } + + if (need_timer && ds->gui_timer == NULL) { + ds->gui_timer = qemu_new_timer_ms(rt_clock, gui_update, ds); + qemu_mod_timer(ds->gui_timer, qemu_get_clock_ms(rt_clock)); + } + if (!need_timer && ds->gui_timer != NULL) { + qemu_del_timer(ds->gui_timer); + qemu_free_timer(ds->gui_timer); + ds->gui_timer = NULL; + } + + ds->have_gfx = have_gfx; + ds->have_text = have_text; +} + void graphic_hw_update(QemuConsole *con) { if (!con) { diff --git a/vl.c b/vl.c index b05c289..ebba472 100644 --- a/vl.c +++ b/vl.c @@ -1630,55 +1630,6 @@ MachineInfoList *qmp_query_machines(Error **errp) /***********************************************************/ /* main execution loop */ -static void gui_update(void *opaque) -{ - uint64_t interval = GUI_REFRESH_INTERVAL; - DisplayState *ds = opaque; - DisplayChangeListener *dcl; - - dpy_refresh(ds); - - QLIST_FOREACH(dcl, &ds->listeners, next) { - if (dcl->gui_timer_interval && - dcl->gui_timer_interval < interval) - interval = dcl->gui_timer_interval; - } - qemu_mod_timer(ds->gui_timer, interval + qemu_get_clock_ms(rt_clock)); -} - -void gui_setup_refresh(DisplayState *ds) -{ - DisplayChangeListener *dcl; - bool need_timer = false; - bool have_gfx = false; - bool have_text = false; - - QLIST_FOREACH(dcl, &ds->listeners, next) { - if (dcl->ops->dpy_refresh != NULL) { - need_timer = true; - } - if (dcl->ops->dpy_gfx_update != NULL) { - have_gfx = true; - } - if (dcl->ops->dpy_text_update != NULL) { - have_text = true; - } - } - - if (need_timer && ds->gui_timer == NULL) { - ds->gui_timer = qemu_new_timer_ms(rt_clock, gui_update, ds); - qemu_mod_timer(ds->gui_timer, qemu_get_clock_ms(rt_clock)); - } - if (!need_timer && ds->gui_timer != NULL) { - qemu_del_timer(ds->gui_timer); - qemu_free_timer(ds->gui_timer); - ds->gui_timer = NULL; - } - - ds->have_gfx = have_gfx; - ds->have_text = have_text; -} - struct vm_change_state_entry { VMChangeStateHandler *cb; void *opaque;