[Spice-commits] 3 commits - server/dcc.c server/dcc.h server/dcc-send.c server/display-channel.c server/display-channel-private.h server/red-channel-client.c server/reds.c server/video-stream.c server/video-stream.h
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jun 18 12:42:38 UTC 2018
server/dcc-send.c | 21 ++++++++-------------
server/dcc.c | 29 ++++++++++++++---------------
server/dcc.h | 4 ++--
server/display-channel-private.h | 4 ++--
server/display-channel.c | 4 ++--
server/red-channel-client.c | 9 ++++-----
server/reds.c | 4 ++--
server/video-stream.c | 6 +++---
server/video-stream.h | 2 +-
9 files changed, 38 insertions(+), 45 deletions(-)
New commits:
commit 83fd1bb4ff5a48a18631edcb88657f44c377d75b
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Wed Dec 13 09:15:47 2017 +0000
Use "base" as pipe item base field name
Most of pipe items use this name for the base field.
This also allows to use SPICE_UPCAST macros instead of a long
SPICE_CONTAINEROF.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 211c69d7..79c3d48b 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -638,7 +638,7 @@ static bool pipe_rendered_drawables_intersect_with_areas(DisplayChannelClient *d
if (pipe_item->type != RED_PIPE_ITEM_TYPE_DRAW)
continue;
- drawable = SPICE_CONTAINEROF(pipe_item, RedDrawablePipeItem, dpi_pipe_item)->drawable;
+ drawable = SPICE_UPCAST(RedDrawablePipeItem, pipe_item)->drawable;
if (ring_item_is_linked(&drawable->list_link))
continue; // item hasn't been rendered
@@ -731,7 +731,7 @@ static void red_pipe_replace_rendered_drawables_with_images(DisplayChannelClient
if (pipe_item->type != RED_PIPE_ITEM_TYPE_DRAW)
continue;
- dpi = SPICE_CONTAINEROF(pipe_item, RedDrawablePipeItem, dpi_pipe_item);
+ dpi = SPICE_UPCAST(RedDrawablePipeItem, pipe_item);
drawable = dpi->drawable;
if (ring_item_is_linked(&drawable->list_link))
continue; // item hasn't been rendered
@@ -2392,7 +2392,7 @@ void dcc_send_item(RedChannelClient *rcc, RedPipeItem *pipe_item)
reset_send_data(dcc);
switch (pipe_item->type) {
case RED_PIPE_ITEM_TYPE_DRAW: {
- RedDrawablePipeItem *dpi = SPICE_CONTAINEROF(pipe_item, RedDrawablePipeItem, dpi_pipe_item);
+ RedDrawablePipeItem *dpi = SPICE_UPCAST(RedDrawablePipeItem, pipe_item);
marshall_qxl_drawable(rcc, m, dpi);
break;
}
@@ -2432,28 +2432,23 @@ void dcc_send_item(RedChannelClient *rcc, RedPipeItem *pipe_item)
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES);
break;
case RED_PIPE_ITEM_TYPE_CREATE_SURFACE: {
- RedSurfaceCreateItem *surface_create = SPICE_CONTAINEROF(pipe_item, RedSurfaceCreateItem,
- pipe_item);
+ RedSurfaceCreateItem *surface_create = SPICE_UPCAST(RedSurfaceCreateItem, pipe_item);
marshall_surface_create(rcc, m, &surface_create->surface_create);
break;
}
case RED_PIPE_ITEM_TYPE_DESTROY_SURFACE: {
- RedSurfaceDestroyItem *surface_destroy = SPICE_CONTAINEROF(pipe_item, RedSurfaceDestroyItem,
- pipe_item);
+ RedSurfaceDestroyItem *surface_destroy = SPICE_UPCAST(RedSurfaceDestroyItem, pipe_item);
marshall_surface_destroy(rcc, m, surface_destroy->surface_destroy.surface_id);
break;
}
case RED_PIPE_ITEM_TYPE_MONITORS_CONFIG: {
- RedMonitorsConfigItem *monconf_item = SPICE_CONTAINEROF(pipe_item,
- RedMonitorsConfigItem,
- pipe_item);
+ RedMonitorsConfigItem *monconf_item = SPICE_UPCAST(RedMonitorsConfigItem, pipe_item);
marshall_monitors_config(rcc, m, monconf_item->monitors_config);
break;
}
case RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT: {
- RedStreamActivateReportItem *report_item = SPICE_CONTAINEROF(pipe_item,
- RedStreamActivateReportItem,
- pipe_item);
+ RedStreamActivateReportItem *report_item =
+ SPICE_UPCAST(RedStreamActivateReportItem, pipe_item);
marshall_stream_activate_report(rcc, m, report_item);
break;
}
diff --git a/server/dcc.c b/server/dcc.c
index 15b65978..d96f1b2b 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -202,7 +202,7 @@ static RedSurfaceCreateItem *red_surface_create_item_new(RedChannel* channel,
create->surface_create.flags = flags;
create->surface_create.format = format;
- red_pipe_item_init(&create->pipe_item, RED_PIPE_ITEM_TYPE_CREATE_SURFACE);
+ red_pipe_item_init(&create->base, RED_PIPE_ITEM_TYPE_CREATE_SURFACE);
return create;
}
@@ -246,7 +246,7 @@ bool dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, int surfac
l = l->next;
if (item->type == RED_PIPE_ITEM_TYPE_DRAW) {
- dpi = SPICE_CONTAINEROF(item, RedDrawablePipeItem, dpi_pipe_item);
+ dpi = SPICE_UPCAST(RedDrawablePipeItem, item);
drawable = dpi->drawable;
} else if (item->type == RED_PIPE_ITEM_TYPE_UPGRADE) {
drawable = SPICE_UPCAST(RedUpgradeItem, item)->drawable;
@@ -313,7 +313,7 @@ void dcc_create_surface(DisplayChannelClient *dcc, int surface_id)
surface->context.height,
surface->context.format, flags);
dcc->priv->surface_client_created[surface_id] = TRUE;
- red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &create->pipe_item);
+ red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &create->base);
}
// adding the pipe item after pos. If pos == NULL, adding to head.
@@ -433,8 +433,7 @@ static void add_drawable_surface_images(DisplayChannelClient *dcc, Drawable *dra
static void red_drawable_pipe_item_free(RedPipeItem *item)
{
- RedDrawablePipeItem *dpi = SPICE_CONTAINEROF(item, RedDrawablePipeItem,
- dpi_pipe_item);
+ RedDrawablePipeItem *dpi = SPICE_UPCAST(RedDrawablePipeItem, item);
spice_assert(item->refcount == 0);
dpi->drawable->pipes = g_list_remove(dpi->drawable->pipes, dpi);
@@ -451,7 +450,7 @@ static RedDrawablePipeItem *red_drawable_pipe_item_new(DisplayChannelClient *dcc
dpi->drawable = drawable;
dpi->dcc = dcc;
drawable->pipes = g_list_prepend(drawable->pipes, dpi);
- red_pipe_item_init_full(&dpi->dpi_pipe_item, RED_PIPE_ITEM_TYPE_DRAW,
+ red_pipe_item_init_full(&dpi->base, RED_PIPE_ITEM_TYPE_DRAW,
red_drawable_pipe_item_free);
drawable->refs++;
return dpi;
@@ -462,7 +461,7 @@ void dcc_prepend_drawable(DisplayChannelClient *dcc, Drawable *drawable)
RedDrawablePipeItem *dpi = red_drawable_pipe_item_new(dcc, drawable);
add_drawable_surface_images(dcc, drawable);
- red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &dpi->dpi_pipe_item);
+ red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &dpi->base);
}
void dcc_append_drawable(DisplayChannelClient *dcc, Drawable *drawable)
@@ -470,7 +469,7 @@ void dcc_append_drawable(DisplayChannelClient *dcc, Drawable *drawable)
RedDrawablePipeItem *dpi = red_drawable_pipe_item_new(dcc, drawable);
add_drawable_surface_images(dcc, drawable);
- red_channel_client_pipe_add_tail(RED_CHANNEL_CLIENT(dcc), &dpi->dpi_pipe_item);
+ red_channel_client_pipe_add_tail(RED_CHANNEL_CLIENT(dcc), &dpi->base);
}
void dcc_add_drawable_after(DisplayChannelClient *dcc, Drawable *drawable, RedPipeItem *pos)
@@ -478,7 +477,7 @@ void dcc_add_drawable_after(DisplayChannelClient *dcc, Drawable *drawable, RedPi
RedDrawablePipeItem *dpi = red_drawable_pipe_item_new(dcc, drawable);
add_drawable_surface_images(dcc, drawable);
- red_channel_client_pipe_add_after(RED_CHANNEL_CLIENT(dcc), &dpi->dpi_pipe_item, pos);
+ red_channel_client_pipe_add_after(RED_CHANNEL_CLIENT(dcc), &dpi->base, pos);
}
static void dcc_init_stream_agents(DisplayChannelClient *dcc)
@@ -634,9 +633,9 @@ void dcc_video_stream_agent_clip(DisplayChannelClient* dcc, VideoStreamAgent *ag
red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &item->base);
}
-static void red_monitors_config_item_free(RedPipeItem *base)
+static void red_monitors_config_item_free(RedPipeItem *pipe_item)
{
- RedMonitorsConfigItem *item = SPICE_CONTAINEROF(base, RedMonitorsConfigItem, pipe_item);
+ RedMonitorsConfigItem *item = SPICE_UPCAST(RedMonitorsConfigItem, pipe_item);
monitors_config_unref(item->monitors_config);
g_free(item);
@@ -650,7 +649,7 @@ static RedMonitorsConfigItem *red_monitors_config_item_new(RedChannel* channel,
mci = g_new(RedMonitorsConfigItem, 1);
mci->monitors_config = monitors_config_ref(monitors_config);
- red_pipe_item_init_full(&mci->pipe_item, RED_PIPE_ITEM_TYPE_MONITORS_CONFIG,
+ red_pipe_item_init_full(&mci->base, RED_PIPE_ITEM_TYPE_MONITORS_CONFIG,
red_monitors_config_item_free);
return mci;
}
@@ -673,7 +672,7 @@ void dcc_push_monitors_config(DisplayChannelClient *dcc)
mci = red_monitors_config_item_new(red_channel_client_get_channel(RED_CHANNEL_CLIENT(dcc)),
monitors_config);
- red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &mci->pipe_item);
+ red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &mci->base);
}
static RedSurfaceDestroyItem *red_surface_destroy_item_new(uint32_t surface_id)
@@ -682,7 +681,7 @@ static RedSurfaceDestroyItem *red_surface_destroy_item_new(uint32_t surface_id)
destroy = g_new(RedSurfaceDestroyItem, 1);
destroy->surface_destroy.surface_id = surface_id;
- red_pipe_item_init(&destroy->pipe_item, RED_PIPE_ITEM_TYPE_DESTROY_SURFACE);
+ red_pipe_item_init(&destroy->base, RED_PIPE_ITEM_TYPE_DESTROY_SURFACE);
return destroy;
}
@@ -744,7 +743,7 @@ void dcc_destroy_surface(DisplayChannelClient *dcc, uint32_t surface_id)
dcc->priv->surface_client_created[surface_id] = FALSE;
destroy = red_surface_destroy_item_new(surface_id);
- red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &destroy->pipe_item);
+ red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &destroy->base);
}
#define MIN_DIMENSION_TO_QUIC 3
diff --git a/server/dcc.h b/server/dcc.h
index 16d60ed0..76c078bf 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -96,7 +96,7 @@ typedef struct FreeList {
#define DCC_TO_DC(dcc) ((DisplayChannel*)red_channel_client_get_channel((RedChannelClient*)dcc))
typedef struct RedSurfaceCreateItem {
- RedPipeItem pipe_item;
+ RedPipeItem base;
SpiceMsgSurfaceCreate surface_create;
} RedSurfaceCreateItem;
@@ -124,7 +124,7 @@ typedef struct RedImageItem {
} RedImageItem;
typedef struct RedDrawablePipeItem {
- RedPipeItem dpi_pipe_item;
+ RedPipeItem base;
Drawable *drawable;
DisplayChannelClient *dcc;
} RedDrawablePipeItem;
diff --git a/server/display-channel-private.h b/server/display-channel-private.h
index 617ce30d..27f0a019 100644
--- a/server/display-channel-private.h
+++ b/server/display-channel-private.h
@@ -132,7 +132,7 @@ struct DisplayChannelPrivate
DisplayChannelClient, _data)
typedef struct RedMonitorsConfigItem {
- RedPipeItem pipe_item;
+ RedPipeItem base;
MonitorsConfig *monitors_config;
} RedMonitorsConfigItem;
@@ -174,7 +174,7 @@ int display_channel_get_video_stream_id(DisplayChannel *display, VideoStream *st
VideoStream *display_channel_get_nth_video_stream(DisplayChannel *display, gint i);
typedef struct RedSurfaceDestroyItem {
- RedPipeItem pipe_item;
+ RedPipeItem base;
SpiceMsgSurfaceDestroy surface_destroy;
} RedSurfaceDestroyItem;
diff --git a/server/display-channel.c b/server/display-channel.c
index b74c1e95..5f2e866f 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -385,7 +385,7 @@ static void pipes_add_drawable_after(DisplayChannel *display,
dpi_pos_after = l->data;
num_other_linked++;
- dcc_add_drawable_after(dpi_pos_after->dcc, drawable, &dpi_pos_after->dpi_pipe_item);
+ dcc_add_drawable_after(dpi_pos_after->dcc, drawable, &dpi_pos_after->base);
}
if (num_other_linked == 0) {
@@ -446,7 +446,7 @@ static void drawable_remove_from_pipes(Drawable *drawable)
RedChannelClient *rcc;
rcc = RED_CHANNEL_CLIENT(dpi->dcc);
- red_channel_client_pipe_remove_and_release(rcc, &dpi->dpi_pipe_item);
+ red_channel_client_pipe_remove_and_release(rcc, &dpi->base);
}
}
diff --git a/server/video-stream.c b/server/video-stream.c
index a4b83b4f..b624093e 100644
--- a/server/video-stream.c
+++ b/server/video-stream.c
@@ -365,7 +365,7 @@ static void before_reattach_stream(DisplayChannel *display,
agent = dcc_get_video_stream_agent(dcc, index);
if (red_channel_client_pipe_item_is_linked(RED_CHANNEL_CLIENT(dcc),
- &dpi->dpi_pipe_item)) {
+ &dpi->base)) {
#ifdef STREAM_STATS
agent->stats.num_drops_pipe++;
#endif
@@ -755,11 +755,11 @@ void dcc_create_stream(DisplayChannelClient *dcc, VideoStream *stream)
RedStreamActivateReportItem *report_pipe_item = g_new0(RedStreamActivateReportItem, 1);
agent->report_id = rand();
- red_pipe_item_init(&report_pipe_item->pipe_item,
+ red_pipe_item_init(&report_pipe_item->base,
RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT);
report_pipe_item->stream_id = stream_id;
report_pipe_item->report_id = agent->report_id;
- red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &report_pipe_item->pipe_item);
+ red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &report_pipe_item->base);
}
#ifdef STREAM_STATS
memset(&agent->stats, 0, sizeof(StreamStats));
diff --git a/server/video-stream.h b/server/video-stream.h
index b733771b..46b076fd 100644
--- a/server/video-stream.h
+++ b/server/video-stream.h
@@ -54,7 +54,7 @@ typedef struct RedUpgradeItem {
} RedUpgradeItem;
typedef struct RedStreamActivateReportItem {
- RedPipeItem pipe_item;
+ RedPipeItem base;
uint32_t stream_id;
uint32_t report_id;
} RedStreamActivateReportItem;
commit b93173c1e04fb47ef08d2887fae645645e871ff7
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Thu Jan 25 14:37:03 2018 +0000
reds: Remove possible alignment warning using Clang
Although capabilities inside link message are handled as arrays
of 4 bytes unsigned integers we don't need capabilities to be
aligned to 4 bytes just to call g_memdup so use a pointer to
uint8_t instead.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/server/reds.c b/server/reds.c
index 935448d8..66a221c3 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1758,7 +1758,7 @@ static void
red_channel_capabilities_init_from_link_message(RedChannelCapabilities *caps,
const SpiceLinkMess *link_mess)
{
- const uint32_t *raw_caps = (uint32_t *)((uint8_t *)link_mess + link_mess->caps_offset);
+ const uint8_t *raw_caps = (const uint8_t *)link_mess + link_mess->caps_offset;
caps->num_common_caps = link_mess->num_common_caps;
caps->common_caps = NULL;
@@ -1769,7 +1769,7 @@ red_channel_capabilities_init_from_link_message(RedChannelCapabilities *caps,
caps->num_caps = link_mess->num_channel_caps;
caps->caps = NULL;
if (link_mess->num_channel_caps) {
- caps->caps = g_memdup(raw_caps + link_mess->num_common_caps,
+ caps->caps = g_memdup(raw_caps + link_mess->num_common_caps * sizeof(uint32_t),
link_mess->num_channel_caps * sizeof(uint32_t));
}
}
commit 0e5c4880edb2fec058847bbb650a8724034c6ff6
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Thu Jun 14 18:29:19 2018 +0100
red-channel-client: Do not allocate iovec array statically in the class
This array is just used locally in red_channel_client_handle_outgoing
so declare it there.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 893a764d..5d256eca 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -101,8 +101,6 @@ typedef struct RedChannelClientConnectivityMonitor {
} RedChannelClientConnectivityMonitor;
typedef struct OutgoingMessageBuffer {
- struct iovec vec[IOV_MAX];
- int vec_size;
int pos;
int size;
} OutgoingMessageBuffer;
@@ -1081,10 +1079,11 @@ static void red_channel_client_handle_outgoing(RedChannelClient *rcc)
}
for (;;) {
- buffer->vec_size =
- red_channel_client_prepare_out_msg(rcc, buffer->vec, G_N_ELEMENTS(buffer->vec),
+ struct iovec vec[IOV_MAX];
+ int vec_size =
+ red_channel_client_prepare_out_msg(rcc, vec, G_N_ELEMENTS(vec),
buffer->pos);
- n = red_stream_writev(stream, buffer->vec, buffer->vec_size);
+ n = red_stream_writev(stream, vec, vec_size);
if (n == -1) {
switch (errno) {
case EAGAIN:
More information about the Spice-commits
mailing list