diff -ur -X excl mythtvopengl13/libs/libmythtv/openglcontext.cpp mythtvopengl14/libs/libmythtv/openglcontext.cpp
old
|
new
|
|
47 | 47 | vector<GLuint> m_programs; |
48 | 48 | vector<GLuint> m_framebuffers; |
49 | 49 | vector<GLuint> m_pbos; |
| 50 | GLuint m_fence; |
50 | 51 | }; |
51 | 52 | |
52 | 53 | OpenGLContext::OpenGLContext(QMutex *lock) : |
… |
… |
|
75 | 76 | DeleteTextures(); |
76 | 77 | DeleteFrameBuffers(); |
77 | 78 | DeletePBOs(); |
| 79 | |
| 80 | Flush(true); |
| 81 | |
| 82 | if (m_priv->m_fence && |
| 83 | IsFeatureSupported(kGLNVFence)) |
| 84 | { |
| 85 | gMythGLDeleteFencesNV(1, &(m_priv->m_fence)); |
| 86 | } |
78 | 87 | } |
79 | 88 | |
80 | | glFlush(); |
| 89 | Flush(false); |
81 | 90 | |
82 | 91 | if (m_priv->m_glx_window) |
83 | 92 | { |
… |
… |
|
266 | 275 | ((has_gl_pixelbuffer_object_support(m_extensions)) ? |
267 | 276 | kGLExtPBufObj : 0) | |
268 | 277 | ((has_gl_fbuffer_object_support(m_extensions)) ? kGLExtFBufObj : 0) | |
| 278 | ((has_gl_nvfence_support(m_extensions)) ? kGLNVFence : 0) | |
269 | 279 | ((minor >= 3) ? kGLXPBuffer : 0); |
270 | 280 | |
271 | 281 | MakeCurrent(true); |
| 282 | |
| 283 | if (IsFeatureSupported(kGLNVFence)) |
| 284 | { |
| 285 | gMythGLGenFencesNV(1, &(m_priv->m_fence)); |
| 286 | if (m_priv->m_fence) |
| 287 | VERBOSE(VB_PLAYBACK, LOC + "Using GL_NV_fence"); |
| 288 | } |
| 289 | |
272 | 290 | Init2DState(); |
273 | 291 | MakeCurrent(false); |
274 | 292 | |
… |
… |
|
343 | 361 | } |
344 | 362 | |
345 | 363 | // locking ok |
346 | | void OpenGLContext::Flush(void) |
| 364 | void OpenGLContext::Flush(bool use_fence) |
347 | 365 | { |
348 | 366 | MakeCurrent(true); |
349 | | glFlush(); |
| 367 | |
| 368 | if (IsFeatureSupported(kGLNVFence) && |
| 369 | m_priv->m_fence && use_fence) |
| 370 | { |
| 371 | gMythGLSetFenceNV(m_priv->m_fence, GL_ALL_COMPLETED_NV); |
| 372 | gMythGLFinishFenceNV(m_priv->m_fence); |
| 373 | } |
| 374 | else |
| 375 | { |
| 376 | glFlush(); |
| 377 | } |
| 378 | |
350 | 379 | MakeCurrent(false); |
351 | 380 | } |
352 | 381 | |
… |
… |
|
373 | 402 | SetupTextureFilters(tex, GL_LINEAR); |
374 | 403 | m_priv->m_textures.push_back(tex); |
375 | 404 | |
376 | | Flush(); |
| 405 | Flush(true); |
377 | 406 | |
378 | 407 | MakeCurrent(false); |
379 | 408 | |
… |
… |
|
434 | 463 | } |
435 | 464 | } |
436 | 465 | |
437 | | Flush(); |
| 466 | Flush(true); |
438 | 467 | |
439 | 468 | MakeCurrent(false); |
440 | 469 | } |
… |
… |
|
447 | 476 | glDeleteTextures(1, &(*(it))); |
448 | 477 | m_priv->m_textures.clear(); |
449 | 478 | |
450 | | Flush(); |
| 479 | Flush(true); |
451 | 480 | } |
452 | 481 | |
453 | 482 | int OpenGLContext::GetTextureType(void) const |
… |
… |
|
498 | 527 | gMythGLDeleteProgramsARB(1, &glfp); |
499 | 528 | } |
500 | 529 | |
501 | | Flush(); |
| 530 | Flush(true); |
502 | 531 | |
503 | 532 | MakeCurrent(false); |
504 | 533 | |
… |
… |
|
524 | 553 | } |
525 | 554 | } |
526 | 555 | |
527 | | Flush(); |
| 556 | Flush(true); |
528 | 557 | |
529 | 558 | MakeCurrent(false); |
530 | 559 | } |
… |
… |
|
552 | 581 | gMythGLDeleteProgramsARB(1, &(*(it))); |
553 | 582 | m_priv->m_programs.clear(); |
554 | 583 | |
555 | | Flush(); |
| 584 | Flush(true); |
556 | 585 | } |
557 | 586 | |
558 | 587 | // locking ok |
… |
… |
|
631 | 660 | else |
632 | 661 | gMythGLDeleteFramebuffersEXT(1, &glfb); |
633 | 662 | |
634 | | Flush(); |
| 663 | Flush(true); |
635 | 664 | |
636 | 665 | glCheck(); |
637 | 666 | MakeCurrent(false); |
… |
… |
|
659 | 688 | } |
660 | 689 | } |
661 | 690 | |
662 | | Flush(); |
| 691 | Flush(true); |
663 | 692 | |
664 | 693 | MakeCurrent(false); |
665 | 694 | } |
… |
… |
|
674 | 703 | } |
675 | 704 | m_priv->m_framebuffers.clear(); |
676 | 705 | |
677 | | Flush(); |
| 706 | Flush(true); |
678 | 707 | } |
679 | 708 | |
680 | 709 | // locking ok |
… |
… |
|
714 | 743 | glDisable(GL_POINT_SMOOTH); |
715 | 744 | glClearColor(0.0f, 0.0f, 0.0f, 0.0f); |
716 | 745 | glClear(GL_COLOR_BUFFER_BIT); |
717 | | glFlush(); |
| 746 | Flush(true); |
718 | 747 | } |
719 | 748 | |
720 | 749 | void OpenGLContext::SetViewPort(const QSize &size) |
… |
… |
|
781 | 810 | |
782 | 811 | gMythGLBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0); |
783 | 812 | |
784 | | Flush(); |
| 813 | Flush(true); |
785 | 814 | |
786 | 815 | MakeCurrent(false); |
787 | 816 | |
… |
… |
|
808 | 837 | } |
809 | 838 | } |
810 | 839 | |
811 | | Flush(); |
| 840 | Flush(true); |
812 | 841 | |
813 | 842 | MakeCurrent(false); |
814 | 843 | } |
… |
… |
|
823 | 852 | } |
824 | 853 | m_priv->m_pbos.clear(); |
825 | 854 | |
826 | | Flush(); |
| 855 | Flush(true); |
827 | 856 | } |
828 | 857 | |
829 | 858 | int OpenGLContext::SetPictureAttribute( |
diff -ur -X excl mythtvopengl13/libs/libmythtv/openglcontext.h mythtvopengl14/libs/libmythtv/openglcontext.h
old
|
new
|
|
24 | 24 | kGLExtFBufObj = 0x04, |
25 | 25 | kGLXPBuffer = 0x08, |
26 | 26 | kGLExtPBufObj = 0x10, |
| 27 | kGLNVFence = 0x20, |
27 | 28 | } GLFeatures; |
28 | 29 | |
29 | 30 | class OpenGLContext; |
… |
… |
|
55 | 56 | |
56 | 57 | bool MakeCurrent(bool current); |
57 | 58 | void SwapBuffers(void); |
58 | | void Flush(void); |
| 59 | void Flush(bool use_fence); |
59 | 60 | |
60 | 61 | uint GetMaxTexSize(void) const { return m_max_tex_size; } |
61 | 62 | uint GetScreenNum(void) const { return m_screen_num; } |
… |
… |
|
136 | 137 | |
137 | 138 | bool MakeCurrent(bool) { return false; } |
138 | 139 | void SwapBuffers(void) { } |
139 | | void Flush(void) { } |
| 140 | void Flush(bool) { } |
140 | 141 | |
141 | 142 | uint GetMaxTexSize(void) const { return 0; } |
142 | 143 | uint GetScreenNum(void) const { return 0; } |
diff -ur -X excl mythtvopengl13/libs/libmythtv/util-opengl.cpp mythtvopengl14/libs/libmythtv/util-opengl.cpp
old
|
new
|
|
32 | 32 | PFNGLXGETVIDEOSYNCSGIPROC gMythGLXGetVideoSyncSGI = NULL; |
33 | 33 | PFNGLXWAITVIDEOSYNCSGIPROC gMythGLXWaitVideoSyncSGI = NULL; |
34 | 34 | |
| 35 | PFNGLGENFENCESNVPROC gMythGLGenFencesNV = NULL; |
| 36 | PFNGLDELETEFENCESNVPROC gMythGLDeleteFencesNV = NULL; |
| 37 | PFNGLSETFENCENVPROC gMythGLSetFenceNV = NULL; |
| 38 | PFNGLFINISHFENCENVPROC gMythGLFinishFenceNV = NULL; |
| 39 | |
35 | 40 | bool init_opengl(void) |
36 | 41 | { |
37 | 42 | static bool is_initialized = false; |
… |
… |
|
86 | 91 | gMythGLXWaitVideoSyncSGI = (PFNGLXWAITVIDEOSYNCSGIPROC) |
87 | 92 | get_gl_proc_address("glXWaitVideoSyncSGI"); |
88 | 93 | |
| 94 | gMythGLGenFencesNV = (PFNGLGENFENCESNVPROC) |
| 95 | get_gl_proc_address("glGenFencesNV"); |
| 96 | gMythGLDeleteFencesNV = (PFNGLDELETEFENCESNVPROC) |
| 97 | get_gl_proc_address("glDeleteFencesNV"); |
| 98 | gMythGLSetFenceNV = (PFNGLSETFENCENVPROC) |
| 99 | get_gl_proc_address("glSetFenceNV"); |
| 100 | gMythGLFinishFenceNV = (PFNGLFINISHFENCENVPROC) |
| 101 | get_gl_proc_address("glFinishFenceNV"); |
| 102 | |
89 | 103 | return true; |
90 | 104 | } |
91 | 105 | |
… |
… |
|
411 | 425 | gMythGLUnmapBufferARB); |
412 | 426 | } |
413 | 427 | |
| 428 | bool has_gl_nvfence_support(const QString &ext) |
| 429 | { |
| 430 | init_opengl(); |
| 431 | |
| 432 | if (!ext.contains("GL_NV_fence")) |
| 433 | return false; |
| 434 | |
| 435 | return (gMythGLGenFencesNV && |
| 436 | gMythGLDeleteFencesNV && |
| 437 | gMythGLSetFenceNV && |
| 438 | gMythGLFinishFenceNV); |
| 439 | } |
| 440 | |
414 | 441 | #ifdef MMX |
415 | 442 | static inline void mmx_pack_alpha_high(uint8_t *a1, uint8_t *a2) |
416 | 443 | { |
diff -ur -X excl mythtvopengl13/libs/libmythtv/util-opengl.h mythtvopengl14/libs/libmythtv/util-opengl.h
old
|
new
|
|
78 | 78 | #define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD |
79 | 79 | #endif |
80 | 80 | |
| 81 | #ifndef GL_NV_fence |
| 82 | #define GL_ALL_COMPLETED_NV 0x84F2 |
| 83 | #endif |
81 | 84 | |
82 | 85 | #ifndef GLX_VERSION_1_3 |
83 | 86 | typedef XID GLXPbuffer; |
… |
… |
|
140 | 143 | bool has_gl_fragment_program_support(const QString &extensions); |
141 | 144 | bool has_glx_video_sync_support(const QString &glx_extensions); |
142 | 145 | bool has_gl_pixelbuffer_object_support(const QString &extensions); |
| 146 | bool has_gl_nvfence_support(const QString &extensions); |
143 | 147 | |
144 | 148 | extern QString gMythGLExtensions; |
145 | 149 | extern uint gMythGLExtSupported; |
… |
… |
|
181 | 185 | extern PFNGLXGETVIDEOSYNCSGIPROC gMythGLXGetVideoSyncSGI; |
182 | 186 | extern PFNGLXWAITVIDEOSYNCSGIPROC gMythGLXWaitVideoSyncSGI; |
183 | 187 | |
| 188 | extern PFNGLGENFENCESNVPROC gMythGLGenFencesNV; |
| 189 | extern PFNGLDELETEFENCESNVPROC gMythGLDeleteFencesNV; |
| 190 | extern PFNGLSETFENCENVPROC gMythGLSetFenceNV; |
| 191 | extern PFNGLFINISHFENCENVPROC gMythGLFinishFenceNV; |
184 | 192 | #endif // USING_OPENGL |
185 | 193 | |
186 | 194 | #endif // _UTIL_OPENGL_H_ |
diff -ur -X excl mythtvopengl13/libs/libmythtv/videoout_xv.cpp mythtvopengl14/libs/libmythtv/videoout_xv.cpp
old
|
new
|
|
2728 | 2728 | if (gl_osd_ready && gl_osdchain) |
2729 | 2729 | gl_osdchain->PrepareFrame(t, m_deinterlacing, framesPlayed); |
2730 | 2730 | |
2731 | | gl_context->Flush(); |
| 2731 | gl_context->Flush(false); |
2732 | 2732 | |
2733 | 2733 | if (vbuffers.GetScratchFrame() == buffer) |
2734 | 2734 | vbuffers.SetLastShownFrameToScratch(); |