mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-26 22:48:19 +00:00
CommonChannel -> CommonGraphicsChannel
Rename this struct to make it clear that it's only the base class for graphics channels (e.g. display and cursor), not all channels. Also renamed CommonChannelClient to CommonGraphicsChannelClient. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Pavel Grunt <pgrunt@redhat.com>
This commit is contained in:
parent
af3aa4b1f4
commit
3644783e24
@ -51,7 +51,7 @@ typedef struct CursorPipeItem {
|
||||
} CursorPipeItem;
|
||||
|
||||
struct CursorChannel {
|
||||
CommonChannel common; // Must be the first thing
|
||||
CommonGraphicsChannel common; // Must be the first thing
|
||||
|
||||
CursorItem *item;
|
||||
int cursor_visible;
|
||||
@ -66,7 +66,7 @@ struct CursorChannel {
|
||||
};
|
||||
|
||||
struct CursorChannelClient {
|
||||
CommonChannelClient common;
|
||||
CommonGraphicsChannelClient common;
|
||||
|
||||
CacheItem *cursor_cache[CURSOR_CACHE_HASH_SIZE];
|
||||
Ring cursor_cache_lru;
|
||||
@ -415,7 +415,7 @@ static void cursor_channel_release_item(RedChannelClient *rcc, PipeItem *item, i
|
||||
CursorChannel* cursor_channel_new(RedWorker *worker)
|
||||
{
|
||||
CursorChannel *cursor_channel;
|
||||
CommonChannel *channel = NULL;
|
||||
CommonGraphicsChannel *channel = NULL;
|
||||
ChannelCbs cbs = {
|
||||
.on_disconnect = cursor_channel_client_on_disconnect,
|
||||
.send_item = cursor_channel_send_item,
|
||||
@ -458,15 +458,15 @@ CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor, RedClient
|
||||
spice_return_val_if_fail(!num_caps || caps, NULL);
|
||||
|
||||
CursorChannelClient *ccc =
|
||||
(CursorChannelClient*)common_channel_new_client(&cursor->common,
|
||||
sizeof(CursorChannelClient),
|
||||
client, stream,
|
||||
mig_target,
|
||||
FALSE,
|
||||
common_caps,
|
||||
num_common_caps,
|
||||
caps,
|
||||
num_caps);
|
||||
(CursorChannelClient*)common_graphics_channel_new_client(&cursor->common,
|
||||
sizeof(CursorChannelClient),
|
||||
client, stream,
|
||||
mig_target,
|
||||
FALSE,
|
||||
common_caps,
|
||||
num_common_caps,
|
||||
caps,
|
||||
num_caps);
|
||||
spice_return_val_if_fail(ccc != NULL, NULL);
|
||||
|
||||
ring_init(&ccc->cursor_cache_lru);
|
||||
@ -547,7 +547,7 @@ void cursor_channel_init(CursorChannel *cursor, CursorChannelClient *client)
|
||||
spice_return_if_fail(cursor);
|
||||
|
||||
if (!red_channel_is_connected(&cursor->common.base)
|
||||
|| COMMON_CHANNEL(cursor)->during_target_migrate) {
|
||||
|| COMMON_GRAPHICS_CHANNEL(cursor)->during_target_migrate) {
|
||||
spice_debug("during_target_migrate: skip init");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -368,8 +368,8 @@ DisplayChannelClient *dcc_new(DisplayChannel *display,
|
||||
{
|
||||
DisplayChannelClient *dcc;
|
||||
|
||||
dcc = (DisplayChannelClient*)common_channel_new_client(
|
||||
COMMON_CHANNEL(display), sizeof(DisplayChannelClient),
|
||||
dcc = (DisplayChannelClient*)common_graphics_channel_new_client(
|
||||
COMMON_GRAPHICS_CHANNEL(display), sizeof(DisplayChannelClient),
|
||||
client, stream, mig_target, TRUE,
|
||||
common_caps, num_common_caps,
|
||||
caps, num_caps);
|
||||
@ -627,7 +627,7 @@ void dcc_destroy_surface(DisplayChannelClient *dcc, uint32_t surface_id)
|
||||
display = DCC_TO_DC(dcc);
|
||||
channel = RED_CHANNEL(display);
|
||||
|
||||
if (COMMON_CHANNEL(display)->during_target_migrate ||
|
||||
if (COMMON_GRAPHICS_CHANNEL(display)->during_target_migrate ||
|
||||
!dcc->surface_client_created[surface_id]) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ typedef struct FreeList {
|
||||
} FreeList;
|
||||
|
||||
struct DisplayChannelClient {
|
||||
CommonChannelClient common;
|
||||
CommonGraphicsChannelClient common;
|
||||
uint32_t id;
|
||||
SpiceImageCompression image_compression;
|
||||
spice_wan_compression_t jpeg_state;
|
||||
@ -116,7 +116,7 @@ struct DisplayChannelClient {
|
||||
};
|
||||
|
||||
#define DCC_TO_WORKER(dcc) \
|
||||
(SPICE_CONTAINEROF((dcc)->common.base.channel, CommonChannel, base)->worker)
|
||||
(SPICE_CONTAINEROF((dcc)->common.base.channel, CommonGraphicsChannel, base)->worker)
|
||||
#define DCC_TO_DC(dcc) \
|
||||
SPICE_CONTAINEROF((dcc)->common.base.channel, DisplayChannel, common.base)
|
||||
#define RCC_TO_DCC(rcc) SPICE_CONTAINEROF((rcc), DisplayChannelClient, common.base)
|
||||
|
||||
@ -164,7 +164,7 @@ struct _Drawable {
|
||||
};
|
||||
|
||||
struct DisplayChannel {
|
||||
CommonChannel common; // Must be the first thing
|
||||
CommonGraphicsChannel common; // Must be the first thing
|
||||
uint32_t bits_unique;
|
||||
|
||||
MonitorsConfig *monitors_config;
|
||||
|
||||
@ -100,7 +100,7 @@ static int display_is_connected(RedWorker *worker)
|
||||
|
||||
static uint8_t *common_alloc_recv_buf(RedChannelClient *rcc, uint16_t type, uint32_t size)
|
||||
{
|
||||
CommonChannel *common = SPICE_CONTAINEROF(rcc->channel, CommonChannel, base);
|
||||
CommonGraphicsChannel *common = SPICE_CONTAINEROF(rcc->channel, CommonGraphicsChannel, base);
|
||||
|
||||
/* SPICE_MSGC_MIGRATE_DATA is the only client message whose size is dynamic */
|
||||
if (type == SPICE_MSGC_MIGRATE_DATA) {
|
||||
@ -400,7 +400,7 @@ static int common_channel_config_socket(RedChannelClient *rcc)
|
||||
RedClient *client = red_channel_client_get_client(rcc);
|
||||
MainChannelClient *mcc = red_client_get_main(client);
|
||||
RedsStream *stream = red_channel_client_get_stream(rcc);
|
||||
CommonChannelClient *ccc = COMMON_CHANNEL_CLIENT(rcc);
|
||||
CommonGraphicsChannelClient *ccc = COMMON_GRAPHICS_CHANNEL_CLIENT(rcc);
|
||||
int flags;
|
||||
int delay_val;
|
||||
|
||||
@ -432,16 +432,16 @@ static int common_channel_config_socket(RedChannelClient *rcc)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
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)
|
||||
CommonGraphicsChannelClient *common_graphics_channel_new_client(CommonGraphicsChannel *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,
|
||||
@ -449,7 +449,7 @@ CommonChannelClient *common_channel_new_client(CommonChannel *common,
|
||||
if (!rcc) {
|
||||
return NULL;
|
||||
}
|
||||
CommonChannelClient *common_cc = (CommonChannelClient*)rcc;
|
||||
CommonGraphicsChannelClient *common_cc = (CommonGraphicsChannelClient*)rcc;
|
||||
common->during_target_migrate = mig_target;
|
||||
|
||||
// TODO: move wide/narrow ack setting to red_channel.
|
||||
@ -460,14 +460,14 @@ CommonChannelClient *common_channel_new_client(CommonChannel *common,
|
||||
}
|
||||
|
||||
|
||||
CommonChannel *red_worker_new_channel(RedWorker *worker, int size,
|
||||
const char *name,
|
||||
uint32_t channel_type, int migration_flags,
|
||||
ChannelCbs *channel_cbs,
|
||||
channel_handle_parsed_proc handle_parsed)
|
||||
CommonGraphicsChannel *red_worker_new_channel(RedWorker *worker, int size,
|
||||
const char *name,
|
||||
uint32_t channel_type, int migration_flags,
|
||||
ChannelCbs *channel_cbs,
|
||||
channel_handle_parsed_proc handle_parsed)
|
||||
{
|
||||
RedChannel *channel = NULL;
|
||||
CommonChannel *common;
|
||||
CommonGraphicsChannel *common;
|
||||
|
||||
spice_return_val_if_fail(worker, NULL);
|
||||
spice_return_val_if_fail(channel_cbs, NULL);
|
||||
@ -489,7 +489,7 @@ CommonChannel *red_worker_new_channel(RedWorker *worker, int size,
|
||||
spice_return_val_if_fail(channel, NULL);
|
||||
red_channel_set_stat_node(channel, stat_add_node(reds, worker->stat, name, TRUE));
|
||||
|
||||
common = (CommonChannel *)channel;
|
||||
common = (CommonGraphicsChannel *)channel;
|
||||
common->qxl = worker->qxl;
|
||||
return common;
|
||||
}
|
||||
@ -808,7 +808,7 @@ static void handle_dev_start(void *opaque, void *payload)
|
||||
|
||||
spice_assert(!worker->running);
|
||||
if (worker->cursor_channel) {
|
||||
COMMON_CHANNEL(worker->cursor_channel)->during_target_migrate = FALSE;
|
||||
COMMON_GRAPHICS_CHANNEL(worker->cursor_channel)->during_target_migrate = FALSE;
|
||||
}
|
||||
if (worker->display_channel) {
|
||||
worker->display_channel->common.during_target_migrate = FALSE;
|
||||
|
||||
@ -24,17 +24,17 @@
|
||||
|
||||
typedef struct RedWorker RedWorker;
|
||||
|
||||
typedef struct CommonChannelClient {
|
||||
typedef struct CommonGraphicsChannelClient {
|
||||
RedChannelClient base;
|
||||
|
||||
int is_low_bandwidth;
|
||||
} CommonChannelClient;
|
||||
} CommonGraphicsChannelClient;
|
||||
|
||||
#define COMMON_CHANNEL_CLIENT(Client) ((CommonChannelClient*)(Client))
|
||||
#define COMMON_GRAPHICS_CHANNEL_CLIENT(Client) ((CommonGraphicsChannelClient*)(Client))
|
||||
#define COMMON_CLIENT_TIMEOUT (NSEC_PER_SEC * 30)
|
||||
|
||||
#define CHANNEL_RECEIVE_BUF_SIZE 1024
|
||||
typedef struct CommonChannel {
|
||||
typedef struct CommonGraphicsChannel {
|
||||
RedChannel base; // Must be the first thing
|
||||
|
||||
QXLInstance *qxl;
|
||||
@ -45,9 +45,9 @@ typedef struct CommonChannel {
|
||||
The flag is used to avoid sending messages that are artifacts
|
||||
of the transition from stopped vm to loaded vm (e.g., recreation
|
||||
of the primary surface) */
|
||||
} CommonChannel;
|
||||
} CommonGraphicsChannel;
|
||||
|
||||
#define COMMON_CHANNEL(Channel) ((CommonChannel*)(Channel))
|
||||
#define COMMON_GRAPHICS_CHANNEL(Channel) ((CommonGraphicsChannel*)(Channel))
|
||||
|
||||
enum {
|
||||
PIPE_ITEM_TYPE_VERB = PIPE_ITEM_TYPE_CHANNEL_BASE,
|
||||
@ -97,21 +97,21 @@ RedChannel* red_worker_get_display_channel(RedWorker *worker);
|
||||
|
||||
void red_drawable_unref(RedDrawable *red_drawable);
|
||||
|
||||
CommonChannel *red_worker_new_channel(RedWorker *worker, int size,
|
||||
const char *name,
|
||||
uint32_t channel_type, int migration_flags,
|
||||
ChannelCbs *channel_cbs,
|
||||
channel_handle_parsed_proc handle_parsed);
|
||||
CommonGraphicsChannel *red_worker_new_channel(RedWorker *worker, int size,
|
||||
const char *name,
|
||||
uint32_t channel_type, int migration_flags,
|
||||
ChannelCbs *channel_cbs,
|
||||
channel_handle_parsed_proc handle_parsed);
|
||||
|
||||
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);
|
||||
CommonGraphicsChannelClient *common_graphics_channel_new_client(CommonGraphicsChannel *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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user