[Spice-commits] 2 commits - server/display-channel.h server/red_worker.c server/tree.h
Frediano Ziglio
fziglio at kemper.freedesktop.org
Wed Nov 11 04:14:28 PST 2015
server/display-channel.h | 89 +++++++++++++++++++++++++++++++++++++++++
server/red_worker.c | 101 +----------------------------------------------
server/tree.h | 6 ++
3 files changed, 98 insertions(+), 98 deletions(-)
New commits:
commit 892feff458b23480e7a923a75d7fb1705a214ca5
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date: Tue Nov 10 14:41:17 2015 -0600
worker: Move drawable utility functions to display channel
Functions that check the equality of a path, brush, etc are moved the
display channel source file to prepare for moving the surfaces to the
display channel.
Acked-by: Fabiano FidĂȘncio <fidencio at redhat.com>
diff --git a/server/display-channel.h b/server/display-channel.h
index 9ff6dca..42574a1 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -20,6 +20,7 @@
#include <setjmp.h>
+#include "common/rect.h"
#include "red_worker.h"
#include "reds_stream.h"
#include "cache-item.h"
@@ -350,6 +351,94 @@ void display_channel_compress_stats_print (const Disp
void display_channel_compress_stats_reset (DisplayChannel *display);
void display_channel_drawable_unref (DisplayChannel *display, Drawable *drawable);
+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_primary_surface(DisplayChannel *display, uint32_t surface_id)
+{
+ if (surface_id == 0) {
+ return TRUE;
+ }
+ return FALSE;
+}
#endif /* DISPLAY_CHANNEL_H_ */
diff --git a/server/red_worker.c b/server/red_worker.c
index 0d04cc4..ec1edb1 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -646,14 +646,6 @@ QXLInstance* red_worker_get_qxl(RedWorker *worker)
return worker->qxl;
}
-static inline int is_primary_surface(DisplayChannel *display, uint32_t surface_id)
-{
- if (surface_id == 0) {
- return TRUE;
- }
- return FALSE;
-}
-
static int validate_drawable_bbox(RedWorker *worker, RedDrawable *drawable)
{
DrawContext *context;
@@ -1494,87 +1486,6 @@ static inline void __current_add_drawable(RedWorker *worker, Drawable *drawable,
drawable->refs++;
}
-static int is_equal_path(RedWorker *worker, 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 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 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 int is_same_geometry(RedWorker *worker, 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(worker, 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 int is_same_drawable(RedWorker *worker, Drawable *d1, Drawable *d2)
-{
- if (!is_same_geometry(worker, 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 void detach_stream(DisplayChannel *display, Stream *stream,
int detach_sized)
{
@@ -2359,7 +2270,7 @@ static inline int red_current_add_equal(RedWorker *worker, DrawItem *item, TreeI
switch (item->effect) {
case QXL_EFFECT_REVERT_ON_DUP:
- if (is_same_drawable(worker, drawable, other_drawable)) {
+ if (is_same_drawable(drawable, other_drawable)) {
DisplayChannelClient *dcc;
DrawablePipeItem *dpi;
@@ -2401,7 +2312,7 @@ static inline int red_current_add_equal(RedWorker *worker, DrawItem *item, TreeI
}
break;
case QXL_EFFECT_OPAQUE_BRUSH:
- if (is_same_geometry(worker, drawable, other_drawable)) {
+ if (is_same_geometry(drawable, other_drawable)) {
__current_add_drawable(worker, drawable, &other->siblings_link);
remove_drawable(worker, other_drawable);
red_pipes_add_drawable(worker, drawable);
@@ -2409,7 +2320,7 @@ static inline int red_current_add_equal(RedWorker *worker, DrawItem *item, TreeI
}
break;
case QXL_EFFECT_NOP_ON_DUP:
- if (is_same_drawable(worker, drawable, other_drawable)) {
+ if (is_same_drawable(drawable, other_drawable)) {
return TRUE;
}
break;
commit 0e7617e51fb8a04767fae4e669c1de66fba846e8
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date: Tue Nov 10 14:41:18 2015 -0600
worker: Move is_opaque_item() to tree.h
Acked-by: Fabiano FidĂȘncio <fidencio at redhat.com>
diff --git a/server/red_worker.c b/server/red_worker.c
index face713..0d04cc4 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -1480,12 +1480,6 @@ static void exclude_region(RedWorker *worker, Ring *ring, RingItem *ring_item, Q
}
}
-static inline int is_opaque_item(TreeItem *item)
-{
- return item->type == TREE_ITEM_TYPE_CONTAINER ||
- (IS_DRAW_ITEM(item) && ((DrawItem *)item)->effect == QXL_EFFECT_OPAQUE);
-}
-
static inline void __current_add_drawable(RedWorker *worker, Drawable *drawable, RingItem *pos)
{
DisplayChannel *display = worker->display_channel;
diff --git a/server/tree.h b/server/tree.h
index 6e83f7a..6249c28 100644
--- a/server/tree.h
+++ b/server/tree.h
@@ -73,6 +73,12 @@ struct DrawItem {
#define IS_DRAW_ITEM(item) ((item)->type == TREE_ITEM_TYPE_DRAWABLE)
#define DRAW_ITEM(item) ((DrawItem*)(item))
+static inline int is_opaque_item(TreeItem *item)
+{
+ return item->type == TREE_ITEM_TYPE_CONTAINER ||
+ (IS_DRAW_ITEM(item) && ((DrawItem *)item)->effect == QXL_EFFECT_OPAQUE);
+}
+
void tree_item_dump (TreeItem *item);
Shadow* shadow_new (DrawItem *item, const SpicePoint *delta);
Container* container_new (DrawItem *item);
More information about the Spice-commits
mailing list