]> source.dussan.org Git - tigervnc.git/commitdiff
Limit maximum lossless refresh CPU usage
authorPierre Ossman <ossman@cendio.se>
Wed, 19 Sep 2018 14:35:40 +0000 (16:35 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 20 Sep 2018 10:08:46 +0000 (12:08 +0200)
If we have plenty of bandwidth then CPU might be the limiting resource.
Unfortunately we don't have a good number for that limit, so add a
conservative hard coded value.

common/rfb/VNCSConnectionST.cxx

index 01e86c17ee153836773cbd3014ffc634814f438f..f1591f4c2939f4c7d7e3731c2edbf2c05aeb90e9 100644 (file)
@@ -1094,11 +1094,16 @@ void VNCSConnectionST::writeDataUpdate()
     //        afford a larger update size
     nextUpdate = server->msToNextUpdate();
     if (nextUpdate > 0) {
-      size_t maxUpdateSize;
+      size_t bandwidth, maxUpdateSize;
 
       // FIXME: Bandwidth estimation without congestion control
-      maxUpdateSize = congestion.getBandwidth() * nextUpdate / 1000;
+      bandwidth = congestion.getBandwidth();
 
+      // FIXME: Hard coded value for maximum CPU throughput
+      if (bandwidth > 5000000)
+        bandwidth = 5000000;
+
+      maxUpdateSize = bandwidth * nextUpdate / 1000;
       encodeManager.writeLosslessRefresh(req, server->getPixelBuffer(),
                                          cursor, maxUpdateSize);
     }