[Spice-commits] 2 commits - server/display-channel.c server/display-channel.h

Frediano Ziglio fziglio at kemper.freedesktop.org
Tue Sep 27 13:30:55 UTC 2016


 server/display-channel.c |   31 ++++++++++++++++---------------
 server/display-channel.h |    2 +-
 2 files changed, 17 insertions(+), 16 deletions(-)

New commits:
commit 5d04ad7359f38dd2db7eb928ed1e55effeb231e8
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Sat Sep 17 06:59:59 2016 +0100

    Rename red_surface to surface
    
    Attempt to use consistent naming.
    Usually we use surface name for RedSurface.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/display-channel.c b/server/display-channel.c
index 6a7228b..d7ea7d5 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1964,7 +1964,7 @@ void display_channel_process_surface_cmd(DisplayChannel *display,
                                          int loadvm)
 {
     uint32_t surface_id;
-    RedSurface *red_surface;
+    RedSurface *surface;
     uint8_t *data;
 
     surface_id = surface_cmd->surface_id;
@@ -1972,7 +1972,7 @@ void display_channel_process_surface_cmd(DisplayChannel *display,
         return;
     }
 
-    red_surface = &display->priv->surfaces[surface_id];
+    surface = &display->priv->surfaces[surface_id];
 
     switch (surface_cmd->type) {
     case QXL_SURFACE_CMD_CREATE: {
@@ -1980,7 +1980,7 @@ void display_channel_process_surface_cmd(DisplayChannel *display,
         int32_t stride = surface_cmd->u.surface_create.stride;
         int reloaded_surface = loadvm || (surface_cmd->flags & QXL_SURF_FLAG_KEEP_DATA);
 
-        if (red_surface->refs) {
+        if (surface->refs) {
             spice_warning("avoiding creating a surface twice");
             break;
         }
@@ -1995,15 +1995,15 @@ void display_channel_process_surface_cmd(DisplayChannel *display,
                                        reloaded_surface,
                                        // reloaded surfaces will be sent on demand
                                        !reloaded_surface);
-        red_surface->create = surface_cmd->release_info_ext;
+        surface->create = surface_cmd->release_info_ext;
         break;
     }
     case QXL_SURFACE_CMD_DESTROY:
-        if (!red_surface->refs) {
+        if (!surface->refs) {
             spice_warning("avoiding destroying a surface twice");
             break;
         }
-        red_surface->destroy = surface_cmd->release_info_ext;
+        surface->destroy = surface_cmd->release_info_ext;
         display_channel_destroy_surface(display, surface_id);
         break;
     default:
commit 05150fbe3457625fca0ed73edc419f4fb353265f
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Sat Sep 17 06:56:17 2016 +0100

    Rename surface argument to surface_cmd
    
    Attempt to use consistent naming.
    Usually we use surface name for RedSurface so make sure
    code reader do not get confused using a different name
    for RedSurfaceCmd.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/display-channel.c b/server/display-channel.c
index c704341..6a7228b 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1959,42 +1959,43 @@ DisplayChannel* display_channel_new(SpiceServer *reds, RedWorker *worker,
     return display;
 }
 
-void display_channel_process_surface_cmd(DisplayChannel *display, RedSurfaceCmd *surface,
+void display_channel_process_surface_cmd(DisplayChannel *display,
+                                         const RedSurfaceCmd *surface_cmd,
                                          int loadvm)
 {
     uint32_t surface_id;
     RedSurface *red_surface;
     uint8_t *data;
 
-    surface_id = surface->surface_id;
+    surface_id = surface_cmd->surface_id;
     if SPICE_UNLIKELY(surface_id >= display->priv->n_surfaces) {
         return;
     }
 
     red_surface = &display->priv->surfaces[surface_id];
 
-    switch (surface->type) {
+    switch (surface_cmd->type) {
     case QXL_SURFACE_CMD_CREATE: {
-        uint32_t height = surface->u.surface_create.height;
-        int32_t stride = surface->u.surface_create.stride;
-        int reloaded_surface = loadvm || (surface->flags & QXL_SURF_FLAG_KEEP_DATA);
+        uint32_t height = surface_cmd->u.surface_create.height;
+        int32_t stride = surface_cmd->u.surface_create.stride;
+        int reloaded_surface = loadvm || (surface_cmd->flags & QXL_SURF_FLAG_KEEP_DATA);
 
         if (red_surface->refs) {
             spice_warning("avoiding creating a surface twice");
             break;
         }
-        data = surface->u.surface_create.data;
+        data = surface_cmd->u.surface_create.data;
         if (stride < 0) {
             /* No need to worry about overflow here, command should already be validated
              * when it is read, specifically red_get_surface_cmd */
             data -= (int32_t)(stride * (height - 1));
         }
-        display_channel_create_surface(display, surface_id, surface->u.surface_create.width,
-                                       height, stride, surface->u.surface_create.format, data,
+        display_channel_create_surface(display, surface_id, surface_cmd->u.surface_create.width,
+                                       height, stride, surface_cmd->u.surface_create.format, data,
                                        reloaded_surface,
                                        // reloaded surfaces will be sent on demand
                                        !reloaded_surface);
-        red_surface->create = surface->release_info_ext;
+        red_surface->create = surface_cmd->release_info_ext;
         break;
     }
     case QXL_SURFACE_CMD_DESTROY:
@@ -2002,7 +2003,7 @@ void display_channel_process_surface_cmd(DisplayChannel *display, RedSurfaceCmd
             spice_warning("avoiding destroying a surface twice");
             break;
         }
-        red_surface->destroy = surface->release_info_ext;
+        red_surface->destroy = surface_cmd->release_info_ext;
         display_channel_destroy_surface(display, surface_id);
         break;
     default:
diff --git a/server/display-channel.h b/server/display-channel.h
index 36633d5..bbae6f1 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -277,7 +277,7 @@ void                       display_channel_process_draw              (DisplayCha
                                                                       RedDrawable *red_drawable,
                                                                       uint32_t process_commands_generation);
 void                       display_channel_process_surface_cmd       (DisplayChannel *display,
-                                                                      RedSurfaceCmd *surface,
+                                                                      const RedSurfaceCmd *surface_cmd,
                                                                       int loadvm);
 void                       display_channel_update_compression        (DisplayChannel *display,
                                                                       DisplayChannelClient *dcc);


More information about the Spice-commits mailing list