More debugging output can be enabled with the #define DEBUG_REPORT_CHANGED_TILES.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2399 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/x0vncserver/PollingManager.cxx b/unix/x0vncserver/PollingManager.cxx
index 325bed1..747817a 100644
--- a/unix/x0vncserver/PollingManager.cxx
+++ b/unix/x0vncserver/PollingManager.cxx
@@ -199,6 +199,10 @@
pChangeFlags += m_widthTiles;
}
+#ifdef DEBUG_REPORT_CHANGED_TILES
+ printChanges("After 1st pass", changeFlags);
+#endif
+
// Do the work related to video area detection, if enabled.
bool haveVideoRect = false;
if ((int)m_videoPriority != 0) {
@@ -214,11 +218,20 @@
// Try to find more changes around. Before doing that, mark the
// video area as changed, to skip comparisons of its pixels.
flagVideoArea(changeFlags, true);
+#ifdef DEBUG_REPORT_CHANGED_TILES
+ printChanges("Before checking neighbors", changeFlags);
+#endif
checkNeighbors(changeFlags);
+#ifdef DEBUG_REPORT_CHANGED_TILES
+ printChanges("After checking neighbors", changeFlags);
+#endif
// Inform the server about the changes. This time, we mark the
// video area as NOT changed, to prevent reading its pixels again.
flagVideoArea(changeFlags, false);
+#ifdef DEBUG_REPORT_CHANGED_TILES
+ printChanges("Before sending", changeFlags);
+#endif
nTilesChanged = sendChanges(changeFlags);
}
@@ -422,6 +435,30 @@
}
void
+PollingManager::printChanges(const char *header, const bool *pChangeFlags)
+{
+ fprintf(stderr, "%s:", header);
+
+ for (int y = 0; y < m_heightTiles; y++) {
+ for (int x = 0; x < m_widthTiles; x++) {
+ if (*pChangeFlags++) {
+ // Count successive tiles marked as changed.
+ int count = 1;
+ while (x + count < m_widthTiles && *pChangeFlags++) {
+ count++;
+ }
+ // Print.
+ fprintf(stderr, " (%d,%d)*%d", x, y, count);
+ // Skip processed tiles.
+ x += count;
+ }
+ }
+ }
+
+ fprintf(stderr, "\n");
+}
+
+void
PollingManager::detectVideo()
{
// Configurable parameters.
diff --git a/unix/x0vncserver/PollingManager.h b/unix/x0vncserver/PollingManager.h
index 27bbf0f..b26e643 100644
--- a/unix/x0vncserver/PollingManager.h
+++ b/unix/x0vncserver/PollingManager.h
@@ -106,6 +106,9 @@
// Check neighboring tiles and update pmxChanged[] matrix.
void checkNeighbors(bool *pChangeFlags);
+ // DEBUG: Print the list of changed tiles.
+ void printChanges(const char *header, const bool *pChangeFlags);
+
// Video detection functions.
void detectVideo();
void getVideoAreaRect(Rect *result);