Add glUseProgram to the list of GL functions requiring synchronization

We have observed an internal deadlock in libGLESv2_adreno where one
thread is in eglCreateContext and another thread in glUseProgram. We
have observed similar deadlocks before and started to synchronize all
access to the offending GL functions. Calls to eglCreateContext are
already synchronized, and this CL synchronizes calls to glUseProgram as
well.

Bug: b/153513005
Change-Id: I576e564aab44c9e429f2b1407105ed72942c309e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173742
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31118}
This commit is contained in:
Magnus Jedvert
2020-04-21 13:52:38 +02:00
committed by Commit Bot
parent 11f92bc81b
commit f355e1a0f6
2 changed files with 6 additions and 2 deletions

View File

@ -290,7 +290,9 @@ public class EglRenderer implements VideoSink {
// Release EGL and GL resources on render thread.
renderThreadHandler.postAtFrontOfQueue(() -> {
// Detach current shader program.
GLES20.glUseProgram(/* program= */ 0);
synchronized (EglBase.lock) {
GLES20.glUseProgram(/* program= */ 0);
}
if (drawer != null) {
drawer.release();
drawer = null;