[Spice-commits] server/display-channel-private.h server/display-channel.h

Frediano Ziglio fziglio at kemper.freedesktop.org
Sat Sep 2 07:32:00 UTC 2017


 server/display-channel-private.h |  214 +++++++++++++++++++++++++++++++++++++++
 server/display-channel.h         |  214 ---------------------------------------
 2 files changed, 214 insertions(+), 214 deletions(-)

New commits:
commit 1138c3f54a7b826aa4fb327e993bcd84700a4f4c
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Fri Aug 18 18:08:49 2017 +0100

    display-channel: Make some declarations private
    
    display-channel.h contains lots of information used by different
    DisplayChannel components.
    In the past all RedWorker, CursorChannel and DisplayChannel code was in
    a single file. Since lots of code to handle DisplayChannel is still in
    RedWorker, display-channel.h contains a lot of declarations so that they
    can be accessed from RedWorker.
    Moving declarations that are not needed by RedWorker and other external
    class components helps to reduce dependencies between RedWorker and
    DisplayChannel.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/display-channel-private.h b/server/display-channel-private.h
index da807d11..fb5d6158 100644
--- a/server/display-channel-private.h
+++ b/server/display-channel-private.h
@@ -20,6 +20,48 @@
 
 #include "display-channel.h"
 
+#define TRACE_ITEMS_SHIFT 3
+#define NUM_TRACE_ITEMS (1 << TRACE_ITEMS_SHIFT)
+#define ITEMS_TRACE_MASK (NUM_TRACE_ITEMS - 1)
+
+typedef struct DrawContext {
+    SpiceCanvas *canvas;
+    int canvas_draws_on_surface;
+    int top_down;
+    uint32_t width;
+    uint32_t height;
+    int32_t stride;
+    uint32_t format;
+    void *line_0;
+} DrawContext;
+
+typedef struct RedSurface {
+    uint32_t refs;
+    /* A Ring representing a hierarchical tree structure. This tree includes
+     * DrawItems, Containers, and Shadows. It is used to efficiently determine
+     * which drawables overlap, and to exclude regions of drawables that are
+     * obscured by other drawables */
+    Ring current;
+    /* A ring of pending Drawables associated with this surface. This ring is
+     * actually used for drawing. The ring is maintained in order of age, the
+     * tail being the oldest drawable. */
+    Ring current_list;
+    DrawContext context;
+
+    Ring depend_on_me;
+    QRegion draw_dirty_region;
+
+    //fix me - better handling here
+    QXLReleaseInfoExt create, destroy;
+} RedSurface;
+
+typedef struct MonitorsConfig {
+    int refs;
+    int count;
+    int max_allowed;
+    QXLHead heads[0];
+} MonitorsConfig;
+
 #define NUM_DRAWABLES 1000
 typedef struct _Drawable _Drawable;
 struct _Drawable {
@@ -83,4 +125,176 @@ struct DisplayChannelPrivate
     ImageEncoderSharedData encoder_shared_data;
 };
 
