diff options
Diffstat (limited to 'libs/hwui/renderthread/RenderThread.cpp')
-rw-r--r-- | libs/hwui/renderthread/RenderThread.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp index 08edd20c0a0d..6cce31943d03 100644 --- a/libs/hwui/renderthread/RenderThread.cpp +++ b/libs/hwui/renderthread/RenderThread.cpp @@ -28,6 +28,8 @@ #include "renderstate/RenderState.h" #include "utils/FatVector.h" #include "utils/TimeUtils.h" +#include "utils/TraceUtils.h" +#include "../HardwareBitmapUploader.h" #ifdef HWUI_GLES_WRAP_ENABLED #include "debug/GlesDriver.h" @@ -52,9 +54,6 @@ namespace renderthread { // using just a few large reads. static const size_t EVENT_BUFFER_SIZE = 100; -// Slight delay to give the UI time to push us a new frame before we replay -static const nsecs_t DISPATCH_FRAME_CALLBACKS_DELAY = milliseconds_to_nanoseconds(4); - static bool gHasRenderThreadInstance = false; static JVMAttachHook gOnStartHook = nullptr; @@ -171,6 +170,7 @@ void RenderThread::initThreadLocals() { mDisplayInfo = DeviceInfo::get()->displayInfo(); nsecs_t frameIntervalNanos = static_cast<nsecs_t>(1000000000 / mDisplayInfo.fps); mTimeLord.setFrameInterval(frameIntervalNanos); + mDispatchFrameDelay = static_cast<nsecs_t>(frameIntervalNanos * .25f); initializeDisplayEventReceiver(); mEglManager = new EglManager(); mRenderState = new RenderState(*this); @@ -311,7 +311,7 @@ void RenderThread::drainDisplayEventQueue() { if (mTimeLord.vsyncReceived(vsyncEvent) && !mFrameCallbackTaskPending) { ATRACE_NAME("queue mFrameCallbackTask"); mFrameCallbackTaskPending = true; - nsecs_t runAt = (vsyncEvent + DISPATCH_FRAME_CALLBACKS_DELAY); + nsecs_t runAt = (vsyncEvent + mDispatchFrameDelay); queue().postAt(runAt, [this]() { dispatchFrameCallbacks(); }); } } @@ -416,6 +416,7 @@ void RenderThread::preload() { if (Properties::getRenderPipelineType() == RenderPipelineType::SkiaVulkan) { requireVkContext(); } + HardwareBitmapUploader::initialize(); } } /* namespace renderthread */ |