[Spice-commits] 13 commits - server/char_device.h server/main_channel.c server/main_channel.h server/red_channel.c server/red_channel.h server/red_parse_qxl.c server/red_worker.c server/reds-private.h server/reds.c server/reds.h server/snd_worker.c server/snd_worker.h

Christophe Fergau teuf at kemper.freedesktop.org
Tue Aug 11 08:45:39 PDT 2015


 server/char_device.h   |    2 +-
 server/main_channel.c  |    5 -----
 server/main_channel.h  |    9 ++++++++-
 server/red_channel.c   |   11 +++--------
 server/red_channel.h   |   11 +++--------
 server/red_parse_qxl.c |    4 ----
 server/red_worker.c    |   31 ++++++++++---------------------
 server/reds-private.h  |    4 ----
 server/reds.c          |    8 ++++++--
 server/reds.h          |    7 -------
 server/snd_worker.c    |    5 -----
 server/snd_worker.h    |    1 -
 12 files changed, 31 insertions(+), 67 deletions(-)

New commits:
commit 648808e282341a98f10df287331729fc1c3e2a08
Author: Victor Toso <victortoso at redhat.com>
Date:   Wed Aug 5 14:23:20 2015 +0200

    red_parse_qxl: remove unused variable

diff --git a/server/red_parse_qxl.c b/server/red_parse_qxl.c
index d2329a3..cc1e6f3 100644
--- a/server/red_parse_qxl.c
+++ b/server/red_parse_qxl.c
@@ -362,10 +362,6 @@ static int bitmap_consistent(SpiceBitmap *bitmap)
     return TRUE;
 }
 
-// This is based on SPICE_BITMAP_FMT_*, copied from server/red_worker.c
-// to avoid a possible unoptimization from making it non static.
-static const int BITMAP_FMT_IS_RGB[] = {0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1};
-
 static SpiceImage *red_get_image(RedMemSlotInfo *slots, int group_id,
                                  QXLPHYSICAL addr, uint32_t flags, int is_mask)
 {
commit a58e123c4b581fb390ca82afb9d1f324536e69a8
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Fri Jul 31 17:32:17 2015 +0100

    Remove unused struct RedsOutItem

diff --git a/server/main_channel.c b/server/main_channel.c
index 12009f3..0ecc9df 100644
--- a/server/main_channel.c
+++ b/server/main_channel.c
@@ -78,11 +78,6 @@ enum {
     PIPE_ITEM_TYPE_MAIN_AGENT_CONNECTED_TOKENS,
 };
 
-typedef struct RedsOutItem RedsOutItem;
-struct RedsOutItem {
-    PipeItem base;
-};
-
 typedef struct RefsPipeItem {
     PipeItem base;
     int *refs;
commit 73fafae5c7eff8e91dab3f5613d65e2aec6f3d5b
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Fri Jul 31 17:32:16 2015 +0100

    RedChannel: remove unused BufDescriptor struct

diff --git a/server/red_channel.h b/server/red_channel.h
index bc0347b..619a841 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -127,11 +127,6 @@ typedef struct OutgoingHandler {
 
 /* Red Channel interface */
 
-typedef struct BufDescriptor {
-    uint32_t size;
-    uint8_t *data;
-} BufDescriptor;
-
 typedef struct RedChannel RedChannel;
 typedef struct RedChannelClient RedChannelClient;
 typedef struct RedClient RedClient;
commit 4243d2a6451900a70750b864fbb36b9fd664e55c
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Fri Jul 31 17:32:15 2015 +0100

    Remove unused snd_get_playback_compression() method

diff --git a/server/snd_worker.c b/server/snd_worker.c
index 4d404e0..b039939 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -1623,8 +1623,3 @@ void snd_set_playback_compression(int on)
         }
     }
 }
-
-int snd_get_playback_compression(void)
-{
-    return playback_compression;
-}
diff --git a/server/snd_worker.h b/server/snd_worker.h
index 8de746d..7cc4db5 100644
--- a/server/snd_worker.h
+++ b/server/snd_worker.h
@@ -27,7 +27,6 @@ void snd_attach_record(SpiceRecordInstance *sin);
 void snd_detach_record(SpiceRecordInstance *sin);
 
 void snd_set_playback_compression(int on);
