[Spice-commits] server/dcc-private.h server/dcc-send.c server/dcc.c server/main-channel-client.c server/spice-qxl.h

Frediano Ziglio fziglio at kemper.freedesktop.org
Wed Nov 9 13:55:20 UTC 2016


 server/dcc-private.h         |   16 ++++------------
 server/dcc-send.c            |    8 ++++----
 server/dcc.c                 |   20 ++++++++++----------
 server/main-channel-client.c |   32 +-------------------------------
 server/spice-qxl.h           |   12 ------------
 5 files changed, 19 insertions(+), 69 deletions(-)

New commits:
commit 389edb684b0712894f69aac3c5d1b6821103feb9
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Nov 9 13:54:58 2016 +0000

    Revert accidentally merged experimental patches
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/dcc-private.h b/server/dcc-private.h
index e39b097..de6ea92 100644
--- a/server/dcc-private.h
+++ b/server/dcc-private.h
@@ -24,16 +24,6 @@
 #include "stream.h"
 #include "red-channel-client.h"
 
-typedef struct DCCStreams {
-    uint32_t outbuf_size;
-    uint8_t *outbuf; // caution stream buffer is also used as compress bufs!!!
-
-    StreamAgent agents[NUM_STREAMS];
-    int use_video_encoder_rate_control;
-    uint32_t max_latency;
-    uint64_t max_bit_rate;
-} DCCStreams;
-
 typedef struct DisplayChannelClientPrivate DisplayChannelClientPrivate;
 struct DisplayChannelClientPrivate
 {
@@ -64,8 +54,10 @@ struct DisplayChannelClientPrivate
     uint8_t surface_client_created[NUM_SURFACES];
     QRegion surface_client_lossy_region[NUM_SURFACES];
 
-    DCCStreams streams;
-
+    StreamAgent stream_agents[NUM_STREAMS];
+    int use_video_encoder_rate_control;
+    uint32_t streams_max_latency;
+    uint64_t streams_max_bit_rate;
     bool gl_draw_ongoing;
 };
 
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 9e34ff6..5f9ea45 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -1688,10 +1688,10 @@ static int red_marshall_stream_data(RedChannelClient *rcc,
         return FALSE;
     }
 
-    StreamAgent *agent = &dcc->priv->streams.agents[display_channel_get_stream_id(display, stream)];
+    StreamAgent *agent = &dcc->priv->stream_agents[display_channel_get_stream_id(display, stream)];
     uint64_t time_now = spice_get_monotonic_time_ns();
 
-    if (!dcc->priv->streams.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
@@ -1715,7 +1715,7 @@ static int red_marshall_stream_data(RedChannelClient *rcc,
                                              &outbuf);
     switch (ret) {
     case VIDEO_ENCODER_FRAME_DROP:
-        spice_assert(dcc->priv->streams.use_video_encoder_rate_control);
+        spice_assert(dcc->priv->use_video_encoder_rate_control);
 #ifdef STREAM_STATS
         agent->stats.num_drops_fps++;
 #endif
@@ -2295,7 +2295,7 @@ static void marshall_stream_activate_report(RedChannelClient *rcc,
                                             uint32_t stream_id)
 {
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
-    StreamAgent *agent = &dcc->priv->streams.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);
diff --git a/server/dcc.c b/server/dcc.c
index 4b0b749..17f9300 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -473,12 +473,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->priv->streams.agents[i];
+        StreamAgent *agent = &dcc->priv->stream_agents[i];
         agent->stream = &display->priv->streams_buf[i];
         region_init(&agent->vis_region);
         region_init(&agent->clip);
     }
-    dcc->priv->streams.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);
 }
 
@@ -605,7 +605,7 @@ static void dcc_destroy_stream_agents(DisplayChannelClient *dcc)
     int i;
 
     for (i = 0; i < NUM_STREAMS; i++) {
-        StreamAgent *agent = &dcc->priv->streams.agents[i];
+        StreamAgent *agent = &dcc->priv->stream_agents[i];
         region_destroy(&agent->vis_region);
         region_destroy(&agent->clip);
         if (agent->video_encoder) {
@@ -1053,7 +1053,7 @@ static int dcc_handle_stream_report(DisplayChannelClient *dcc,
         return FALSE;
     }
 
-    agent = &dcc->priv->streams.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",
@@ -1265,7 +1265,7 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mess
 
 StreamAgent* dcc_get_stream_agent(DisplayChannelClient *dcc, int stream_id)
 {
-    return &dcc->priv->streams.agents[stream_id];
+    return &dcc->priv->stream_agents[stream_id];
 }
 
 ImageEncoders* dcc_get_encoders(DisplayChannelClient *dcc)
@@ -1285,27 +1285,27 @@ spice_wan_compression_t dcc_get_zlib_glz_state(DisplayChannelClient *dcc)
 
 gboolean dcc_use_video_encoder_rate_control(DisplayChannelClient *dcc)
 {
-    return dcc->priv->streams.use_video_encoder_rate_control;
+    return dcc->priv->use_video_encoder_rate_control;
 }
 
 uint32_t dcc_get_max_stream_latency(DisplayChannelClient *dcc)
 {
-    return dcc->priv->streams.max_latency;
+    return dcc->priv->streams_max_latency;
 }
 
 void dcc_set_max_stream_latency(DisplayChannelClient *dcc, uint32_t latency)
 {
-    dcc->priv->streams.max_latency = latency;
+    dcc->priv->streams_max_latency = latency;
 }
 
 uint64_t dcc_get_max_stream_bit_rate(DisplayChannelClient *dcc)
 {
-    return dcc->priv->streams.max_bit_rate;
+    return dcc->priv->streams_max_bit_rate;
 }
 
 void dcc_set_max_stream_bit_rate(DisplayChannelClient *dcc, uint64_t rate)
 {
-    dcc->priv->streams.max_bit_rate = rate;
+    dcc->priv->streams_max_bit_rate = rate;
 }
 
 int dcc_config_socket(RedChannelClient *rcc)
diff --git a/server/main-channel-client.c b/server/main-channel-client.c
index 052764e..7304586 100644
--- a/server/main-channel-client.c
+++ b/server/main-channel-client.c
@@ -19,7 +19,6 @@
 #endif
 
 #include <inttypes.h>
-#include <netinet/tcp.h>
 #include <common/generated_server_marshallers.h>
 
 #include "main-channel-client.h"
@@ -465,34 +464,9 @@ void main_channel_client_handle_migrate_dst_do_seamless(MainChannelClient *mcc,
                                               SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_NACK);
     }
 }
