Ok, I did some digging. The root of the problem obviously is the 100% CPU usage all the time.
CImageLoader loads all the big images (menu backgrounds, fanart, ...). It is derived from CJob and run by a CJobWorker. Now, the thread priority of a CJobWorker is always set to the lowest possible value, i.e. with high CPU usage CImageLoader hardly gets any CPU time. So increasing thread priority for CImageLoader:: DoWork would solve the problem? To prove that I did a small hackfix for Windows (diff file):
Code:
Index: GUILargeTextureManager.cpp
===================================================================
--- GUILargeTextureManager.cpp (Revision 26904)
+++ GUILargeTextureManager.cpp (Arbeitskopie)
@@ -52,6 +52,12 @@
bool CImageLoader::DoWork()
{
CFileItem file(m_path, false);
+
+ HANDLE hThread = GetCurrentThread();
+ int iPriority = GetThreadPriority( hThread );
+
+ SetThreadPriority( hThread, THREAD_PRIORITY_HIGHEST );
+
if (file.IsPicture() && !(file.IsZIP() || file.IsRAR() || file.IsCBR() || file.IsCBZ())) // ignore non-pictures
{ // check for filename only (i.e. lookup in skin/media/)
CStdString loadPath(m_path);
@@ -81,6 +87,8 @@
CLog::Log(LOGDEBUG, "%s - took %d ms to load %s", __FUNCTION__, CTimeUtils::GetTimeMS() - start, m_path.c_str());
}
+ SetThreadPriority( hThread, iPriority );
+
return true;
}
With these 4 Lines of code added the images load quickly without delay again! I'm quite happy with it now. Note: THREAD_PRIORITY_ABOVE_NORMAL wasn't enough. I had to use THREAD_PRIORITY_HIGHEST.
A proper fix could be to add a thread priority attribute to CJob or solving the 100% CPU usage issue. I suspect that the latter could be a problem with graphics drivers in combination with OpenGL (VSync doesn't work).