From 1427d3d34589cd779d5e06da281e6fd65a765ccb Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 23 Apr 2021 01:10:19 +0200 Subject: [PATCH] I can't convince myself that _canvas_mutex is doing anything useful, so remove it. --- src/wx/gl_video_view.cc | 39 ++++++++++++++++----------------------- src/wx/gl_video_view.h | 4 ---- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc index bda3a58ec..7bf9e3adc 100644 --- a/src/wx/gl_video_view.cc +++ b/src/wx/gl_video_view.cc @@ -122,20 +122,18 @@ GLVideoView::check_for_butler_errors () } +/** Called from the UI thread */ void GLVideoView::update () { - { - boost::mutex::scoped_lock lm (_canvas_mutex); - if (!_canvas->IsShownOnScreen()) { - return; - } + if (!_canvas->IsShownOnScreen()) { + return; + } #ifdef DCPOMATIC_OSX - /* macOS gives errors if we don't do this (and therefore [NSOpenGLContext setView:]) from the main thread */ - ensure_context (); + /* macOS gives errors if we don't do this (and therefore [NSOpenGLContext setView:]) from the main thread */ + ensure_context (); #endif - } if (!_thread.joinable()) { _thread = boost::thread (boost::bind(&GLVideoView::thread, this)); @@ -262,7 +260,6 @@ DCPOMATIC_ENABLE_WARNINGS glFlush(); check_gl_error ("glFlush"); - boost::mutex::scoped_lock lm (_canvas_mutex); _canvas->SwapBuffers(); } @@ -364,23 +361,19 @@ try { start_of_thread ("GLVideoView"); - { - boost::mutex::scoped_lock lm (_canvas_mutex); - #if defined(DCPOMATIC_OSX) - /* Without this we see errors like - * ../src/osx/cocoa/glcanvas.mm(194): assert ""context"" failed in SwapBuffers(): should have current context [in thread 700006970000] - */ - WXGLSetCurrentContext (_context->GetWXGLContext()); + /* Without this we see errors like + * ../src/osx/cocoa/glcanvas.mm(194): assert ""context"" failed in SwapBuffers(): should have current context [in thread 700006970000] + */ + WXGLSetCurrentContext (_context->GetWXGLContext()); #else - /* We must call this here on Linux otherwise we get no image (for reasons - * that aren't clear). However, doing ensure_context() from this thread - * on macOS gives - * "[NSOpenGLContext setView:] must be called from the main thread". - */ - ensure_context (); + /* We must call this here on Linux otherwise we get no image (for reasons + * that aren't clear). However, doing ensure_context() from this thread + * on macOS gives + * "[NSOpenGLContext setView:] must be called from the main thread". + */ + ensure_context (); #endif - } #if defined(DCPOMATIC_LINUX) && defined(DCPOMATIC_HAVE_GLX_SWAP_INTERVAL_EXT) if (_canvas->IsExtensionSupported("GLX_EXT_swap_control")) { diff --git a/src/wx/gl_video_view.h b/src/wx/gl_video_view.h index 4601eb02d..36edd6b8b 100644 --- a/src/wx/gl_video_view.h +++ b/src/wx/gl_video_view.h @@ -64,10 +64,6 @@ private: void ensure_context (); void size_changed (wxSizeEvent const &); - /* Mutex for use of _canvas; it's only contended when our ::thread - is started up so this may be overkill. - */ - boost::mutex _canvas_mutex; wxGLCanvas* _canvas; wxGLContext* _context; -- 2.30.2