[Spice-devel] [PATCH v2 08/10] Add DisplayChannelClientPrivate and CursorChannelPrivate structs
Jonathon Jongsma
jjongsma at redhat.com
Wed Sep 7 20:37:26 UTC 2016
These need to be introduced at the same time since cache-item.tmpl.c
assumes that both of these classes will have a cache in the same place:
either within the channel client struct itself or (now) within a priv
struct owned by the channel client.
This encapsulates private data and prepares for porting to GObject.
---
Changes in v2:
- Fixed leak of priv by using 1-element array trick
server/cache-item.tmpl.c | 38 +++++-----
server/cursor-channel-client.c | 16 ++--
server/dcc-private.h | 14 +++-
server/dcc-send.c | 114 ++++++++++++++--------------
server/dcc.c | 165 +++++++++++++++++++++--------------------
5 files changed, 182 insertions(+), 165 deletions(-)
diff --git a/server/cache-item.tmpl.c b/server/cache-item.tmpl.c
index d1310a5..ce38a2a 100644
--- a/server/cache-item.tmpl.c
+++ b/server/cache-item.tmpl.c
@@ -46,12 +46,12 @@
static RedCacheItem *FUNC_NAME(find)(CHANNELCLIENT *channel_client, uint64_t id)
{
- RedCacheItem *item = channel_client->CACHE_NAME[CACHE_HASH_KEY(id)];
+ RedCacheItem *item = channel_client->priv->CACHE_NAME[CACHE_HASH_KEY(id)];
while (item) {
if (item->id == id) {
ring_remove(&item->u.cache_data.lru_link);
- ring_add(&channel_client->VAR_NAME(lru), &item->u.cache_data.lru_link);
+ ring_add(&channel_client->priv->VAR_NAME(lru), &item->u.cache_data.lru_link);
break;
}
item = item->u.cache_data.next;
@@ -64,7 +64,7 @@ static void FUNC_NAME(remove)(CHANNELCLIENT *channel_client, RedCacheItem *item)
RedCacheItem **now;
spice_assert(item);
- now = &channel_client->CACHE_NAME[CACHE_HASH_KEY(item->id)];
+ now = &channel_client->priv->CACHE_NAME[CACHE_HASH_KEY(item->id)];
for (;;) {
spice_assert(*now);
if (*now == item) {
@@ -74,8 +74,8 @@ static void FUNC_NAME(remove)(CHANNELCLIENT *channel_client, RedCacheItem *item)
now = &(*now)->u.cache_data.next;
}
ring_remove(&item->u.cache_data.lru_link);
- channel_client->VAR_NAME(items)--;
- channel_client->VAR_NAME(available) += item->u.cache_data.size;
+ channel_client->priv->VAR_NAME(items)--;
+ channel_client->priv->VAR_NAME(available) += item->u.cache_data.size;
red_pipe_item_init(&item->u.pipe_data, RED_PIPE_ITEM_TYPE_INVAL_ONE);
red_channel_client_pipe_add_tail_and_push(&channel_client->base, &item->u.pipe_data); // for now
@@ -88,22 +88,22 @@ static int FUNC_NAME(add)(CHANNELCLIENT *channel_client, uint64_t id, size_t siz
item = spice_new(RedCacheItem, 1);
- channel_client->VAR_NAME(available) -= size;
+ channel_client->priv->VAR_NAME(available) -= size;
verify(SPICE_OFFSETOF(RedCacheItem, u.cache_data.lru_link) == 0);
- while (channel_client->VAR_NAME(available) < 0) {
- RedCacheItem *tail = (RedCacheItem *)ring_get_tail(&channel_client->VAR_NAME(lru));
+ while (channel_client->priv->VAR_NAME(available) < 0) {
+ RedCacheItem *tail = (RedCacheItem *)ring_get_tail(&channel_client->priv->VAR_NAME(lru));
if (!tail) {
- channel_client->VAR_NAME(available) += size;
+ channel_client->priv->VAR_NAME(available) += size;
free(item);
return FALSE;
}
FUNC_NAME(remove)(channel_client, tail);
}
- ++channel_client->VAR_NAME(items);
- item->u.cache_data.next = channel_client->CACHE_NAME[(key = CACHE_HASH_KEY(id))];
- channel_client->CACHE_NAME[key] = item;
+ ++channel_client->priv->VAR_NAME(items);
+ item->u.cache_data.next = channel_client->priv->CACHE_NAME[(key = CACHE_HASH_KEY(id))];
+ channel_client->priv->CACHE_NAME[key] = item;
ring_item_init(&item->u.cache_data.lru_link);
- ring_add(&channel_client->VAR_NAME(lru), &item->u.cache_data.lru_link);
+ ring_add(&channel_client->priv->VAR_NAME(lru), &item->u.cache_data.lru_link);
item->id = id;
item->u.cache_data.size = size;
return TRUE;
@@ -114,15 +114,15 @@ static void FUNC_NAME(reset)(CHANNELCLIENT *channel_client, long size)
int i;
for (i = 0; i < CACHE_HASH_SIZE; i++) {
- while (channel_client->CACHE_NAME[i]) {
- RedCacheItem *item = channel_client->CACHE_NAME[i];
- channel_client->CACHE_NAME[i] = item->u.cache_data.next;
+ while (channel_client->priv->CACHE_NAME[i]) {
+ RedCacheItem *item = channel_client->priv->CACHE_NAME[i];
+ channel_client->priv->CACHE_NAME[i] = item->u.cache_data.next;
free(item);
}
}
- ring_init(&channel_client->VAR_NAME(lru));
- channel_client->VAR_NAME(available) = size;
- channel_client->VAR_NAME(items) = 0;
+ ring_init(&channel_client->priv->VAR_NAME(lru));
+ channel_client->priv->VAR_NAME(available) = size;
+ channel_client->priv->VAR_NAME(items) = 0;
}
diff --git a/server/cursor-channel-client.c b/server/cursor-channel-client.c
index 4a29f98..bbcc290 100644
--- a/server/cursor-channel-client.c
+++ b/server/cursor-channel-client.c
@@ -40,15 +40,21 @@ enum {
RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE,
};
-struct CursorChannelClient {
- RedChannelClient base;
-
+typedef struct CursorChannelClientPrivate CursorChannelClientPrivate;
+struct CursorChannelClientPrivate
+{
RedCacheItem *cursor_cache[CURSOR_CACHE_HASH_SIZE];
Ring cursor_cache_lru;
long cursor_cache_available;
uint32_t cursor_cache_items;
};
+struct CursorChannelClient
+{
+ RedChannelClient base;
+
+ CursorChannelClientPrivate priv[1];
+};
#define CLIENT_CURSOR_CACHE
#include "cache-item.tmpl.c"
@@ -102,8 +108,8 @@ CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor, RedClient
spice_return_val_if_fail(ccc != NULL, NULL);
COMMON_GRAPHICS_CHANNEL(cursor)->during_target_migrate = mig_target;
- ring_init(&ccc->cursor_cache_lru);
- ccc->cursor_cache_available = CLIENT_CURSOR_CACHE_SIZE;
+ ring_init(&ccc->priv->cursor_cache_lru);
+ ccc->priv->cursor_cache_available = CLIENT_CURSOR_CACHE_SIZE;
return ccc;
}
diff --git a/server/dcc-private.h b/server/dcc-private.h
index d5aad3f..46f1db3 100644
--- a/server/dcc-private.h
+++ b/server/dcc-private.h
@@ -24,9 +24,9 @@
#include "stream.h"
#include "red-channel-client.h"
-struct DisplayChannelClient {
- RedChannelClient base;
- int is_low_bandwidth;
+typedef struct DisplayChannelClientPrivate DisplayChannelClientPrivate;
+struct DisplayChannelClientPrivate
+{
uint32_t id;
SpiceImageCompression image_compression;
spice_wan_compression_t jpeg_state;
@@ -61,4 +61,12 @@ struct DisplayChannelClient {
bool gl_draw_ongoing;
};
+struct DisplayChannelClient
+{
+ RedChannelClient base;
+ int is_low_bandwidth;
+
+ DisplayChannelClientPrivate priv[1];
+};
+
#endif /* DCC_PRIVATE_H_ */
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 7c9f4e1..aabe262 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -51,7 +51,7 @@ typedef struct BitmapData {
static int dcc_pixmap_cache_unlocked_hit(DisplayChannelClient *dcc, uint64_t id, int *lossy)
{
- PixmapCache *cache = dcc->pixmap_cache;
+ PixmapCache *cache = dcc->priv->pixmap_cache;
NewCacheItem *item;
uint64_t serial;
@@ -62,9 +62,9 @@ static int dcc_pixmap_cache_unlocked_hit(DisplayChannelClient *dcc, uint64_t id,
if (item->id == id) {
ring_remove(&item->lru_link);
ring_add(&cache->lru, &item->lru_link);
- spice_assert(dcc->id < MAX_CACHE_CLIENTS);
- item->sync[dcc->id] = serial;
- cache->sync[dcc->id] = serial;
+ spice_assert(dcc->priv->id < MAX_CACHE_CLIENTS);
+ item->sync[dcc->priv->id] = serial;
+ cache->sync[dcc->priv->id] = serial;
*lossy = item->lossy;
break;
}
@@ -77,7 +77,7 @@ static int dcc_pixmap_cache_unlocked_hit(DisplayChannelClient *dcc, uint64_t id,
static int dcc_pixmap_cache_hit(DisplayChannelClient *dcc, uint64_t id, int *lossy)
{
int hit;
- PixmapCache *cache = dcc->pixmap_cache;
+ PixmapCache *cache = dcc->priv->pixmap_cache;
pthread_mutex_lock(&cache->lock);
hit = dcc_pixmap_cache_unlocked_hit(dcc, id, lossy);
@@ -97,7 +97,7 @@ static int is_surface_area_lossy(DisplayChannelClient *dcc, uint32_t surface_id,
spice_return_val_if_fail(validate_surface(display, surface_id), FALSE);
surface = &display->surfaces[surface_id];
- surface_lossy_region = &dcc->surface_client_lossy_region[surface_id];
+ surface_lossy_region = &dcc->priv->surface_client_lossy_region[surface_id];
if (!area) {
if (region_is_empty(surface_lossy_region)) {
@@ -206,7 +206,7 @@ static void red_display_add_image_to_pixmap_cache(RedChannelClient *rcc,
image->descriptor.width * image->descriptor.height,
is_lossy)) {
io_image->descriptor.flags |= SPICE_IMAGE_FLAGS_CACHE_ME;
- dcc->send_data.pixmap_cache_items[dcc->send_data.num_pixmap_cache_items++] =
+ dcc->priv->send_data.pixmap_cache_items[dcc->priv->send_data.num_pixmap_cache_items++] =
image->descriptor.id;
stat_inc_counter(reds, display_channel->add_to_cache_counter, 1);
}
@@ -242,7 +242,7 @@ static void marshal_sub_msg_inval_list_wait(SpiceMarshaller *m,
static void send_free_list_legacy(RedChannelClient *rcc)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
- FreeList *free_list = &dcc->send_data.free_list;
+ FreeList *free_list = &dcc->priv->send_data.free_list;
SpiceMarshaller *marshaller;
int sub_list_len = 1;
SpiceMarshaller *wait_m = NULL;
@@ -273,7 +273,7 @@ static void send_free_list_legacy(RedChannelClient *rcc)
static void send_free_list(RedChannelClient *rcc)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
- FreeList *free_list = &dcc->send_data.free_list;
+ FreeList *free_list = &dcc->priv->send_data.free_list;
int sub_list_len = 1;
SpiceMarshaller *urgent_marshaller;
SpiceMarshaller *wait_m = NULL;
@@ -284,14 +284,14 @@ static void send_free_list(RedChannelClient *rcc)
int i;
urgent_marshaller = red_channel_client_switch_to_urgent_sender(rcc);
- for (i = 0; i < dcc->send_data.num_pixmap_cache_items; i++) {
+ for (i = 0; i < dcc->priv->send_data.num_pixmap_cache_items; i++) {
int dummy;
/* When using the urgent marshaller, the serial number of the message that is
* going to be sent right after the SPICE_MSG_LIST, is increased by one.
* But all this message pixmaps cache references used its old serial.
* we use pixmap_cache_items to collect these pixmaps, and we update their serial
* by calling pixmap_cache_hit. */
- dcc_pixmap_cache_hit(dcc, dcc->send_data.pixmap_cache_items[i], &dummy);
+ dcc_pixmap_cache_hit(dcc, dcc->priv->send_data.pixmap_cache_items[i], &dummy);
}
if (free_list->wait.header.wait_count) {
@@ -377,13 +377,13 @@ static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
if (simage->descriptor.flags & SPICE_IMAGE_FLAGS_HIGH_BITS_SET) {
image.descriptor.flags = SPICE_IMAGE_FLAGS_HIGH_BITS_SET;
}
- pthread_mutex_lock(&dcc->pixmap_cache->lock);
+ pthread_mutex_lock(&dcc->priv->pixmap_cache->lock);
if ((simage->descriptor.flags & SPICE_IMAGE_FLAGS_CACHE_ME)) {
int lossy_cache_item;
if (dcc_pixmap_cache_unlocked_hit(dcc, image.descriptor.id, &lossy_cache_item)) {
- dcc->send_data.pixmap_cache_items[dcc->send_data.num_pixmap_cache_items++] =
- image.descriptor.id;
+ dcc->priv->send_data.pixmap_cache_items[dcc->priv->send_data.num_pixmap_cache_items++] =
+ image.descriptor.id;
if (can_lossy || !lossy_cache_item) {
if (!display->enable_jpeg || lossy_cache_item) {
image.descriptor.type = SPICE_IMAGE_TYPE_FROM_CACHE;
@@ -398,10 +398,10 @@ static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
spice_assert(bitmap_palette_out == NULL);
spice_assert(lzplt_palette_out == NULL);
stat_inc_counter(reds, display->cache_hits_counter, 1);
- pthread_mutex_unlock(&dcc->pixmap_cache->lock);
+ pthread_mutex_unlock(&dcc->priv->pixmap_cache->lock);
return FILL_BITS_TYPE_CACHE;
} else {
- pixmap_cache_unlocked_set_lossy(dcc->pixmap_cache, simage->descriptor.id,
+ pixmap_cache_unlocked_set_lossy(dcc->priv->pixmap_cache, simage->descriptor.id,
FALSE);
image.descriptor.flags |= SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME;
}
@@ -416,7 +416,7 @@ static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
surface_id = simage->u.surface.surface_id;
if (!validate_surface(display, surface_id)) {
spice_warning("Invalid surface in SPICE_IMAGE_TYPE_SURFACE");
- pthread_mutex_unlock(&dcc->pixmap_cache->lock);
+ pthread_mutex_unlock(&dcc->priv->pixmap_cache->lock);
return FILL_BITS_TYPE_SURFACE;
}
@@ -431,7 +431,7 @@ static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
&bitmap_palette_out, &lzplt_palette_out);
spice_assert(bitmap_palette_out == NULL);
spice_assert(lzplt_palette_out == NULL);
- pthread_mutex_unlock(&dcc->pixmap_cache->lock);
+ pthread_mutex_unlock(&dcc->priv->pixmap_cache->lock);
return FILL_BITS_TYPE_SURFACE;
}
case SPICE_IMAGE_TYPE_BITMAP: {
@@ -463,7 +463,7 @@ static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
}
spice_marshaller_add_ref_chunks(m, bitmap->data);
- pthread_mutex_unlock(&dcc->pixmap_cache->lock);
+ pthread_mutex_unlock(&dcc->priv->pixmap_cache->lock);
return FILL_BITS_TYPE_BITMAP;
} else {
red_display_add_image_to_pixmap_cache(rcc, simage, &image,
@@ -481,7 +481,7 @@ static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
}
spice_assert(!comp_send_data.is_lossy || can_lossy);
- pthread_mutex_unlock(&dcc->pixmap_cache->lock);
+ pthread_mutex_unlock(&dcc->priv->pixmap_cache->lock);
return (comp_send_data.is_lossy ? FILL_BITS_TYPE_COMPRESS_LOSSY :
FILL_BITS_TYPE_COMPRESS_LOSSLESS);
}
@@ -495,12 +495,12 @@ static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
spice_assert(bitmap_palette_out == NULL);
spice_assert(lzplt_palette_out == NULL);
spice_marshaller_add_ref_chunks(m, image.u.quic.data);
- pthread_mutex_unlock(&dcc->pixmap_cache->lock);
+ pthread_mutex_unlock(&dcc->priv->pixmap_cache->lock);
return FILL_BITS_TYPE_COMPRESS_LOSSLESS;
default:
spice_error("invalid image type %u", image.descriptor.type);
}
- pthread_mutex_unlock(&dcc->pixmap_cache->lock);
+ pthread_mutex_unlock(&dcc->priv->pixmap_cache->lock);
return FILL_BITS_TYPE_INVALID;
}
@@ -510,12 +510,12 @@ static void fill_mask(RedChannelClient *rcc, SpiceMarshaller *m,
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
if (mask_bitmap && m) {
- if (dcc->image_compression != SPICE_IMAGE_COMPRESSION_OFF) {
+ if (dcc->priv->image_compression != SPICE_IMAGE_COMPRESSION_OFF) {
/* todo: pass compression argument */
- SpiceImageCompression save_img_comp = dcc->image_compression;
- dcc->image_compression = SPICE_IMAGE_COMPRESSION_OFF;
+ SpiceImageCompression save_img_comp = dcc->priv->image_compression;
+ dcc->priv->image_compression = SPICE_IMAGE_COMPRESSION_OFF;
fill_bits(dcc, m, mask_bitmap, drawable, FALSE);
- dcc->image_compression = save_img_comp;
+ dcc->priv->image_compression = save_img_comp;
} else {
fill_bits(dcc, m, mask_bitmap, drawable, FALSE);
}
@@ -569,7 +569,7 @@ static void surface_lossy_region_update(DisplayChannelClient *dcc,
return;
}
- surface_lossy_region = &dcc->surface_client_lossy_region[item->surface_id];
+ surface_lossy_region = &dcc->priv->surface_client_lossy_region[item->surface_id];
drawable = item->red_drawable;
if (drawable->clip.type == SPICE_CLIP_TYPE_RECTS ) {
@@ -1706,10 +1706,10 @@ static int red_marshall_stream_data(RedChannelClient *rcc,
return FALSE;
}
- StreamAgent *agent = &dcc->stream_agents[get_stream_id(display, stream)];
+ StreamAgent *agent = &dcc->priv->stream_agents[get_stream_id(display, stream)];
uint64_t time_now = spice_get_monotonic_time_ns();
- if (!dcc->use_video_encoder_rate_control) {
+ if (!dcc->priv->use_video_encoder_rate_control) {
if (time_now - agent->last_send_time < (1000 * 1000 * 1000) / agent->fps) {
agent->frames--;
#ifdef STREAM_STATS
@@ -1733,7 +1733,7 @@ static int red_marshall_stream_data(RedChannelClient *rcc,
&outbuf);
switch (ret) {
case VIDEO_ENCODER_FRAME_DROP:
- spice_assert(dcc->use_video_encoder_rate_control);
+ spice_assert(dcc->priv->use_video_encoder_rate_control);
#ifdef STREAM_STATS
agent->stats.num_drops_fps++;
#endif
@@ -1811,7 +1811,7 @@ static void display_channel_marshall_migrate_data_surfaces(DisplayChannelClient
for (i = 0; i < NUM_SURFACES; i++) {
SpiceRect lossy_rect;
- if (!dcc->surface_client_created[i]) {
+ if (!dcc->priv->surface_client_created[i]) {
continue;
}
spice_marshaller_add_uint32(m2, i);
@@ -1820,7 +1820,7 @@ static void display_channel_marshall_migrate_data_surfaces(DisplayChannelClient
if (!lossy) {
continue;
}
- region_extents(&dcc->surface_client_lossy_region[i], &lossy_rect);
+ region_extents(&dcc->priv->surface_client_lossy_region[i], &lossy_rect);
spice_marshaller_add_int32(m2, lossy_rect.left);
spice_marshaller_add_int32(m2, lossy_rect.top);
spice_marshaller_add_int32(m2, lossy_rect.right);
@@ -1833,6 +1833,7 @@ static void display_channel_marshall_migrate_data(RedChannelClient *rcc,
{
DisplayChannel *display_channel;
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
+ ImageEncoders *encoders = dcc_get_encoders(dcc);
SpiceMigrateDataDisplay display_data = {0,};
display_channel = DCC_TO_DC(dcc);
@@ -1841,20 +1842,20 @@ static void display_channel_marshall_migrate_data(RedChannelClient *rcc,
spice_marshaller_add_uint32(base_marshaller, SPICE_MIGRATE_DATA_DISPLAY_MAGIC);
spice_marshaller_add_uint32(base_marshaller, SPICE_MIGRATE_DATA_DISPLAY_VERSION);
- spice_assert(dcc->pixmap_cache);
+ spice_assert(dcc->priv->pixmap_cache);
spice_assert(MIGRATE_DATA_DISPLAY_MAX_CACHE_CLIENTS == 4 &&
MIGRATE_DATA_DISPLAY_MAX_CACHE_CLIENTS == MAX_CACHE_CLIENTS);
display_data.message_serial = red_channel_client_get_message_serial(rcc);
- display_data.low_bandwidth_setting = dcc->is_low_bandwidth;
+ display_data.low_bandwidth_setting = dcc_is_low_bandwidth(dcc);
- display_data.pixmap_cache_freezer = pixmap_cache_freeze(dcc->pixmap_cache);
- display_data.pixmap_cache_id = dcc->pixmap_cache->id;
- display_data.pixmap_cache_size = dcc->pixmap_cache->size;
- memcpy(display_data.pixmap_cache_clients, dcc->pixmap_cache->sync,
+ display_data.pixmap_cache_freezer = pixmap_cache_freeze(dcc->priv->pixmap_cache);
+ display_data.pixmap_cache_id = dcc->priv->pixmap_cache->id;
+ display_data.pixmap_cache_size = dcc->priv->pixmap_cache->size;
+ memcpy(display_data.pixmap_cache_clients, dcc->priv->pixmap_cache->sync,
sizeof(display_data.pixmap_cache_clients));
- image_encoders_glz_get_restore_data(&dcc->encoders, &display_data.glz_dict_id,
+ image_encoders_glz_get_restore_data(encoders, &display_data.glz_dict_id,
&display_data.glz_dict_data);
/* all data besided the surfaces ref */
@@ -1872,7 +1873,7 @@ static void display_channel_marshall_pixmap_sync(RedChannelClient *rcc,
PixmapCache *pixmap_cache;
red_channel_client_init_send_data(rcc, SPICE_MSG_WAIT_FOR_CHANNELS, NULL);
- pixmap_cache = dcc->pixmap_cache;
+ pixmap_cache = dcc->priv->pixmap_cache;
pthread_mutex_lock(&pixmap_cache->lock);
@@ -1880,8 +1881,8 @@ static void display_channel_marshall_pixmap_sync(RedChannelClient *rcc,
wait.wait_list[0].channel_type = SPICE_CHANNEL_DISPLAY;
wait.wait_list[0].channel_id = pixmap_cache->generation_initiator.client;
wait.wait_list[0].message_serial = pixmap_cache->generation_initiator.message;
- dcc->pixmap_cache_generation = pixmap_cache->generation;
- dcc->pending_pixmaps_sync = FALSE;
+ dcc->priv->pixmap_cache_generation = pixmap_cache->generation;
+ dcc->priv->pending_pixmaps_sync = FALSE;
pthread_mutex_unlock(&pixmap_cache->lock);
@@ -1890,7 +1891,7 @@ static void display_channel_marshall_pixmap_sync(RedChannelClient *rcc,
static void dcc_pixmap_cache_reset(DisplayChannelClient *dcc, SpiceMsgWaitForChannels* sync_data)
{
- PixmapCache *cache = dcc->pixmap_cache;
+ PixmapCache *cache = dcc->priv->pixmap_cache;
uint8_t wait_count;
uint64_t serial;
uint32_t i;
@@ -1899,14 +1900,14 @@ static void dcc_pixmap_cache_reset(DisplayChannelClient *dcc, SpiceMsgWaitForCha
pthread_mutex_lock(&cache->lock);
pixmap_cache_clear(cache);
- dcc->pixmap_cache_generation = ++cache->generation;
- cache->generation_initiator.client = dcc->id;
+ dcc->priv->pixmap_cache_generation = ++cache->generation;
+ cache->generation_initiator.client = dcc->priv->id;
cache->generation_initiator.message = serial;
- cache->sync[dcc->id] = serial;
+ cache->sync[dcc->priv->id] = serial;
wait_count = 0;
for (i = 0; i < MAX_CACHE_CLIENTS; i++) {
- if (cache->sync[i] && i != dcc->id) {
+ if (cache->sync[i] && i != dcc->priv->id) {
sync_data->wait_list[wait_count].channel_type = SPICE_CHANNEL_DISPLAY;
sync_data->wait_list[wait_count].channel_id = i;
sync_data->wait_list[wait_count++].message_serial = cache->sync[i];
@@ -1993,7 +1994,7 @@ static void red_marshall_image(RedChannelClient *rcc,
int comp_succeeded = dcc_compress_image(dcc, &red_image, &bitmap, NULL, item->can_lossy, &comp_send_data);
- surface_lossy_region = &dcc->surface_client_lossy_region[item->surface_id];
+ surface_lossy_region = &dcc->priv->surface_client_lossy_region[item->surface_id];
if (comp_succeeded) {
spice_marshall_Image(src_bitmap_out, &red_image,
&bitmap_palette_out, &lzplt_palette_out);
@@ -2260,7 +2261,7 @@ static void marshall_surface_create(RedChannelClient *rcc,
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
- region_init(&dcc->surface_client_lossy_region[surface_create->surface_id]);
+ region_init(&dcc->priv->surface_client_lossy_region[surface_create->surface_id]);
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_SURFACE_CREATE, NULL);
spice_marshall_msg_display_surface_create(base_marshaller, surface_create);
@@ -2272,7 +2273,7 @@ static void marshall_surface_destroy(RedChannelClient *rcc,
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
SpiceMsgSurfaceDestroy surface_destroy;
- region_destroy(&dcc->surface_client_lossy_region[surface_id]);
+ region_destroy(&dcc->priv->surface_client_lossy_region[surface_id]);
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_SURFACE_DESTROY, NULL);
surface_destroy.surface_id = surface_id;
@@ -2312,7 +2313,7 @@ static void marshall_stream_activate_report(RedChannelClient *rcc,
uint32_t stream_id)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
- StreamAgent *agent = &dcc->stream_agents[stream_id];
+ StreamAgent *agent = &dcc->priv->stream_agents[stream_id];
SpiceMsgDisplayStreamActivateReport msg;
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT, NULL);
@@ -2353,14 +2354,14 @@ static void marshall_gl_draw(RedChannelClient *rcc,
static void begin_send_message(RedChannelClient *rcc)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
- FreeList *free_list = &dcc->send_data.free_list;
+ FreeList *free_list = &dcc->priv->send_data.free_list;
if (free_list->res->count) {
int sync_count = 0;
int i;
for (i = 0; i < MAX_CACHE_CLIENTS; i++) {
- if (i != dcc->id && free_list->sync[i] != 0) {
+ if (i != dcc->priv->id && free_list->sync[i] != 0) {
free_list->wait.header.wait_list[sync_count].channel_type = SPICE_CHANNEL_DISPLAY;
free_list->wait.header.wait_list[sync_count].channel_id = i;
free_list->wait.header.wait_list[sync_count++].message_serial = free_list->sync[i];
@@ -2379,9 +2380,10 @@ static void begin_send_message(RedChannelClient *rcc)
static void reset_send_data(DisplayChannelClient *dcc)
{
- dcc->send_data.free_list.res->count = 0;
- dcc->send_data.num_pixmap_cache_items = 0;
- memset(dcc->send_data.free_list.sync, 0, sizeof(dcc->send_data.free_list.sync));
+ dcc->priv->send_data.free_list.res->count = 0;
+ dcc->priv->send_data.num_pixmap_cache_items = 0;
+ memset(dcc->priv->send_data.free_list.sync, 0,
+ sizeof(dcc->priv->send_data.free_list.sync));
}
void dcc_send_item(RedChannelClient *rcc, RedPipeItem *pipe_item)
diff --git a/server/dcc.c b/server/dcc.c
index 87ef145..866be1b 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -154,7 +154,7 @@ void dcc_create_surface(DisplayChannelClient *dcc, int surface_id)
/* don't send redundant create surface commands to client */
if (!dcc || display->common.during_target_migrate ||
- dcc->surface_client_created[surface_id]) {
+ dcc->priv->surface_client_created[surface_id]) {
return;
}
surface = &display->surfaces[surface_id];
@@ -162,7 +162,7 @@ void dcc_create_surface(DisplayChannelClient *dcc, int surface_id)
surface_id, surface->context.width,
surface->context.height,
surface->context.format, flags);
- dcc->surface_client_created[surface_id] = TRUE;
+ dcc->priv->surface_client_created[surface_id] = TRUE;
red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &create->pipe_item);
}
@@ -264,7 +264,7 @@ static void add_drawable_surface_images(DisplayChannelClient *dcc, Drawable *dra
surface_id = drawable->surface_deps[x];
if (surface_id != -1) {
- if (dcc->surface_client_created[surface_id] == TRUE) {
+ if (dcc->priv->surface_client_created[surface_id] == TRUE) {
continue;
}
dcc_create_surface(dcc, surface_id);
@@ -273,7 +273,7 @@ static void add_drawable_surface_images(DisplayChannelClient *dcc, Drawable *dra
}
}
- if (dcc->surface_client_created[drawable->surface_id] == TRUE) {
+ if (dcc->priv->surface_client_created[drawable->surface_id] == TRUE) {
return;
}
@@ -342,12 +342,12 @@ static void dcc_init_stream_agents(DisplayChannelClient *dcc)
DisplayChannel *display = DCC_TO_DC(dcc);
for (i = 0; i < NUM_STREAMS; i++) {
- StreamAgent *agent = &dcc->stream_agents[i];
+ StreamAgent *agent = &dcc->priv->stream_agents[i];
agent->stream = &display->streams_buf[i];
region_init(&agent->vis_region);
region_init(&agent->clip);
}
- dcc->use_video_encoder_rate_control =
+ dcc->priv->use_video_encoder_rate_control =
red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(dcc), SPICE_DISPLAY_CAP_STREAM_REPORT);
}
@@ -371,27 +371,28 @@ DisplayChannelClient *dcc_new(DisplayChannel *display,
client, stream, TRUE,
num_common_caps, common_caps,
num_caps, caps);
+
display->common.during_target_migrate = mig_target;
- dcc->id = display->common.qxl->id;
+ dcc->priv->id = display->common.qxl->id;
spice_return_val_if_fail(dcc, NULL);
spice_info("New display (client %p) dcc %p stream %p", client, dcc, stream);
- ring_init(&dcc->palette_cache_lru);
- dcc->palette_cache_available = CLIENT_PALETTE_CACHE_SIZE;
- dcc->image_compression = image_compression;
- dcc->jpeg_state = jpeg_state;
- dcc->zlib_glz_state = zlib_glz_state;
+ ring_init(&dcc->priv->palette_cache_lru);
+ dcc->priv->palette_cache_available = CLIENT_PALETTE_CACHE_SIZE;
+ dcc->priv->image_compression = image_compression;
+ dcc->priv->jpeg_state = jpeg_state;
+ dcc->priv->zlib_glz_state = zlib_glz_state;
// TODO: tune quality according to bandwidth
- dcc->encoders.jpeg_quality = 85;
+ dcc->priv->encoders.jpeg_quality = 85;
- dcc->send_data.free_list.res =
+ dcc->priv->send_data.free_list.res =
spice_malloc(sizeof(SpiceResourceList) +
DISPLAY_FREE_LIST_DEFAULT_SIZE * sizeof(SpiceResourceID));
- dcc->send_data.free_list.res_size = DISPLAY_FREE_LIST_DEFAULT_SIZE;
+ dcc->priv->send_data.free_list.res_size = DISPLAY_FREE_LIST_DEFAULT_SIZE;
dcc_init_stream_agents(dcc);
- image_encoders_init(&dcc->encoders, &display->encoder_shared_data);
+ image_encoders_init(&dcc->priv->encoders, &display->encoder_shared_data);
return dcc;
}
@@ -410,18 +411,18 @@ static void dcc_create_all_streams(DisplayChannelClient *dcc)
/* TODO: this function is evil^Wsynchronous, fix */
static int display_channel_client_wait_for_init(DisplayChannelClient *dcc)
{
- dcc->expect_init = TRUE;
+ dcc->priv->expect_init = TRUE;
uint64_t end_time = spice_get_monotonic_time_ns() + COMMON_CLIENT_TIMEOUT;
for (;;) {
red_channel_client_receive(RED_CHANNEL_CLIENT(dcc));
if (!red_channel_client_is_connected(RED_CHANNEL_CLIENT(dcc))) {
break;
}
- if (dcc->pixmap_cache && dcc->encoders.glz_dict) {
- dcc->pixmap_cache_generation = dcc->pixmap_cache->generation;
+ if (dcc->priv->pixmap_cache && dcc->priv->encoders.glz_dict) {
+ dcc->priv->pixmap_cache_generation = dcc->priv->pixmap_cache->generation;
/* TODO: move common.id? if it's used for a per client structure.. */
- spice_info("creating encoder with id == %d", dcc->id);
- if (!image_encoders_glz_create(&dcc->encoders, dcc->id)) {
+ spice_info("creating encoder with id == %d", dcc->priv->id);
+ if (!image_encoders_glz_create(&dcc->priv->encoders, dcc->priv->id)) {
spice_critical("create global lz failed");
}
return TRUE;
@@ -472,7 +473,7 @@ static void dcc_destroy_stream_agents(DisplayChannelClient *dcc)
int i;
for (i = 0; i < NUM_STREAMS; i++) {
- StreamAgent *agent = &dcc->stream_agents[i];
+ StreamAgent *agent = &dcc->priv->stream_agents[i];
region_destroy(&agent->vis_region);
region_destroy(&agent->clip);
if (agent->video_encoder) {
@@ -486,14 +487,14 @@ void dcc_stop(DisplayChannelClient *dcc)
{
DisplayChannel *dc = DCC_TO_DC(dcc);
- pixmap_cache_unref(dcc->pixmap_cache);
- dcc->pixmap_cache = NULL;
+ pixmap_cache_unref(dcc->priv->pixmap_cache);
+ dcc->priv->pixmap_cache = NULL;
dcc_palette_cache_reset(dcc);
- free(dcc->send_data.free_list.res);
+ free(dcc->priv->send_data.free_list.res);
dcc_destroy_stream_agents(dcc);
- image_encoders_free(&dcc->encoders);
+ image_encoders_free(&dcc->priv->encoders);
- if (dcc->gl_draw_ongoing) {
+ if (dcc->priv->gl_draw_ongoing) {
display_channel_gl_draw_done(dc);
}
}
@@ -599,7 +600,7 @@ RedPipeItem *dcc_gl_draw_item_new(RedChannelClient *rcc, void *data, int num)
return NULL;
}
- dcc->gl_draw_ongoing = TRUE;
+ dcc->priv->gl_draw_ongoing = TRUE;
item->draw = *draw;
red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_GL_DRAW);
@@ -620,11 +621,11 @@ void dcc_destroy_surface(DisplayChannelClient *dcc, uint32_t surface_id)
channel = RED_CHANNEL(display);
if (COMMON_GRAPHICS_CHANNEL(display)->during_target_migrate ||
- !dcc->surface_client_created[surface_id]) {
+ !dcc->priv->surface_client_created[surface_id]) {
return;
}
- dcc->surface_client_created[surface_id] = FALSE;
+ dcc->priv->surface_client_created[surface_id] = FALSE;
destroy = red_surface_destroy_item_new(channel, surface_id);
red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &destroy->pipe_item);
}
@@ -725,20 +726,20 @@ int dcc_compress_image(DisplayChannelClient *dcc,
stat_start_time_init(&start_time, &display_channel->encoder_shared_data.off_stat);
- image_compression = get_compression_for_bitmap(src, dcc->image_compression, drawable);
+ image_compression = get_compression_for_bitmap(src, dcc->priv->image_compression, drawable);
switch (image_compression) {
case SPICE_IMAGE_COMPRESSION_OFF:
break;
case SPICE_IMAGE_COMPRESSION_QUIC:
if (can_lossy && display_channel->enable_jpeg &&
(src->format != SPICE_BITMAP_FMT_RGBA || !bitmap_has_extra_stride(src))) {
- success = image_encoders_compress_jpeg(&dcc->encoders, dest, src, o_comp_data);
+ success = image_encoders_compress_jpeg(&dcc->priv->encoders, dest, src, o_comp_data);
break;
}
- success = image_encoders_compress_quic(&dcc->encoders, dest, src, o_comp_data);
+ success = image_encoders_compress_quic(&dcc->priv->encoders, dest, src, o_comp_data);
break;
case SPICE_IMAGE_COMPRESSION_GLZ:
- success = image_encoders_compress_glz(&dcc->encoders, dest, src,
+ success = image_encoders_compress_glz(&dcc->priv->encoders, dest, src,
drawable->red_drawable, &drawable->glz_retention,
o_comp_data,
display_channel->enable_zlib_glz_wrap);
@@ -750,13 +751,13 @@ int dcc_compress_image(DisplayChannelClient *dcc,
case SPICE_IMAGE_COMPRESSION_LZ4:
if (red_channel_client_test_remote_cap(&dcc->base,
SPICE_DISPLAY_CAP_LZ4_COMPRESSION)) {
- success = image_encoders_compress_lz4(&dcc->encoders, dest, src, o_comp_data);
+ success = image_encoders_compress_lz4(&dcc->priv->encoders, dest, src, o_comp_data);
break;
}
#endif
lz_compress:
case SPICE_IMAGE_COMPRESSION_LZ:
- success = image_encoders_compress_lz(&dcc->encoders, dest, src, o_comp_data);
+ success = image_encoders_compress_lz(&dcc->priv->encoders, dest, src, o_comp_data);
if (success && !bitmap_fmt_is_rgb(src->format)) {
dcc_palette_cache_palette(dcc, dest->u.lz_plt.palette, &(dest->u.lz_plt.flags));
}
@@ -802,7 +803,7 @@ void dcc_palette_cache_reset(DisplayChannelClient *dcc)
static void dcc_push_release(DisplayChannelClient *dcc, uint8_t type, uint64_t id,
uint64_t* sync_data)
{
- FreeList *free_list = &dcc->send_data.free_list;
+ FreeList *free_list = &dcc->priv->send_data.free_list;
int i;
for (i = 0; i < MAX_CACHE_CLIENTS; i++) {
@@ -827,7 +828,7 @@ static void dcc_push_release(DisplayChannelClient *dcc, uint8_t type, uint64_t i
int dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
uint32_t size, int lossy)
{
- PixmapCache *cache = dcc->pixmap_cache;
+ PixmapCache *cache = dcc->priv->pixmap_cache;
NewCacheItem *item;
uint64_t serial;
int key;
@@ -837,11 +838,11 @@ int dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
item = spice_new(NewCacheItem, 1);
serial = red_channel_client_get_message_serial(RED_CHANNEL_CLIENT(dcc));
- if (cache->generation != dcc->pixmap_cache_generation) {
- if (!dcc->pending_pixmaps_sync) {
+ if (cache->generation != dcc->priv->pixmap_cache_generation) {
+ if (!dcc->priv->pending_pixmaps_sync) {
red_channel_client_pipe_add_type(
RED_CHANNEL_CLIENT(dcc), RED_PIPE_ITEM_TYPE_PIXMAP_SYNC);
- dcc->pending_pixmaps_sync = TRUE;
+ dcc->priv->pending_pixmaps_sync = TRUE;
}
free(item);
return FALSE;
@@ -854,7 +855,7 @@ int dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
verify(SPICE_OFFSETOF(NewCacheItem, lru_link) == 0);
if (!(tail = (NewCacheItem *)ring_get_tail(&cache->lru)) ||
- tail->sync[dcc->id] == serial) {
+ tail->sync[dcc->priv->id] == serial) {
cache->available += size;
free(item);
return FALSE;
@@ -872,7 +873,7 @@ int dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
ring_remove(&tail->lru_link);
cache->items--;
cache->available += tail->size;
- cache->sync[dcc->id] = serial;
+ cache->sync[dcc->priv->id] = serial;
dcc_push_release(dcc, SPICE_RES_TYPE_PIXMAP, tail->id, tail->sync);
free(tail);
}
@@ -885,8 +886,8 @@ int dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
item->size = size;
item->lossy = lossy;
memset(item->sync, 0, sizeof(item->sync));
- item->sync[dcc->id] = serial;
- cache->sync[dcc->id] = serial;
+ item->sync[dcc->priv->id] = serial;
+ cache->sync[dcc->priv->id] = serial;
return TRUE;
}
@@ -895,16 +896,16 @@ static int dcc_handle_init(DisplayChannelClient *dcc, SpiceMsgcDisplayInit *init
gboolean success;
RedClient *client = red_channel_client_get_client(RED_CHANNEL_CLIENT(dcc));
- spice_return_val_if_fail(dcc->expect_init, FALSE);
- dcc->expect_init = FALSE;
+ spice_return_val_if_fail(dcc->priv->expect_init, FALSE);
+ dcc->priv->expect_init = FALSE;
- spice_return_val_if_fail(!dcc->pixmap_cache, FALSE);
- dcc->pixmap_cache = pixmap_cache_get(client,
- init->pixmap_cache_id,
- init->pixmap_cache_size);
- spice_return_val_if_fail(dcc->pixmap_cache, FALSE);
+ spice_return_val_if_fail(!dcc->priv->pixmap_cache, FALSE);
+ dcc->priv->pixmap_cache = pixmap_cache_get(client,
+ init->pixmap_cache_id,
+ init->pixmap_cache_size);
+ spice_return_val_if_fail(dcc->priv->pixmap_cache, FALSE);
- success = image_encoders_get_glz_dictionary(&dcc->encoders,
+ success = image_encoders_get_glz_dictionary(&dcc->priv->encoders,
client,
init->glz_dictionary_id,
init->glz_dictionary_window_size);
@@ -924,7 +925,7 @@ static int dcc_handle_stream_report(DisplayChannelClient *dcc,
return FALSE;
}
- agent = &dcc->stream_agents[report->stream_id];
+ agent = &dcc->priv->stream_agents[report->stream_id];
if (!agent->video_encoder) {
spice_info("stream_report: no encoder for stream id %u. "
"The stream has probably been destroyed",
@@ -962,7 +963,7 @@ static int dcc_handle_preferred_compression(DisplayChannelClient *dcc,
case SPICE_IMAGE_COMPRESSION_LZ:
case SPICE_IMAGE_COMPRESSION_GLZ:
case SPICE_IMAGE_COMPRESSION_OFF:
- dcc->image_compression = pc->image_compression;
+ dcc->priv->image_compression = pc->image_compression;
break;
default:
spice_warning("preferred-compression: unsupported image compression setting");
@@ -974,13 +975,13 @@ static int dcc_handle_gl_draw_done(DisplayChannelClient *dcc)
{
DisplayChannel *display = DCC_TO_DC(dcc);
- if (G_UNLIKELY(!dcc->gl_draw_ongoing)) {
+ if (G_UNLIKELY(!dcc->priv->gl_draw_ongoing)) {
g_warning("unexpected DRAW_DONE received\n");
/* close client connection */
return FALSE;
}
- dcc->gl_draw_ongoing = FALSE;
+ dcc->priv->gl_draw_ongoing = FALSE;
display_channel_gl_draw_done(display);
return TRUE;
@@ -1008,7 +1009,7 @@ int dcc_handle_message(RedChannelClient *rcc, uint32_t size, uint16_t type, void
static int dcc_handle_migrate_glz_dictionary(DisplayChannelClient *dcc,
SpiceMigrateDataDisplay *migrate)
{
- return image_encoders_restore_glz_dictionary(&dcc->encoders,
+ return image_encoders_restore_glz_dictionary(&dcc->priv->encoders,
red_channel_client_get_client(RED_CHANNEL_CLIENT(dcc)),
migrate->glz_dict_id,
&migrate->glz_dict_data);
@@ -1018,11 +1019,11 @@ static int restore_surface(DisplayChannelClient *dcc, uint32_t surface_id)
{
/* we don't process commands till we receive the migration data, thus,
* we should have not sent any surface to the client. */
- if (dcc->surface_client_created[surface_id]) {
+ if (dcc->priv->surface_client_created[surface_id]) {
spice_warning("surface %u is already marked as client_created", surface_id);
return FALSE;
}
- dcc->surface_client_created[surface_id] = TRUE;
+ dcc->priv->surface_client_created[surface_id] = TRUE;
return TRUE;
}
@@ -1060,8 +1061,8 @@ static int restore_surfaces_lossy(DisplayChannelClient *dcc,
lossy_rect.top = mig_lossy_rect->top;
lossy_rect.right = mig_lossy_rect->right;
lossy_rect.bottom = mig_lossy_rect->bottom;
- region_init(&dcc->surface_client_lossy_region[surface_id]);
- region_add(&dcc->surface_client_lossy_region[surface_id], &lossy_rect);
+ region_init(&dcc->priv->surface_client_lossy_region[surface_id]);
+ region_add(&dcc->priv->surface_client_lossy_region[surface_id], &lossy_rect);
}
return TRUE;
}
@@ -1085,26 +1086,26 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mess
* channel client that froze the cache on the src size receives the migrate
* data and unfreezes the cache by setting its size > 0 and by triggering
* pixmap_cache_reset */
- dcc->pixmap_cache = pixmap_cache_get(red_channel_client_get_client(RED_CHANNEL_CLIENT(dcc)),
- migrate_data->pixmap_cache_id, -1);
- spice_return_val_if_fail(dcc->pixmap_cache, FALSE);
+ dcc->priv->pixmap_cache = pixmap_cache_get(red_channel_client_get_client(RED_CHANNEL_CLIENT(dcc)),
+ migrate_data->pixmap_cache_id, -1);
+ spice_return_val_if_fail(dcc->priv->pixmap_cache, FALSE);
- pthread_mutex_lock(&dcc->pixmap_cache->lock);
+ pthread_mutex_lock(&dcc->priv->pixmap_cache->lock);
for (i = 0; i < MAX_CACHE_CLIENTS; i++) {
- dcc->pixmap_cache->sync[i] = MAX(dcc->pixmap_cache->sync[i],
- migrate_data->pixmap_cache_clients[i]);
+ dcc->priv->pixmap_cache->sync[i] = MAX(dcc->priv->pixmap_cache->sync[i],
+ migrate_data->pixmap_cache_clients[i]);
}
- pthread_mutex_unlock(&dcc->pixmap_cache->lock);
+ pthread_mutex_unlock(&dcc->priv->pixmap_cache->lock);
if (migrate_data->pixmap_cache_freezer) {
/* activating the cache. The cache will start to be active after
* pixmap_cache_reset is called, when handling RED_PIPE_ITEM_TYPE_PIXMAP_RESET */
- dcc->pixmap_cache->size = migrate_data->pixmap_cache_size;
+ dcc->priv->pixmap_cache->size = migrate_data->pixmap_cache_size;
red_channel_client_pipe_add_type(RED_CHANNEL_CLIENT(dcc), RED_PIPE_ITEM_TYPE_PIXMAP_RESET);
}
if (dcc_handle_migrate_glz_dictionary(dcc, migrate_data)) {
- image_encoders_glz_create(&dcc->encoders, dcc->id);
+ image_encoders_glz_create(&dcc->priv->encoders, dcc->priv->id);
} else {
spice_critical("restoring global lz dictionary failed");
}
@@ -1113,10 +1114,10 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mess
if (migrate_data->low_bandwidth_setting) {
red_channel_client_ack_set_client_window(RED_CHANNEL_CLIENT(dcc), WIDE_CLIENT_ACK_WINDOW);
- if (dcc->jpeg_state == SPICE_WAN_COMPRESSION_AUTO) {
+ if (dcc->priv->jpeg_state == SPICE_WAN_COMPRESSION_AUTO) {
display->enable_jpeg = TRUE;
}
- if (dcc->zlib_glz_state == SPICE_WAN_COMPRESSION_AUTO) {
+ if (dcc->priv->zlib_glz_state == SPICE_WAN_COMPRESSION_AUTO) {
display->enable_zlib_glz_wrap = TRUE;
}
}
@@ -1136,47 +1137,47 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mess
StreamAgent* dcc_get_stream_agent(DisplayChannelClient *dcc, int stream_id)
{
- return &dcc->stream_agents[stream_id];
+ return &dcc->priv->stream_agents[stream_id];
}
ImageEncoders* dcc_get_encoders(DisplayChannelClient *dcc)
{
- return &dcc->encoders;
+ return &dcc->priv->encoders;
}
spice_wan_compression_t dcc_get_jpeg_state(DisplayChannelClient *dcc)
{
- return dcc->jpeg_state;
+ return dcc->priv->jpeg_state;
}
spice_wan_compression_t dcc_get_zlib_glz_state(DisplayChannelClient *dcc)
{
- return dcc->zlib_glz_state;
+ return dcc->priv->zlib_glz_state;
}
gboolean dcc_use_video_encoder_rate_control(DisplayChannelClient *dcc)
{
- return dcc->use_video_encoder_rate_control;
+ return dcc->priv->use_video_encoder_rate_control;
}
uint32_t dcc_get_max_stream_latency(DisplayChannelClient *dcc)
{
- return dcc->streams_max_latency;
+ return dcc->priv->streams_max_latency;
}
void dcc_set_max_stream_latency(DisplayChannelClient *dcc, uint32_t latency)
{
- dcc->streams_max_latency = latency;
+ dcc->priv->streams_max_latency = latency;
}
uint64_t dcc_get_max_stream_bit_rate(DisplayChannelClient *dcc)
{
- return dcc->streams_max_bit_rate;
+ return dcc->priv->streams_max_bit_rate;
}
void dcc_set_max_stream_bit_rate(DisplayChannelClient *dcc, uint64_t rate)
{
- dcc->streams_max_bit_rate = rate;
+ dcc->priv->streams_max_bit_rate = rate;
}
int dcc_config_socket(RedChannelClient *rcc)
--
2.7.4
More information about the Spice-devel
mailing list