Module: Mesa Branch: staging/20.2 Commit: 0bc9a81733e975aaacab65a67f7eec3dd4f639c2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0bc9a81733e975aaacab65a67f7eec3dd4f639c2
Author: Marcin Ślusarz <[email protected]> Date: Fri Oct 16 20:07:28 2020 +0200 vulkan/wsi: fix possible random stalls in wsi_display_wait_for_event pthread_cond_broadcast man page says this: "The pthread_cond_broadcast() or pthread_cond_signal() functions may be called by a thread whether or not it currently owns the mutex that threads calling pthread_cond_wait() or pthread_cond_timedwait() have associated with the condition variable during their waits; however, if predictable scheduling behavior is required, then that mutex shall be locked by the thread calling pthread_cond_broadcast() or pthread_cond_signal()." Found by reading the code. Compile tested only. Fixes: da997ebec92 ("vulkan: Add KHR_display extension using DRM [v10]") Signed-off-by: Marcin Ślusarz <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7197> (cherry picked from commit 440813114281bfd05c2b0d26c6488d1410790be4) --- .pick_status.json | 2 +- src/vulkan/wsi/wsi_common_display.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index d15e4552bf5..171ae40b136 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -166,7 +166,7 @@ "description": "vulkan/wsi: fix possible random stalls in wsi_display_wait_for_event", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "da997ebec92942193955386535813374286b7fb1" }, diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c index b05d7cc479d..e77211cf0a1 100644 --- a/src/vulkan/wsi/wsi_common_display.c +++ b/src/vulkan/wsi/wsi_common_display.c @@ -1209,8 +1209,8 @@ wsi_display_wait_thread(void *data) if (ret > 0) { pthread_mutex_lock(&wsi->wait_mutex); (void) drmHandleEvent(wsi->fd, &event_context); - pthread_mutex_unlock(&wsi->wait_mutex); pthread_cond_broadcast(&wsi->wait_cond); + pthread_mutex_unlock(&wsi->wait_mutex); } } return NULL; _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
