From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J3vhR-0003Mb-VJ for qemu-devel@nongnu.org; Sun, 16 Dec 2007 10:46:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J3vhQ-0003Jh-Lt for qemu-devel@nongnu.org; Sun, 16 Dec 2007 10:46:41 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J3vhQ-0003JU-J7 for qemu-devel@nongnu.org; Sun, 16 Dec 2007 10:46:40 -0500 Received: from 0xc2c0b63d.fbbft3nxf1.bf-dhcp.tele.dk ([194.192.182.61] helo=smtp.hotelhot.dk) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J3vhP-0001lV-U0 for qemu-devel@nongnu.org; Sun, 16 Dec 2007 10:46:40 -0500 Received: from smtp.hotelhot.dk (localhost [127.0.0.1]) by smtp.hotelhot.dk (Postfix) with ESMTP id B7D1614092 for ; Sun, 16 Dec 2007 16:46:37 +0100 (CET) Received: from [192.168.0.251] (dhcp251.kalibalik.dk [192.168.0.251]) by smtp.hotelhot.dk (Postfix) with ESMTP id A782714088 for ; Sun, 16 Dec 2007 16:46:37 +0100 (CET) Message-ID: <4765485D.9070501@flac.kalibalik.dk> Date: Sun, 16 Dec 2007 16:46:37 +0100 From: Anders MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 4] Reduce redundant timer rearming References: <4761BA27.5020307@flac.kalibalik.dk> <4761C8C7.1030202@flac.kalibalik.dk> In-Reply-To: <4761C8C7.1030202@flac.kalibalik.dk> Content-Type: multipart/mixed; boundary="------------070908030207090409050607" Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------070908030207090409050607 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit The VNC output runs two 33 Hz timers, one for calling vga_hw_update() in dpy_refresh (from vl.c), and another for calling vnc_update_client(). This patch moves the vga_hw_update() call into vnc_update_client(), removing the need for the dpy_refresh timer. It also makes the remaining timer only fire when a client is actually connected to the VNC server. Best regards, Anders. --------------070908030207090409050607 Content-Type: text/x-patch; name="qemu-dynamic-vnc-refresh.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="qemu-dynamic-vnc-refresh.diff" --- a/qemu/vnc.c +++ b/qemu/vnc.c @@ -493,6 +493,8 @@ static void vnc_update_client(void *opaque) int saved_offset; int has_dirty = 0; + vga_hw_update(); + vnc_set_bits(width_mask, (vs->width / 16), VNC_DIRTY_WORDS); /* Walk through the dirty map and eliminate tiles that @@ -566,22 +568,11 @@ static void vnc_update_client(void *opaque) vnc_flush(vs); } - qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL); -} -static void vnc_timer_init(VncState *vs) -{ - if (vs->timer == NULL) { - vs->timer = qemu_new_timer(rt_clock, vnc_update_client, vs); - qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock)); + if (vs->csock != -1) { + qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL); } -} -static void vnc_dpy_refresh(DisplayState *ds) -{ - VncState *vs = ds->opaque; - vnc_timer_init(vs); - vga_hw_update(); } static int vnc_listen_poll(void *opaque) @@ -1890,6 +1881,7 @@ static void vnc_listen_read(void *opaque) vs->has_resize = 0; vs->has_hextile = 0; vs->ds->dpy_copy = NULL; + vnc_update_client(vs); } } @@ -1923,10 +1915,12 @@ void vnc_display_init(DisplayState *ds) if (!vs->kbd_layout) exit(1); + vs->timer = qemu_new_timer(rt_clock, vnc_update_client, vs); + vs->ds->data = NULL; vs->ds->dpy_update = vnc_dpy_update; vs->ds->dpy_resize = vnc_dpy_resize; - vs->ds->dpy_refresh = vnc_dpy_refresh; + vs->ds->dpy_refresh = NULL; memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row)); --------------070908030207090409050607--