Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X11: some fixes to OML timings #14211

Merged
merged 1 commit into from
Jul 22, 2018
Merged

X11: some fixes to OML timings #14211

merged 1 commit into from
Jul 22, 2018

Conversation

FernetMenta
Copy link
Contributor

fixes hang in sleep cause by huge sleep time

@FernetMenta FernetMenta added Type: Fix non-breaking change which fixes an issue v18 Leia labels Jul 22, 2018
@fritsch fritsch merged commit 8a4c29f into xbmc:master Jul 22, 2018
@Rechi Rechi added this to the Leia 18.0-alpha3 milestone Jul 22, 2018
@fritsch
Copy link
Member

fritsch commented Jul 22, 2018

Now we log, but sleep the huge time never the less. I think this needs a little change:

diff --git a/xbmc/windowing/X11/GLContextEGL.cpp b/xbmc/windowing/X11/GLContextEGL.cpp
index ae84ea53f0..4f50757715 100644
--- a/xbmc/windowing/X11/GLContextEGL.cpp
+++ b/xbmc/windowing/X11/GLContextEGL.cpp
@@ -374,12 +374,12 @@ void CGLContextEGL::SwapBuffers()
     // if no vertical retrace has occurred in eglSwapBuffers,
     // sleep until next vertical retrace
     uint64_t lastIncrement = (now / 1000 - ust2);
-    uint64_t sleeptime = m_sync.interval - lastIncrement;
     if (lastIncrement > m_sync.interval)
     {
       lastIncrement = m_sync.interval;
       CLog::Log(LOGWARNING, "CGLContextEGL::SwapBuffers: last msc time greater than interval");
     }
+    uint64_t sleeptime = m_sync.interval - lastIncrement;
     usleep(sleeptime);
     m_sync.cont++;
     msc2++;
@@ -389,12 +389,12 @@ void CGLContextEGL::SwapBuffers()
     // sleep until next vertical retrace
     // this avoids blocking outside of this function
     uint64_t lastIncrement = (now / 1000 - ust2);
-    uint64_t sleeptime = m_sync.interval - lastIncrement;
     if (lastIncrement > m_sync.interval)
     {
       lastIncrement = m_sync.interval;
       CLog::Log(LOGWARNING, "CGLContextEGL::SwapBuffers: last msc time greater than interval (1)");
     }
+    uint64_t sleeptime = m_sync.interval - lastIncrement;
     usleep(sleeptime);
     msc2++;
   }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Fix non-breaking change which fixes an issue v18 Leia
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants