summaryrefslogtreecommitdiffstats
path: root/server/red_worker.h
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2015-10-27 16:04:05 +0000
committerFrediano Ziglio <fziglio@redhat.com>2015-10-29 09:58:25 +0000
commit070e0fcd634ca29abfdd73bc8a2ac12958915072 (patch)
tree17413dd4e04d2412c207a7295d7dab4221531803 /server/red_worker.h
parent266d344b7fbbaa79f4112a62dc573e448239a2a8 (diff)
downloadspice-070e0fcd634ca29abfdd73bc8a2ac12958915072.tar.gz
spice-070e0fcd634ca29abfdd73bc8a2ac12958915072.tar.xz
spice-070e0fcd634ca29abfdd73bc8a2ac12958915072.zip
worker: move some cursor code to cursor-channel.c
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Diffstat (limited to 'server/red_worker.h')
-rw-r--r--server/red_worker.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/server/red_worker.h b/server/red_worker.h
index 0f5fac76..502283e9 100644
--- a/server/red_worker.h
+++ b/server/red_worker.h
@@ -32,6 +32,8 @@ typedef struct CommonChannelClient {
int is_low_bandwidth;
} CommonChannelClient;
+#define DISPLAY_CLIENT_TIMEOUT 30000000000ULL //nano
+
#define CHANNEL_RECEIVE_BUF_SIZE 1024
typedef struct CommonChannel {
RedChannel base; // Must be the first thing
@@ -45,7 +47,97 @@ typedef struct CommonChannel {
of the primary surface) */
} CommonChannel;
+enum {
+ PIPE_ITEM_TYPE_DRAW = PIPE_ITEM_TYPE_CHANNEL_BASE,
+ PIPE_ITEM_TYPE_INVAL_ONE,
+ PIPE_ITEM_TYPE_CURSOR,
+ PIPE_ITEM_TYPE_CURSOR_INIT,
+ PIPE_ITEM_TYPE_IMAGE,
+ PIPE_ITEM_TYPE_STREAM_CREATE,
+ PIPE_ITEM_TYPE_STREAM_CLIP,
+ PIPE_ITEM_TYPE_STREAM_DESTROY,
+ PIPE_ITEM_TYPE_UPGRADE,
+ PIPE_ITEM_TYPE_VERB,
+ PIPE_ITEM_TYPE_MIGRATE_DATA,
+ PIPE_ITEM_TYPE_PIXMAP_SYNC,
+ PIPE_ITEM_TYPE_PIXMAP_RESET,
+ PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE,
+ PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE,
+ PIPE_ITEM_TYPE_CREATE_SURFACE,
+ PIPE_ITEM_TYPE_DESTROY_SURFACE,
+ PIPE_ITEM_TYPE_MONITORS_CONFIG,
+ PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT,
+};
+
+typedef struct VerbItem {
+ PipeItem base;
+ uint16_t verb;
+} VerbItem;
+
+static inline void red_marshall_verb(RedChannelClient *rcc, uint16_t verb)
+{
+ spice_assert(rcc);
+ red_channel_client_init_send_data(rcc, verb, NULL);
+}
+
+static inline void red_pipe_add_verb(RedChannelClient* rcc, uint16_t verb)
+{
+ VerbItem *item = spice_new(VerbItem, 1);
+
+ red_channel_pipe_item_init(rcc->channel, &item->base, PIPE_ITEM_TYPE_VERB);
+ item->verb = verb;
+ red_channel_client_pipe_add(rcc, &item->base);
+}
+
+/* a generic safe for loop macro */
+#define SAFE_FOREACH(link, next, cond, ring, data, get_data) \
+ for ((((link) = ((cond) ? ring_get_head(ring) : NULL)), \
+ ((next) = ((link) ? ring_next((ring), (link)) : NULL)), \
+ ((data) = ((link)? (get_data) : NULL))); \
+ (link); \
+ (((link) = (next)), \
+ ((next) = ((link) ? ring_next((ring), (link)) : NULL)), \
+ ((data) = ((link)? (get_data) : NULL))))
+
+#define LINK_TO_RCC(ptr) SPICE_CONTAINEROF(ptr, RedChannelClient, channel_link)
+#define RCC_FOREACH_SAFE(link, next, rcc, channel) \
+ SAFE_FOREACH(link, next, channel, &(channel)->clients, rcc, LINK_TO_RCC(link))
+
+
+static inline void red_pipes_add_verb(RedChannel *channel, uint16_t verb)
+{
+ RedChannelClient *rcc;
+ RingItem *link, *next;
+
+ RCC_FOREACH_SAFE(link, next, rcc, channel) {
+ red_pipe_add_verb(rcc, verb);
+ }
+}
+
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,
+ channel_send_pipe_item_proc send_item,
+ channel_hold_pipe_item_proc hold_item,
+ channel_release_pipe_item_proc release_item,
+ channel_handle_parsed_proc handle_parsed,
+ channel_handle_migrate_flush_mark_proc handle_migrate_flush_mark,
+ channel_handle_migrate_data_proc handle_migrate_data,
+ channel_handle_migrate_data_get_serial_proc migrate_get_serial);
#endif