mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-07 12:36:46 +00:00
Add RedChannelClientPrivate struct
Encapsulate private data and prepare for port to GObject Acked-by: Frediano Ziglio <fziglio@redhat.com
This commit is contained in:
parent
aa2430e5ad
commit
51ccb44af0
@ -97,6 +97,7 @@ libserver_la_SOURCES = \
|
||||
red-channel.h \
|
||||
red-channel-client.c \
|
||||
red-channel-client.h \
|
||||
red-channel-client-private.h \
|
||||
red-common.h \
|
||||
dispatcher.c \
|
||||
dispatcher.h \
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
|
||||
#include "dcc-private.h"
|
||||
#include "display-channel.h"
|
||||
#include "red-channel-client-private.h"
|
||||
|
||||
#include <common/marshaller.h>
|
||||
#include <common/generated_server_marshallers.h>
|
||||
@ -188,7 +189,7 @@ static int is_brush_lossy(RedChannelClient *rcc, SpiceBrush *brush,
|
||||
|
||||
static RedPipeItem *dcc_get_tail(DisplayChannelClient *dcc)
|
||||
{
|
||||
return (RedPipeItem*)ring_get_tail(&RED_CHANNEL_CLIENT(dcc)->pipe);
|
||||
return (RedPipeItem*)ring_get_tail(red_channel_client_get_pipe(RED_CHANNEL_CLIENT(dcc)));
|
||||
}
|
||||
|
||||
static void red_display_add_image_to_pixmap_cache(RedChannelClient *rcc,
|
||||
@ -441,7 +442,7 @@ static FillBitsType fill_bits(DisplayChannelClient *dcc, SpiceMarshaller *m,
|
||||
/* Images must be added to the cache only after they are compressed
|
||||
in order to prevent starvation in the client between pixmap_cache and
|
||||
global dictionary (in cases of multiple monitors) */
|
||||
if (reds_stream_get_family(rcc->stream) == AF_UNIX ||
|
||||
if (reds_stream_get_family(red_channel_client_get_stream(rcc)) == AF_UNIX ||
|
||||
!dcc_compress_image(dcc, &image, &simage->u.bitmap,
|
||||
drawable, can_lossy, &comp_send_data)) {
|
||||
SpicePalette *palette;
|
||||
@ -620,7 +621,7 @@ static int pipe_rendered_drawables_intersect_with_areas(DisplayChannelClient *dc
|
||||
Ring *pipe;
|
||||
|
||||
spice_assert(num_surfaces);
|
||||
pipe = &RED_CHANNEL_CLIENT(dcc)->pipe;
|
||||
pipe = red_channel_client_get_pipe(RED_CHANNEL_CLIENT(dcc));
|
||||
|
||||
for (pipe_item = (RedPipeItem *)ring_get_head(pipe);
|
||||
pipe_item;
|
||||
@ -712,7 +713,7 @@ static void red_pipe_replace_rendered_drawables_with_images(DisplayChannelClient
|
||||
resent_areas[0] = *first_area;
|
||||
num_resent = 1;
|
||||
|
||||
pipe = &RED_CHANNEL_CLIENT(dcc)->pipe;
|
||||
pipe = red_channel_client_get_pipe(RED_CHANNEL_CLIENT(dcc));
|
||||
|
||||
// going from the oldest to the newest
|
||||
for (pipe_item = (RedPipeItem *)ring_get_tail(pipe);
|
||||
@ -2367,7 +2368,7 @@ static void begin_send_message(RedChannelClient *rcc)
|
||||
}
|
||||
free_list->wait.header.wait_count = sync_count;
|
||||
|
||||
if (rcc->is_mini_header) {
|
||||
if (red_channel_client_is_mini_header(rcc)) {
|
||||
send_free_list(rcc);
|
||||
} else {
|
||||
send_free_list_legacy(rcc);
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
|
||||
#include "dcc-private.h"
|
||||
#include "display-channel.h"
|
||||
#include "red-channel-client-private.h"
|
||||
|
||||
#define DISPLAY_CLIENT_SHORT_TIMEOUT 15000000000ULL //nano
|
||||
|
||||
@ -76,7 +77,7 @@ int dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, int surface
|
||||
no other drawable depends on them */
|
||||
|
||||
rcc = RED_CHANNEL_CLIENT(dcc);
|
||||
ring = &rcc->pipe;
|
||||
ring = &rcc->priv->pipe;
|
||||
item = (RedPipeItem *) ring;
|
||||
while ((item = (RedPipeItem *)ring_next(ring, &item->link))) {
|
||||
Drawable *drawable;
|
||||
@ -459,7 +460,7 @@ void dcc_start(DisplayChannelClient *dcc)
|
||||
dcc_create_all_streams(dcc);
|
||||
}
|
||||
|
||||
if (reds_stream_is_plain_unix(rcc->stream) &&
|
||||
if (reds_stream_is_plain_unix(red_channel_client_get_stream(rcc)) &&
|
||||
red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_GL_SCANOUT)) {
|
||||
red_channel_client_pipe_add(rcc, dcc_gl_scanout_item_new(rcc, NULL, 0));
|
||||
dcc_push_monitors_config(dcc);
|
||||
@ -573,7 +574,7 @@ RedPipeItem *dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int num)
|
||||
spice_return_val_if_fail(item != NULL, NULL);
|
||||
|
||||
/* FIXME: on !unix peer, start streaming with a video codec */
|
||||
if (!reds_stream_is_plain_unix(rcc->stream) ||
|
||||
if (!reds_stream_is_plain_unix(red_channel_client_get_stream(rcc)) ||
|
||||
!red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_GL_SCANOUT)) {
|
||||
spice_printerr("FIXME: client does not support GL scanout");
|
||||
red_channel_client_disconnect(rcc);
|
||||
|
||||
76
server/red-channel-client-private.h
Normal file
76
server/red-channel-client-private.h
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright (C) 2009-2015 Red Hat, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _H_RED_CHANNEL_CLIENT_PRIVATE
|
||||
#define _H_RED_CHANNEL_CLIENT_PRIVATE
|
||||
|
||||
#include "red-channel.h"
|
||||
|
||||
struct RedChannelClientPrivate
|
||||
{
|
||||
RedChannel *channel;
|
||||
RedClient *client;
|
||||
RedsStream *stream;
|
||||
int dummy;
|
||||
int dummy_connected;
|
||||
|
||||
uint32_t refs;
|
||||
|
||||
struct {
|
||||
uint32_t generation;
|
||||
uint32_t client_generation;
|
||||
uint32_t messages_window;
|
||||
uint32_t client_window;
|
||||
} ack_data;
|
||||
|
||||
struct {
|
||||
SpiceMarshaller *marshaller;
|
||||
SpiceDataHeaderOpaque header;
|
||||
uint32_t size;
|
||||
RedPipeItem *item;
|
||||
int blocked;
|
||||
uint64_t serial;
|
||||
uint64_t last_sent_serial;
|
||||
|
||||
struct {
|
||||
SpiceMarshaller *marshaller;
|
||||
uint8_t *header_data;
|
||||
RedPipeItem *item;
|
||||
} main;
|
||||
|
||||
struct {
|
||||
SpiceMarshaller *marshaller;
|
||||
} urgent;
|
||||
} send_data;
|
||||
|
||||
int during_send;
|
||||
int id; // debugging purposes
|
||||
Ring pipe;
|
||||
uint32_t pipe_size;
|
||||
|
||||
RedChannelCapabilities remote_caps;
|
||||
int is_mini_header;
|
||||
gboolean destroying;
|
||||
|
||||
int wait_migrate_data;
|
||||
int wait_migrate_flush_mark;
|
||||
|
||||
RedChannelClientLatencyMonitor latency_monitor;
|
||||
RedChannelClientConnectivityMonitor connectivity_monitor;
|
||||
};
|
||||
|
||||
#endif /* _H_RED_CHANNEL_CLIENT_PRIVATE */
|
||||
File diff suppressed because it is too large
Load Diff
@ -23,12 +23,15 @@
|
||||
#include "red-pipe-item.h"
|
||||
#include "reds-stream.h"
|
||||
#include "red-channel.h"
|
||||
/* FIXME: remove */
|
||||
#include "red-channel-client-private.h"
|
||||
|
||||
typedef struct RedChannel RedChannel;
|
||||
typedef struct RedClient RedClient;
|
||||
typedef struct IncomingHandler IncomingHandler;
|
||||
|
||||
typedef struct RedChannelClient RedChannelClient;
|
||||
typedef struct RedChannelClientPrivate RedChannelClientPrivate;
|
||||
|
||||
/*
|
||||
* When an error occurs over a channel, we treat it as a warning
|
||||
@ -111,6 +114,8 @@ void red_channel_client_pipe_add_type(RedChannelClient *rcc, int pipe_item_type)
|
||||
void red_channel_client_pipe_add_empty_msg(RedChannelClient *rcc, int msg_type);
|
||||
gboolean red_channel_client_pipe_is_empty(RedChannelClient *rcc);
|
||||
uint32_t red_channel_client_get_pipe_size(RedChannelClient *rcc);
|
||||
Ring* red_channel_client_get_pipe(RedChannelClient *rcc);
|
||||
gboolean red_channel_client_is_mini_header(RedChannelClient *rcc);
|
||||
|
||||
void red_channel_client_ack_zero_messages_window(RedChannelClient *rcc);
|
||||
void red_channel_client_ack_set_client_window(RedChannelClient *rcc, int client_window);
|
||||
@ -192,57 +197,11 @@ typedef struct IncomingHandler {
|
||||
} IncomingHandler;
|
||||
|
||||
struct RedChannelClient {
|
||||
RedChannel *channel;
|
||||
RedClient *client;
|
||||
RedsStream *stream;
|
||||
int dummy;
|
||||
int dummy_connected;
|
||||
|
||||
uint32_t refs;
|
||||
|
||||
struct {
|
||||
uint32_t generation;
|
||||
uint32_t client_generation;
|
||||
uint32_t messages_window;
|
||||
uint32_t client_window;
|
||||
} ack_data;
|
||||
|
||||
struct {
|
||||
SpiceMarshaller *marshaller;
|
||||
SpiceDataHeaderOpaque header;
|
||||
uint32_t size;
|
||||
RedPipeItem *item;
|
||||
int blocked;
|
||||
uint64_t serial;
|
||||
uint64_t last_sent_serial;
|
||||
|
||||
struct {
|
||||
SpiceMarshaller *marshaller;
|
||||
uint8_t *header_data;
|
||||
RedPipeItem *item;
|
||||
} main;
|
||||
|
||||
struct {
|
||||
SpiceMarshaller *marshaller;
|
||||
} urgent;
|
||||
} send_data;
|
||||
|
||||
/* protected */
|
||||
OutgoingHandler outgoing;
|
||||
IncomingHandler incoming;
|
||||
int during_send;
|
||||
int id; // debugging purposes
|
||||
Ring pipe;
|
||||
uint32_t pipe_size;
|
||||
|
||||
RedChannelCapabilities remote_caps;
|
||||
int is_mini_header;
|
||||
gboolean destroying;
|
||||
|
||||
int wait_migrate_data;
|
||||
int wait_migrate_flush_mark;
|
||||
|
||||
RedChannelClientLatencyMonitor latency_monitor;
|
||||
RedChannelClientConnectivityMonitor connectivity_monitor;
|
||||
RedChannelClientPrivate priv[1];
|
||||
};
|
||||
|
||||
#endif /* _H_RED_CHANNEL_CLIENT */
|
||||
|
||||
@ -35,6 +35,8 @@
|
||||
#include "reds.h"
|
||||
#include "red-qxl.h"
|
||||
#include "red-channel-client.h"
|
||||
/* FIXME: for now, allow sound channel access to private RedChannelClient data */
|
||||
#include "red-channel-client-private.h"
|
||||
#include "sound.h"
|
||||
#include <common/snd_codec.h>
|
||||
#include "demarshallers.h"
|
||||
@ -522,7 +524,7 @@ static inline int snd_reset_send_data(SndChannel *channel, uint16_t verb)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
header = &channel->channel_client->send_data.header;
|
||||
header = &channel->channel_client->priv->send_data.header;
|
||||
spice_marshaller_reset(channel->send_data.marshaller);
|
||||
header->data = spice_marshaller_reserve_space(channel->send_data.marshaller,
|
||||
header->header_size);
|
||||
@ -532,7 +534,7 @@ static inline int snd_reset_send_data(SndChannel *channel, uint16_t verb)
|
||||
header->set_msg_size(header, 0);
|
||||
header->set_msg_type(header, verb);
|
||||
channel->send_data.serial++;
|
||||
if (!channel->channel_client->is_mini_header) {
|
||||
if (!channel->channel_client->priv->is_mini_header) {
|
||||
header->set_msg_serial(header, channel->send_data.serial);
|
||||
header->set_msg_sub_list(header, 0);
|
||||
}
|
||||
@ -542,7 +544,7 @@ static inline int snd_reset_send_data(SndChannel *channel, uint16_t verb)
|
||||
|
||||
static int snd_begin_send_message(SndChannel *channel)
|
||||
{
|
||||
SpiceDataHeaderOpaque *header = &channel->channel_client->send_data.header;
|
||||
SpiceDataHeaderOpaque *header = &channel->channel_client->priv->send_data.header;
|
||||
|
||||
spice_marshaller_flush(channel->send_data.marshaller);
|
||||
channel->send_data.size = spice_marshaller_get_total_size(channel->send_data.marshaller);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user