-
-#ifdef __linux__
-static uint64_t reds_stream_rtt(const RedsStream *stream)
-{
-    if (!stream || stream->socket < 0) {
-        return 0;
-    }
-
-    struct tcp_info ti;
-    socklen_t ti_len = sizeof(ti);
-    if (getsockopt(stream->socket, SOL_TCP, TCP_INFO, &ti, &ti_len)) {
-        return 0;
-    }
-
-    fprintf(stderr, "RCV RTT %u\n", ti.tcpi_rttvar);
-    fprintf(stderr, "RCV MTU %u\n", ti.tcpi_pmtu);
-    return ti.tcpi_rtt;
-}
-#else
-static inline uint64_t reds_stream_rtt(const RedsStream *stream)
-{
-    return 0;
-}
-#endif
-
 void main_channel_client_handle_pong(MainChannelClient *mcc, SpiceMsgPing *ping, uint32_t size)
 {
-    uint64_t roundtrip, rtt;
+    uint64_t roundtrip;
     RedChannelClient* rcc = RED_CHANNEL_CLIENT(mcc);
 
     roundtrip = g_get_monotonic_time() - ping->timestamp;
@@ -517,10 +491,6 @@ void main_channel_client_handle_pong(MainChannelClient *mcc, SpiceMsgPing *ping,
         mcc->priv->latency = MIN(mcc->priv->latency, roundtrip);
         break;
     case NET_TEST_STAGE_RATE:
-        rtt = reds_stream_rtt(red_channel_client_get_stream(rcc));
-        if (rtt)
-            mcc->priv->latency = MIN(mcc->priv->latency, rtt);
-
         mcc->priv->net_test_id = 0;
         if (roundtrip <= mcc->priv->latency) {
             // probably high load on client or server result with incorrect values
diff --git a/server/spice-qxl.h b/server/spice-qxl.h
index c8f9ea3..b8910bf 100644
--- a/server/spice-qxl.h
+++ b/server/spice-qxl.h
@@ -171,19 +171,15 @@ struct QXLDevSurfaceCreate {
 struct QXLInterface {
     SpiceBaseInterface base;
 
-    // ONLY QXL, used to see id
     void (*attache_worker)(QXLInstance *qin, QXLWorker *qxl_worker);
     void (*set_compression_level)(QXLInstance *qin, int level);
-    // REMOVED
     void (*set_mm_time)(QXLInstance *qin, uint32_t mm_time) SPICE_GNUC_DEPRECATED;
 
-    // ONLY QXL
     void (*get_init_info)(QXLInstance *qin, QXLDevInitInfo *info);
 
     /* Retrieve the next command to be processed
      * This call should be non-blocking. If no commands are available, it
      * should return 0, or 1 if a command was retrieved */
-    // ONLY QXL
     int (*get_command)(QXLInstance *qin, struct QXLCommandExt *cmd);
 
     /* Request notification when new commands are available
@@ -191,21 +187,13 @@ struct QXLInterface {
      * notified by calling spice_qxl_wakeup(). If commands are already
      * available, this function should return false and no notification
      * triggered */
-    // ONLY QXL
     int (*req_cmd_notification)(QXLInstance *qin);
-    // ONLY QXL
     void (*release_resource)(QXLInstance *qin, struct QXLReleaseInfoExt release_info);
-    // ONLY QXL
     int (*get_cursor_command)(QXLInstance *qin, struct QXLCommandExt *cmd);
-    // ONLY QXL
     int (*req_cursor_notification)(QXLInstance *qin);
-    // REMOVED
     void (*notify_update)(QXLInstance *qin, uint32_t update_id);
-    // abort for display, do something in HW called in OOM
     int (*flush_resources)(QXLInstance *qin);
-    // both for sure
     void (*async_complete)(QXLInstance *qin, uint64_t cookie);
-    // abort for display, do something in HW spice_qxl_update_area_async, only QXL
     void (*update_area_complete)(QXLInstance *qin, uint32_t surface_id,
                                  struct QXLRect *updated_rects,
                                  uint32_t num_updated_rects);


More information about the Spice-commits mailing list