[Spice-devel] [PATCH 06/18] Rename surface argument to surface_cmd

Frediano Ziglio fziglio at redhat.com
Mon Sep 26 08:12:39 UTC 2016


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>
---
 server/display-channel.c | 23 ++++++++++++-----------
 server/display-channel.h |  6 +++---
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/server/display-channel.c b/server/display-channel.c
index c9be4fe..ad9dde6 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..b64b9a8 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -276,9 +276,9 @@ uint32_t                   display_channel_generate_uid              (DisplayCha
 void                       display_channel_process_draw              (DisplayChannel *display,
                                                                       RedDrawable *red_drawable,
                                                                       uint32_t process_commands_generation);
-void                       display_channel_process_surface_cmd       (DisplayChannel *display,
-                                                                      RedSurfaceCmd *surface,
-                                                                      int loadvm);
+void display_channel_process_surface_cmd(DisplayChannel *display,
+                                         const RedSurfaceCmd *surface_cmd,
+                                         int loadvm);
 void                       display_channel_update_compression        (DisplayChannel *display,
                                                                       DisplayChannelClient *dcc);
 void                       display_channel_gl_scanout                (DisplayChannel *display);
-- 
2.7.4



More information about the Spice-devel mailing list