Merge "[RenderEngine] Reorder when ImageManager thread starts"
This commit is contained in:
commit
dd44f7465d
3 changed files with 15 additions and 2 deletions
|
@ -424,6 +424,7 @@ GLESRenderEngine::GLESRenderEngine(uint32_t featureFlags, EGLDisplay display, EG
|
|||
mFlushTracer = std::make_unique<FlushTracer>(this);
|
||||
}
|
||||
mImageManager = std::make_unique<ImageManager>(this);
|
||||
mImageManager->initThread();
|
||||
mDrawingBuffer = createFramebuffer();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#undef LOG_TAG
|
||||
#define LOG_TAG "RenderEngine"
|
||||
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
|
||||
|
||||
#include <pthread.h>
|
||||
|
@ -27,7 +30,10 @@ namespace android {
|
|||
namespace renderengine {
|
||||
namespace gl {
|
||||
|
||||
ImageManager::ImageManager(GLESRenderEngine* engine) : mEngine(engine) {
|
||||
ImageManager::ImageManager(GLESRenderEngine* engine) : mEngine(engine) {}
|
||||
|
||||
void ImageManager::initThread() {
|
||||
mThread = std::thread([this]() { threadMain(); });
|
||||
pthread_setname_np(mThread.native_handle(), "ImageManager");
|
||||
// Use SCHED_FIFO to minimize jitter
|
||||
struct sched_param param = {0};
|
||||
|
@ -133,6 +139,8 @@ void ImageManager::threadMain() {
|
|||
entry.barrier->condition.notify_one();
|
||||
}
|
||||
}
|
||||
|
||||
ALOGD("Reached end of threadMain, terminating ImageManager thread!");
|
||||
}
|
||||
|
||||
} // namespace gl
|
||||
|
|
|
@ -39,6 +39,10 @@ public:
|
|||
};
|
||||
ImageManager(GLESRenderEngine* engine);
|
||||
~ImageManager();
|
||||
// Starts the background thread for the ImageManager
|
||||
// We need this to guarantee that the class is fully-constructed before the
|
||||
// thread begins running.
|
||||
void initThread();
|
||||
void cacheAsync(const sp<GraphicBuffer>& buffer, const std::shared_ptr<Barrier>& barrier)
|
||||
EXCLUDES(mMutex);
|
||||
status_t cache(const sp<GraphicBuffer>& buffer);
|
||||
|
@ -57,7 +61,7 @@ private:
|
|||
void queueOperation(const QueueEntry&& entry);
|
||||
void threadMain();
|
||||
GLESRenderEngine* const mEngine;
|
||||
std::thread mThread = std::thread([this]() { threadMain(); });
|
||||
std::thread mThread;
|
||||
std::condition_variable_any mCondition;
|
||||
std::mutex mMutex;
|
||||
std::queue<QueueEntry> mQueue GUARDED_BY(mMutex);
|
||||
|
|
Loading…
Reference in a new issue