Opened 16 years ago
Closed 15 years ago
#5324 closed patch (fixed)
OpenGLVideo patches
Reported by: | Owned by: | danielk | |
---|---|---|---|
Priority: | minor | Milestone: | 0.22 |
Component: | mythtv | Version: | head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
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.
Attachments (29)
Change History (55)
Changed 16 years ago by
Attachment: | openglvid_1.diff added |
---|
Changed 16 years ago by
Attachment: | openglvid_2.diff added |
---|
Changed 16 years ago by
Attachment: | openglvid_3.diff added |
---|
Changed 16 years ago by
Attachment: | openglvid_4.diff added |
---|
Changed 16 years ago by
Attachment: | openglvid_5.diff added |
---|
Changed 16 years ago by
Attachment: | openglvid_6.diff added |
---|
Changed 16 years ago by
Attachment: | openglvid_7.diff added |
---|
Changed 16 years ago by
Attachment: | openglvid_8.diff added |
---|
Changed 16 years ago by
Attachment: | openglvid_9.diff added |
---|
Changed 16 years ago by
Attachment: | openglvid_10.diff added |
---|
Changed 16 years ago by
Attachment: | openglvid_11.diff added |
---|
Changed 16 years ago by
Attachment: | openglvid_12.diff added |
---|
Changed 16 years ago by
Attachment: | openglvid_13.diff added |
---|
comment:1 Changed 16 years ago by
14 Implement GL_NV_fence support
glFlush does not guarantee all pipeline instructions have been executed before completion. glFinish does guarantee this but may block until the next vertical sync. NV_fence allows us to guarantee completion of the pipeline without potential blocking.
Changed 16 years ago by
Attachment: | openglvid_14.diff added |
---|
comment:2 Changed 16 years ago by
15 Small ATI fix
Ref patch 10 (pbo support) - ensure we pick up the correct extension
Changed 16 years ago by
Attachment: | openglvid_15.diff added |
---|
comment:3 Changed 16 years ago by
comment:4 Changed 16 years ago by
comment:5 Changed 16 years ago by
(In [17396]) Refs #5324, Refs #2287. mythtv-vid: commit patch (3) of #5324. Rename key variables in line with VideoOutput?? to make opengl code easier to follow.
comment:6 Changed 16 years ago by
comment:7 Changed 16 years ago by
comment:8 Changed 16 years ago by
comment:9 Changed 16 years ago by
comment:10 Changed 16 years ago by
comment:11 Changed 16 years ago by
Changed 16 years ago by
Attachment: | mythtv-vid-16.diff added |
---|
Tidy up some locking and ensure GL_PACK_ALIGNMENT is set to the correct value.
Changed 16 years ago by
Attachment: | mythtv-vid-17.diff added |
---|
Tidy up YV12 packing code and add proper packing/upsampling of interlaced YV12 frames
Changed 16 years ago by
Attachment: | mythtv-vid-18.diff added |
---|
Re-write of texture handling. Default to packing all video textures, even if we don't have PixelBufferObjects? (still as fast as existing code and makes fragment program code much easier to handle). Much tighter control over texture properties - needed for bicubic filter. Fixes some FrameBufferObject? instability.
Changed 16 years ago by
Attachment: | mythtv-vid-18a.diff added |
---|
Don't try and upsample interlaced frames when using software bobdeint.
Changed 16 years ago by
Attachment: | mythtv-vid-19.diff added |
---|
Rewrite of deinterlacing code. Combine YUV2RGB and deinterlacing. Use 3 different fragment programs for progressive, top field and bottom field. Now properly deinterlaces luma and chroma channels and much faster. FrameBufferObjects? no longer a requirement.
Changed 16 years ago by
Attachment: | mythtv-vid-23.diff added |
---|
Add ability to switch on bicubic by adding openglbicubic to filters in display profile. Also adds some opengl options.
Changed 16 years ago by
Attachment: | mythtv-vid-24.diff added |
---|
Add DisableTextures? method for mythtv-vid functionality
comment:12 Changed 16 years ago by
comment:13 Changed 16 years ago by
Changed 16 years ago by
Attachment: | mythtv-vid-25.diff added |
---|
Use mmx for the bulk of YV12 packing if OSD frame width is not divisible by 8 and fall back to c for the rest.
Changed 16 years ago by
Attachment: | mythtv-vid-26.diff added |
---|
Use an extra resize stage when downscaling and deinterlacing (denterlacing doesn't work otherwise), remove it when not deinterlacing.
comment:14 Changed 16 years ago by
(In [18013]) Refs #5324, Refs #2287. apply patch 19. Rewrite of deinterlacing code. Combine YUV2RGB and deinterlacing. Use 3 different fragment programs for progressive, top field and bottom field. Now properly deinterlaces luma and chroma channels and much faster. FrameBufferObjects?? no longer a requirement. patch 18 and 18a, are already applied. this was done through [17954].
comment:15 Changed 16 years ago by
Changed 16 years ago by
Attachment: | mythtv-vid-27.diff added |
---|
Small fix when using bobdeint and opengl renderer (get the fields the right way around)
comment:16 follow-up: 17 Changed 15 years ago by
I have been running these patches for nearly 8 weeks without a single problem. Any chance of getting them into 0.21-fixes?
comment:17 Changed 15 years ago by
Replying to elkin@elkin.de:
I have been running these patches for nearly 8 weeks without a single problem. Any chance of getting them into 0.21-fixes?
that ought to be a joke, right?
comment:19 Changed 15 years ago by
Milestone: | unknown → 0.22 |
---|---|
Owner: | changed from Isaac Richards to danielk |
Status: | new → assigned |
Version: | unknown → head |
comment:20 Changed 15 years ago by
comment:21 Changed 15 years ago by
comment:22 Changed 15 years ago by
(In [19033]) Refs #2287. Refs #5324. Applies Mark Kendal's disable textures patch #24 to mythtv-vid; this adds a DisableTextures? method to OpenGLContext to match the EnableTextures? method and uses it in openglvideo instead of raw OpenGL.
comment:23 Changed 15 years ago by
comment:24 Changed 15 years ago by
comment:25 Changed 15 years ago by
comment:26 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
All patches have been applied, closing as fixed. Lets start a new ticket for any refactoring of the OpenGL video output...
Missed in patch 2