[PATCH 16/18] worker: move display_channel_update

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

 



From: Marc-André Lureau <marcandre.lureau@xxxxxxxxx>

---
 server/display-channel.c | 39 +++++++++++++++++++++++++++++++++++++++
 server/display-channel.h |  6 ++++++
 server/red_worker.c      | 39 ---------------------------------------
 3 files changed, 45 insertions(+), 39 deletions(-)

diff --git a/server/display-channel.c b/server/display-channel.c
index 0fbddf5..fce9dd5 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1403,6 +1403,45 @@ void display_channel_draw(DisplayChannel *display, const SpiceRect *area, int su
     surface_update_dest(surface, area);
 }
 
+static void region_to_qxlrects(QRegion *region, QXLRect *qxl_rects, uint32_t num_rects)
+{
+    SpiceRect *rects;
+    int i;
+
+    rects = spice_new0(SpiceRect, num_rects);
+    region_ret_rects(region, rects, num_rects);
+    for (i = 0; i < num_rects; i++) {
+        qxl_rects[i].top    = rects[i].top;
+        qxl_rects[i].left   = rects[i].left;
+        qxl_rects[i].bottom = rects[i].bottom;
+        qxl_rects[i].right  = rects[i].right;
+    }
+    free(rects);
+}
+
+void display_channel_update(DisplayChannel *display,
+                            uint32_t surface_id, const QXLRect *area, uint32_t clear_dirty,
+                            QXLRect **qxl_dirty_rects, uint32_t *num_dirty_rects)
+{
+    SpiceRect rect;
+    RedSurface *surface;
+
+    spice_return_if_fail(validate_surface(display, surface_id));
+
+    red_get_rect_ptr(&rect, area);
+    display_channel_draw(display, &rect, surface_id);
+
+    surface = &display->surfaces[surface_id];
+    if (!*qxl_dirty_rects) {
+        *num_dirty_rects = pixman_region32_n_rects(&surface->draw_dirty_region);
+        *qxl_dirty_rects = spice_new0(QXLRect, *num_dirty_rects);
+    }
+
+    region_to_qxlrects(&surface->draw_dirty_region, *qxl_dirty_rects, *num_dirty_rects);
+    if (clear_dirty)
+        region_clear(&surface->draw_dirty_region);
+}
+
 static void clear_surface_drawables_from_pipes(DisplayChannel *display, int surface_id,
                                                int wait_if_used)
 {
diff --git a/server/display-channel.h b/server/display-channel.h
index 750362b..0d79463 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -266,6 +266,12 @@ void                       display_channel_draw_until                (DisplayCha
                                                                       const SpiceRect *area,
                                                                       int surface_id,
                                                                       Drawable *last);
+void                       display_channel_update                    (DisplayChannel *display,
+                                                                      uint32_t surface_id,
+                                                                      const QXLRect *area,
+                                                                      uint32_t clear_dirty,
+                                                                      QXLRect **qxl_dirty_rects,
+                                                                      uint32_t *num_dirty_rects);
 void                       display_channel_free_some                 (DisplayChannel *display);
 void                       display_channel_set_stream_video          (DisplayChannel *display,
                                                                       int stream_video);
diff --git a/server/red_worker.c b/server/red_worker.c
index 470f813..0816f63 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -3803,45 +3803,6 @@ static void cursor_connect(RedWorker *worker, RedClient *client, RedsStream *str
         cursor_channel_init(channel, ccc);
 }
 
-static void region_to_qxlrects(QRegion *region, QXLRect *qxl_rects, uint32_t num_rects)
-{
-    SpiceRect *rects;
-    int i;
-
-    rects = spice_new0(SpiceRect, num_rects);
-    region_ret_rects(region, rects, num_rects);
-    for (i = 0; i < num_rects; i++) {
-        qxl_rects[i].top    = rects[i].top;
-        qxl_rects[i].left   = rects[i].left;
-        qxl_rects[i].bottom = rects[i].bottom;
-        qxl_rects[i].right  = rects[i].right;
-    }
-    free(rects);
-}
-
-void display_channel_update(DisplayChannel *display,
-                            uint32_t surface_id, const QXLRect *area, uint32_t clear_dirty,
-                            QXLRect **qxl_dirty_rects, uint32_t *num_dirty_rects)
-{
-    SpiceRect rect;
-    RedSurface *surface;
-
-    spice_return_if_fail(validate_surface(display, surface_id));
-
-    red_get_rect_ptr(&rect, area);
-    display_channel_draw(display, &rect, surface_id);
-
-    surface = &display->surfaces[surface_id];
-    if (!*qxl_dirty_rects) {
-        *num_dirty_rects = pixman_region32_n_rects(&surface->draw_dirty_region);
-        *qxl_dirty_rects = spice_new0(QXLRect, *num_dirty_rects);
-    }
-
-    region_to_qxlrects(&surface->draw_dirty_region, *qxl_dirty_rects, *num_dirty_rects);
-    if (clear_dirty)
-        region_clear(&surface->draw_dirty_region);
-}
-
 static void handle_dev_update_async(void *opaque, void *payload)
 {
     RedWorker *worker = opaque;
-- 
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]