[Spice-commits] 2 commits - server/red-worker.c server/tests

Frediano Ziglio fziglio at kemper.freedesktop.org
Tue Jan 26 04:48:52 PST 2016


 server/red-worker.c   |   10 +++++-----
 server/tests/replay.c |    5 ++++-
 2 files changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 1ad571f576730295be754415275f322d792dc52f
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Thu Jan 21 13:47:23 2016 +0000

    replay: do not wake up loop too much
    
    Send wakeups only when a command is available.
    This emulate better what a guest driver should do (append the command
    to the ring and then signal).
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Pavel Grunt <pgrunt at redhat.com>

diff --git a/server/tests/replay.c b/server/tests/replay.c
index 0c98168..c7f3f00 100644
--- a/server/tests/replay.c
+++ b/server/tests/replay.c
@@ -108,6 +108,7 @@ static void get_init_info(QXLInstance *qin, QXLDevInitInfo *info)
 static gboolean fill_queue_idle(gpointer user_data)
 {
     gboolean keep = FALSE;
+    gboolean wakeup = FALSE;
 
     while (g_async_queue_length(aqueue) < 50) {
         QXLCommandExt *cmd = spice_replay_next_cmd(replay, qxl_worker);
@@ -119,6 +120,7 @@ static gboolean fill_queue_idle(gpointer user_data)
         if (slow)
             g_usleep(slow);
 
+        wakeup = TRUE;
         g_async_queue_push(aqueue, cmd);
     }
 
@@ -132,7 +134,8 @@ end:
         }
         pthread_mutex_unlock(&mutex);
     }
-    spice_qxl_wakeup(&display_sin);
+    if (wakeup)
+        spice_qxl_wakeup(&display_sin);
 
     return keep;
 }
commit a68d9a3100946ead6756c6fd5c063defa1816d97
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Tue Jan 26 11:59:06 2016 +0000

    worker: use core interface to create watch
    
    This increase code reuse and make Glib integration more straight forward.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/red-worker.c b/server/red-worker.c
index b8826c5..6196682 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -69,6 +69,7 @@ struct RedWorker {
     pthread_t thread;
     QXLInstance *qxl;
     RedDispatcher *red_dispatcher;
+    SpiceWatch *dispatch_watch;
     int running;
     SpiceCoreInterfaceInternal core;
     struct pollfd poll_fds[MAX_EVENT_SOURCES];
@@ -1578,11 +1579,10 @@ RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher)
         worker->poll_fds[i].fd = -1;
     }
 
-    worker->poll_fds[0].fd = dispatcher_get_recv_fd(dispatcher);
-    worker->poll_fds[0].events = POLLIN;
-    worker->watches[0].worker = worker;
-    worker->watches[0].watch_func = handle_dev_input;
-    worker->watches[0].watch_func_opaque = worker;
+    worker->dispatch_watch =
+        worker->core.watch_add(&worker->core, dispatcher_get_recv_fd(dispatcher),
+                               SPICE_WATCH_EVENT_READ, handle_dev_input, worker);
+    spice_assert(worker->dispatch_watch != NULL);
 
     memslot_info_init(&worker->mem_slots,
                       init_info.num_memslots_groups,


More information about the Spice-commits mailing list