summaryrefslogtreecommitdiff
path: root/server/dcc.cpp
diff options
context:
space:
mode:
authorFrediano Ziglio <freddy77@gmail.com>2021-05-23 22:13:56 +0100
committerFrediano Ziglio <freddy77@gmail.com>2021-08-07 07:46:12 +0100
commitd8bca15f2b0ab0a25b739a26f6aef278e0d0064a (patch)
tree2a8611ec6c349c9ca1584abe0f1d765a617df72c /server/dcc.cpp
parentf5c2043143f93ef8919f30e09f6331e0b12e5431 (diff)
Allows surfaces to be updated without having to wait
Store pointers to surface object in "surfaces" and allows to have different surfaces with same ID in memory. The surface was keep "busy" if there was pending drawing around. Consider the following case: 1- receive drawing command 2- queue command on DCCs 3- destroy surface 4- send draw Previously at point 4) you would have to use a surface from "surfaces" which was destroyed, that is we would have to maintain the pointer (and canvas) to the surface until reference counter was 0. However consider this case: 1- receive drawing command 2- queue command on DCCs 3- destroy surface 4- create surface 5- send draw What would happen in point 4) ? We could not change the surface as it will be used by point 5). To avoid this the code attempts to wait the commands to release the surface. However this can be an issue, you can't force the clients to receive pending data if network is slow. So this patch change this allowing to create surfaces while the old version will still be used. This is also more clean from the reference pointer prospective, as the reference is increased for a specific surface. Note that now instead of checking for canvas to not be NULL a simple check for surface pointer is enough. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Victor Toso <victortoso@redhat.com>
Diffstat (limited to 'server/dcc.cpp')
-rw-r--r--server/dcc.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/server/dcc.cpp b/server/dcc.cpp
index 54f55484..2a5159a8 100644
--- a/server/dcc.cpp
+++ b/server/dcc.cpp
@@ -243,7 +243,7 @@ void dcc_push_surface_image(DisplayChannelClient *dcc, RedSurface *surface)
return;
}
- if (!surface->context.canvas) {
+ if (!surface) {
return;
}
area.top = area.left = 0;
@@ -407,11 +407,12 @@ void dcc_start(DisplayChannelClient *dcc)
red::shared_ptr<DisplayChannelClient> self(dcc);
dcc->ack_zero_messages_window();
- if (display->priv->surfaces[0].context.canvas) {
- display_channel_current_flush(display, &display->priv->surfaces[0]);
+ auto surface0 = display->priv->surfaces[0];
+ if (surface0) {
+ display_channel_current_flush(display, surface0);
dcc->pipe_add_type(RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE);
- dcc_create_surface(dcc, &display->priv->surfaces[0]);
- dcc_push_surface_image(dcc, &display->priv->surfaces[0]);
+ dcc_create_surface(dcc, surface0);
+ dcc_push_surface_image(dcc, surface0);
dcc_push_monitors_config(dcc);
dcc->pipe_add_empty_msg(SPICE_MSG_DISPLAY_MARK);
dcc_create_all_streams(dcc);