summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2011-04-13 08:52:44 +0300
committerAlon Levy <alevy@redhat.com>2011-08-23 18:02:14 +0300
commit6a1d65737300627b77bf0c5b813028146e40159b (patch)
treea809511431a28091fd686e9dea12fb4777e59a90
parent9c192980e829633cf780e23e246c811119ef5ca1 (diff)
downloadspice-6a1d65737300627b77bf0c5b813028146e40159b.tar.gz
spice-6a1d65737300627b77bf0c5b813028146e40159b.tar.xz
spice-6a1d65737300627b77bf0c5b813028146e40159b.zip
server/red_channel: add pipe_size helpers
-rw-r--r--server/red_channel.c15
-rw-r--r--server/red_channel.h7
-rw-r--r--server/red_worker.c18
3 files changed, 33 insertions, 7 deletions
diff --git a/server/red_channel.c b/server/red_channel.c
index 43b57889..eb00aba1 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -1105,3 +1105,18 @@ void red_channel_pipes_new_add_tail(RedChannel *channel, new_pipe_item_t creator
red_channel_pipes_create_batch(channel, creator, data,
red_channel_client_pipe_add_tail_no_push);
}
+
+uint32_t red_channel_max_pipe_size(RedChannel *channel)
+{
+ return channel->rcc ? channel->rcc->pipe_size : 0;
+}
+
+uint32_t red_channel_min_pipe_size(RedChannel *channel)
+{
+ return channel->rcc ? channel->rcc->pipe_size : 0;
+}
+
+uint32_t red_channel_sum_pipes_size(RedChannel *channel)
+{
+ return channel->rcc ? channel->rcc->pipe_size : 0;
+}
diff --git a/server/red_channel.h b/server/red_channel.h
index a48d3a5c..4b29b0cc 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -365,6 +365,13 @@ RedClient *red_channel_client_get_client(RedChannelClient *rcc);
* not via the below accessor and direct header manipulation. */
SpiceDataHeader *red_channel_client_get_header(RedChannelClient *rcc);
+/* return the sum of all the rcc pipe size */
+uint32_t red_channel_max_pipe_size(RedChannel *channel);
+/* return the min size of all the rcc pipe */
+uint32_t red_channel_min_pipe_size(RedChannel *channel);
+/* return the max size of all the rcc pipe */
+uint32_t red_channel_sum_pipes_size(RedChannel *channel);
+
/* apply given function to all connected clients */
typedef void (*channel_client_callback)(RedChannelClient *rcc);
typedef void (*channel_client_callback_data)(RedChannelClient *rcc, void *data);
diff --git a/server/red_worker.c b/server/red_worker.c
index 54958faf..cbd90010 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -4316,7 +4316,7 @@ static int red_process_cursor(RedWorker *worker, uint32_t max_pipe_size, int *ri
*ring_is_empty = FALSE;
while (!cursor_is_connected(worker) ||
- worker->cursor_channel->common.base.rcc->pipe_size <= max_pipe_size) {
+ red_channel_min_pipe_size(&worker->cursor_channel->common.base) <= max_pipe_size) {
if (!worker->qxl->st->qif->get_cursor_command(worker->qxl, &ext_cmd)) {
*ring_is_empty = TRUE;
if (worker->repoll_cursor_ring < CMD_RING_POLL_RETRIES) {
@@ -4361,8 +4361,8 @@ static int red_process_commands(RedWorker *worker, uint32_t max_pipe_size, int *
}
*ring_is_empty = FALSE;
- while (!display_is_connected(worker)
- || worker->display_channel->common.base.rcc->pipe_size <= max_pipe_size) {
+ while (!display_is_connected(worker) ||
+ red_channel_min_pipe_size(&worker->display_channel->common.base) <= max_pipe_size) {
if (!worker->qxl->st->qif->get_command(worker->qxl, &ext_cmd)) {
*ring_is_empty = TRUE;;
if (worker->repoll_cmd_ring < CMD_RING_POLL_RETRIES) {
@@ -8488,6 +8488,8 @@ static void red_wait_outgoing_items(RedChannel *channel);
static inline void flush_display_commands(RedWorker *worker)
{
+ RedChannel *display_red_channel = &worker->display_channel->common.base;
+
for (;;) {
uint64_t end_time;
int ring_is_empty;
@@ -8509,7 +8511,7 @@ static inline void flush_display_commands(RedWorker *worker)
for (;;) {
red_channel_push(&worker->display_channel->common.base);
if (!display_is_connected(worker) ||
- worker->display_channel->common.base.rcc->pipe_size <= MAX_PIPE_SIZE) {
+ red_channel_min_pipe_size(display_red_channel) <= MAX_PIPE_SIZE) {
break;
}
RedChannel *channel = (RedChannel *)worker->display_channel;
@@ -8530,6 +8532,8 @@ static inline void flush_display_commands(RedWorker *worker)
static inline void flush_cursor_commands(RedWorker *worker)
{
+ RedChannel *cursor_red_channel = &worker->cursor_channel->common.base;
+
for (;;) {
uint64_t end_time;
int ring_is_empty = FALSE;
@@ -8551,7 +8555,7 @@ static inline void flush_cursor_commands(RedWorker *worker)
for (;;) {
red_channel_push(&worker->cursor_channel->common.base);
if (!cursor_is_connected(worker)
- || worker->cursor_channel->common.base.rcc->pipe_size <= MAX_PIPE_SIZE) {
+ || red_channel_min_pipe_size(cursor_red_channel) <= MAX_PIPE_SIZE) {
break;
}
RedChannel *channel = (RedChannel *)worker->cursor_channel;
@@ -10023,9 +10027,9 @@ static void handle_dev_input(EventListener *listener, uint32_t events)
red_channel_push(&worker->display_channel->common.base);
}
if (worker->qxl->st->qif->flush_resources(worker->qxl) == 0) {
- red_printf("oom current %u pipe %u", worker->current_size,
+ red_printf("oom current %u pipes %u", worker->current_size,
worker->display_channel ?
- display_red_channel->rcc->pipe_size : 0);
+ red_channel_sum_pipes_size(display_red_channel) : 0);
red_free_some(worker);
worker->qxl->st->qif->flush_resources(worker->qxl);
}