[8/n] RenderThread: Consume Vulkan first

Bug: 177241396
Change-Id: I6c8afdbc129e43c95fc4113cc0be5f23762e9b81
diff --git a/stream-servers/RenderThread.cpp b/stream-servers/RenderThread.cpp
index ac6cd7c..84040ef 100644
--- a/stream-servers/RenderThread.cpp
+++ b/stream-servers/RenderThread.cpp
@@ -437,10 +437,6 @@
                 seqnoPtr = FrameBuffer::getFB()->getProcessSequenceNumberPtr(tInfo.m_puid);
             }
 
-            if (mRunInLimitedMode) {
-                sThreadRunLimiter.lock();
-            }
-
             progress = false;
             size_t last;
 
@@ -448,6 +444,8 @@
             // try to process some of the command buffer using the
             // Vulkan decoder
             //
+            // Note: It's risky to limit Vulkan decoding to one thread,
+            // so we do it outside the limiter
             {
                 last = tInfo.m_vkDec.decode(readBuf.buf(), readBuf.validData(),
                                             ioStream);
@@ -458,7 +456,7 @@
             }
 
             if (mRunInLimitedMode) {
-                sThreadRunLimiter.unlock();
+                sThreadRunLimiter.lock();
             }
 
             // try to process some of the command buffer using the GLESv1
@@ -516,6 +514,10 @@
                 }
             }
 
+            if (mRunInLimitedMode) {
+                sThreadRunLimiter.unlock();
+            }
+
         } while (progress);
     }