[mythtv-commits] Ticket #5324: OpenGLVideo patches

MythTV mythtv at cvs.mythtv.org
Wed May 7 01:45:18 UTC 2008


#5324: OpenGLVideo patches
------------------------------------+---------------------------------------
 Reporter:  mark.kendall at gmail.com  |       Owner:  ijr    
     Type:  patch                   |      Status:  new    
 Priority:  minor                   |   Milestone:  unknown
Component:  mythtv                  |     Version:  unknown
 Severity:  medium                  |     Mlocked:  0      
------------------------------------+---------------------------------------
 1 Remove OpenGLVideo::ReInit
     This is only used in one place (PiP) and will become increasingly
 tricky to maintain. Simply delete and recreate instead.

 2 Remove offscreen rendering code
     Unlikely to be used and just complicating the source.

 3 Rename variables
     Rename key variables in line with VideoOutput to make opengl code
 easier to follow.

 4 Remove an unnecessary #ifdef

 5 Move OpenGL state management to OpenGLContext
     The opengl state logically sits with the context and allows us to
 avoid some state thrashing.

 6 FramebufferObject Memory fix
     On slower systems, I would get intermittent failures/crashes when
 switching between different opengl deinterlacers. FramebufferObject
 creation was failing with out of memory errors when framebuffers were
 deleted and re-created in quick succession. Flushing the pipeline appears
 to fix the issue - this ties up with the ogl spec where it is recommended
 that we ensure any resource has actually been created (or released) before
 using it. For completeness I've added some flushing around other resource
 creation/deletion (textures, frag progs etc) and left some glCheck's in
 CreateFramebuffer to catch any other fbo issues (fbo's appear to tricky at
 the best of times).
     N.B. glFlush doesn't actually guarantee execution of the pipeline. I'm
 looking at implementing NV_FENCE to help.

 7 HD fix
     Ensure sources that report 1088 frame height are rendered correctly.

 8 Thread safety/locking.
     This implements a fairly comprehensive thread safety 'policy' to fix
 stability issues. gl_context_lock is created as a recursive qmutex. This
 is used by itself when creating and deleting gl_context. It is then passed
 to gl_context which uses the mutex in combination with MakeCurrent to
 ensure only one thread can access the context - i.e. the one it is current
 to. By tracking the lock, we also avoid unnecessary calls to
 glxMakeCurrent and do not release the context early (which has caught me
 out a number of times!). We then ensure that all public members of
 OpenGLContext and OpenGLVideo are wrapped by a MakeCurrent 'pair'. Finally
 ContextLocker is provided as a convenience class (as the folks at
 Trolltech would say).

 9 Simplify OpenGLVideo::Teardown

 10 Implement PixelBufferObject support
     Uploading video frame data is currently a significant bottleneck for
 opengl performance. In the current code, the driver will take the
 luminance and chroma information and pad them internally to 4 bytes per
 'pixel' before sending them to the gpu. We then have to access 3 different
 textures to retrieve all of our video data. Hence there is overhead at
 every stage (300% overhead on data transfer alone)
     PixelBufferObjects are optimised for data transfer/streaming when the
 texture format is BGRA. So we pack the YUV data into one texture, tell the
 driver it is BGRA, use a PBO to transfer the data and then we only need to
 access one texture on the GPU. Performance is further improved by using
 some mmx optimisations to pack the video frame into one texture.
     For reference, some test code I have will blit a video sequence at 440
 fps using the current (trunk) opengl code. This a 720x576 frame size
 dispayed at 720x576 (i.e no scaling) with no audio and all vsync's turned
 off (using an 8800GT). The same code will run at 660 fps using the XVideo
 renderer.
     With pbo support (and using mmx), the opengl renderer will run at 590
 fps.

 11 Picture controls
     Move the picture control code from OpenGLVideo to OpenGLContext so
 that the picture attributes can be shared between the main video, PiP and
 osd. I couldn't decide whether to apply picture controls to the osd but in
 the end enabled them for consistency with the Xv renderer.

 12 glx1.3 fixes
     glx1.2 calls aren't deprecated but their use is not recommended. Will
 also facilitate moving xvmc-opengl code into OpenGLVideo/OpenGLContext.

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/5324>
MythTV <http://www.mythtv.org/>
MythTV


More information about the mythtv-commits mailing list