[Spice-commits] 5 commits - server/cursor-channel.c server/cursor-channel.h server/red_worker.c server/red_worker.h
Frediano Ziglio
fziglio at kemper.freedesktop.org
Fri Oct 30 01:49:08 PDT 2015
server/cursor-channel.c | 36 +++++++++---------------
server/cursor-channel.h | 4 +-
server/red_worker.c | 72 ++++++++++++++++++++----------------------------
server/red_worker.h | 26 ++++++++---------
4 files changed, 59 insertions(+), 79 deletions(-)
New commits:
commit 7b39f818b8d4b02f83085d5006b47164b09f0c6e
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date: Thu Oct 29 16:54:47 2015 -0500
Remove a couple single-use static functions
red_cursor_marshall_inval(), red_migrate_cursor() and
on_new_cursor_channel() were short functions that were each only called
from a single location, so there's no need for them to be separate
functions.
Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index b47eeaa..7ab9285 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -289,13 +289,6 @@ static inline void red_marshall_inval(RedChannelClient *rcc,
spice_marshall_msg_cursor_inval_one(base_marshaller, &inval_one);
}
-static void red_cursor_marshall_inval(RedChannelClient *rcc,
- SpiceMarshaller *m, CacheItem *cach_item)
-{
- spice_assert(rcc);
- red_marshall_inval(rcc, m, cach_item);
-}
-
static void cursor_channel_send_item(RedChannelClient *rcc, PipeItem *pipe_item)
{
SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
@@ -306,7 +299,7 @@ static void cursor_channel_send_item(RedChannelClient *rcc, PipeItem *pipe_item)
cursor_marshall(rcc, m, SPICE_CONTAINEROF(pipe_item, CursorPipeItem, base));
break;
case PIPE_ITEM_TYPE_INVAL_ONE:
- red_cursor_marshall_inval(rcc, m, (CacheItem *)pipe_item);
+ red_marshall_inval(rcc, m, (CacheItem *)pipe_item);
break;
case PIPE_ITEM_TYPE_VERB:
red_marshall_verb(rcc, (VerbItem*)pipe_item);
diff --git a/server/red_worker.c b/server/red_worker.c
index d0ef926..c4bbe4a 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -9894,29 +9894,6 @@ static void handle_new_display_channel(RedWorker *worker, RedClient *client, Red
on_new_display_channel_client(dcc);
}
-static void red_migrate_cursor(RedWorker *worker, RedChannelClient *rcc)
-{
- if (red_channel_client_is_connected(rcc)) {
- red_channel_client_pipe_add_type(rcc,
- PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
- red_channel_client_default_migrate(rcc);
- }
-}
-
-static void on_new_cursor_channel(RedWorker *worker, RedChannelClient *rcc)
-{
- CursorChannel *channel = worker->cursor_channel;
-
- spice_assert(channel);
- red_channel_client_ack_zero_messages_window(rcc);
- red_channel_client_push_set_ack(rcc);
- // TODO: why do we check for context.canvas? defer this to after display cc is connected
- // and test it's canvas? this is just a test to see if there is an active renderer?
- if (worker->surfaces[0].context.canvas && !channel->common.during_target_migrate) {
- red_channel_client_pipe_add_type(rcc, PIPE_ITEM_TYPE_CURSOR_INIT);
- }
-}
-
static void red_connect_cursor(RedWorker *worker, RedClient *client, RedsStream *stream,
int migrate,
uint32_t *common_caps, int num_common_caps,
@@ -9942,7 +9919,15 @@ static void red_connect_cursor(RedWorker *worker, RedClient *client, RedsStream
channel->stat = stat_add_node(worker->stat, "cursor_channel", TRUE);
channel->common.base.out_bytes_counter = stat_add_counter(channel->stat, "out_bytes", TRUE);
#endif
- on_new_cursor_channel(worker, &ccc->common.base);
+
+ RedChannelClient *rcc = &ccc->common.base;
+ red_channel_client_ack_zero_messages_window(rcc);
+ red_channel_client_push_set_ack(rcc);
+ // TODO: why do we check for context.canvas? defer this to after display cc is connected
+ // and test it's canvas? this is just a test to see if there is an active renderer?
+ if (worker->surfaces[0].context.canvas && !channel->common.during_target_migrate) {
+ red_channel_client_pipe_add_type(rcc, PIPE_ITEM_TYPE_CURSOR_INIT);
+ }
}
static void surface_dirty_region_to_rects(RedSurface *surface,
@@ -10667,12 +10652,15 @@ void handle_dev_cursor_disconnect(void *opaque, void *payload)
void handle_dev_cursor_migrate(void *opaque, void *payload)
{
RedWorkerMessageCursorMigrate *msg = payload;
- RedWorker *worker = opaque;
RedChannelClient *rcc = msg->rcc;
spice_info("migrate cursor client");
spice_assert(rcc);
- red_migrate_cursor(worker, rcc);
+ if (!red_channel_client_is_connected(rcc))
+ return;
+
+ red_channel_client_pipe_add_type(rcc, PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
+ red_channel_client_default_migrate(rcc);
}
void handle_dev_set_compression(void *opaque, void *payload)
commit 30c9ff7a8fcbf3e6cb9a7c1f8030c5e8b40f2f0b
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date: Thu Oct 29 16:54:45 2015 -0500
CursorChannel* arg in cursor_channel_client_new()
Instead of passing a CommonChannel* argument, use CursorChannel* since
this function is only valid for CursorChannels.
Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 22514dc..b47eeaa 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -381,14 +381,13 @@ CursorChannel* cursor_channel_new(RedWorker *worker)
return cursor;
}
-CursorChannelClient *cursor_channel_client_new(CommonChannel *common,
- RedClient *client, RedsStream *stream,
+CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor, RedClient *client, RedsStream *stream,
int mig_target,
uint32_t *common_caps, int num_common_caps,
uint32_t *caps, int num_caps)
{
CursorChannelClient *ccc =
- (CursorChannelClient*)common_channel_new_client(common,
+ (CursorChannelClient*)common_channel_new_client(&cursor->common,
sizeof(CursorChannelClient),
client, stream,
mig_target,
diff --git a/server/cursor-channel.h b/server/cursor-channel.h
index 6a26bdb..1914226 100644
--- a/server/cursor-channel.h
+++ b/server/cursor-channel.h
@@ -87,7 +87,7 @@ CursorItem* cursor_item_new (RedCursorCmd *cmd, uint32_t gro
void cursor_item_unref (QXLInstance *qxl, CursorItem *cursor);
-CursorChannelClient *cursor_channel_client_new(CommonChannel *common,
+CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor,
RedClient *client, RedsStream *stream,
int mig_target,
uint32_t *common_caps, int num_common_caps,
diff --git a/server/red_worker.c b/server/red_worker.c
index a46100f..d0ef926 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -9931,7 +9931,7 @@ static void red_connect_cursor(RedWorker *worker, RedClient *client, RedsStream
}
channel = worker->cursor_channel;
spice_info("add cursor channel client");
- ccc = cursor_channel_client_new(&channel->common, client, stream,
+ ccc = cursor_channel_client_new(channel, client, stream,
migrate,
common_caps, num_common_caps,
caps, num_caps);
commit 591f39e7ccd1f9b5ba1839c937883970e1bfefdb
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date: Thu Oct 29 16:54:43 2015 -0500
common_channel_client_create -> common_channel_new_client
Rename and re-order the initial arguments to make this function look and
act more like a method of the CommonChannel class.
Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 6eac505..22514dc 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -388,15 +388,15 @@ CursorChannelClient *cursor_channel_client_new(CommonChannel *common,
uint32_t *caps, int num_caps)
{
CursorChannelClient *ccc =
- (CursorChannelClient*)common_channel_client_create(
- sizeof(CursorChannelClient), common, client, stream,
- mig_target,
- FALSE,
- common_caps,
- num_common_caps,
- caps,
- num_caps);
-
+ (CursorChannelClient*)common_channel_new_client(common,
+ sizeof(CursorChannelClient),
+ client, stream,
+ mig_target,
+ FALSE,
+ common_caps,
+ num_common_caps,
+ caps,
+ num_caps);
if (!ccc) {
return NULL;
}
diff --git a/server/red_worker.c b/server/red_worker.c
index 43011c1..a46100f 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -9508,16 +9508,16 @@ SpiceCoreInterface worker_core = {
.watch_remove = worker_watch_remove,
};
-CommonChannelClient *common_channel_client_create(int size,
- CommonChannel *common,
- RedClient *client,
- RedsStream *stream,
- int mig_target,
- int monitor_latency,
- uint32_t *common_caps,
- int num_common_caps,
- uint32_t *caps,
- int num_caps)
+CommonChannelClient *common_channel_new_client(CommonChannel *common,
+ int size,
+ RedClient *client,
+ RedsStream *stream,
+ int mig_target,
+ int monitor_latency,
+ uint32_t *common_caps,
+ int num_common_caps,
+ uint32_t *caps,
+ int num_caps)
{
RedChannelClient *rcc =
red_channel_client_create(size, &common->base, client, stream, monitor_latency,
@@ -9545,8 +9545,8 @@ DisplayChannelClient *display_channel_client_create(CommonChannel *common,
uint32_t *caps, int num_caps)
{
DisplayChannelClient *dcc =
- (DisplayChannelClient*)common_channel_client_create(
- sizeof(DisplayChannelClient), common, client, stream,
+ (DisplayChannelClient*)common_channel_new_client(
+ common, sizeof(DisplayChannelClient), client, stream,
mig_target,
TRUE,
common_caps, num_common_caps,
diff --git a/server/red_worker.h b/server/red_worker.h
index c828d99..795959d 100644
--- a/server/red_worker.h
+++ b/server/red_worker.h
@@ -118,17 +118,6 @@ RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher);
bool red_worker_run(RedWorker *worker);
QXLInstance* red_worker_get_qxl(RedWorker *worker);
-CommonChannelClient *common_channel_client_create(int size,
- CommonChannel *common,
- RedClient *client,
- RedsStream *stream,
- int mig_target,
- int monitor_latency,
- uint32_t *common_caps,
- int num_common_caps,
- uint32_t *caps,
- int num_caps);
-
RedChannel *__new_channel(RedWorker *worker, int size, uint32_t channel_type,
int migration_flags,
channel_disconnect_proc on_disconnect,
@@ -140,4 +129,15 @@ RedChannel *__new_channel(RedWorker *worker, int size, uint32_t channel_type,
channel_handle_migrate_data_proc handle_migrate_data,
channel_handle_migrate_data_get_serial_proc migrate_get_serial);
+CommonChannelClient *common_channel_new_client(CommonChannel *common,
+ int size,
+ RedClient *client,
+ RedsStream *stream,
+ int mig_target,
+ int monitor_latency,
+ uint32_t *common_caps,
+ int num_common_caps,
+ uint32_t *caps,
+ int num_caps);
+
#endif
commit 8f5a5582c03774f99796d676f39a32933b6b90a9
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date: Thu Oct 29 16:54:42 2015 -0500
Change red_marshall_verb() to accept a VerbItem
Instead of passing a verb enumeration value, pass the verb pipe item
Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index ee6520f..6eac505 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -309,7 +309,7 @@ static void cursor_channel_send_item(RedChannelClient *rcc, PipeItem *pipe_item)
red_cursor_marshall_inval(rcc, m, (CacheItem *)pipe_item);
break;
case PIPE_ITEM_TYPE_VERB:
- red_marshall_verb(rcc, ((VerbItem*)pipe_item)->verb);
+ red_marshall_verb(rcc, (VerbItem*)pipe_item);
break;
case PIPE_ITEM_TYPE_CURSOR_INIT:
red_reset_cursor_cache(rcc);
@@ -317,7 +317,7 @@ static void cursor_channel_send_item(RedChannelClient *rcc, PipeItem *pipe_item)
break;
case PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE:
red_reset_cursor_cache(rcc);
- red_marshall_verb(rcc, SPICE_MSG_CURSOR_INVAL_ALL);
+ red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_INVAL_ALL, NULL);
break;
default:
spice_error("invalid pipe item type");
diff --git a/server/red_worker.c b/server/red_worker.c
index 9a4869f..43011c1 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -8394,7 +8394,7 @@ static void display_channel_send_item(RedChannelClient *rcc, PipeItem *pipe_item
red_display_marshall_upgrade(rcc, m, (UpgradeItem *)pipe_item);
break;
case PIPE_ITEM_TYPE_VERB:
- red_marshall_verb(rcc, ((VerbItem*)pipe_item)->verb);
+ red_marshall_verb(rcc, (VerbItem*)pipe_item);
break;
case PIPE_ITEM_TYPE_MIGRATE_DATA:
display_channel_marshall_migrate_data(rcc, m);
@@ -8410,7 +8410,7 @@ static void display_channel_send_item(RedChannelClient *rcc, PipeItem *pipe_item
break;
case PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE:
red_reset_palette_cache(dcc);
- red_marshall_verb(rcc, SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES);
+ red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES, NULL);
break;
case PIPE_ITEM_TYPE_CREATE_SURFACE: {
SurfaceCreateItem *surface_create = SPICE_CONTAINEROF(pipe_item, SurfaceCreateItem,
diff --git a/server/red_worker.h b/server/red_worker.h
index 502283e..c828d99 100644
--- a/server/red_worker.h
+++ b/server/red_worker.h
@@ -74,10 +74,10 @@ typedef struct VerbItem {
uint16_t verb;
} VerbItem;
-static inline void red_marshall_verb(RedChannelClient *rcc, uint16_t verb)
+static inline void red_marshall_verb(RedChannelClient *rcc, VerbItem *item)
{
spice_assert(rcc);
- red_channel_client_init_send_data(rcc, verb, NULL);
+ red_channel_client_init_send_data(rcc, item->verb, NULL);
}
static inline void red_pipe_add_verb(RedChannelClient* rcc, uint16_t verb)
commit 26005ddb042f7445aec4b6ea795af486dc0b42b8
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date: Thu Oct 29 16:54:41 2015 -0500
Remove unused parameter from cursor_channel_new()
cursor_channel_new() is only called from one location, and always passes
FALSE as the value for the 'migrate' paramater. In addition, this
parameter is not used within the function. Remove it.
Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 6cc2b93..ee6520f 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -357,7 +357,7 @@ static void cursor_channel_release_item(RedChannelClient *rcc, PipeItem *item, i
}
}
-CursorChannel* cursor_channel_new(RedWorker *worker, int migrate)
+CursorChannel* cursor_channel_new(RedWorker *worker)
{
CursorChannel* cursor;
diff --git a/server/cursor-channel.h b/server/cursor-channel.h
index 2c19859..6a26bdb 100644
--- a/server/cursor-channel.h
+++ b/server/cursor-channel.h
@@ -77,7 +77,7 @@ typedef struct CursorChannel {
G_STATIC_ASSERT(sizeof(CursorItem) <= QXL_CURSUR_DEVICE_DATA_SIZE);
-CursorChannel* cursor_channel_new (RedWorker *worker, int migrate);
+CursorChannel* cursor_channel_new (RedWorker *worker);
void cursor_channel_disconnect (RedChannel *channel);
void cursor_channel_reset (CursorChannel *cursor);
void cursor_channel_process_cmd (CursorChannel *cursor, RedCursorCmd *cursor_cmd,
diff --git a/server/red_worker.c b/server/red_worker.c
index c8e4b2c..9a4869f 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -10632,7 +10632,7 @@ void handle_dev_cursor_channel_create(void *opaque, void *payload)
// TODO: handle seemless migration. Temp, setting migrate to FALSE
if (!worker->cursor_channel) {
- worker->cursor_channel = cursor_channel_new(worker, FALSE);
+ worker->cursor_channel = cursor_channel_new(worker);
}
red_channel = &worker->cursor_channel->common.base;
send_data(worker->channel, &red_channel, sizeof(RedChannel *));
More information about the Spice-commits
mailing list