From f50bd7f9bf902790cee46a1753906d676fbf5f77 Mon Sep 17 00:00:00 2001 From: Constantin Kaplinsky Date: Thu, 10 Jan 2008 15:27:42 +0000 Subject: [PATCH] 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 --- unix/x0vncserver/PollingManager.cxx | 37 +++++++++++++++++++++++++++++ unix/x0vncserver/PollingManager.h | 3 +++ 2 files changed, 40 insertions(+) diff --git a/unix/x0vncserver/PollingManager.cxx b/unix/x0vncserver/PollingManager.cxx index 325bed1f..747817ad 100644 --- a/unix/x0vncserver/PollingManager.cxx +++ b/unix/x0vncserver/PollingManager.cxx @@ -199,6 +199,10 @@ bool PollingManager::pollScreen() 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 @@ bool PollingManager::pollScreen() // 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); } @@ -421,6 +434,30 @@ PollingManager::checkNeighbors(bool *pChangeFlags) } } +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() { diff --git a/unix/x0vncserver/PollingManager.h b/unix/x0vncserver/PollingManager.h index 27bbf0f5..b26e643f 100644 --- a/unix/x0vncserver/PollingManager.h +++ b/unix/x0vncserver/PollingManager.h @@ -106,6 +106,9 @@ private: // 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); -- 2.39.5