[Spice-commits] 4 commits - configure.ac meson_options.txt server/inputs-channel.c server/reds.c server/reds.h server/red-stream-device.c server/stream-channel.c subprojects/spice-common

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 23 14:53:06 UTC 2019


 configure.ac               |    1 +
 meson_options.txt          |    5 +++++
 server/inputs-channel.c    |    8 ++++----
 server/red-stream-device.c |    6 ++++++
 server/reds.c              |   36 +++++++++++++++++++-----------------
 server/reds.h              |    2 +-
 server/stream-channel.c    |    5 +++++
 subprojects/spice-common   |    2 +-
 8 files changed, 42 insertions(+), 23 deletions(-)

New commits:
commit e5bc6f952ceb0de6aecc63e29a666434cca375fd
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Dec 12 10:06:49 2018 +0000

    Trace streaming device data using recorder
    
    Trace when data is received from the guest and when is sent
    to the client.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/server/red-stream-device.c b/server/red-stream-device.c
index 215ddbe7..3b553510 100644
--- a/server/red-stream-device.c
+++ b/server/red-stream-device.c
@@ -19,6 +19,8 @@
 #include <config.h>
 #endif
 
+#include <common/recorder.h>
+
 #include "red-stream-device.h"
 
 #include "stream-channel.h"
@@ -70,6 +72,8 @@ static StreamMsgHandler handle_msg_format, handle_msg_data, handle_msg_cursor_se
 static bool handle_msg_invalid(StreamDevice *dev, SpiceCharDeviceInstance *sin,
                                const char *error_msg) SPICE_GNUC_WARN_UNUSED_RESULT;
 
