Merge "Acquire the context lock before reading color buffer"

GitOrigin-RevId: cffc73e893e7e7e4c5d9f93bd6547c47c7885512
Change-Id: I27419d33349c0b5deb0d59240190cdafb89c8c9a
diff --git a/host/FrameBuffer.cpp b/host/FrameBuffer.cpp
index 2fb1c7c..967f961 100644
--- a/host/FrameBuffer.cpp
+++ b/host/FrameBuffer.cpp
@@ -3703,6 +3703,12 @@
 }
 
 bool FrameBuffer::invalidateColorBufferForVk(HandleType colorBufferHandle) {
+    // It reads contents from GL, which requires a context lock.
+    // Also we should not do this in PostWorkerGl, otherwise it will deadlock.
+    //
+    // b/283524158
+    // b/273986739
+    AutoLock mutex(m_lock);
     auto colorBuffer = findColorBuffer(colorBufferHandle);
     if (!colorBuffer) {
         ERR("Failed to find ColorBuffer:%d", colorBufferHandle);