diff -ur -X excl mythtvopengl7/libs/libmythtv/openglcontext.cpp mythtvopengl8/libs/libmythtv/openglcontext.cpp
old
|
new
|
|
7 | 7 | #define LOC QString("GLCtx: ") |
8 | 8 | #define LOC_ERR QString("GLCtx, Error: ") |
9 | 9 | |
| 10 | ContextLocker::ContextLocker(OpenGLContext *ctx) |
| 11 | : m_ctx(ctx) |
| 12 | { |
| 13 | if (m_ctx) |
| 14 | m_ctx->MakeCurrent(true); |
| 15 | } |
| 16 | ContextLocker::~ContextLocker() |
| 17 | { |
| 18 | if (m_ctx) |
| 19 | m_ctx->MakeCurrent(false); |
| 20 | } |
| 21 | |
10 | 22 | class PrivateContext |
11 | 23 | { |
12 | 24 | public: |
… |
… |
|
36 | 48 | vector<GLuint> m_framebuffers; |
37 | 49 | }; |
38 | 50 | |
39 | | OpenGLContext::OpenGLContext() : |
| 51 | OpenGLContext::OpenGLContext(QMutex *lock) : |
40 | 52 | m_priv(new PrivateContext()), |
41 | 53 | m_display(NULL), m_screen_num(0), |
42 | 54 | m_major_ver(1), m_minor_ver(2), |
43 | 55 | m_extensions(QString::null), m_ext_supported(0), |
44 | | m_max_tex_size(0), m_viewport(0,0) |
| 56 | m_max_tex_size(0), m_viewport(0,0), |
| 57 | m_lock(lock), m_lock_level(0) |
45 | 58 | { |
46 | 59 | if (!init_opengl()) |
47 | 60 | VERBOSE(VB_PLAYBACK, LOC_ERR + "Failed to initialize OpenGL support."); |
… |
… |
|
63 | 76 | |
64 | 77 | glFlush(); |
65 | 78 | |
66 | | MakeCurrent(false); |
67 | | |
68 | 79 | if (m_priv->m_glx_window) |
69 | 80 | { |
70 | 81 | X11S(glXDestroyWindow(m_display, m_priv->m_glx_window)); |
… |
… |
|
77 | 88 | m_priv->m_gl_window = 0; |
78 | 89 | } |
79 | 90 | |
| 91 | MakeCurrent(false); |
| 92 | |
80 | 93 | if (m_priv->m_glx_context) |
81 | 94 | { |
82 | 95 | X11S(glXDestroyContext(m_display, m_priv->m_glx_context)); |
… |
… |
|
89 | 102 | |
90 | 103 | void OpenGLContext::Hide(void) |
91 | 104 | { |
| 105 | MakeCurrent(true); |
92 | 106 | X11S(XUnmapWindow(m_display, m_priv->m_gl_window)); |
| 107 | MakeCurrent(false); |
93 | 108 | } |
94 | 109 | |
95 | 110 | void OpenGLContext::Show(void) |
96 | 111 | { |
| 112 | MakeCurrent(true); |
97 | 113 | X11S(XMapWindow(m_display, m_priv->m_gl_window)); |
| 114 | MakeCurrent(false); |
98 | 115 | } |
99 | 116 | |
100 | 117 | // locking ok |
… |
… |
|
245 | 262 | ((has_gl_fbuffer_object_support(m_extensions)) ? kGLExtFBufObj : 0) | |
246 | 263 | ((minor >= 3) ? kGLXPBuffer : 0); |
247 | 264 | |
| 265 | MakeCurrent(true); |
248 | 266 | Init2DState(); |
| 267 | MakeCurrent(false); |
249 | 268 | |
250 | 269 | return true; |
251 | 270 | } |
… |
… |
|
253 | 272 | // locking ok |
254 | 273 | bool OpenGLContext::MakeCurrent(bool current) |
255 | 274 | { |
256 | | bool ok; |
| 275 | bool ok = true; |
257 | 276 | |
258 | 277 | if (current) |
259 | 278 | { |
260 | | if (IsGLXSupported(1,3)) |
261 | | { |
262 | | X11S(ok = glXMakeCurrent(m_display, |
263 | | m_priv->m_glx_window, |
264 | | m_priv->m_glx_context)); |
265 | | } |
266 | | else |
| 279 | m_lock->lock(); |
| 280 | if (m_lock_level == 0) |
267 | 281 | { |
268 | | X11S(ok = glXMakeCurrent(m_display, |
269 | | m_priv->m_gl_window, |
270 | | m_priv->m_glx_context)); |
| 282 | if (IsGLXSupported(1,3)) |
| 283 | { |
| 284 | X11S(ok = glXMakeCurrent(m_display, |
| 285 | m_priv->m_glx_window, |
| 286 | m_priv->m_glx_context)); |
| 287 | } |
| 288 | else |
| 289 | { |
| 290 | X11S(ok = glXMakeCurrent(m_display, |
| 291 | m_priv->m_gl_window, |
| 292 | m_priv->m_glx_context)); |
| 293 | } |
271 | 294 | } |
| 295 | m_lock_level++; |
272 | 296 | } |
273 | 297 | else |
274 | 298 | { |
275 | | X11S(ok = glXMakeCurrent(m_display, None, NULL)); |
| 299 | m_lock_level--; |
| 300 | if (m_lock_level == 0) |
| 301 | { |
| 302 | X11S(ok = glXMakeCurrent(m_display, None, NULL)); |
| 303 | } |
| 304 | else if (m_lock_level < 0) |
| 305 | { |
| 306 | VERBOSE(VB_PLAYBACK, LOC_ERR + "Mis-matched calls to MakeCurrent"); |
| 307 | } |
| 308 | m_lock->unlock(); |
276 | 309 | } |
277 | 310 | |
278 | 311 | if (!ok) |
279 | | VERBOSE(VB_PLAYBACK, LOC + "Could not make context current."); |
| 312 | VERBOSE(VB_PLAYBACK, LOC_ERR + "Could not make context current."); |
280 | 313 | |
281 | 314 | return ok; |
282 | 315 | } |
… |
… |
|
298 | 331 | // locking ok |
299 | 332 | void OpenGLContext::Flush(void) |
300 | 333 | { |
| 334 | MakeCurrent(true); |
301 | 335 | glFlush(); |
| 336 | MakeCurrent(false); |
302 | 337 | } |
303 | 338 | |
304 | 339 | // locking ok |
… |
… |
|
359 | 394 | // locking ok |
360 | 395 | void OpenGLContext::SetupTextureFilters(uint tex, int filt) |
361 | 396 | { |
| 397 | MakeCurrent(true); |
362 | 398 | glBindTexture(GetTextureType(), tex); |
363 | 399 | glTexParameteri(GetTextureType(), GL_TEXTURE_MIN_FILTER, filt); |
364 | 400 | glTexParameteri(GetTextureType(), GL_TEXTURE_MAG_FILTER, filt); |
365 | 401 | glTexParameteri(GetTextureType(), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
366 | 402 | glTexParameteri(GetTextureType(), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 403 | MakeCurrent(false); |
367 | 404 | } |
368 | 405 | |
369 | 406 | // locking ok |
… |
… |
|
391 | 428 | // locking ok |
392 | 429 | void OpenGLContext::DeleteTextures(void) |
393 | 430 | { |
394 | | MakeCurrent(true); |
395 | | |
396 | 431 | vector<GLuint>::iterator it; |
397 | 432 | for (it = m_priv->m_textures.begin(); it !=m_priv->m_textures.end(); it++) |
398 | 433 | glDeleteTextures(1, &(*(it))); |
399 | 434 | m_priv->m_textures.clear(); |
400 | 435 | |
401 | 436 | Flush(); |
402 | | |
403 | | MakeCurrent(false); |
404 | 437 | } |
405 | 438 | |
406 | 439 | int OpenGLContext::GetTextureType(void) const |
… |
… |
|
484 | 517 | |
485 | 518 | void OpenGLContext::BindFragmentProgram(uint fp) |
486 | 519 | { |
| 520 | MakeCurrent(true); |
487 | 521 | gMythGLBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, fp); |
| 522 | MakeCurrent(false); |
488 | 523 | } |
489 | 524 | |
490 | 525 | void OpenGLContext::InitFragmentParams( |
491 | 526 | uint fp, float a, float b, float c, float d) |
492 | 527 | { |
| 528 | MakeCurrent(true); |
493 | 529 | gMythGLProgramEnvParameter4fARB( |
494 | 530 | GL_FRAGMENT_PROGRAM_ARB, fp, a, b, c, d); |
| 531 | MakeCurrent(false); |
495 | 532 | } |
496 | 533 | |
497 | 534 | void OpenGLContext::DeletePrograms(void) |
498 | 535 | { |
499 | | MakeCurrent(true); |
500 | | |
501 | 536 | vector<GLuint>::iterator it; |
502 | 537 | for (it = m_priv->m_programs.begin(); it != m_priv->m_programs.end(); it++) |
503 | 538 | gMythGLDeleteProgramsARB(1, &(*(it))); |
504 | 539 | m_priv->m_programs.clear(); |
505 | 540 | |
506 | 541 | Flush(); |
507 | | |
508 | | MakeCurrent(false); |
509 | 542 | } |
510 | 543 | |
511 | 544 | // locking ok |
… |
… |
|
619 | 652 | |
620 | 653 | void OpenGLContext::DeleteFrameBuffers(void) |
621 | 654 | { |
622 | | MakeCurrent(true); |
623 | | |
624 | 655 | vector<GLuint>::iterator it; |
625 | 656 | for (it = m_priv->m_framebuffers.begin(); |
626 | 657 | it != m_priv->m_framebuffers.end(); it++) |
… |
… |
|
630 | 661 | m_priv->m_framebuffers.clear(); |
631 | 662 | |
632 | 663 | Flush(); |
633 | | |
634 | | MakeCurrent(false); |
635 | 664 | } |
636 | 665 | |
637 | 666 | // locking ok |
638 | 667 | void OpenGLContext::BindFramebuffer(uint fb) |
639 | 668 | { |
| 669 | MakeCurrent(true); |
640 | 670 | gMythGLBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb); |
| 671 | MakeCurrent(false); |
641 | 672 | } |
642 | 673 | |
643 | 674 | bool OpenGLContext::IsGLXSupported( |
… |
… |
|
655 | 686 | |
656 | 687 | void OpenGLContext::Init2DState(void) |
657 | 688 | { |
658 | | MakeCurrent(true); |
659 | 689 | glDisable(GL_BLEND); |
660 | 690 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // for gl osd |
661 | 691 | glDisable(GL_DEPTH_TEST); |
662 | 692 | glDepthMask(GL_FALSE); |
663 | 693 | glDisable(GL_CULL_FACE); |
| 694 | |
664 | 695 | EnableTextures();; |
| 696 | |
665 | 697 | glShadeModel(GL_FLAT); |
666 | 698 | glDisable(GL_POLYGON_SMOOTH); |
667 | 699 | glDisable(GL_LINE_SMOOTH); |
… |
… |
|
669 | 701 | glClearColor(0.0f, 0.0f, 0.0f, 0.0f); |
670 | 702 | glClear(GL_COLOR_BUFFER_BIT); |
671 | 703 | glFlush(); |
672 | | MakeCurrent(false); |
673 | 704 | } |
674 | 705 | |
675 | 706 | void OpenGLContext::SetViewPort(const QSize &size) |
… |
… |
|
678 | 709 | size.height() == m_viewport.height()) |
679 | 710 | return; |
680 | 711 | |
| 712 | MakeCurrent(true); |
| 713 | |
681 | 714 | m_viewport = size; |
682 | 715 | |
683 | 716 | glViewport(0, 0, size.width(), size.height()); |
… |
… |
|
687 | 720 | 0, size.height() - 1, 1, -1); // aargh... |
688 | 721 | glMatrixMode(GL_MODELVIEW); |
689 | 722 | glLoadIdentity(); |
| 723 | |
| 724 | MakeCurrent(false); |
690 | 725 | } |
diff -ur -X excl mythtvopengl7/libs/libmythtv/openglcontext.h mythtvopengl8/libs/libmythtv/openglcontext.h
old
|
new
|
|
23 | 23 | kGLXPBuffer = 0x08, |
24 | 24 | } GLFeatures; |
25 | 25 | |
| 26 | class OpenGLContext; |
| 27 | |
| 28 | class ContextLocker |
| 29 | { |
| 30 | public: |
| 31 | ContextLocker(OpenGLContext *ctx); |
| 32 | ~ContextLocker(); |
| 33 | |
| 34 | private: |
| 35 | OpenGLContext *m_ctx; |
| 36 | }; |
| 37 | |
26 | 38 | #ifdef USING_OPENGL |
27 | 39 | |
28 | 40 | class OpenGLContext |
29 | 41 | { |
30 | 42 | public: |
31 | | OpenGLContext(); |
| 43 | OpenGLContext(QMutex *lock); |
32 | 44 | ~OpenGLContext(); |
33 | 45 | |
34 | 46 | bool Create(Display *display, Window window, uint screen_num, |
… |
… |
|
87 | 99 | uint m_ext_supported; |
88 | 100 | uint m_max_tex_size; |
89 | 101 | QSize m_viewport; |
| 102 | QMutex *m_lock; |
| 103 | int m_lock_level; |
90 | 104 | }; |
91 | 105 | |
92 | 106 | #else // if !USING_OPENGL |
… |
… |
|
94 | 108 | class OpenGLContext |
95 | 109 | { |
96 | 110 | public: |
97 | | OpenGLContext() { } |
| 111 | OpenGLContext(QMutex*) { } |
98 | 112 | ~OpenGLContext() { } |
99 | 113 | |
100 | 114 | bool Create(Display*, Window, uint, const QSize&) { return false; } |
diff -ur -X excl mythtvopengl7/libs/libmythtv/openglvideo.cpp mythtvopengl8/libs/libmythtv/openglvideo.cpp
old
|
new
|
|
53 | 53 | |
54 | 54 | OpenGLVideo::~OpenGLVideo() |
55 | 55 | { |
| 56 | ContextLocker ctx_lock(gl_context); |
56 | 57 | Teardown(); |
57 | 58 | } |
58 | 59 | |
… |
… |
|
61 | 62 | { |
62 | 63 | ShutDownYUV2RGB(); |
63 | 64 | |
64 | | gl_context->MakeCurrent(true); |
65 | | |
66 | 65 | for (uint i = 0; i < inputTextures.size(); i++) |
67 | 66 | gl_context->DeleteTexture(inputTextures[i]); |
68 | 67 | inputTextures.clear(); |
… |
… |
|
83 | 82 | } |
84 | 83 | } |
85 | 84 | filters.clear(); |
86 | | |
87 | | gl_context->MakeCurrent(false); |
88 | 85 | } |
89 | 86 | |
90 | 87 | // locking ok |
… |
… |
|
94 | 91 | bool viewport_control, bool osd) |
95 | 92 | { |
96 | 93 | gl_context = glcontext; |
| 94 | if (!gl_context) |
| 95 | return false; |
| 96 | |
| 97 | ContextLocker ctx_lock(gl_context); |
| 98 | |
97 | 99 | actual_video_dim = videoDim; |
98 | 100 | video_dim = videoDim; |
99 | 101 | if (video_dim.height() == 1088) |
… |
… |
|
347 | 349 | VERBOSE(VB_PLAYBACK, LOC + QString("Creating %1 filter.") |
348 | 350 | .arg(FilterToString(filter))); |
349 | 351 | |
350 | | gl_context->MakeCurrent(true); |
351 | | |
352 | 352 | OpenGLFilter *temp = new OpenGLFilter(); |
353 | 353 | |
354 | 354 | temp->numInputs = 1; |
… |
… |
|
405 | 405 | VERBOSE(VB_PLAYBACK, QString("Removing %1 filter") |
406 | 406 | .arg(FilterToString(filter))); |
407 | 407 | |
408 | | gl_context->MakeCurrent(true); |
409 | | |
410 | 408 | gl_context->DeleteFragmentProgram(filters[filter]->fragmentProgram); |
411 | 409 | |
412 | 410 | vector<GLuint> temp; |
… |
… |
|
422 | 420 | |
423 | 421 | filters.erase(filter); |
424 | 422 | |
425 | | gl_context->MakeCurrent(false); |
426 | | |
427 | 423 | return true; |
428 | 424 | } |
429 | 425 | |
430 | 426 | // locking ok |
431 | 427 | bool OpenGLVideo::AddDeinterlacer(const QString &filter) |
432 | 428 | { |
| 429 | ContextLocker ctx_lock(gl_context); |
| 430 | |
433 | 431 | QString current_deinterlacer = GetDeinterlacer(); |
434 | 432 | |
435 | 433 | if (current_deinterlacer == filter) |
… |
… |
|
552 | 550 | // locking ok |
553 | 551 | void OpenGLVideo::UpdateInputFrame(const VideoFrame *frame) |
554 | 552 | { |
| 553 | ContextLocker ctx_lock(gl_context); |
| 554 | |
555 | 555 | if (frame->width != actual_video_dim.width() || |
556 | 556 | frame->height != actual_video_dim.height() || |
557 | 557 | frame->width < 1 || |
… |
… |
|
600 | 600 | void OpenGLVideo::UpdateInput(const unsigned char *buf, const int *offsets, |
601 | 601 | uint texture_index, int format, QSize size) |
602 | 602 | { |
| 603 | ContextLocker ctx_lock(gl_context); |
| 604 | |
603 | 605 | inputUpdated = false; |
604 | 606 | |
605 | 607 | if (texture_index >= inputTextures.size()) |
… |
… |
|
640 | 642 | // TODO shouldn't this take a QSize, not QRect? |
641 | 643 | void OpenGLVideo::SetVideoResize(const QRect &rect) |
642 | 644 | { |
| 645 | ContextLocker ctx_lock(gl_context); |
| 646 | |
643 | 647 | bool abort = ((rect.right() > video_dim.width()) || |
644 | 648 | (rect.bottom() > video_dim.height()) || |
645 | 649 | (rect.width() > video_dim.width()) || |
… |
… |
|
662 | 666 | // locking ok |
663 | 667 | void OpenGLVideo::DisableVideoResize(void) |
664 | 668 | { |
| 669 | ContextLocker ctx_lock(gl_context); |
| 670 | |
665 | 671 | videoResize = false; |
666 | 672 | videoResizeRect = QRect(0, 0, 0, 0); |
667 | 673 | } |
… |
… |
|
695 | 701 | if (deinterlacing == hardwareDeinterlacing) |
696 | 702 | return; |
697 | 703 | |
| 704 | ContextLocker ctx_lock(gl_context); |
| 705 | |
698 | 706 | VERBOSE(VB_PLAYBACK, LOC + QString("Turning %1 deinterlacing.") |
699 | 707 | .arg(deinterlacing ? "on" : "off")); |
700 | 708 | |
… |
… |
|
723 | 731 | } |
724 | 732 | } |
725 | 733 | |
726 | | gl_context->MakeCurrent(true); |
727 | 734 | SetFiltering(); |
728 | | gl_context->MakeCurrent(false); |
729 | 735 | } |
730 | 736 | |
731 | 737 | // locking ok |
… |
… |
|
735 | 741 | if (inputTextures.empty() || filters.empty()) |
736 | 742 | return; |
737 | 743 | |
| 744 | ContextLocker ctx_lock(gl_context); |
| 745 | |
738 | 746 | vector<GLuint> inputs = inputTextures; |
739 | 747 | QSize inputsize = inputTextureSize; |
740 | 748 | uint numfilters = filters.size(); |
… |
… |
|
1041 | 1049 | if (!useColourControl) |
1042 | 1050 | return -1; |
1043 | 1051 | |
| 1052 | ContextLocker ctx_lock(gl_context); |
| 1053 | |
1044 | 1054 | int ret = -1; |
1045 | 1055 | switch (attribute) |
1046 | 1056 | { |
diff -ur -X excl mythtvopengl7/libs/libmythtv/videoout_xv.cpp mythtvopengl8/libs/libmythtv/videoout_xv.cpp
old
|
new
|
|
122 | 122 | xv_colorkey(0), xv_draw_colorkey(false), |
123 | 123 | xv_chroma(0), |
124 | 124 | |
125 | | gl_context_lock(false), gl_context(NULL), |
| 125 | gl_context_lock(true), gl_context(NULL), |
126 | 126 | gl_videochain(NULL), gl_pipchain(NULL), |
127 | 127 | gl_osdchain(NULL), |
128 | 128 | |
… |
… |
|
219 | 219 | |
220 | 220 | if (gl_videochain) |
221 | 221 | { |
222 | | QMutexLocker locker(&gl_context_lock); |
| 222 | ContextLocker ctx_lock(gl_context); |
223 | 223 | gl_videochain->SetVideoRect(display_video_rect, video_rect); |
224 | 224 | } |
225 | 225 | } |
… |
… |
|
943 | 943 | #ifdef USING_OPENGL_VIDEO |
944 | 944 | ok = gl_context; |
945 | 945 | |
946 | | gl_context_lock.lock(); |
| 946 | gl_context_lock.lock(); |
947 | 947 | |
948 | 948 | if (!ok) |
949 | 949 | { |
950 | | gl_context = new OpenGLContext(); |
| 950 | gl_context = new OpenGLContext(&gl_context_lock); |
951 | 951 | |
952 | 952 | ok = gl_context->Create( |
953 | 953 | XJ_disp, XJ_win, XJ_screen_num, |
954 | 954 | display_visible_rect.size()); |
955 | 955 | } |
956 | 956 | |
| 957 | gl_context_lock.unlock(); |
| 958 | |
957 | 959 | if (ok) |
958 | 960 | { |
| 961 | ContextLocker ctx_lock(gl_context); |
959 | 962 | gl_context->Show(); |
960 | | gl_context->MakeCurrent(true); |
961 | 963 | gl_videochain = new OpenGLVideo(); |
962 | 964 | ok = gl_videochain->Init(gl_context, db_use_picture_controls, |
963 | 965 | video_dim, display_visible_rect, |
964 | 966 | display_video_rect, video_rect, true); |
965 | | gl_context->MakeCurrent(false); |
966 | 967 | } |
967 | 968 | |
968 | | gl_context_lock.unlock(); |
969 | | |
970 | 969 | if (ok) |
971 | 970 | { |
| 971 | ContextLocker ctx_lock(gl_context); |
972 | 972 | InstallXErrorHandler(XJ_disp); |
973 | 973 | |
974 | 974 | ok = CreateBuffers(OpenGL); |
… |
… |
|
994 | 994 | if (!m_deintfiltername.isEmpty() && |
995 | 995 | !m_deintfiltername.contains("opengl")) |
996 | 996 | { |
997 | | QMutexLocker locker(&gl_context_lock); |
998 | 997 | gl_videochain->SetSoftwareDeinterlacer(m_deintfiltername); |
999 | 998 | } |
1000 | 999 | |
… |
… |
|
1413 | 1412 | |
1414 | 1413 | if (osd_renderer == "opengl2") |
1415 | 1414 | { |
1416 | | QMutexLocker locker(&gl_context_lock); |
| 1415 | ContextLocker ctx_lock(gl_context); |
1417 | 1416 | gl_use_osd_opengl2 = true; |
1418 | 1417 | |
1419 | | gl_context->MakeCurrent(true); |
1420 | | |
1421 | 1418 | gl_osdchain = new OpenGLVideo(); |
1422 | 1419 | if (!gl_osdchain->Init( |
1423 | 1420 | gl_context, false, |
… |
… |
|
1435 | 1432 | { |
1436 | 1433 | gl_osdchain->SetMasterViewport(gl_videochain->GetViewPort()); |
1437 | 1434 | } |
1438 | | |
1439 | | gl_context->MakeCurrent(false); |
1440 | 1435 | } |
1441 | 1436 | |
1442 | 1437 | if (osd_renderer == "chromakey") |
… |
… |
|
1777 | 1772 | if (enable && m_deinterlacing && (OpenGL != VideoOutputSubType())) |
1778 | 1773 | return m_deinterlacing; |
1779 | 1774 | |
| 1775 | ContextLocker ctx_lock(gl_context); |
| 1776 | |
1780 | 1777 | if (enable) |
1781 | 1778 | { |
1782 | 1779 | if (m_deintfiltername == "") |
… |
… |
|
1789 | 1786 | else if (!m_deintfiltername.contains("opengl")) |
1790 | 1787 | { |
1791 | 1788 | // make sure opengl deinterlacing is disabled |
1792 | | gl_context_lock.lock(); |
1793 | 1789 | gl_videochain->SetDeinterlacing(false); |
1794 | | gl_context_lock.unlock(); |
1795 | 1790 | |
1796 | 1791 | if (!m_deintFiltMan || !m_deintFilter) |
1797 | 1792 | return VideoOutput::SetupDeinterlace(enable); |
… |
… |
|
1799 | 1794 | } |
1800 | 1795 | |
1801 | 1796 | if (gl_videochain) |
1802 | | { |
1803 | | QMutexLocker locker(&gl_context_lock); |
1804 | 1797 | gl_videochain->SetDeinterlacing(enable); |
1805 | | } |
1806 | 1798 | |
1807 | 1799 | m_deinterlacing = enable; |
1808 | 1800 | |
… |
… |
|
1815 | 1807 | (void) interlaced; |
1816 | 1808 | (void) overridefilter; |
1817 | 1809 | |
| 1810 | ContextLocker ctx_lock(gl_context); |
| 1811 | |
1818 | 1812 | m_deintfiltername = db_vdisp_profile->GetFilteredDeint(overridefilter); |
1819 | 1813 | |
1820 | 1814 | if (!m_deintfiltername.contains("opengl")) |
1821 | 1815 | { |
1822 | | gl_context_lock.lock(); |
1823 | 1816 | gl_videochain->SetDeinterlacing(false); |
1824 | | gl_context_lock.unlock(); |
1825 | 1817 | |
1826 | 1818 | gl_videochain->SetSoftwareDeinterlacer(QString::null); |
1827 | 1819 | |
… |
… |
|
1851 | 1843 | if (!gl_videochain) |
1852 | 1844 | return false; |
1853 | 1845 | |
1854 | | QMutexLocker locker(&gl_context_lock); |
1855 | | |
1856 | 1846 | if (m_deinterlacing && !m_deintfiltername.isEmpty()) |
1857 | 1847 | { |
1858 | 1848 | if (gl_videochain->GetDeinterlacer() != m_deintfiltername) |
… |
… |
|
2347 | 2337 | #endif // USING_XVMC |
2348 | 2338 | |
2349 | 2339 | // OpenGL stuff |
2350 | | gl_context_lock.lock(); |
| 2340 | if (gl_context) |
| 2341 | gl_context->MakeCurrent(true); |
2351 | 2342 | |
2352 | 2343 | if (gl_videochain) |
2353 | 2344 | { |
… |
… |
|
2366 | 2357 | } |
2367 | 2358 | |
2368 | 2359 | if (gl_context) |
| 2360 | { |
2369 | 2361 | gl_context->Hide(); |
| 2362 | gl_context->MakeCurrent(false); |
| 2363 | } |
2370 | 2364 | |
2371 | 2365 | gl_use_osd_opengl2 = false; |
2372 | 2366 | gl_pip_ready = false; |
2373 | 2367 | gl_osd_ready = false; |
2374 | 2368 | allowpreviewepg = true; |
2375 | | |
2376 | | gl_context_lock.unlock(); |
2377 | 2369 | // end OpenGL stuff |
2378 | 2370 | |
2379 | 2371 | vbuffers.DeleteBuffers(); |
… |
… |
|
2716 | 2708 | { |
2717 | 2709 | (void) t; |
2718 | 2710 | |
2719 | | QMutexLocker locker(&gl_context_lock); |
| 2711 | ContextLocker ctx_lock(gl_context); |
2720 | 2712 | |
2721 | 2713 | if (!buffer) |
2722 | 2714 | buffer = vbuffers.GetScratchFrame(); |
… |
… |
|
2727 | 2719 | if (buffer->codec != FMT_YV12) |
2728 | 2720 | return; |
2729 | 2721 | |
2730 | | gl_context->MakeCurrent(true); |
2731 | 2722 | gl_videochain->PrepareFrame(t, m_deinterlacing, framesPlayed); |
2732 | 2723 | |
2733 | 2724 | if (gl_pip_ready && gl_pipchain) |
… |
… |
|
2737 | 2728 | gl_osdchain->PrepareFrame(t, m_deinterlacing, framesPlayed); |
2738 | 2729 | |
2739 | 2730 | gl_context->Flush(); |
2740 | | gl_context->MakeCurrent(false); |
2741 | 2731 | |
2742 | 2732 | if (vbuffers.GetScratchFrame() == buffer) |
2743 | 2733 | vbuffers.SetLastShownFrameToScratch(); |
… |
… |
|
3106 | 3096 | else if (VideoOutputSubType() == XVideo) |
3107 | 3097 | ShowXVideo(scan); |
3108 | 3098 | else if (VideoOutputSubType() == OpenGL) |
3109 | | { |
3110 | | QMutexLocker locker(&gl_context_lock); |
3111 | 3099 | gl_context->SwapBuffers(); |
3112 | | } |
3113 | 3100 | |
3114 | 3101 | X11S(XSync(XJ_disp, False)); |
3115 | 3102 | } |
… |
… |
|
3714 | 3701 | (void) filterList; |
3715 | 3702 | (void) pipPlayer; |
3716 | 3703 | |
3717 | | QMutexLocker locker(&gl_context_lock); |
| 3704 | ContextLocker ctx_lock(gl_context); |
3718 | 3705 | |
3719 | 3706 | bool pauseframe = false; |
3720 | 3707 | if (!frame) |
… |
… |
|
3724 | 3711 | pauseframe = true; |
3725 | 3712 | } |
3726 | 3713 | |
3727 | | // disable image processing for offscreen rendering |
3728 | | gl_context->MakeCurrent(true); |
3729 | | |
3730 | 3714 | if (filterList) |
3731 | 3715 | filterList->ProcessFrame(frame); |
3732 | 3716 | |
… |
… |
|
3749 | 3733 | |
3750 | 3734 | if (gl_videochain) |
3751 | 3735 | gl_videochain->UpdateInputFrame(frame); |
3752 | | |
3753 | | gl_context->MakeCurrent(false); |
3754 | 3736 | } |
3755 | 3737 | |
3756 | 3738 | void VideoOutputXv::ProcessFrameMem(VideoFrame *frame, OSD *osd, |