+RECORDER(stream_device_data, 32, "Stream device data packet");
+
 static void
 close_timer_func(void *opaque)
 {
@@ -324,6 +328,8 @@ handle_msg_data(StreamDevice *dev, SpiceCharDeviceInstance *sin)
      */
     if (dev->msg_pos == 0) {
         dev->frame_mmtime = reds_get_mm_time();
+        record(stream_device_data, "Stream data packet size %u mm_time %u",
+               dev->hdr.size, dev->frame_mmtime);
         if (dev->msg_len < dev->hdr.size) {
             g_free(dev->msg);
             dev->msg = g_malloc(dev->hdr.size);
diff --git a/server/stream-channel.c b/server/stream-channel.c
index c69c88d4..c38ee043 100644
--- a/server/stream-channel.c
+++ b/server/stream-channel.c
@@ -20,6 +20,7 @@
 #endif
 
 #include <common/generated_server_marshallers.h>
+#include <common/recorder.h>
 #include <spice/stream-device.h>
 
 #include "red-channel-client.h"
@@ -116,6 +117,8 @@ typedef struct StreamDataItem {
 
 static void stream_channel_client_on_disconnect(RedChannelClient *rcc);
 
+RECORDER(stream_channel_data, 32, "Stream channel data packet");
+
 static void
 stream_channel_client_class_init(StreamChannelClientClass *klass)
 {
@@ -289,6 +292,8 @@ stream_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_item)
         red_pipe_item_ref(pipe_item);
         spice_marshaller_add_by_ref_full(m, item->data.data, item->data.data_size,
                                          marshaller_unref_pipe_item, pipe_item);
+        record(stream_channel_data, "Stream data packet size %u mm_time %u",
+               item->data.data_size, item->data.base.multi_media_time);
         break;
     }
     case RED_PIPE_ITEM_TYPE_STREAM_DESTROY: {
commit 1de0e6a2920a696c4eec7c283745e6d5c806d401
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Jan 23 14:50:33 2019 +0000

    Allows to enable recorder integration
    
    recorder library will be used to collect some statistics during
    development.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/configure.ac b/configure.ac
index 96e4e66c..903993a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -134,6 +134,7 @@ AX_VALGRIND_CHECK
 
 SPICE_CHECK_LZ4
 SPICE_CHECK_SASL
+SPICE_CHECK_RECORDER
 AM_CONDITIONAL(HAVE_SASL, test "x$have_sasl" = "xyes")
 
 dnl =========================================================================
diff --git a/meson_options.txt b/meson_options.txt
index 9568c97e..49f59cc4 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -45,3 +45,8 @@ option('manual',
     type : 'boolean',
     value : true,
     description : 'Build SPICE manual')
+
+option('recorder',
+    type : 'boolean',
+    value : false,
+    description: 'Enable recorder instrumentation')
diff --git a/subprojects/spice-common b/subprojects/spice-common
index 0a753b93..2e914f33 160000
--- a/subprojects/spice-common
+++ b/subprojects/spice-common
@@ -1 +1 @@
-Subproject commit 0a753b93b50b548a2ac04023c96a7cda83f204bf
+Subproject commit 2e914f3305f685c82143fa04067ce9f57fbfd602
commit b9cc232a703762821b531dd92b54fe32b05a9d5c
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Mon Jan 14 12:11:08 2019 +0000

    Update spice-common submodule
    
    This brings in the following changes:
    
    Frediano Ziglio (11):
          Update --enable-celt051 help string
          test-marshaller: Make test_overflow static
          test-marshaller: Make main declaration easier
          test-region: Add missing dependencies
          ci: Run tests on Windows using wine
          Use a single copy of subject string
          log: Use proper format attribute for spice_log
          marshaller: Provide spice_marshaller_fill_iovec for Windows
          test: Add a test for subject_to_x509_name function
          lz: Avoid buffer reading overflow checking for image type
          lz: More checks on image sizes
    
    Jonathon Jongsma (1):
          Fix some additional typos
    
    Marc-André Lureau (5):
          Bump libcacard requirement to 2.5.1
          Add a .gitpublish
          build-sys: improve asciidoc rules to allow multiple targets
          quic: fix sign-compare warning
          meson: fix building for big-endian host
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/subprojects/spice-common b/subprojects/spice-common
index 125cfa7f..0a753b93 160000
--- a/subprojects/spice-common
+++ b/subprojects/spice-common
@@ -1 +1 @@
-Subproject commit 125cfa7fb2493060419c79eae3b40dbc499bd3db
+Subproject commit 0a753b93b50b548a2ac04023c96a7cda83f204bf
commit c67876757ff67f1dfe698275ce9b167a45a81934
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Jan 2 11:20:35 2019 +0000

    Reuse SPICE_UPCAST instead of SPICE_CONTAINEROF where possible
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index 20ebd11c..a7df62e2 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -170,7 +170,7 @@ static void kbd_push_scan(SpiceKbdInstance *sin, uint8_t scan)
     if (!sin) {
         return;
     }
-    sif = SPICE_CONTAINEROF(sin->base.sif, SpiceKbdInterface, base);
+    sif = SPICE_UPCAST(SpiceKbdInterface, sin->base.sif);
 
     /* track XT scan code set 1 key state */
     if (scan >= 0xe0 && scan <= 0xe2) {
@@ -193,7 +193,7 @@ static uint8_t kbd_get_leds(SpiceKbdInstance *sin)
     if (!sin) {
         return 0;
     }
-    sif = SPICE_CONTAINEROF(sin->base.sif, SpiceKbdInterface, base);
+    sif = SPICE_UPCAST(SpiceKbdInterface, sin->base.sif);
     return sif->get_leds(sin);
 }
 
@@ -288,7 +288,7 @@ static bool inputs_channel_handle_message(RedChannelClient *rcc, uint16_t type,
         inputs_channel_client_on_mouse_motion(icc);
         if (mouse && reds_get_mouse_mode(reds) == SPICE_MOUSE_MODE_SERVER) {
             SpiceMouseInterface *sif;
-            sif = SPICE_CONTAINEROF(mouse->base.sif, SpiceMouseInterface, base);
+            sif = SPICE_UPCAST(SpiceMouseInterface, mouse->base.sif);
             sif->motion(mouse,
                         mouse_motion->dx, mouse_motion->dy, 0,
                         RED_MOUSE_STATE_TO_LOCAL(mouse_motion->buttons_state));
@@ -306,7 +306,7 @@ static bool inputs_channel_handle_message(RedChannelClient *rcc, uint16_t type,
         spice_assert((reds_config_get_agent_mouse(reds) && reds_has_vdagent(reds)) || tablet);
         if (!reds_config_get_agent_mouse(reds) || !reds_has_vdagent(reds)) {
             SpiceTabletInterface *sif;
-            sif = SPICE_CONTAINEROF(tablet->base.sif, SpiceTabletInterface, base);
+            sif = SPICE_UPCAST(SpiceTabletInterface, tablet->base.sif);
             sif->position(tablet, pos->x, pos->y, RED_MOUSE_STATE_TO_LOCAL(pos->buttons_state));
             break;
         }
diff --git a/server/reds.c b/server/reds.c
index cdbb94cb..e95c62d5 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -439,7 +439,7 @@ static void reds_mig_cleanup(RedsState *reds)
         if (reds->mig_wait_connect || reds->mig_wait_disconnect) {
             SpiceMigrateInterface *sif;
             spice_assert(reds->migration_interface);
-            sif = SPICE_CONTAINEROF(reds->migration_interface->base.sif, SpiceMigrateInterface, base);
+            sif = SPICE_UPCAST(SpiceMigrateInterface, reds->migration_interface->base.sif);
             if (reds->mig_wait_connect) {
                 sif->migrate_connect_complete(reds->migration_interface);
             } else {
@@ -3136,7 +3136,7 @@ static int spice_server_char_device_add_interface(SpiceServer *reds,
                                            SpiceBaseInstance *sin)
 {
     SpiceCharDeviceInstance* char_device =
-            SPICE_CONTAINEROF(sin, SpiceCharDeviceInstance, base);
+            SPICE_UPCAST(SpiceCharDeviceInstance, sin);
     RedCharDevice *dev_state = NULL;
 
     spice_debug("CHAR_DEVICE %s", char_device->subtype);
@@ -3193,7 +3193,7 @@ static int spice_server_char_device_add_interface(SpiceServer *reds,
 static int spice_server_char_device_remove_interface(RedsState *reds, SpiceBaseInstance *sin)
 {
     SpiceCharDeviceInstance* char_device =
-            SPICE_CONTAINEROF(sin, SpiceCharDeviceInstance, base);
+            SPICE_UPCAST(SpiceCharDeviceInstance, sin);
 
     spice_debug("remove CHAR_DEVICE %s", char_device->subtype);
     if (strcmp(char_device->subtype, SUBTYPE_VDAGENT) == 0) {
@@ -3231,7 +3231,8 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *reds,
             spice_warning("unsupported keyboard interface");
             return -1;
         }
-        if (inputs_channel_set_keyboard(reds->inputs_channel, SPICE_CONTAINEROF(sin, SpiceKbdInstance, base)) != 0) {
+        if (inputs_channel_set_keyboard(reds->inputs_channel,
+                                        SPICE_UPCAST(SpiceKbdInstance, sin)) != 0) {
             return -1;
         }
     } else if (strcmp(interface->type, SPICE_INTERFACE_MOUSE) == 0) {
@@ -3241,7 +3242,8 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *reds,
             spice_warning("unsupported mouse interface");
             return -1;
         }
-        if (inputs_channel_set_mouse(reds->inputs_channel, SPICE_CONTAINEROF(sin, SpiceMouseInstance, base)) != 0) {
+        if (inputs_channel_set_mouse(reds->inputs_channel,
+                                     SPICE_UPCAST(SpiceMouseInstance, sin)) != 0) {
             return -1;
         }
     } else if (strcmp(interface->type, SPICE_INTERFACE_QXL) == 0) {
@@ -3254,7 +3256,7 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *reds,
             return -1;
         }
 
-        qxl = SPICE_CONTAINEROF(sin, QXLInstance, base);
+        qxl = SPICE_UPCAST(QXLInstance, sin);
         red_qxl_init(reds, qxl);
         reds->qxl_instances = g_list_prepend(reds->qxl_instances, qxl);
 
@@ -3266,7 +3268,7 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *reds,
         red_qxl_attach_worker(qxl);
         red_qxl_set_compression_level(qxl, calc_compression_level(reds));
     } else if (strcmp(interface->type, SPICE_INTERFACE_TABLET) == 0) {
-        SpiceTabletInstance *tablet = SPICE_CONTAINEROF(sin, SpiceTabletInstance, base);
+        SpiceTabletInstance *tablet = SPICE_UPCAST(SpiceTabletInstance, sin);
         spice_debug("SPICE_INTERFACE_TABLET");
         if (interface->major_version != SPICE_INTERFACE_TABLET_MAJOR ||
             interface->minor_version > SPICE_INTERFACE_TABLET_MINOR) {
@@ -3288,7 +3290,7 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *reds,
             spice_warning("unsupported playback interface");
             return -1;
         }
-        snd_attach_playback(reds, SPICE_CONTAINEROF(sin, SpicePlaybackInstance, base));
+        snd_attach_playback(reds, SPICE_UPCAST(SpicePlaybackInstance, sin));
 
     } else if (strcmp(interface->type, SPICE_INTERFACE_RECORD) == 0) {
         spice_debug("SPICE_INTERFACE_RECORD");
@@ -3297,7 +3299,7 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *reds,
             spice_warning("unsupported record interface");
             return -1;
         }
-        snd_attach_record(reds, SPICE_CONTAINEROF(sin, SpiceRecordInstance, base));
+        snd_attach_record(reds, SPICE_UPCAST(SpiceRecordInstance, sin));
 
     } else if (strcmp(interface->type, SPICE_INTERFACE_CHAR_DEVICE) == 0) {
         if (interface->major_version != SPICE_INTERFACE_CHAR_DEVICE_MAJOR ||
@@ -3319,7 +3321,7 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *reds,
             spice_warning("unsupported migration interface");
             return -1;
         }
-        reds->migration_interface = SPICE_CONTAINEROF(sin, SpiceMigrateInstance, base);
+        reds->migration_interface = SPICE_UPCAST(SpiceMigrateInstance, sin);
         reds->migration_interface->st = (SpiceMigrateState *)(intptr_t)1; // dummy pointer
     }
 
@@ -3335,7 +3337,7 @@ SPICE_GNUC_VISIBLE int spice_server_remove_interface(SpiceBaseInstance *sin)
 
     interface = sin->sif;
     if (strcmp(interface->type, SPICE_INTERFACE_TABLET) == 0) {
-        SpiceTabletInstance *tablet = SPICE_CONTAINEROF(sin, SpiceTabletInstance, base);
+        SpiceTabletInstance *tablet = SPICE_UPCAST(SpiceTabletInstance, sin);
         g_return_val_if_fail(tablet->st != NULL, -1);
         reds = spice_tablet_state_get_server(tablet->st);
         spice_debug("remove SPICE_INTERFACE_TABLET");
@@ -3343,19 +3345,19 @@ SPICE_GNUC_VISIBLE int spice_server_remove_interface(SpiceBaseInstance *sin)
         reds_update_mouse_mode(reds);
     } else if (strcmp(interface->type, SPICE_INTERFACE_PLAYBACK) == 0) {
         spice_debug("remove SPICE_INTERFACE_PLAYBACK");
-        snd_detach_playback(SPICE_CONTAINEROF(sin, SpicePlaybackInstance, base));
+        snd_detach_playback(SPICE_UPCAST(SpicePlaybackInstance, sin));
     } else if (strcmp(interface->type, SPICE_INTERFACE_RECORD) == 0) {
         spice_debug("remove SPICE_INTERFACE_RECORD");
-        snd_detach_record(SPICE_CONTAINEROF(sin, SpiceRecordInstance, base));
+        snd_detach_record(SPICE_UPCAST(SpiceRecordInstance, sin));
     } else if (strcmp(interface->type, SPICE_INTERFACE_CHAR_DEVICE) == 0) {
-        SpiceCharDeviceInstance *char_device = SPICE_CONTAINEROF(sin, SpiceCharDeviceInstance, base);
+        SpiceCharDeviceInstance *char_device = SPICE_UPCAST(SpiceCharDeviceInstance, sin);
         g_return_val_if_fail(char_device->st != NULL, -1);
         reds = red_char_device_get_server(char_device->st);
         return spice_server_char_device_remove_interface(reds, sin);
     } else if (strcmp(interface->type, SPICE_INTERFACE_QXL) == 0) {
         QXLInstance *qxl;
 
-        qxl = SPICE_CONTAINEROF(sin, QXLInstance, base);
+        qxl = SPICE_UPCAST(QXLInstance, sin);
         g_return_val_if_fail(qxl->st != NULL, -1);
         reds = red_qxl_get_server(qxl->st);
         reds->qxl_instances = g_list_remove(reds->qxl_instances, qxl);
@@ -4083,7 +4085,7 @@ SPICE_GNUC_VISIBLE int spice_server_migrate_connect(SpiceServer *reds, const cha
         main_channel_migrate_src_complete(reds->main_channel, FALSE);
     }
 
-    sif = SPICE_CONTAINEROF(reds->migration_interface->base.sif, SpiceMigrateInterface, base);
+    sif = SPICE_UPCAST(SpiceMigrateInterface, reds->migration_interface->base.sif);
 
     if (!reds_set_migration_dest_info(reds, dest, port, secure_port, cert_subject)) {
         sif->migrate_connect_complete(reds->migration_interface);
@@ -4149,7 +4151,7 @@ SPICE_GNUC_VISIBLE int spice_server_migrate_end(SpiceServer *reds, int completed
 
     spice_assert(reds->migration_interface);
 
-    sif = SPICE_CONTAINEROF(reds->migration_interface->base.sif, SpiceMigrateInterface, base);
+    sif = SPICE_UPCAST(SpiceMigrateInterface, reds->migration_interface->base.sif);
     if (completed && !reds->expect_migrate && g_list_length(reds->clients) > 0) {
         spice_warning("spice_server_migrate_info was not called, disconnecting clients");
         reds_disconnect(reds);
diff --git a/server/reds.h b/server/reds.h
index 9f17a5ec..7f74a21a 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -32,7 +32,7 @@
 
 static inline QXLInterface * qxl_get_interface(QXLInstance *qxl)
 {
-    return SPICE_CONTAINEROF(qxl->base.sif, QXLInterface, base);
+    return SPICE_UPCAST(QXLInterface, qxl->base.sif);
 }
 
 /* main thread only */


More information about the Spice-commits mailing list