[Spice-devel] [PATCH] Simplify set_surface_release_info

Frediano Ziglio fziglio at redhat.com
Tue Aug 25 03:35:56 PDT 2015


---
 server/red_worker.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index 7966f91..1512709 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -1772,20 +1772,11 @@ static inline void red_destroy_surface(RedWorker *worker, uint32_t surface_id)
     }
 }
 
-static inline void set_surface_release_info(RedWorker *worker, uint32_t surface_id, int is_create,
+static inline void set_surface_release_info(QXLReleaseInfoExt *release_info_ext,
                                             QXLReleaseInfo *release_info, uint32_t group_id)
 {
-    RedSurface *surface;
-
-    surface = &worker->surfaces[surface_id];
-
-    if (is_create) {
-        surface->create.info = release_info;
-        surface->create.group_id = group_id;
-    } else {
-        surface->destroy.info = release_info;
-        surface->destroy.group_id = group_id;
-    }
+    release_info_ext->info = release_info;
+    release_info_ext->group_id = group_id;
 }
 
 static RedDrawable *ref_red_drawable(RedDrawable *drawable)
@@ -4302,12 +4293,12 @@ static inline void red_process_surface(RedWorker *worker, RedSurfaceCmd *surface
                            reloaded_surface,
                            // reloaded surfaces will be sent on demand
                            !reloaded_surface);
-        set_surface_release_info(worker, surface_id, 1, surface->release_info, group_id);
+        set_surface_release_info(&red_surface->create, surface->release_info, group_id);
         break;
     }
     case QXL_SURFACE_CMD_DESTROY:
         spice_warn_if(!red_surface->context.canvas);
-        set_surface_release_info(worker, surface_id, 0, surface->release_info, group_id);
+        set_surface_release_info(&red_surface->destroy, surface->release_info, group_id);
         red_handle_depends_on_target_surface(worker, surface_id);
         /* note that red_handle_depends_on_target_surface must be called before red_current_clear.
            otherwise "current" will hold items that other drawables may depend on, and then
-- 
2.4.3



More information about the Spice-devel mailing list