[Spice-devel] [spice-server 2/4] streaming: Remove the Drawable.sized_stream field
Christophe Fergeau
cfergeau at redhat.com
Fri Jun 10 13:48:26 UTC 2016
From: Francois Gouget <fgouget at codeweavers.com>
Only red_marshall_stream_data() needs to know whether to send the frame
using a SpiceMsgDisplayStreamDataSized or a regular StreamData message.
So check whether we have a sized frame there and simplify the rest of
the code.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
server/dcc-send.c | 13 +++----------
server/display-channel.h | 1 -
server/stream.c | 31 ++++---------------------------
3 files changed, 7 insertions(+), 38 deletions(-)
diff --git a/server/dcc-send.c b/server/dcc-send.c
index ff4aa4d..b18bd80 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -1683,10 +1683,6 @@ static int red_marshall_stream_data(RedChannelClient *rcc,
int is_sized, width, height;
int ret;
- if (!stream) {
- spice_assert(drawable->sized_stream);
- stream = drawable->sized_stream;
- }
spice_assert(drawable->red_drawable->type == QXL_DRAW_COPY);
copy = &drawable->red_drawable->u.copy;
@@ -1696,16 +1692,13 @@ static int red_marshall_stream_data(RedChannelClient *rcc,
width = copy->src_area.right - copy->src_area.left;
height = copy->src_area.bottom - copy->src_area.top;
- is_sized = (drawable->sized_stream != NULL);
+ is_sized = (width != stream->width) || (height != stream->height) ||
+ !rect_is_equal(&drawable->red_drawable->bbox, &stream->dest_area);
if (is_sized &&
!red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_SIZED_STREAM)) {
return FALSE;
}
- if (!is_sized) {
- width = stream->width;
- height = stream->height;
- }
StreamAgent *agent = &dcc->stream_agents[get_stream_id(display, stream)];
uint64_t time_now = spice_get_monotonic_time_ns();
@@ -2150,7 +2143,7 @@ static void marshall_qxl_drawable(RedChannelClient *rcc,
spice_return_if_fail(display);
/* allow sized frames to be streamed, even if they where replaced by another frame, since
* newer frames might not cover sized frames completely if they are bigger */
- if ((item->stream || item->sized_stream) && red_marshall_stream_data(rcc, m, item)) {
+ if (item->stream && red_marshall_stream_data(rcc, m, item)) {
return;
}
if (display->enable_jpeg)
diff --git a/server/display-channel.h b/server/display-channel.h
index 16ea709..5891e94 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -70,7 +70,6 @@ struct Drawable {
int gradual_frames_count;
int last_gradual_frame;
Stream *stream;
- Stream *sized_stream;
int streamable;
BitmapGradualType copy_bitmap_graduality;
DependItem depend_items[3];
diff --git a/server/stream.c b/server/stream.c
index d8be148..f527c71 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -226,7 +226,6 @@ static int is_next_stream_frame(DisplayChannel *display,
int container_candidate_allowed)
{
RedDrawable *red_drawable;
- int is_frame_container = FALSE;
if (!candidate->streamable) {
return STREAM_FRAME_NONE;
@@ -252,7 +251,6 @@ static int is_next_stream_frame(DisplayChannel *display,
}
} else {
if (rect_contains(&red_drawable->bbox, other_dest)) {
- SpiceRect* candidate_src;
int candidate_area = rect_get_area(&red_drawable->bbox);
int other_area = rect_get_area(other_dest);
/* do not stream drawables that are significantly
@@ -265,13 +263,6 @@ static int is_next_stream_frame(DisplayChannel *display,
rect_debug(&red_drawable->bbox);
return STREAM_FRAME_NONE;
}
-
- candidate_src = &red_drawable->u.copy.src_area;
- if (candidate_area > other_area ||
- candidate_src->right - candidate_src->left != other_src_width ||
- candidate_src->bottom - candidate_src->top != other_src_height) {
- is_frame_container = TRUE;
- }
} else {
return STREAM_FRAME_NONE;
}
@@ -283,11 +274,7 @@ static int is_next_stream_frame(DisplayChannel *display,
return STREAM_FRAME_NONE;
}
}
- if (is_frame_container) {
- return STREAM_FRAME_CONTAINER;
- } else {
- return STREAM_FRAME_NATIVE;
- }
+ return STREAM_FRAME_NATIVE;
}
static void attach_stream(DisplayChannel *display, Drawable *drawable, Stream *stream)
@@ -340,9 +327,6 @@ void detach_stream(DisplayChannel *display, Stream *stream,
spice_assert(stream->current && stream->current->stream);
spice_assert(stream->current->stream == stream);
stream->current->stream = NULL;
- if (detach_sized) {
- stream->current->sized_stream = NULL;
- }
stream->current = NULL;
}
@@ -545,9 +529,6 @@ void stream_trace_update(DisplayChannel *display, Drawable *drawable)
detach_stream(display, stream, FALSE);
}
attach_stream(display, drawable, stream);
- if (is_next_frame == STREAM_FRAME_CONTAINER) {
- drawable->sized_stream = stream;
- }
return;
}
}
@@ -590,9 +571,6 @@ void stream_maintenance(DisplayChannel *display,
detach_stream(display, stream, FALSE);
prev->streamable = FALSE; //prevent item trace
attach_stream(display, candidate, stream);
- if (is_next_frame == STREAM_FRAME_CONTAINER) {
- candidate->sized_stream = stream;
- }
}
} else if (candidate->streamable) {
SpiceRect* prev_src = &prev->red_drawable->u.copy.src_area;
@@ -833,13 +811,12 @@ static void dcc_detach_stream_gracefully(DisplayChannelClient *dcc,
/* (1) The caller should detach the drawable from the stream. This will
* lead to sending the drawable losslessly, as an ordinary drawable. */
if (dcc_drawable_is_in_pipe(dcc, stream->current)) {
- spice_debug("stream %d: upgrade by linked drawable. sized %d, box ==>",
- stream_id, stream->current->sized_stream != NULL);
+ spice_debug("stream %d: upgrade by linked drawable. box ==>",
+ stream_id);
rect_debug(&stream->current->red_drawable->bbox);
goto clear_vis_region;
}
- spice_debug("stream %d: upgrade by drawable. sized %d, box ==>",
- stream_id, stream->current->sized_stream != NULL);
+ spice_debug("stream %d: upgrade by drawable. box ==>", stream_id);
rect_debug(&stream->current->red_drawable->bbox);
rcc = RED_CHANNEL_CLIENT(dcc);
upgrade_item = spice_new(RedUpgradeItem, 1);
--
2.7.4
More information about the Spice-devel
mailing list