From 1d37802b9e0ba8f8bab6b3bc1c25cd150924be27 Mon Sep 17 00:00:00 2001 From: Constantin Kaplinsky Date: Tue, 25 Dec 2007 17:43:09 +0000 Subject: [PATCH] Implemented new "VideoPriority" parameter. It allows to increase the priority of video data (when set to 2 or higher), or to disable video detection completely (when set to 0). The value 1 gives video area the same priority as the rest of the screen, the value 2 doubles video area priority, and so on. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2379 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- unix/x0vncserver/PollingManager.cxx | 24 +++++++++++++++++++++++- unix/x0vncserver/PollingManager.h | 3 +++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/unix/x0vncserver/PollingManager.cxx b/unix/x0vncserver/PollingManager.cxx index 5cd611bd..bf13cac6 100644 --- a/unix/x0vncserver/PollingManager.cxx +++ b/unix/x0vncserver/PollingManager.cxx @@ -39,6 +39,9 @@ const int PollingManager::m_pollingOrder[32] = { 19, 3, 27, 11, 29, 13, 5, 21 }; +IntParameter PollingManager::m_videoPriority("VideoPriority", + "Priority of sending updates for video area (0..8)", 2); + // // Constructor. // @@ -51,6 +54,7 @@ PollingManager::PollingManager(Display *dpy, Image *image, int offsetLeft, int offsetTop) : m_dpy(dpy), m_server(0), m_image(image), m_offsetLeft(offsetLeft), m_offsetTop(offsetTop), + m_numVideoPasses(0), m_pollingStep(0) { // Save width and height of the screen (and the image). @@ -145,6 +149,22 @@ bool PollingManager::pollScreen() if (!m_server) return false; + // If video data should have higher priority, and video area was + // detected, perform special passes to send video data only. Such + // "video passes" will be performed between normal polling passes. + // No actual polling is performed in a video pass since we know that + // video is changing continuously. + if ((int)m_videoPriority > 1 && !m_videoRect.is_empty()) { + if (m_numVideoPasses > 0) { + m_numVideoPasses--; + getScreenRect(m_videoRect); + return true; // we've got changes + } else { + // Normal pass now, but schedule video passes for next calls. + m_numVideoPasses = (int)m_videoPriority - 1; + } + } + // changeFlags[] array will hold boolean values corresponding to // each 32x32 tile. If a value is true, then we've detected a change // in that tile. Initially, we fill in the array with zero values. @@ -164,7 +184,9 @@ bool PollingManager::pollScreen() } // Do the work related to video area detection. - bool haveVideoRect = handleVideo(changeFlags); + bool haveVideoRect = false; + if ((int)m_videoPriority != 0) + haveVideoRect = handleVideo(changeFlags); // Inform the server about the changes. // FIXME: It's possible that (nTilesChanged != 0) but changeFlags[] diff --git a/unix/x0vncserver/PollingManager.h b/unix/x0vncserver/PollingManager.h index 3f77081d..e3a29b0b 100644 --- a/unix/x0vncserver/PollingManager.h +++ b/unix/x0vncserver/PollingManager.h @@ -115,10 +115,13 @@ private: char *m_rateMatrix; char *m_videoFlags; Rect m_videoRect; + int m_numVideoPasses; unsigned int m_pollingStep; static const int m_pollingOrder[]; + static IntParameter m_videoPriority; + #ifdef DEBUG private: -- 2.39.5