From 46000a3564cbf265ea9d40142686a1a84f4fba6c Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 18 Mar 2010 17:25:28 -0300 Subject: [PATCH 02/14] spice: simple display: wake spice server only when idle. RH-Author: Gerd Hoffmann Message-id: <1268933140-655-3-git-send-email-kraxel@redhat.com> Patchwork-id: 7894 O-Subject: [RHEL-6 kvm PATCH v3 02/14] spice: simple display: wake spice server only when idle. Bugzilla: 574212 RH-Acked-by: Alexander Larsson RH-Acked-by: Yonit Halperin RH-Acked-by: Izik Eidus The simple spice display wakes the spice server on every single screen update. Instead it should do this only in case the spice server is hanging around idle, i.e. there are no unprocessed update requests. bugzilla: #574212 -- spice:wake spice server only when idle Signed-off-by: Gerd Hoffmann --- spice-display.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) Signed-off-by: Eduardo Habkost --- spice-display.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/spice-display.c b/spice-display.c index a3441ab..e491e6e 100644 --- a/spice-display.c +++ b/spice-display.c @@ -111,14 +111,21 @@ static void spice_vm_change_state_handler(void *opaque, int running, int reason) static void spice_display_update(struct DisplayState *ds, int x, int y, int w, int h) { Rect update_area; + int notify = 0; update_area.left = x, update_area.right = x + w; update_area.top = y; update_area.bottom = y + h; pthread_mutex_lock(&sdpy.lock); + if (rect_is_empty(&sdpy.dirty)) { + notify = 1; + } rect_union(&sdpy.dirty, &update_area); pthread_mutex_unlock(&sdpy.lock); + if (notify && sdpy.is_attached) { + sdpy.worker->wakeup(sdpy.worker); + } } static void spice_display_resize(struct DisplayState *ds) @@ -145,11 +152,6 @@ static void spice_display_resize(struct DisplayState *ds) static void spice_display_refresh(struct DisplayState *ds) { vga_hw_update(); - if (rect_is_empty(&sdpy.dirty)) - return; - if (sdpy.is_attached) { - sdpy.worker->wakeup(sdpy.worker); - } } /* spice display interface callbacks */ -- 1.6.3.rc4.29.g8146