From patchwork Tue Apr 16 09:39:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 236906 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 9E4372C00F3 for ; Tue, 16 Apr 2013 20:16:20 +1000 (EST) Received: from localhost ([::1]:33117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US2SD-0000SJ-Uy for incoming@patchwork.ozlabs.org; Tue, 16 Apr 2013 05:45:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US2Mk-0001gK-Qo for qemu-devel@nongnu.org; Tue, 16 Apr 2013 05:40:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1US2Mb-0006wt-IP for qemu-devel@nongnu.org; Tue, 16 Apr 2013 05:39:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60771) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US2Mb-0006wV-A4 for qemu-devel@nongnu.org; Tue, 16 Apr 2013 05:39:45 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3G9diCT011614 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 16 Apr 2013 05:39:44 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-37.ams2.redhat.com [10.36.116.37]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3G9dg3X007270; Tue, 16 Apr 2013 05:39:43 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id BD14840F09; Tue, 16 Apr 2013 11:39:39 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 16 Apr 2013 11:39:34 +0200 Message-Id: <1366105178-26744-21-git-send-email-kraxel@redhat.com> In-Reply-To: <1366105178-26744-1-git-send-email-kraxel@redhat.com> References: <1366105178-26744-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 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 20/24] xen: re-enable refresh interval reporting for xenfb 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 xenfb informs the guest about the gui refresh interval so it can avoid pointless work. That logic was temporarely disabled for the DisplayState reorganization. Restore it now, with a proper interface for it. Signed-off-by: Gerd Hoffmann --- hw/display/xenfb.c | 56 +++++++++++++++----------------------------------- include/ui/console.h | 1 + ui/console.c | 6 ++++++ 3 files changed, 24 insertions(+), 39 deletions(-) diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index 8d327f1..f2eb89f 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -78,7 +78,6 @@ struct XenFB { void *pixels; int fbpages; int feature_update; - int refresh_period; int bug_trigger; int have_console; int do_resize; @@ -646,7 +645,7 @@ static void xenfb_guest_copy(struct XenFB *xenfb, int x, int y, int w, int h) dpy_gfx_update(xenfb->c.con, x, y, w, h); } -#if 0 /* def XENFB_TYPE_REFRESH_PERIOD */ +#ifdef XENFB_TYPE_REFRESH_PERIOD static int xenfb_queue_full(struct XenFB *xenfb) { struct xenfb_page *page = xenfb->c.page; @@ -704,39 +703,7 @@ static void xenfb_update(void *opaque) if (xenfb->c.xendev.be_state != XenbusStateConnected) return; - if (xenfb->feature_update) { -#if 0 /* XENFB_TYPE_REFRESH_PERIOD */ - struct DisplayChangeListener *l; - int period = 99999999; - int idle = 1; - - if (xenfb_queue_full(xenfb)) - return; - - QLIST_FOREACH(l, &xenfb->c.ds->listeners, next) { - if (l->idle) - continue; - idle = 0; - if (!l->gui_timer_interval) { - if (period > GUI_REFRESH_INTERVAL) - period = GUI_REFRESH_INTERVAL; - } else { - if (period > l->gui_timer_interval) - period = l->gui_timer_interval; - } - } - if (idle) - period = XENFB_NO_REFRESH; - - if (xenfb->refresh_period != period) { - xenfb_send_refresh_period(xenfb, period); - xenfb->refresh_period = period; - xen_be_printf(&xenfb->c.xendev, 1, "refresh period: %d\n", period); - } -#else - ; /* nothing */ -#endif - } else { + if (!xenfb->feature_update) { /* we don't get update notifications, thus use the * sledge hammer approach ... */ xenfb->up_fullscreen = 1; @@ -785,6 +752,20 @@ static void xenfb_update(void *opaque) xenfb->up_fullscreen = 0; } +static void xenfb_update_interval(void *opaque, uint64_t interval) +{ + struct XenFB *xenfb = opaque; + + if (xenfb->feature_update) { +#ifdef XENFB_TYPE_REFRESH_PERIOD + if (xenfb_queue_full(xenfb)) { + return; + } + xenfb_send_refresh_period(xenfb, interval); +#endif + } +} + /* QEMU display state changed, so refresh the framebuffer copy */ static void xenfb_invalidate(void *opaque) { @@ -858,10 +839,6 @@ static void xenfb_handle_events(struct XenFB *xenfb) static int fb_init(struct XenDevice *xendev) { - struct XenFB *fb = container_of(xendev, struct XenFB, c.xendev); - - fb->refresh_period = -1; - #ifdef XENFB_TYPE_RESIZE xenstore_write_be_int(xendev, "feature-resize", 1); #endif @@ -980,6 +957,7 @@ struct XenDevOps xen_framebuffer_ops = { static const GraphicHwOps xenfb_ops = { .invalidate = xenfb_invalidate, .gfx_update = xenfb_update, + .update_interval = xenfb_update_interval, }; /* diff --git a/include/ui/console.h b/include/ui/console.h index 3cb0018..800f458 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -272,6 +272,7 @@ typedef struct GraphicHwOps { void (*invalidate)(void *opaque); void (*gfx_update)(void *opaque); void (*text_update)(void *opaque, console_ch_t *text); + void (*update_interval)(void *opaque, uint64_t interval); } GraphicHwOps; QemuConsole *graphic_console_init(const GraphicHwOps *ops, diff --git a/ui/console.c b/ui/console.c index 5bbc891..43ff80b 100644 --- a/ui/console.c +++ b/ui/console.c @@ -182,6 +182,7 @@ static void gui_update(void *opaque) uint64_t dcl_interval; DisplayState *ds = opaque; DisplayChangeListener *dcl; + int i; ds->refreshing = true; dpy_refresh(ds); @@ -196,6 +197,11 @@ static void gui_update(void *opaque) } if (ds->update_interval != interval) { ds->update_interval = interval; + for (i = 0; i < nb_consoles; i++) { + if (consoles[i]->hw_ops->update_interval) { + consoles[i]->hw_ops->update_interval(consoles[i]->hw, interval); + } + } trace_console_refresh(interval); } ds->last_update = qemu_get_clock_ms(rt_clock);