Loading libs/hwui/renderthread/RenderProxy.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -563,7 +563,10 @@ void RenderProxy::post(RenderTask* task) { void* RenderProxy::postAndWait(MethodInvokeRenderTask* task) { void* retval; task->setReturnPtr(&retval); mRenderThread.queueAndWait(task); SignalingRenderTask syncTask(task, &mSyncMutex, &mSyncCondition); AutoMutex _lock(mSyncMutex); mRenderThread.queue(&syncTask); mSyncCondition.wait(mSyncMutex); return retval; } Loading libs/hwui/renderthread/RenderProxy.h +3 −0 Original line number Diff line number Diff line Loading @@ -117,6 +117,9 @@ private: DrawFrameTask mDrawFrameTask; Mutex mSyncMutex; Condition mSyncCondition; void destroyContext(); void post(RenderTask* task); Loading libs/hwui/renderthread/RenderThread.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -25,7 +25,9 @@ #include <gui/ISurfaceComposer.h> #include <gui/SurfaceComposerClient.h> #include <sys/resource.h> #include <utils/Condition.h> #include <utils/Log.h> #include <utils/Mutex.h> namespace android { namespace uirenderer { Loading Loading @@ -325,10 +327,16 @@ void RenderThread::queue(RenderTask* task) { } void RenderThread::queueAndWait(RenderTask* task) { SignalingRenderTask syncTask(task, &mSyncMutex, &mSyncCondition); AutoMutex _lock(mSyncMutex); // These need to be local to the thread to avoid the Condition // signaling the wrong thread. The easiest way to achieve that is to just // make this on the stack, although that has a slight cost to it Mutex mutex; Condition condition; SignalingRenderTask syncTask(task, &mutex, &condition); AutoMutex _lock(mutex); queue(&syncTask); mSyncCondition.wait(mSyncMutex); condition.wait(mutex); } void RenderThread::queueAtFront(RenderTask* task) { Loading libs/hwui/renderthread/RenderThread.h +0 −4 Original line number Diff line number Diff line Loading @@ -27,9 +27,7 @@ #include <utils/Looper.h> #include <utils/Thread.h> #include <condition_variable> #include <memory> #include <mutex> #include <set> namespace android { Loading Loading @@ -127,8 +125,6 @@ private: nsecs_t mNextWakeup; TaskQueue mQueue; Mutex mSyncMutex; Condition mSyncCondition; DisplayInfo mDisplayInfo; Loading Loading
libs/hwui/renderthread/RenderProxy.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -563,7 +563,10 @@ void RenderProxy::post(RenderTask* task) { void* RenderProxy::postAndWait(MethodInvokeRenderTask* task) { void* retval; task->setReturnPtr(&retval); mRenderThread.queueAndWait(task); SignalingRenderTask syncTask(task, &mSyncMutex, &mSyncCondition); AutoMutex _lock(mSyncMutex); mRenderThread.queue(&syncTask); mSyncCondition.wait(mSyncMutex); return retval; } Loading
libs/hwui/renderthread/RenderProxy.h +3 −0 Original line number Diff line number Diff line Loading @@ -117,6 +117,9 @@ private: DrawFrameTask mDrawFrameTask; Mutex mSyncMutex; Condition mSyncCondition; void destroyContext(); void post(RenderTask* task); Loading
libs/hwui/renderthread/RenderThread.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -25,7 +25,9 @@ #include <gui/ISurfaceComposer.h> #include <gui/SurfaceComposerClient.h> #include <sys/resource.h> #include <utils/Condition.h> #include <utils/Log.h> #include <utils/Mutex.h> namespace android { namespace uirenderer { Loading Loading @@ -325,10 +327,16 @@ void RenderThread::queue(RenderTask* task) { } void RenderThread::queueAndWait(RenderTask* task) { SignalingRenderTask syncTask(task, &mSyncMutex, &mSyncCondition); AutoMutex _lock(mSyncMutex); // These need to be local to the thread to avoid the Condition // signaling the wrong thread. The easiest way to achieve that is to just // make this on the stack, although that has a slight cost to it Mutex mutex; Condition condition; SignalingRenderTask syncTask(task, &mutex, &condition); AutoMutex _lock(mutex); queue(&syncTask); mSyncCondition.wait(mSyncMutex); condition.wait(mutex); } void RenderThread::queueAtFront(RenderTask* task) { Loading
libs/hwui/renderthread/RenderThread.h +0 −4 Original line number Diff line number Diff line Loading @@ -27,9 +27,7 @@ #include <utils/Looper.h> #include <utils/Thread.h> #include <condition_variable> #include <memory> #include <mutex> #include <set> namespace android { Loading Loading @@ -127,8 +125,6 @@ private: nsecs_t mNextWakeup; TaskQueue mQueue; Mutex mSyncMutex; Condition mSyncCondition; DisplayInfo mDisplayInfo; Loading