[mythtv] Captions/subtitles partially broken by mythrender_opengl.cpp commit

Lawrence Rust lvr at softsystem.co.uk
Wed Jan 6 18:30:28 UTC 2016


On Wed, 2016-01-06 at 06:36 -0800, Jim Stichnoth wrote:
> On Mon, Jan 4, 2016 at 10:26 AM, Lawrence Rust <lvr at softsystem.co.uk> wrote:
> 
> > Hi Jim,
> >
> > Thanks for finding this.  Apologies for causing you the problem.  As you
> > have a system which demonstrates this problem perhaps you would help
> > debug the problem?
> >
> > 1. Can you add this '-O UIPainterMaxCacheHW=96' to the FE command line
> > and see if the problem continues.
> >
> 
> Behavior is the same with this option.
> 
> 
> >
> > 2. If no change then would you add this patch:
> >
> > --- a/mythtv/libs/libmythui/mythrender_opengl.cpp
> > +++ b/mythtv/libs/libmythui/mythrender_opengl.cpp
> > @@ -1461,6 +1461,7 @@ bool MythRenderOpenGL::ClearTexture(uint tex)
> >
> >      memset(scratch, 0, tmp_size);
> >
> > +    glCheck();
> >      if ((m_textures[tex].m_type == GL_TEXTURE_1D) && m_glTexImage1D)
> >      {
> >          m_glTexImage1D(m_textures[tex].m_type, 0,
> >
> >
> >
> This does make the caption drawing problem go away, though obviously it
> just masks the root problem.
> 
> 
> > If the problem is resolved by this patch then the GL error is occurring
> > in some previous code but being detected in ClearTexture.  In which case
> > would you move the glCheck() to various lines in
> > MythRenderOpenGL::CreateTexture to track which GL call is failing.  My
> > guess is it's in EnableTextures.
> >
> >
> After sprinkling glCheck() calls everywhere, it turns out the problem is
> calling glLineWidth(0), which happens
> in MythRenderOpenGL1::DrawRectPriv().  Applying std::max(1, ...) to the
> argument "fixes" the problem.  This makes sense in the context of the
> behavior in the unmodified code - all the subtitle black background
> rectangles are drawn first, each of which gives this error, and then when
> all the text lines are drawn, the first one fails because of the new
> glCheck().
> 
> This is in part due to my commits eda5d2e2460d739ba9410c74f949b177865763f2
> and 0bd79053bc7476bab4d7e71a86b37dc6b27ad05f which deliberately set the
> line pen width to 0 to deal with some Qt behavioral change, with the same
> rationale as your 521b12bb52ddc7282745d7dbbdd8ea2433c95dcb commit.
> 
> The std::max(1, ...) solution seems appropriate, and I'll commit it if you
> agree.

Agreed.

NB if the pen style is guaranteed to be Qt::NoPen when width == 0 then
MythRenderOpenGL2::DrawRectPriv() should be immune to this problem.  If
not, then an additional test for 0 width should be applied there too.

> I guess my next puzzle is to figure out why my systems are falling back to
> the MythRenderOpenGL1 renderer...

MythRenderOpenGL::Create is the place to start.  The logic is somewhat
dubious in testing for OpenGL 2 support.

> Thanks for your help!

Glad we could work it out.

-- Lawrence



More information about the mythtv-dev mailing list