+#define FOREACH_DCC(_channel, _data) \
+    GLIST_FOREACH((_channel ? red_channel_get_clients(RED_CHANNEL(_channel)) : NULL), \
+                  DisplayChannelClient, _data)
+
+typedef struct RedMonitorsConfigItem {
+    RedPipeItem pipe_item;
+    MonitorsConfig *monitors_config;
+} RedMonitorsConfigItem;
+
+enum {
+    RED_PIPE_ITEM_TYPE_DRAW = RED_PIPE_ITEM_TYPE_COMMON_LAST,
+    RED_PIPE_ITEM_TYPE_IMAGE,
+    RED_PIPE_ITEM_TYPE_STREAM_CREATE,
+    RED_PIPE_ITEM_TYPE_STREAM_CLIP,
+    RED_PIPE_ITEM_TYPE_STREAM_DESTROY,
+    RED_PIPE_ITEM_TYPE_UPGRADE,
+    RED_PIPE_ITEM_TYPE_MIGRATE_DATA,
+    RED_PIPE_ITEM_TYPE_PIXMAP_SYNC,
+    RED_PIPE_ITEM_TYPE_PIXMAP_RESET,
+    RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE,
+    RED_PIPE_ITEM_TYPE_CREATE_SURFACE,
+    RED_PIPE_ITEM_TYPE_DESTROY_SURFACE,
+    RED_PIPE_ITEM_TYPE_MONITORS_CONFIG,
+    RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT,
+    RED_PIPE_ITEM_TYPE_GL_SCANOUT,
+    RED_PIPE_ITEM_TYPE_GL_DRAW,
+};
+
+void drawable_unref(Drawable *drawable);
+
+MonitorsConfig *monitors_config_ref(MonitorsConfig *config);
+void monitors_config_unref(MonitorsConfig *config);
+
+void display_channel_draw_until(DisplayChannel *display,
+                                const SpiceRect *area,
+                                int surface_id,
+                                Drawable *last);
+GArray* display_channel_get_video_codecs(DisplayChannel *display);
+int display_channel_get_stream_video(DisplayChannel *display);
+void display_channel_current_flush(DisplayChannel *display,
+                                   int surface_id);
+uint32_t display_channel_generate_uid(DisplayChannel *display);
+
+int display_channel_get_stream_id(DisplayChannel *display, Stream *stream);
+Stream *display_channel_get_nth_stream(DisplayChannel *display, gint i);
+
+typedef struct RedSurfaceDestroyItem {
+    RedPipeItem pipe_item;
+    SpiceMsgSurfaceDestroy surface_destroy;
+} RedSurfaceDestroyItem;
+
+typedef struct RedUpgradeItem {
+    RedPipeItem base;
+    Drawable *drawable;
+    SpiceClipRects *rects;
+} RedUpgradeItem;
+
+static inline int is_equal_path(SpicePath *path1, SpicePath *path2)
+{
+    SpicePathSeg *seg1, *seg2;
+    int i, j;
+
+    if (path1->num_segments != path2->num_segments)
+        return FALSE;
+
+    for (i = 0; i < path1->num_segments; i++) {
+        seg1 = path1->segments[i];
+        seg2 = path2->segments[i];
+
+        if (seg1->flags != seg2->flags ||
+            seg1->count != seg2->count) {
+            return FALSE;
+        }
+        for (j = 0; j < seg1->count; j++) {
+            if (seg1->points[j].x != seg2->points[j].x ||
+                seg1->points[j].y != seg2->points[j].y) {
+                return FALSE;
+            }
+        }
+    }
+
+    return TRUE;
+}
+
+// partial imp
+static inline int is_equal_brush(SpiceBrush *b1, SpiceBrush *b2)
+{
+    return b1->type == b2->type &&
+           b1->type == SPICE_BRUSH_TYPE_SOLID &&
+           b1->u.color == b2->u.color;
+}
+
+// partial imp
+static inline int is_equal_line_attr(SpiceLineAttr *a1, SpiceLineAttr *a2)
+{
+    return a1->flags == a2->flags &&
+           a1->style_nseg == a2->style_nseg &&
+           a1->style_nseg == 0;
+}
+
+// partial imp
+static inline int is_same_geometry(Drawable *d1, Drawable *d2)
+{
+    if (d1->red_drawable->type != d2->red_drawable->type) {
+        return FALSE;
+    }
+
+    switch (d1->red_drawable->type) {
+    case QXL_DRAW_STROKE:
+        return is_equal_line_attr(&d1->red_drawable->u.stroke.attr,
+                                  &d2->red_drawable->u.stroke.attr) &&
+               is_equal_path(d1->red_drawable->u.stroke.path,
+                             d2->red_drawable->u.stroke.path);
+    case QXL_DRAW_FILL:
+        return rect_is_equal(&d1->red_drawable->bbox, &d2->red_drawable->bbox);
+    default:
+        return FALSE;
+    }
+}
+
+static inline int is_same_drawable(Drawable *d1, Drawable *d2)
+{
+    if (!is_same_geometry(d1, d2)) {
+        return FALSE;
+    }
+
+    switch (d1->red_drawable->type) {
+    case QXL_DRAW_STROKE:
+        return is_equal_brush(&d1->red_drawable->u.stroke.brush,
+                              &d2->red_drawable->u.stroke.brush);
+    case QXL_DRAW_FILL:
+        return is_equal_brush(&d1->red_drawable->u.fill.brush,
+                              &d2->red_drawable->u.fill.brush);
+    default:
+        return FALSE;
+    }
+}
+
+static inline int is_drawable_independent_from_surfaces(Drawable *drawable)
+{
+    int x;
+
+    for (x = 0; x < 3; ++x) {
+        if (drawable->surface_deps[x] != -1) {
+            return FALSE;
+        }
+    }
+    return TRUE;
+}
+
+static inline int has_shadow(RedDrawable *drawable)
+{
+    return drawable->type == QXL_COPY_BITS;
+}
+
+static inline int is_primary_surface(DisplayChannel *display, uint32_t surface_id)
+{
+    if (surface_id == 0) {
+        return TRUE;
+    }
+    return FALSE;
+}
+
+static inline void region_add_clip_rects(QRegion *rgn, SpiceClipRects *data)
+{
+    int i;
+
+    for (i = 0; i < data->num_rects; i++) {
+        region_add(rgn, data->rects + i);
+    }
+}
+
 #endif /* DISPLAY_CHANNEL_PRIVATE_H_ */
diff --git a/server/display-channel.h b/server/display-channel.h
index 75b1efea..d3fc41dd 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -108,96 +108,6 @@ struct Drawable {
     DisplayChannel *display;
 };
 
-void drawable_unref (Drawable *drawable);
-
-enum {
-    RED_PIPE_ITEM_TYPE_DRAW = RED_PIPE_ITEM_TYPE_COMMON_LAST,
-    RED_PIPE_ITEM_TYPE_IMAGE,
-    RED_PIPE_ITEM_TYPE_STREAM_CREATE,
-    RED_PIPE_ITEM_TYPE_STREAM_CLIP,
-    RED_PIPE_ITEM_TYPE_STREAM_DESTROY,
-    RED_PIPE_ITEM_TYPE_UPGRADE,
-    RED_PIPE_ITEM_TYPE_MIGRATE_DATA,
-    RED_PIPE_ITEM_TYPE_PIXMAP_SYNC,
-    RED_PIPE_ITEM_TYPE_PIXMAP_RESET,
-    RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE,
-    RED_PIPE_ITEM_TYPE_CREATE_SURFACE,
-    RED_PIPE_ITEM_TYPE_DESTROY_SURFACE,
-    RED_PIPE_ITEM_TYPE_MONITORS_CONFIG,
-    RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT,
-    RED_PIPE_ITEM_TYPE_GL_SCANOUT,
-    RED_PIPE_ITEM_TYPE_GL_DRAW,
-};
-
-typedef struct MonitorsConfig {
-    int refs;
-    int count;
-    int max_allowed;
-    QXLHead heads[0];
-} MonitorsConfig;
-
-typedef struct RedMonitorsConfigItem {
-    RedPipeItem pipe_item;
-    MonitorsConfig *monitors_config;
-} RedMonitorsConfigItem;
-
-MonitorsConfig *           monitors_config_ref                       (MonitorsConfig *config);
-void                       monitors_config_unref                     (MonitorsConfig *config);
-
-#define TRACE_ITEMS_SHIFT 3
-#define NUM_TRACE_ITEMS (1 << TRACE_ITEMS_SHIFT)
-#define ITEMS_TRACE_MASK (NUM_TRACE_ITEMS - 1)
-
-typedef struct DrawContext {
-    SpiceCanvas *canvas;
-    int canvas_draws_on_surface;
-    int top_down;
-    uint32_t width;
-    uint32_t height;
-    int32_t stride;
-    uint32_t format;
-    void *line_0;
-} DrawContext;
-
-typedef struct RedSurface {
-    uint32_t refs;
-    /* A Ring representing a hierarchical tree structure. This tree includes
-     * DrawItems, Containers, and Shadows. It is used to efficiently determine
-     * which drawables overlap, and to exclude regions of drawables that are
-     * obscured by other drawables */
-    Ring current;
-    /* A ring of pending Drawables associated with this surface. This ring is
-     * actually used for drawing. The ring is maintained in order of age, the
-     * tail being the oldest drawable. */
-    Ring current_list;
-    DrawContext context;
-
-    Ring depend_on_me;
-    QRegion draw_dirty_region;
-
-    //fix me - better handling here
-    QXLReleaseInfoExt create, destroy;
-} RedSurface;
-
-#define FOREACH_DCC(_channel, _data) \
-    GLIST_FOREACH((_channel ? red_channel_get_clients(RED_CHANNEL(_channel)) : NULL), \
-                  DisplayChannelClient, _data)
-
-int display_channel_get_stream_id(DisplayChannel *display, Stream *stream);
-Stream *display_channel_get_nth_stream(DisplayChannel *display, gint i);
-
-typedef struct RedSurfaceDestroyItem {
-    RedPipeItem pipe_item;
-    SpiceMsgSurfaceDestroy surface_destroy;
-} RedSurfaceDestroyItem;
-
-typedef struct RedUpgradeItem {
-    RedPipeItem base;
-    Drawable *drawable;
-    SpiceClipRects *rects;
-} RedUpgradeItem;
-
-
 DisplayChannel*            display_channel_new                       (RedsState *reds,
                                                                       QXLInstance *qxl,
                                                                       const SpiceCoreInterfaceInternal *core,
@@ -212,10 +122,6 @@ void                       display_channel_create_surface            (DisplayCha
 void                       display_channel_draw                      (DisplayChannel *display,
                                                                       const SpiceRect *area,
                                                                       int surface_id);
-void                       display_channel_draw_until                (DisplayChannel *display,
-                                                                      const SpiceRect *area,
-                                                                      int surface_id,
-                                                                      Drawable *last);
 void                       display_channel_update                    (DisplayChannel *display,
                                                                       uint32_t surface_id,
                                                                       const QXLRect *area,
@@ -227,15 +133,11 @@ void                       display_channel_set_stream_video          (DisplayCha
                                                                       int stream_video);
 void                       display_channel_set_video_codecs          (DisplayChannel *display,
                                                                       GArray *video_codecs);
-GArray*                    display_channel_get_video_codecs          (DisplayChannel *display);
-int                        display_channel_get_stream_video          (DisplayChannel *display);
 int                        display_channel_get_streams_timeout       (DisplayChannel *display);
 void                       display_channel_compress_stats_print      (DisplayChannel *display);
 void                       display_channel_compress_stats_reset      (DisplayChannel *display);
 void                       display_channel_surface_unref             (DisplayChannel *display,
                                                                       uint32_t surface_id);
-void                       display_channel_current_flush             (DisplayChannel *display,
-                                                                      int surface_id);
 bool                       display_channel_wait_for_migrate_data     (DisplayChannel *display);
 void                       display_channel_flush_all_surfaces        (DisplayChannel *display);
 void                       display_channel_free_glz_drawables_to_free(DisplayChannel *display);
@@ -243,7 +145,6 @@ void                       display_channel_free_glz_drawables        (DisplayCha
 void                       display_channel_destroy_surface_wait      (DisplayChannel *display,
                                                                       uint32_t surface_id);
 void                       display_channel_destroy_surfaces          (DisplayChannel *display);
-uint32_t                   display_channel_generate_uid              (DisplayChannel *display);
 void                       display_channel_process_draw              (DisplayChannel *display,
                                                                       RedDrawable *red_drawable,
                                                                       uint32_t process_commands_generation);
@@ -268,121 +169,6 @@ void display_channel_reset_image_cache(DisplayChannel *self);
 
 void display_channel_debug_oom(DisplayChannel *display, const char *msg);
 
-static inline int is_equal_path(SpicePath *path1, SpicePath *path2)
-{
-    SpicePathSeg *seg1, *seg2;
-    int i, j;
-
-    if (path1->num_segments != path2->num_segments)
-        return FALSE;
-
-    for (i = 0; i < path1->num_segments; i++) {
-        seg1 = path1->segments[i];
-        seg2 = path2->segments[i];
-
-        if (seg1->flags != seg2->flags ||
-            seg1->count != seg2->count) {
-            return FALSE;
-        }
-        for (j = 0; j < seg1->count; j++) {
-            if (seg1->points[j].x != seg2->points[j].x ||
-                seg1->points[j].y != seg2->points[j].y) {
-                return FALSE;
-            }
-        }
-    }
-
-    return TRUE;
-}
-
-// partial imp
-static inline int is_equal_brush(SpiceBrush *b1, SpiceBrush *b2)
-{
-    return b1->type == b2->type &&
-           b1->type == SPICE_BRUSH_TYPE_SOLID &&
-           b1->u.color == b2->u.color;
-}
-
-// partial imp
-static inline int is_equal_line_attr(SpiceLineAttr *a1, SpiceLineAttr *a2)
-{
-    return a1->flags == a2->flags &&
-           a1->style_nseg == a2->style_nseg &&
-           a1->style_nseg == 0;
-}
-
-// partial imp
-static inline int is_same_geometry(Drawable *d1, Drawable *d2)
-{
-    if (d1->red_drawable->type != d2->red_drawable->type) {
-        return FALSE;
-    }
-
-    switch (d1->red_drawable->type) {
-    case QXL_DRAW_STROKE:
-        return is_equal_line_attr(&d1->red_drawable->u.stroke.attr,
-                                  &d2->red_drawable->u.stroke.attr) &&
-               is_equal_path(d1->red_drawable->u.stroke.path,
-                             d2->red_drawable->u.stroke.path);
-    case QXL_DRAW_FILL:
-        return rect_is_equal(&d1->red_drawable->bbox, &d2->red_drawable->bbox);
-    default:
-        return FALSE;
-    }
-}
-
-static inline int is_same_drawable(Drawable *d1, Drawable *d2)
-{
-    if (!is_same_geometry(d1, d2)) {
-        return FALSE;
-    }
-
-    switch (d1->red_drawable->type) {
-    case QXL_DRAW_STROKE:
-        return is_equal_brush(&d1->red_drawable->u.stroke.brush,
-                              &d2->red_drawable->u.stroke.brush);
-    case QXL_DRAW_FILL:
-        return is_equal_brush(&d1->red_drawable->u.fill.brush,
-                              &d2->red_drawable->u.fill.brush);
-    default:
-        return FALSE;
-    }
-}
-
-static inline int is_drawable_independent_from_surfaces(Drawable *drawable)
-{
-    int x;
-
-    for (x = 0; x < 3; ++x) {
-        if (drawable->surface_deps[x] != -1) {
-            return FALSE;
-        }
-    }
-    return TRUE;
-}
-
-static inline int has_shadow(RedDrawable *drawable)
-{
-    return drawable->type == QXL_COPY_BITS;
-}
-
-static inline int is_primary_surface(DisplayChannel *display, uint32_t surface_id)
-{
-    if (surface_id == 0) {
-        return TRUE;
-    }
-    return FALSE;
-}
-
-static inline void region_add_clip_rects(QRegion *rgn, SpiceClipRects *data)
-{
-    int i;
-
-    for (i = 0; i < data->num_rects; i++) {
-        region_add(rgn, data->rects + i);
-    }
-}
-
 G_END_DECLS
 
 #endif /* DISPLAY_CHANNEL_H_ */


More information about the Spice-commits mailing list