[PATCH 03/15] worker: move red_process_draw to display-channel.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
Acked-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 server/display-channel.c | 25 +++++++++++++++++++++----
 server/display-channel.h |  7 ++-----
 server/red_worker.c      | 20 ++------------------
 3 files changed, 25 insertions(+), 27 deletions(-)

diff --git a/server/display-channel.c b/server/display-channel.c
index 007512e..94c32e3 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1098,9 +1098,9 @@ static int validate_drawable_bbox(DisplayChannel *display, RedDrawable *drawable
  *
  * @return initialized Drawable or NULL on failure
  */
-Drawable *display_channel_get_drawable(DisplayChannel *display, uint8_t effect,
-                                       RedDrawable *red_drawable, uint32_t group_id,
-                                       uint32_t process_commands_generation)
+static Drawable *display_channel_get_drawable(DisplayChannel *display, uint8_t effect,
+                                              RedDrawable *red_drawable, uint32_t group_id,
+                                              uint32_t process_commands_generation)
 {
     Drawable *drawable;
     int x;
@@ -1145,7 +1145,7 @@ Drawable *display_channel_get_drawable(DisplayChannel *display, uint8_t effect,
  * Add a Drawable to the items to draw.
  * On failure the Drawable is not added.
  */
-void display_channel_add_drawable(DisplayChannel *display, Drawable *drawable)
+static void display_channel_add_drawable(DisplayChannel *display, Drawable *drawable)
 {
     int success = FALSE, surface_id = drawable->surface_id;
     RedDrawable *red_drawable = drawable->red_drawable;
@@ -1195,6 +1195,23 @@ void display_channel_add_drawable(DisplayChannel *display, Drawable *drawable)
 #endif
 }
 
+void display_channel_process_draw(DisplayChannel *display, RedDrawable *red_drawable,
+                                  uint32_t group_id, int process_commands_generation)
+{
+    Drawable *drawable =
+        display_channel_get_drawable(display, red_drawable->effect, red_drawable, group_id,
+                                     process_commands_generation);
+
+    if (!drawable) {
+        return;
+    }
+
+    display_channel_add_drawable(display, drawable);
+
+    display_channel_drawable_unref(display, drawable);
+}
+
+
 int display_channel_wait_for_migrate_data(DisplayChannel *display)
 {
     uint64_t end_time = red_get_monotonic_time() + DISPLAY_CLIENT_MIGRATE_DATA_TIMEOUT;
diff --git a/server/display-channel.h b/server/display-channel.h
index 83b50ca..a990e09 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -286,8 +286,6 @@ void                       display_channel_surface_unref             (DisplayCha
                                                                       uint32_t surface_id);
 bool                       display_channel_surface_has_canvas        (DisplayChannel *display,
                                                                       uint32_t surface_id);
-void                       display_channel_add_drawable              (DisplayChannel *display,
-                                                                      Drawable *drawable);
 void                       display_channel_current_flush             (DisplayChannel *display,
                                                                       int surface_id);
 int                        display_channel_wait_for_migrate_data     (DisplayChannel *display);
@@ -300,11 +298,10 @@ void                       display_channel_destroy_surfaces          (DisplayCha
 void                       display_channel_destroy_surface           (DisplayChannel *display,
                                                                       uint32_t surface_id);
 uint32_t                   display_channel_generate_uid              (DisplayChannel *display);
-Drawable *                 display_channel_get_drawable              (DisplayChannel *display,
-                                                                      uint8_t effect,
+void                       display_channel_process_draw              (DisplayChannel *display,
                                                                       RedDrawable *red_drawable,
                                                                       uint32_t group_id,
-                                                                      uint32_t process_commands_generation);
+                                                                      int process_commands_generation);
 void                       display_channel_process_surface_cmd       (DisplayChannel *display,
                                                                       RedSurfaceCmd *surface,
                                                                       uint32_t group_id,
diff --git a/server/red_worker.c b/server/red_worker.c
index 1204bb1..9ba57e4 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -165,23 +165,6 @@ void red_drawable_unref(RedWorker *worker, RedDrawable *red_drawable,
     free(red_drawable);
 }
 
-static inline void red_process_draw(RedWorker *worker, RedDrawable *red_drawable,
-                                    uint32_t group_id)
-{
-    DisplayChannel *display = worker->display_channel;
-    Drawable *drawable =
-        display_channel_get_drawable(display, red_drawable->effect, red_drawable, group_id,
-                                     worker->process_display_generation);
-
-    if (!drawable) {
-        return;
-    }
-
-    display_channel_add_drawable(worker->display_channel, drawable);
-
-    display_channel_drawable_unref(display, drawable);
-}
-
 static int red_process_cursor(RedWorker *worker, uint32_t max_pipe_size, int *ring_is_empty)
 {
     QXLCommandExt ext_cmd;
@@ -284,7 +267,8 @@ static int red_process_display(RedWorker *worker, uint32_t max_pipe_size, int *r
 
             if (!red_get_drawable(&worker->mem_slots, ext_cmd.group_id,
                                  red_drawable, ext_cmd.cmd.data, ext_cmd.flags)) {
-                red_process_draw(worker, red_drawable, ext_cmd.group_id);
+                display_channel_process_draw(worker->display_channel, red_drawable, ext_cmd.group_id,
+                                             worker->process_display_generation);
             }
             // release the red_drawable
             red_drawable_unref(worker, red_drawable, ext_cmd.group_id);
-- 
2.4.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]