<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Nov 2, 2020, at 6:15 PM, Alexandre Janniaux <<a href="mailto:ajanni@videolabs.io" class="">ajanni@videolabs.io</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Hi,</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">On Mon, Nov 02, 2020 at 10:35:09AM +0100, Steve Lhomme wrote:</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">It seems the issue is that code in macosx.m<br class=""><br class="">   @synchronized(self) {<br class="">       _hasPendingReshape = NO;<br class="">   }<br class=""><br class="">It might use an atomic bool for this variable. Using less locks is always a<br class="">good idea when possible. I don't know if/how Objective-C can handle atomics.<br class=""><br class="">On the other hand the original patch is not mandatory and doesn't improve<br class="">anything much. So if necessary I'm OK with reverting it.<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">I read the issue as «you cannot get the display lock for mouse update, since</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">display can currently report the mouse state, thus already under display lock».</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Is that different from reality?</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Using the work from Marvin, we'll be able to remove the mouse API from display</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">on MacOSX, so finally solve this issue.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""></div></blockquote><div><br class=""></div><div>So it’s OK to just revert? The master branch is totally unusable now.</div><br class=""><blockquote type="cite" class=""><div class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Regards,</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">--</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Alexandre Janniaux</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Videolabs</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">On 2020-10-31 17:49, Zhao Zhili wrote:<br class=""><blockquote type="cite" class="">Hi Steve,<br class=""><br class=""><blockquote type="cite" class="">On Sep 14, 2020, at 10:03 PM, Steve Lhomme <<a href="mailto:robux4@ycbcr.xyz" class="">robux4@ycbcr.xyz</a>> wrote:<br class=""><br class="">We can do this in the UI thread, the processing is light.<br class="">Locking the display_lock doesn't have a big impact on lag as it's only taking<br class="">time when reloading a display module, which is very rare.<br class="">---<br class="">src/video_output/video_output.c | 21 ++++++++++++---------<br class="">1 file changed, 12 insertions(+), 9 deletions(-)<br class=""><br class="">diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c<br class="">index cbc66b9dbc0..ed1e3bfcb07 100644<br class="">--- a/src/video_output/video_output.c<br class="">+++ b/src/video_output/video_output.c<br class="">@@ -389,7 +389,14 @@ void vout_MouseState(vout_thread_t *vout, const vlc_mouse_t *mouse)<br class="">    assert(mouse);<br class="">    vout_control_cmd_t cmd;<br class="">    vout_control_cmd_Init(&cmd, VOUT_CONTROL_MOUSE_STATE);<br class="">-    cmd.mouse = *mouse;<br class="">+<br class="">+    /* Translate window coordinates to video coordinates */<br class="">+    vlc_mutex_lock(&sys->display_lock);<br class=""></blockquote><br class="">This change leads to a deadlock on macOS.<br class=""><br class="">* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP<br class="">  * frame #0: 0x00007fff6dcdd882 libsystem_kernel.dylib`__psynch_cvwait + 10<br class="">    frame #1: 0x00007fff6dd9e425 libsystem_pthread.dylib`_pthread_cond_wait + 698<br class="">    frame #2: 0x000000010023d27c libvlccore.dylib`vlc_atomic_wait(addr=0x000000010ef31ff0, value=2) at wait.c:84:9<br class="">    frame #3: 0x0000000100226d4e libvlccore.dylib`vlc_mutex_lock(mtx=0x000000010ef31ff0) at threads.c:175:9<br class="">    frame #4: 0x00000001001eb968 libvlccore.dylib`vout_MouseState(vout=0x000000010ef31d50, mouse=0x000000010ed8e4a8) at video_output.c:389:5<br class="">    frame #5: 0x00000001002005f4 libvlccore.dylib`vout_display_window_MouseEvent(window=0x000000010ed8e370, ev=0x00007ffeefbfdd80) at window.c:321:5<br class="">    frame #6: 0x0000000107fc11b9 libvout_macosx_plugin.dylib`vout_window_SendMouseEvent(window=0x000000010ed8e370, mouse=0x00007ffeefbfdd80) at vlc_vout_window.h:595:9<br class="">    frame #7: 0x0000000107fc1239 libvout_macosx_plugin.dylib`vout_window_ReportMouseMoved(window=0x000000010ed8e370, x=2038, y=943) at vlc_vout_window.h:614:5<br class="">    frame #8: 0x0000000107fc05b8 libvout_macosx_plugin.dylib`vout_display_SendMouseMovedDisplayCoordinates(vd=0x0000000110911340, m_x=2038, m_y=943) at vlc_vout_display.h:467:5<br class="">    frame #9: 0x0000000107fc0507 libvout_macosx_plugin.dylib`-[VLCOpenGLVideoView mouseMoved:](self=0x0000000110911da0, _cmd="mouseMoved:", o_event=0x0000000100676520) at macosx.m:778:17<br class=""><br class=""><br class="">  thread #42<br class="">    frame #0: 0x00007fff6dcdc55e libsystem_kernel.dylib`__ulock_wait + 10<br class="">    frame #1: 0x00007fff6dd909c3 libsystem_platform.dylib`_os_unfair_lock_lock_slow + 160<br class="">    frame #2: 0x00007fff6c9e8dc7 libobjc.A.dylib`objc_sync_enter + 27<br class="">    frame #3: 0x0000000107fbf4e4 libvout_macosx_plugin.dylib`-[VLCOpenGLVideoView setVoutFlushing:](self=0x0000000110911da0, _cmd="setVoutFlushing:", flushing=YES) at macosx.m:550:5<br class="">    frame #4: 0x0000000107fc0cf0 libvout_macosx_plugin.dylib`PictureDisplay(vd=0x0000000110911340, pic=0x000000010ae1d640) at macosx.m:331:5<br class="">    frame #5: 0x00000001001f2b09 libvlccore.dylib`vout_display_Display(vd=0x0000000110911340, picture=0x000000010ae1d640) at vlc_vout_display.h:431:9<br class="">    frame #6: 0x00000001001f2127 libvlccore.dylib`ThreadDisplayRenderPicture(vout=0x000000010ef31d50, render_now=false) at video_output.c:1446:5<br class="">    frame #7: 0x00000001001edf69 libvlccore.dylib`ThreadDisplayPicture(vout=0x000000010ef31d50, deadline=0x00007000061d6fa0) at video_output.c:1572:15<br class="">    frame #8: 0x00000001001f0409 libvlccore.dylib`Thread(object=0x000000010ef31d50) at video_output.c:1914:16<br class="">    frame #9: 0x00007fff6dd9e109 libsystem_pthread.dylib`_pthread_start + 148<br class="">    frame #10: 0x00007fff6dd99b8b libsystem_pthread.dylib`thread_start + 15<br class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">+    if (sys->display)<br class="">+        vout_display_TranslateMouseState(sys->display, &cmd.mouse, mouse);<br class="">+    else<br class="">+        cmd.mouse = *mouse;<br class="">+    vlc_mutex_unlock(&sys->display_lock);<br class=""><br class="">    vout_control_Push(&sys->control, &cmd);<br class="">}<br class="">@@ -1678,17 +1685,13 @@ void vout_ChangeSpuRate(vout_thread_t *vout, size_t channel_id, float rate)<br class="">static void ThreadProcessMouseState(vout_thread_sys_t *p_vout,<br class="">                                    const vlc_mouse_t *win_mouse)<br class="">{<br class="">-    vlc_mouse_t vid_mouse, tmp1, tmp2, *m;<br class="">+    vlc_mouse_t tmp1, tmp2;<br class="">+    const vlc_mouse_t *m;<br class="">    vout_thread_t *vout = &p_vout->obj;<br class="">    vout_thread_sys_t *sys = p_vout;<br class=""><br class="">-    /* Translate window coordinates to video coordinates */<br class="">-    vlc_mutex_lock(&sys->display_lock);<br class="">-    vout_display_TranslateMouseState(sys->display, &vid_mouse, win_mouse);<br class="">-    vlc_mutex_unlock(&sys->display_lock);<br class="">-<br class="">-    /* Then pass up the filter chains. */<br class="">-    m = &vid_mouse;<br class="">+    /* pass mouse coordinates in the filter chains. */<br class="">+    m = win_mouse;<br class="">    vlc_mutex_lock(&sys->filter.lock);<br class="">    if (sys->filter.chain_static && sys->filter.chain_interactive) {<br class="">        if (!filter_chain_MouseFilter(sys->filter.chain_interactive,<br class="">--<br class="">2.26.2<br class=""><br class="">_______________________________________________<br class="">vlc-devel mailing list<br class="">To unsubscribe or modify your subscription options:<br class=""><a href="https://mailman.videolan.org/listinfo/vlc-devel" class="">https://mailman.videolan.org/listinfo/vlc-devel</a><br class=""></blockquote><br class="">_______________________________________________<br class="">vlc-devel mailing list<br class="">To unsubscribe or modify your subscription options:<br class=""><a href="https://mailman.videolan.org/listinfo/vlc-devel" class="">https://mailman.videolan.org/listinfo/vlc-devel</a><br class=""><br class=""></blockquote>_______________________________________________<br class="">vlc-devel mailing list<br class="">To unsubscribe or modify your subscription options:<br class=""><a href="https://mailman.videolan.org/listinfo/vlc-devel" class="">https://mailman.videolan.org/listinfo/vlc-devel</a><br class=""></blockquote><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">vlc-devel mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">To unsubscribe or modify your subscription options:</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="https://mailman.videolan.org/listinfo/vlc-devel" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://mailman.videolan.org/listinfo/vlc-devel</a></div></blockquote></div><br class=""></body></html>