[mythtv-commits] Ticket #12902: Cannot make QOpenGLContext current in a different thread (occurred while watching live tv)

MythTV noreply at mythtv.org
Sat Jan 7 18:27:48 UTC 2017


#12902: Cannot make QOpenGLContext current in a different thread (occurred while
watching live tv)
-------------------------------------------------+-------------------------
 Reporter:  William L. DeRieux IV                |          Owner:
  <WilliamDeRieux@…>                             |
     Type:  Bug Report - Crash                   |         Status:  new
 Priority:  critical                             |      Milestone:  0.28.1
Component:  Qt5 issues                           |        Version:  0.28.0
 Severity:  high                                 |     Resolution:
 Keywords:                                       |  Ticket locked:  0
-------------------------------------------------+-------------------------

Comment (by WilliamDeRieux@…):

 Replying to [comment:6 pbennett]:
 > You can extract a small part of a video, a minute or two. If we receive
 a takedown request from the copyright owner we will be sure to take its
 URL down. I do not think anybody will object to a two minute video clip
 that we will use for debugging purposes. I normally share a clip using
 dropbox. I have currently 4 video clips in my dropbox that I have shared
 in various tickets and nobody has sent me a takedown request. You can
 extract 200MB from a recording by using, for example
 > {{{
 > dd bs=1MB count=201 skip=4889 if=3819_20160207020000.mpg
 of=extracted_with_dd.mpg
 > }}}
 > I would not attempt to fix a bug unless I could first reproduce it. I do
 not have an analog recorder so I cannot create any nuv files, and even if
 I did, I don't know the conditions that will cause the error.
 >
 > It may not be specific to a video, but when it does happen, is it
 reproducible in occurring at the  same place every time you play the
 video?

 Ok....your are misunderstanding the problem.

 '''this is a purely a QT5 rendering issue'''

 Supplying you with a video wouldn't make any difference.

 This is the setup I use:[[BR]]
 1) ATI TV Wonder Pro 500 (analog capture)[[BR]]
 2) I use QT 5.7.1[[BR]]
 3) I also use OpenGL for video rendering (not OpenGLES)[[BR]]
 -- the only relevant thing here is using OpenGL 5 rendering and the setup
 of the deinterlacer

 '''What version of QT are you using?'''[[BR]]
 [[BR]]
 '''Do you use OpenGL (and not OpenGLES)?'''

 ----

 The problem occurs when VideoOutputOpenGL::SetupDeinterlace is
 called[[BR]]
 and then the code does this:

 {{{
 OpenGLLocker ctx_lock(gl_context);
 }}}

 This causes the following to be called on the wrong thread and it
 shouldn't matter what the video content is.

 {{{
 OpenGLLocker::OpenGLLocker(MythRenderOpenGL *render) : m_render(render)
 {
     if (m_render)
         m_render->makeCurrent();
 }
 }}}


 This is what the MythRenderOpenGL::makeCurrent method looks like (and is
 where the issue is occuring)[[BR]]
 Apparently:  QGLContext::makeCurrent() will then makes a call to
 QOpenGLContext::makeCurrent -- I don't know if the call has a valid
 reference to a surface.[[BR]]
 And USE_OPENGL_QT5 is only defined if USING_OPENGLES is also defined

 {{{
 #if defined USING_OPENGLES && QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
 #define USE_OPENGL_QT5
 }}}


 {{{
 void MythRenderOpenGL::makeCurrent()
 {
     m_lock.lock();
 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
     // Testing MythRenderOpenGL::currentContext is not reliable
     if (!m_lock_level++)
     {
 #ifdef USE_OPENGL_QT5
         QOpenGLContext::makeCurrent(m_window);
 #else
             QGLContext::makeCurrent();
 #endif
     }
 #else
     if (this != MythRenderOpenGL::currentContext())
         QGLContext::makeCurrent();
     m_lock_level++;
  #endif
 }
 }}}

--
Ticket URL: <https://code.mythtv.org/trac/ticket/12902#comment:7>
MythTV <http://www.mythtv.org>
MythTV Media Center


More information about the mythtv-commits mailing list