-int snd_get_playback_compression(void);
 
 void snd_set_playback_latency(RedClient *client, uint32_t latency);
 
commit 295dadbf94db982e1508ea80a2ffad6b27187b22
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Fri Jul 31 17:32:14 2015 +0100

    Fix typo in comment in char_device.h

diff --git a/server/char_device.h b/server/char_device.h
index c17a40d..3dbc761 100644
--- a/server/char_device.h
+++ b/server/char_device.h
@@ -13,7 +13,7 @@
  * device attached: call spice_char_device_state_create
  * device detached: call spice_char_device_state_destroy/reset
  *
- * client connected and assoicated with a device: spice_char_device_client_add
+ * client connected and associated with a device: spice_char_device_client_add
  * client disconnected: spice_char_device_client_remove
  *
  * Writing to the device
commit 3c39371b57df0dd19017757c2bda35265f0d297f
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Fri Jul 31 17:32:07 2015 +0100

    Fix typo in comments

diff --git a/server/reds.c b/server/reds.c
index 978832e..c07cb6c 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -394,8 +394,8 @@ static void reds_reset_vdp(void)
     /* Throw away pending chunks from the current (if any) and future
      * messages written by the client.
      * TODO: client should clear its agent messages queue when the agent
-     * is disconnect. Currently, when and agent gets disconnected and reconnected,
-     * messeges that were directed to the previous instance of the agent continues
+     * is disconnected. Currently, when an agent gets disconnected and reconnected,
+     * messages that were directed to the previous instance of the agent continue
      * to be sent from the client. This TODO will require server, protocol, and client changes */
     state->write_filter.result = AGENT_MSG_FILTER_DISCARD;
     state->write_filter.discard_all = TRUE;
commit ff97799487284816a44403ac4406c19e30bf5fa2
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Fri Jul 31 17:31:58 2015 +0100

    Move RedsMigSpice to main-channel.h
    
    This is the place that needs the complete type definition. If it is
    defined in reds.h, it can create circular references.

diff --git a/server/main_channel.h b/server/main_channel.h
index c8e9ade..d371d79 100644
--- a/server/main_channel.h
+++ b/server/main_channel.h
@@ -21,7 +21,6 @@
 #include <stdint.h>
 #include <spice/vd_agent.h>
 #include "common/marshaller.h"
-#include "reds.h"
 #include "red_channel.h"
 
 // TODO: Defines used to calculate receive buffer size, and also by reds.c
@@ -33,6 +32,14 @@
 #define MAIN_CHANNEL_RECEIVE_BUF_SIZE \
     (4096 + (REDS_AGENT_WINDOW_SIZE + REDS_NUM_INTERNAL_AGENT_MESSAGES) * SPICE_AGENT_MAX_DATA_SIZE)
 
+struct RedsMigSpice {
+    char *host;
+    char *cert_subject;
+    int port;
+    int sport;
+};
+typedef struct RedsMigSpice RedsMigSpice;
+
 typedef struct MainChannel {
     RedChannel base;
     uint8_t recv_buf[MAIN_CHANNEL_RECEIVE_BUF_SIZE];
diff --git a/server/reds.h b/server/reds.h
index 0483c71..a9c2df9 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -44,13 +44,6 @@ struct SpiceMigrateState {
     int dummy;
 };
 
-typedef struct RedsMigSpice {
-    char *host;
-    char *cert_subject;
-    int port;
-    int sport;
-} RedsMigSpice;
-
 /* main thread only */
 void reds_handle_channel_event(int event, SpiceChannelEventInfo *info);
 
commit 0eaf34c04b8535c8fe1571a435dd8539c9815eed
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Fri Jul 31 17:29:11 2015 +0100

    Cleanup: move static function declarations out of header
    
    It doesn't make much sense to have static function declarations in a
    header, even a private header. So move them down into the source file.

diff --git a/server/reds-private.h b/server/reds-private.h
index 2f9af44..953a52a 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -33,10 +33,6 @@ typedef struct VDIReadBuf {
     uint8_t data[SPICE_AGENT_MAX_DATA_SIZE];
 } VDIReadBuf;
 
-static VDIReadBuf *vdi_port_read_buf_get(void);
-static VDIReadBuf *vdi_port_read_buf_ref(VDIReadBuf *buf);
-static void vdi_port_read_buf_unref(VDIReadBuf *buf);
-
 enum {
     VDI_PORT_READ_STATE_READ_HEADER,
     VDI_PORT_READ_STATE_GET_BUFF,
diff --git a/server/reds.c b/server/reds.c
index cec28b8..978832e 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -156,6 +156,10 @@ static void reds_char_device_add_state(SpiceCharDeviceState *st);
 static void reds_char_device_remove_state(SpiceCharDeviceState *st);
 static void reds_send_mm_time(void);
 
+static VDIReadBuf *vdi_port_read_buf_get(void);
+static VDIReadBuf *vdi_port_read_buf_ref(VDIReadBuf *buf);
+static void vdi_port_read_buf_unref(VDIReadBuf *buf);
+
 static ChannelSecurityOptions *channels_security = NULL;
 static int default_channel_security =
     SPICE_CHANNEL_SECURITY_NONE | SPICE_CHANNEL_SECURITY_SSL;
commit e4bbdc3391f03860bb0b790da53e65900a37c919
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Fri Jul 31 17:29:10 2015 +0100

    worker: remove unused preload_group_id

diff --git a/server/red_worker.c b/server/red_worker.c
index a0adddc..1655bbe 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -982,8 +982,6 @@ typedef struct RedWorker {
 
     RedMemSlotInfo mem_slots;
 
-    uint32_t preload_group_id;
-
     ImageCache image_cache;
 
     SpiceImageCompression image_compression;
@@ -4407,8 +4405,6 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
 
     image_cache_aging(&worker->image_cache);
 
-    worker->preload_group_id = drawable->group_id;
-
     region_add(&surface->draw_dirty_region, &drawable->red_drawable->bbox);
 
     switch (drawable->red_drawable->type) {
commit 26dc05edc46374abd92a78dea697c1c1234cad90
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Fri Jul 31 17:29:09 2015 +0100

    channel: minor simplification

diff --git a/server/red_channel.c b/server/red_channel.c
index b08848e..f7aa3f7 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -600,8 +600,6 @@ static void red_channel_client_send_item(RedChannelClient *rcc, PipeItem *item)
 
 static void red_channel_client_release_item(RedChannelClient *rcc, PipeItem *item, int item_pushed)
 {
-    int handled = TRUE;
-
     switch (item->type) {
         case PIPE_ITEM_TYPE_SET_ACK:
         case PIPE_ITEM_TYPE_EMPTY_MSG:
@@ -610,10 +608,7 @@ static void red_channel_client_release_item(RedChannelClient *rcc, PipeItem *ite
             free(item);
             break;
         default:
-            handled = FALSE;
-    }
-    if (!handled) {
-        rcc->channel->channel_cbs.release_item(rcc, item, item_pushed);
+            rcc->channel->channel_cbs.release_item(rcc, item, item_pushed);
     }
 }
 
commit 6a38af37fc0997c041361b1b64d18e927657161b
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Fri Jul 31 17:29:08 2015 +0100

    server: remove unused CursorData

diff --git a/server/red_worker.c b/server/red_worker.c
index 48f7dc7..a0adddc 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -10991,15 +10991,6 @@ static void red_connect_cursor(RedWorker *worker, RedClient *client, RedsStream
     on_new_cursor_channel(worker, &ccc->common.base);
 }
 
-typedef struct __attribute__ ((__packed__)) CursorData {
-    uint32_t visible;
-    SpicePoint16 position;
-    uint16_t trail_length;
-    uint16_t trail_frequency;
-    uint32_t data_size;
-    SpiceCursor _cursor;
-} CursorData;
-
 static void surface_dirty_region_to_rects(RedSurface *surface,
                                           QXLRect *qxl_dirty_rects,
                                           uint32_t num_dirty_rects,
commit 3da1e1ed0ce3fd0892637c96a958017db612a8f1
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Fri Jul 31 17:29:07 2015 +0100

    server: use more const CoreInterface

diff --git a/server/red_channel.c b/server/red_channel.c
index 2a273e9..b08848e 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -1022,7 +1022,7 @@ void red_channel_client_default_migrate(RedChannelClient *rcc)
 }
 
 RedChannel *red_channel_create(int size,
-                               SpiceCoreInterface *core,
+                               const SpiceCoreInterface *core,
                                uint32_t type, uint32_t id,
                                int handle_acks,
                                channel_handle_message_proc handle_message,
@@ -1137,7 +1137,7 @@ static int do_nothing_handle_message(RedChannelClient *rcc,
 }
 
 RedChannel *red_channel_create_parser(int size,
-                               SpiceCoreInterface *core,
+                               const SpiceCoreInterface *core,
                                uint32_t type, uint32_t id,
                                int handle_acks,
                                spice_parse_channel_func_t parser,
diff --git a/server/red_channel.h b/server/red_channel.h
index 24d29fe..bc0347b 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -308,7 +308,7 @@ struct RedChannel {
 
     RingItem link; // channels link for reds
 
-    SpiceCoreInterface *core;
+    const SpiceCoreInterface *core;
     int handle_acks;
 
     // RedChannel will hold only connected channel clients (logic - when pushing pipe item to all channel clients, there
@@ -353,7 +353,7 @@ struct RedChannel {
 /* if one of the callbacks should cause disconnect, use red_channel_shutdown and don't
  * explicitly destroy the channel */
 RedChannel *red_channel_create(int size,
-                               SpiceCoreInterface *core,
+                               const SpiceCoreInterface *core,
                                uint32_t type, uint32_t id,
                                int handle_acks,
                                channel_handle_message_proc handle_message,
@@ -363,7 +363,7 @@ RedChannel *red_channel_create(int size,
 /* alternative constructor, meant for marshaller based (inputs,main) channels,
  * will become default eventually */
 RedChannel *red_channel_create_parser(int size,
-                               SpiceCoreInterface *core,
+                               const SpiceCoreInterface *core,
                                uint32_t type, uint32_t id,
                                int handle_acks,
                                spice_parse_channel_func_t parser,
commit e3187ebd29ee689fa8679dc56433e0a391c395f2
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Fri Jul 31 17:29:06 2015 +0100

    worker: move red_init_*() functions
    
    There is a red_init() methods, we can group all the red_init_*() calls
    in it rather than calling red_init() followed by all these calls in our
    main function.

diff --git a/server/red_worker.c b/server/red_worker.c
index 4584b36..48f7dc7 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -12157,6 +12157,15 @@ static void red_init(RedWorker *worker, WorkerInitData *init_data)
 
     message = RED_WORKER_MESSAGE_READY;
     write_message(worker->channel, &message);
+
+    red_init_quic(worker);
+    red_init_lz(worker);
+    red_init_jpeg(worker);
+#ifdef USE_LZ4
+    red_init_lz4(worker);
+#endif
+    red_init_zlib(worker);
+    worker->event_timeout = INF_EVENT_WAIT;
 }
 
 static void red_display_cc_free_glz_drawables(RedChannelClient *rcc)
@@ -12181,14 +12190,7 @@ SPICE_GNUC_NORETURN void *red_worker_main(void *arg)
 #endif
 
     red_init(worker, (WorkerInitData *)arg);
-    red_init_quic(worker);
-    red_init_lz(worker);
-    red_init_jpeg(worker);
-#ifdef USE_LZ4
-    red_init_lz4(worker);
-#endif
-    red_init_zlib(worker);
-    worker->event_timeout = INF_EVENT_WAIT;
+
     for (;;) {
         int i, num_events;
         unsigned int timers_queue_timeout;


More information about the Spice-commits mailing list