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

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 24 16:31:25 UTC 2018


 server/red-worker.c |   16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

New commits:
commit 612c94c61bd77c4fd82c9ea42c2fd8f558de4fa9
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed May 23 14:50:12 2018 +0200

    worker: Remove display_is_connected()
    
    It's only called once, and when it's called, we will have dereferenced
    worker->display_channel a few lines before in
    display_channel_set_monitors_config_to_primary(), so this cannot be
    NULL. The 'if (worker->display_channel)' check can thus be removed, so
    display_is_connected() becomes just red_channel_is_connected().
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/red-worker.c b/server/red-worker.c
index 541110f8..8424306d 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -93,12 +93,6 @@ struct RedWorker {
     GMainLoop *loop;
 };
 
-static int display_is_connected(RedWorker *worker)
-{
-    return worker->display_channel &&
-        red_channel_is_connected(RED_CHANNEL(worker->display_channel));
-}
-
 void red_drawable_unref(RedDrawable *red_drawable)
 {
     if (--red_drawable->refs) {
@@ -529,7 +523,7 @@ static void dev_create_primary_surface(RedWorker *worker, uint32_t surface_id,
 
     CommonGraphicsChannel *common = COMMON_GRAPHICS_CHANNEL(display);
     RedChannel *channel = RED_CHANNEL(display);
-    if (display_is_connected(worker) &&
+    if (red_channel_is_connected(channel) &&
         !common_graphics_channel_get_during_target_migrate(common)) {
         /* guest created primary, so it will (hopefully) send a monitors_config
          * now, don't send our own temporary one */
commit ca8ffdb8ef4e063254db3a7e0ab431c15504c887
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed May 23 14:50:05 2018 +0200

    worker: Use more local vars in dev_create_primary_surface
    
    There's already a 'display' variable equal to worker->display_channel
    which is not consistently used. This commit also adds a new 'channel'
    local variable to limit the number of  upcasts to RedChannel.
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/red-worker.c b/server/red-worker.c
index eb927f3e..541110f8 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -527,7 +527,8 @@ static void dev_create_primary_surface(RedWorker *worker, uint32_t surface_id,
                                    line_0, surface.flags & QXL_SURF_FLAG_KEEP_DATA, TRUE);
     display_channel_set_monitors_config_to_primary(display);
 
-    CommonGraphicsChannel *common = COMMON_GRAPHICS_CHANNEL(worker->display_channel);
+    CommonGraphicsChannel *common = COMMON_GRAPHICS_CHANNEL(display);
+    RedChannel *channel = RED_CHANNEL(display);
     if (display_is_connected(worker) &&
         !common_graphics_channel_get_during_target_migrate(common)) {
         /* guest created primary, so it will (hopefully) send a monitors_config
@@ -535,9 +536,8 @@ static void dev_create_primary_surface(RedWorker *worker, uint32_t surface_id,
         if (!worker->driver_cap_monitors_config) {
             display_channel_push_monitors_config(display);
         }
-        red_channel_pipes_add_empty_msg(RED_CHANNEL(worker->display_channel),
-                                        SPICE_MSG_DISPLAY_MARK);
-        red_channel_push(RED_CHANNEL(worker->display_channel));
+        red_channel_pipes_add_empty_msg(channel, SPICE_MSG_DISPLAY_MARK);
+        red_channel_push(channel);
     }
 
     cursor_channel_do_init(worker->cursor_channel);


More information about the Spice-commits mailing list