summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/DrawFrameTask.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2014-05-05 19:21:26 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-05 19:21:26 +0000
commit5d039c458c67e8c08334e597a6a8781eda6aab13 (patch)
tree159dd8c4e6d74d124d575153f900f3a1cbaf2351 /libs/hwui/renderthread/DrawFrameTask.cpp
parent983ce97a5dd82688966e783a2c26f34550cfafa5 (diff)
parent18f16e6fba74eda173e1e7c869e6e2e2acc073ff (diff)
Merge "TIME LORD!"
Diffstat (limited to 'libs/hwui/renderthread/DrawFrameTask.cpp')
-rw-r--r--libs/hwui/renderthread/DrawFrameTask.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/libs/hwui/renderthread/DrawFrameTask.cpp b/libs/hwui/renderthread/DrawFrameTask.cpp
index 45f5cb057ee4..a7b781a21514 100644
--- a/libs/hwui/renderthread/DrawFrameTask.cpp
+++ b/libs/hwui/renderthread/DrawFrameTask.cpp
@@ -30,13 +30,17 @@ namespace android {
namespace uirenderer {
namespace renderthread {
-DrawFrameTask::DrawFrameTask() : mContext(0) {
+DrawFrameTask::DrawFrameTask()
+ : mRenderThread(NULL)
+ , mContext(NULL)
+ , mFrameTimeNanos(NULL) {
}
DrawFrameTask::~DrawFrameTask() {
}
-void DrawFrameTask::setContext(CanvasContext* context) {
+void DrawFrameTask::setContext(RenderThread* thread, CanvasContext* context) {
+ mRenderThread = thread;
mContext = context;
}
@@ -59,18 +63,20 @@ void DrawFrameTask::setDirty(int left, int top, int right, int bottom) {
mDirty.set(left, top, right, bottom);
}
-void DrawFrameTask::drawFrame(RenderThread* renderThread) {
+void DrawFrameTask::drawFrame(nsecs_t frameTimeNanos) {
LOG_ALWAYS_FATAL_IF(!mContext, "Cannot drawFrame with no CanvasContext!");
- postAndWait(renderThread);
+ mFrameTimeNanos = frameTimeNanos;
+ postAndWait();
// Reset the single-frame data
+ mFrameTimeNanos = 0;
mDirty.setEmpty();
}
-void DrawFrameTask::postAndWait(RenderThread* renderThread) {
+void DrawFrameTask::postAndWait() {
AutoMutex _lock(mLock);
- renderThread->queue(this);
+ mRenderThread->queue(this);
mSignal.wait(mLock);
}
@@ -99,13 +105,11 @@ static void initTreeInfo(TreeInfo& info) {
info.prepareTextures = true;
info.performStagingPush = true;
info.evaluateAnimations = true;
- // TODO: Get this from Choreographer
- nsecs_t frameTimeNs = systemTime(CLOCK_MONOTONIC);
- info.frameTimeMs = nanoseconds_to_milliseconds(frameTimeNs);
}
bool DrawFrameTask::syncFrameState() {
ATRACE_CALL();
+ mRenderThread->timeLord().vsyncReceived(mFrameTimeNanos);
mContext->makeCurrent();
Caches::getInstance().textureCache.resetMarkInUse();
TreeInfo info;