blob: c784d64f820c15da26fb3d0ecb3e963e2aa8a161 [file] [log] [blame]
John Reckcec24ae2013-11-05 13:27:50 -08001/*
2 * Copyright (C) 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
John Reckcec24ae2013-11-05 13:27:50 -080017#include "RenderThread.h"
18
John Reck4f02bf42014-01-03 18:09:17 -080019#include "CanvasContext.h"
John Reck56428472018-03-16 17:27:17 -070020#include "DeviceInfo.h"
John Reck3b202512014-06-23 13:13:08 -070021#include "EglManager.h"
Stan Iliev1a025a72018-09-05 16:35:11 -040022#include "Readback.h"
John Reck4f02bf42014-01-03 18:09:17 -080023#include "RenderProxy.h"
Derek Sollenberger0e3cba32016-11-09 11:58:36 -050024#include "VulkanManager.h"
John Reck1bcacfd2017-11-03 10:12:19 -070025#include "hwui/Bitmap.h"
26#include "pipeline/skia/SkiaOpenGLPipeline.h"
John Reck1a4a9812018-04-18 16:13:31 -070027#include "pipeline/skia/SkiaVulkanPipeline.h"
John Reck1bcacfd2017-11-03 10:12:19 -070028#include "renderstate/RenderState.h"
John Reck12efa552016-11-15 10:22:01 -080029#include "utils/FatVector.h"
John Reck56428472018-03-16 17:27:17 -070030#include "utils/TimeUtils.h"
John Reckcec24ae2013-11-05 13:27:50 -080031
John Reck1e510712018-04-23 08:15:03 -070032#ifdef HWUI_GLES_WRAP_ENABLED
33#include "debug/GlesDriver.h"
34#endif
35
36#include <GrContextOptions.h>
37#include <gl/GrGLInterface.h>
38
Chris Craik65fe5ee2015-01-26 18:06:29 -080039#include <gui/DisplayEventReceiver.h>
40#include <sys/resource.h>
John Reckcba287b2015-11-10 12:52:44 -080041#include <utils/Condition.h>
Chris Craik65fe5ee2015-01-26 18:06:29 -080042#include <utils/Log.h>
John Reckcba287b2015-11-10 12:52:44 -080043#include <utils/Mutex.h>
Stan Iliev898123b2019-02-14 14:57:44 -050044#include <thread>
Chris Craik65fe5ee2015-01-26 18:06:29 -080045
John Reckcec24ae2013-11-05 13:27:50 -080046namespace android {
John Reckcec24ae2013-11-05 13:27:50 -080047namespace uirenderer {
48namespace renderthread {
49
John Recke45b1fd2014-04-15 09:50:16 -070050// Number of events to read at a time from the DisplayEventReceiver pipe.
51// The value should be large enough that we can quickly drain the pipe
52// using just a few large reads.
53static const size_t EVENT_BUFFER_SIZE = 100;
54
John Reck6b507802015-11-03 10:09:59 -080055static bool gHasRenderThreadInstance = false;
56
Stan Iliev80dbc352019-02-05 15:31:28 -050057static JVMAttachHook gOnStartHook = nullptr;
John Reck259b25a2017-12-01 16:18:53 -080058
John Reck56428472018-03-16 17:27:17 -070059class DisplayEventReceiverWrapper : public VsyncSource {
60public:
61 DisplayEventReceiverWrapper(std::unique_ptr<DisplayEventReceiver>&& receiver)
62 : mDisplayEventReceiver(std::move(receiver)) {}
63
64 virtual void requestNextVsync() override {
65 status_t status = mDisplayEventReceiver->requestNextVsync();
66 LOG_ALWAYS_FATAL_IF(status != NO_ERROR, "requestNextVsync failed with status: %d", status);
67 }
68
69 virtual nsecs_t latestVsyncEvent() override {
70 DisplayEventReceiver::Event buf[EVENT_BUFFER_SIZE];
71 nsecs_t latest = 0;
72 ssize_t n;
73 while ((n = mDisplayEventReceiver->getEvents(buf, EVENT_BUFFER_SIZE)) > 0) {
74 for (ssize_t i = 0; i < n; i++) {
75 const DisplayEventReceiver::Event& ev = buf[i];
76 switch (ev.header.type) {
77 case DisplayEventReceiver::DISPLAY_EVENT_VSYNC:
78 latest = ev.header.timestamp;
79 break;
80 }
81 }
82 }
83 if (n < 0) {
84 ALOGW("Failed to get events from display event receiver, status=%d", status_t(n));
85 }
86 return latest;
87 }
88
89private:
90 std::unique_ptr<DisplayEventReceiver> mDisplayEventReceiver;
91};
92
93class DummyVsyncSource : public VsyncSource {
94public:
95 DummyVsyncSource(RenderThread* renderThread) : mRenderThread(renderThread) {}
96
97 virtual void requestNextVsync() override {
John Reckb90d4cb2018-04-19 17:05:35 -070098 mRenderThread->queue().postDelayed(16_ms,
99 [this]() { mRenderThread->drainDisplayEventQueue(); });
John Reck56428472018-03-16 17:27:17 -0700100 }
101
John Reckb90d4cb2018-04-19 17:05:35 -0700102 virtual nsecs_t latestVsyncEvent() override { return systemTime(CLOCK_MONOTONIC); }
John Reck56428472018-03-16 17:27:17 -0700103
104private:
105 RenderThread* mRenderThread;
106};
107
John Reck6b507802015-11-03 10:09:59 -0800108bool RenderThread::hasInstance() {
109 return gHasRenderThreadInstance;
110}
111
Stan Iliev80dbc352019-02-05 15:31:28 -0500112void RenderThread::setOnStartHook(JVMAttachHook onStartHook) {
John Reck259b25a2017-12-01 16:18:53 -0800113 LOG_ALWAYS_FATAL_IF(hasInstance(), "can't set an onStartHook after we've started...");
114 gOnStartHook = onStartHook;
115}
116
Stan Iliev80dbc352019-02-05 15:31:28 -0500117JVMAttachHook RenderThread::getOnStartHook() {
118 return gOnStartHook;
119}
120
John Reck6b507802015-11-03 10:09:59 -0800121RenderThread& RenderThread::getInstance() {
122 // This is a pointer because otherwise __cxa_finalize
123 // will try to delete it like a Good Citizen but that causes us to crash
124 // because we don't want to delete the RenderThread normally.
125 static RenderThread* sInstance = new RenderThread();
126 gHasRenderThreadInstance = true;
127 return *sInstance;
128}
129
John Reck1bcacfd2017-11-03 10:12:19 -0700130RenderThread::RenderThread()
131 : ThreadBase()
John Reck56428472018-03-16 17:27:17 -0700132 , mVsyncSource(nullptr)
John Recke45b1fd2014-04-15 09:50:16 -0700133 , mVsyncRequested(false)
134 , mFrameCallbackTaskPending(false)
Chris Craikd41c4d82015-01-05 15:51:13 -0800135 , mRenderState(nullptr)
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500136 , mEglManager(nullptr)
John Reck283bb462018-12-13 16:40:14 -0800137 , mFunctorManager(WebViewFunctorManager::instance())
Derek Sollenberger0e3cba32016-11-09 11:58:36 -0500138 , mVkManager(nullptr) {
Chris Craik2507c342015-05-04 14:36:49 -0700139 Properties::load();
John Reckf8441e62017-10-23 13:10:41 -0700140 start("RenderThread");
John Reckcec24ae2013-11-05 13:27:50 -0800141}
142
143RenderThread::~RenderThread() {
John Reck3b202512014-06-23 13:13:08 -0700144 LOG_ALWAYS_FATAL("Can't destroy the render thread");
John Reckcec24ae2013-11-05 13:27:50 -0800145}
146
John Recke45b1fd2014-04-15 09:50:16 -0700147void RenderThread::initializeDisplayEventReceiver() {
John Reck56428472018-03-16 17:27:17 -0700148 LOG_ALWAYS_FATAL_IF(mVsyncSource, "Initializing a second DisplayEventReceiver?");
John Recke45b1fd2014-04-15 09:50:16 -0700149
John Reck56428472018-03-16 17:27:17 -0700150 if (!Properties::isolatedProcess) {
151 auto receiver = std::make_unique<DisplayEventReceiver>();
152 status_t status = receiver->initCheck();
153 LOG_ALWAYS_FATAL_IF(status != NO_ERROR,
John Reckb90d4cb2018-04-19 17:05:35 -0700154 "Initialization of DisplayEventReceiver "
155 "failed with status: %d",
156 status);
John Reck56428472018-03-16 17:27:17 -0700157
158 // Register the FD
159 mLooper->addFd(receiver->getFd(), 0, Looper::EVENT_INPUT,
John Reckb90d4cb2018-04-19 17:05:35 -0700160 RenderThread::displayEventReceiverCallback, this);
John Reck56428472018-03-16 17:27:17 -0700161 mVsyncSource = new DisplayEventReceiverWrapper(std::move(receiver));
162 } else {
163 mVsyncSource = new DummyVsyncSource(this);
164 }
John Recke45b1fd2014-04-15 09:50:16 -0700165}
166
John Reck3b202512014-06-23 13:13:08 -0700167void RenderThread::initThreadLocals() {
Derek Sollenberger17662382018-09-13 14:14:00 -0400168 mDisplayInfo = DeviceInfo::get()->displayInfo();
John Reckb36016c2015-03-11 08:50:53 -0700169 nsecs_t frameIntervalNanos = static_cast<nsecs_t>(1000000000 / mDisplayInfo.fps);
170 mTimeLord.setFrameInterval(frameIntervalNanos);
John Reck3c0f5632019-03-15 16:36:01 -0700171 mDispatchFrameDelay = static_cast<nsecs_t>(frameIntervalNanos * .25f);
John Reck3b202512014-06-23 13:13:08 -0700172 initializeDisplayEventReceiver();
John Reck1e510712018-04-23 08:15:03 -0700173 mEglManager = new EglManager();
John Reck0e89e2b2014-10-31 14:49:06 -0700174 mRenderState = new RenderState(*this);
Stan Iliev981afe72019-02-13 14:24:33 -0500175 mVkManager = new VulkanManager();
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400176 mCacheManager = new CacheManager(mDisplayInfo);
177}
178
John Reck1e510712018-04-23 08:15:03 -0700179void RenderThread::requireGlContext() {
180 if (mEglManager->hasEglContext()) {
181 return;
182 }
183 mEglManager->initialize();
John Reck1e510712018-04-23 08:15:03 -0700184
John Reck1e510712018-04-23 08:15:03 -0700185#ifdef HWUI_GLES_WRAP_ENABLED
John Reckb5fc2092018-04-30 14:43:22 -0700186 debug::GlesDriver* driver = debug::GlesDriver::get();
187 sk_sp<const GrGLInterface> glInterface(driver->getSkiaInterface());
John Reck1e510712018-04-23 08:15:03 -0700188#else
John Reckb5fc2092018-04-30 14:43:22 -0700189 sk_sp<const GrGLInterface> glInterface(GrGLCreateNativeInterface());
John Reck1e510712018-04-23 08:15:03 -0700190#endif
John Reckb5fc2092018-04-30 14:43:22 -0700191 LOG_ALWAYS_FATAL_IF(!glInterface.get());
John Reck1e510712018-04-23 08:15:03 -0700192
John Reckb5fc2092018-04-30 14:43:22 -0700193 GrContextOptions options;
Stan Iliev981afe72019-02-13 14:24:33 -0500194 initGrContextOptions(options);
Yichi Chen9f959552018-03-29 21:21:54 +0800195 auto glesVersion = reinterpret_cast<const char*>(glGetString(GL_VERSION));
196 auto size = glesVersion ? strlen(glesVersion) : -1;
197 cacheManager().configureContext(&options, glesVersion, size);
John Reckb5fc2092018-04-30 14:43:22 -0700198 sk_sp<GrContext> grContext(GrContext::MakeGL(std::move(glInterface), options));
199 LOG_ALWAYS_FATAL_IF(!grContext.get());
200 setGrContext(grContext);
John Reck1e510712018-04-23 08:15:03 -0700201}
202
Stan Iliev981afe72019-02-13 14:24:33 -0500203void RenderThread::requireVkContext() {
204 if (mVkManager->hasVkContext()) {
205 return;
206 }
207 mVkManager->initialize();
208 GrContextOptions options;
209 initGrContextOptions(options);
210 // TODO: get a string describing the SPIR-V compiler version and use it here
211 cacheManager().configureContext(&options, nullptr, 0);
212 sk_sp<GrContext> grContext = mVkManager->createContext(options);
213 LOG_ALWAYS_FATAL_IF(!grContext.get());
214 setGrContext(grContext);
215}
216
217void RenderThread::initGrContextOptions(GrContextOptions& options) {
218 options.fPreferExternalImagesOverES3 = true;
219 options.fDisableDistanceFieldPaths = true;
220}
221
John Reck283bb462018-12-13 16:40:14 -0800222void RenderThread::destroyRenderingContext() {
223 mFunctorManager.onContextDestroyed();
Stan Iliev90276c82019-02-03 18:01:02 -0500224 if (Properties::getRenderPipelineType() == RenderPipelineType::SkiaGL) {
225 if (mEglManager->hasEglContext()) {
226 setGrContext(nullptr);
227 mEglManager->destroy();
228 }
229 } else {
230 if (vulkanManager().hasVkContext()) {
231 setGrContext(nullptr);
232 vulkanManager().destroy();
233 }
John Reck1e510712018-04-23 08:15:03 -0700234 }
235}
236
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400237void RenderThread::dumpGraphicsMemory(int fd) {
John Reck34781b22017-07-05 16:39:36 -0700238 globalProfileData()->dump(fd);
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400239
240 String8 cachesOutput;
241 String8 pipeline;
242 auto renderType = Properties::getRenderPipelineType();
243 switch (renderType) {
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400244 case RenderPipelineType::SkiaGL: {
245 mCacheManager->dumpMemoryUsage(cachesOutput, mRenderState);
246 pipeline.appendFormat("Skia (OpenGL)");
247 break;
248 }
249 case RenderPipelineType::SkiaVulkan: {
250 mCacheManager->dumpMemoryUsage(cachesOutput, mRenderState);
251 pipeline.appendFormat("Skia (Vulkan)");
252 break;
253 }
254 default:
John Reck1bcacfd2017-11-03 10:12:19 -0700255 LOG_ALWAYS_FATAL("canvas context type %d not supported", (int32_t)renderType);
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400256 break;
257 }
258
John Reck47f5c3a2017-11-13 11:32:39 -0800259 dprintf(fd, "\n%s\n", cachesOutput.string());
260 dprintf(fd, "\nPipeline=%s\n", pipeline.string());
John Reck3b202512014-06-23 13:13:08 -0700261}
262
Derek Sollenbergerc4fbada2016-11-07 16:05:41 -0500263Readback& RenderThread::readback() {
Derek Sollenbergerc4fbada2016-11-07 16:05:41 -0500264 if (!mReadback) {
Stan Iliev1a025a72018-09-05 16:35:11 -0400265 mReadback = new Readback(*this);
Derek Sollenbergerc4fbada2016-11-07 16:05:41 -0500266 }
267
268 return *mReadback;
269}
270
Greg Daniel660d6ec2017-12-08 11:44:27 -0500271void RenderThread::setGrContext(sk_sp<GrContext> context) {
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400272 mCacheManager->reset(context);
Greg Daniel660d6ec2017-12-08 11:44:27 -0500273 if (mGrContext) {
Derek Sollenberger5a5a6482018-09-19 13:52:13 -0400274 mRenderState->onContextDestroyed();
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400275 mGrContext->releaseResourcesAndAbandonContext();
276 }
Greg Daniel660d6ec2017-12-08 11:44:27 -0500277 mGrContext = std::move(context);
Derek Sollenberger17662382018-09-13 14:14:00 -0400278 if (mGrContext) {
Derek Sollenberger5a5a6482018-09-19 13:52:13 -0400279 mRenderState->onContextCreated();
Derek Sollenberger17662382018-09-13 14:14:00 -0400280 DeviceInfo::setMaxTextureSize(mGrContext->maxRenderTargetSize());
281 }
Derek Sollenbergerf9e45d12017-06-01 13:07:39 -0400282}
283
John Recke45b1fd2014-04-15 09:50:16 -0700284int RenderThread::displayEventReceiverCallback(int fd, int events, void* data) {
285 if (events & (Looper::EVENT_ERROR | Looper::EVENT_HANGUP)) {
286 ALOGE("Display event receiver pipe was closed or an error occurred. "
John Reck1bcacfd2017-11-03 10:12:19 -0700287 "events=0x%x",
288 events);
289 return 0; // remove the callback
John Recke45b1fd2014-04-15 09:50:16 -0700290 }
291
292 if (!(events & Looper::EVENT_INPUT)) {
293 ALOGW("Received spurious callback for unhandled poll event. "
John Reck1bcacfd2017-11-03 10:12:19 -0700294 "events=0x%x",
295 events);
296 return 1; // keep the callback
John Recke45b1fd2014-04-15 09:50:16 -0700297 }
298
299 reinterpret_cast<RenderThread*>(data)->drainDisplayEventQueue();
300
John Reck1bcacfd2017-11-03 10:12:19 -0700301 return 1; // keep the callback
John Recke45b1fd2014-04-15 09:50:16 -0700302}
303
John Recka733f892014-12-19 11:37:21 -0800304void RenderThread::drainDisplayEventQueue() {
John Recka5dda642014-05-22 15:43:54 -0700305 ATRACE_CALL();
John Reck56428472018-03-16 17:27:17 -0700306 nsecs_t vsyncEvent = mVsyncSource->latestVsyncEvent();
John Recke45b1fd2014-04-15 09:50:16 -0700307 if (vsyncEvent > 0) {
308 mVsyncRequested = false;
John Recka733f892014-12-19 11:37:21 -0800309 if (mTimeLord.vsyncReceived(vsyncEvent) && !mFrameCallbackTaskPending) {
John Recka5dda642014-05-22 15:43:54 -0700310 ATRACE_NAME("queue mFrameCallbackTask");
John Recke45b1fd2014-04-15 09:50:16 -0700311 mFrameCallbackTaskPending = true;
John Reck3c0f5632019-03-15 16:36:01 -0700312 nsecs_t runAt = (vsyncEvent + mDispatchFrameDelay);
John Reck1bcacfd2017-11-03 10:12:19 -0700313 queue().postAt(runAt, [this]() { dispatchFrameCallbacks(); });
John Recke45b1fd2014-04-15 09:50:16 -0700314 }
315 }
316}
317
318void RenderThread::dispatchFrameCallbacks() {
John Recka5dda642014-05-22 15:43:54 -0700319 ATRACE_CALL();
John Recke45b1fd2014-04-15 09:50:16 -0700320 mFrameCallbackTaskPending = false;
321
322 std::set<IFrameCallback*> callbacks;
323 mFrameCallbacks.swap(callbacks);
324
John Recka733f892014-12-19 11:37:21 -0800325 if (callbacks.size()) {
326 // Assume one of them will probably animate again so preemptively
327 // request the next vsync in case it occurs mid-frame
328 requestVsync();
John Reck1bcacfd2017-11-03 10:12:19 -0700329 for (std::set<IFrameCallback*>::iterator it = callbacks.begin(); it != callbacks.end();
330 it++) {
John Recka733f892014-12-19 11:37:21 -0800331 (*it)->doFrame();
332 }
John Recke45b1fd2014-04-15 09:50:16 -0700333 }
334}
335
John Recka5dda642014-05-22 15:43:54 -0700336void RenderThread::requestVsync() {
337 if (!mVsyncRequested) {
338 mVsyncRequested = true;
John Reck56428472018-03-16 17:27:17 -0700339 mVsyncSource->requestNextVsync();
John Recka5dda642014-05-22 15:43:54 -0700340 }
341}
342
John Reckcec24ae2013-11-05 13:27:50 -0800343bool RenderThread::threadLoop() {
John Reck21be43e2014-08-14 10:25:16 -0700344 setpriority(PRIO_PROCESS, 0, PRIORITY_DISPLAY);
John Reck700079e2019-02-19 10:38:50 -0800345 Looper::setForThread(mLooper);
John Reck259b25a2017-12-01 16:18:53 -0800346 if (gOnStartHook) {
Stan Iliev978d5322019-02-06 12:02:28 -0500347 gOnStartHook("RenderThread");
John Reck259b25a2017-12-01 16:18:53 -0800348 }
John Reck3b202512014-06-23 13:13:08 -0700349 initThreadLocals();
John Recke45b1fd2014-04-15 09:50:16 -0700350
John Reckf8441e62017-10-23 13:10:41 -0700351 while (true) {
352 waitForWork();
353 processQueue();
John Recka5dda642014-05-22 15:43:54 -0700354
355 if (mPendingRegistrationFrameCallbacks.size() && !mFrameCallbackTaskPending) {
John Recka733f892014-12-19 11:37:21 -0800356 drainDisplayEventQueue();
John Reck1bcacfd2017-11-03 10:12:19 -0700357 mFrameCallbacks.insert(mPendingRegistrationFrameCallbacks.begin(),
358 mPendingRegistrationFrameCallbacks.end());
John Recka5dda642014-05-22 15:43:54 -0700359 mPendingRegistrationFrameCallbacks.clear();
360 requestVsync();
361 }
John Recka22c9b22015-01-14 10:40:15 -0800362
363 if (!mFrameCallbackTaskPending && !mVsyncRequested && mFrameCallbacks.size()) {
364 // TODO: Clean this up. This is working around an issue where a combination
365 // of bad timing and slow drawing can result in dropping a stale vsync
366 // on the floor (correct!) but fails to schedule to listen for the
367 // next vsync (oops), so none of the callbacks are run.
368 requestVsync();
369 }
John Reckcec24ae2013-11-05 13:27:50 -0800370 }
371
372 return false;
373}
374
John Recke45b1fd2014-04-15 09:50:16 -0700375void RenderThread::postFrameCallback(IFrameCallback* callback) {
John Recka5dda642014-05-22 15:43:54 -0700376 mPendingRegistrationFrameCallbacks.insert(callback);
John Recke45b1fd2014-04-15 09:50:16 -0700377}
378
John Reck01a5ea32014-12-03 13:01:07 -0800379bool RenderThread::removeFrameCallback(IFrameCallback* callback) {
380 size_t erased;
381 erased = mFrameCallbacks.erase(callback);
382 erased |= mPendingRegistrationFrameCallbacks.erase(callback);
383 return erased;
John Recka5dda642014-05-22 15:43:54 -0700384}
385
386void RenderThread::pushBackFrameCallback(IFrameCallback* callback) {
387 if (mFrameCallbacks.erase(callback)) {
388 mPendingRegistrationFrameCallbacks.insert(callback);
389 }
John Recke45b1fd2014-04-15 09:50:16 -0700390}
391
Stan Iliev7bc3bc62017-05-24 13:28:36 -0400392sk_sp<Bitmap> RenderThread::allocateHardwareBitmap(SkBitmap& skBitmap) {
393 auto renderType = Properties::getRenderPipelineType();
394 switch (renderType) {
Stan Iliev7bc3bc62017-05-24 13:28:36 -0400395 case RenderPipelineType::SkiaVulkan:
396 return skiapipeline::SkiaVulkanPipeline::allocateHardwareBitmap(*this, skBitmap);
397 default:
John Reck1bcacfd2017-11-03 10:12:19 -0700398 LOG_ALWAYS_FATAL("canvas context type %d not supported", (int32_t)renderType);
Stan Iliev7bc3bc62017-05-24 13:28:36 -0400399 break;
400 }
401 return nullptr;
402}
403
Stan Iliev6b894d72017-08-23 12:41:41 -0400404bool RenderThread::isCurrent() {
405 return gettid() == getInstance().getTid();
406}
407
Stan Iliev898123b2019-02-14 14:57:44 -0500408void RenderThread::preload() {
409 std::thread eglInitThread([]() {
410 //TODO: don't load EGL drivers for Vulkan, when HW bitmap uploader is refactored.
411 eglGetDisplay(EGL_DEFAULT_DISPLAY);
412 });
413 eglInitThread.detach();
414 if (Properties::getRenderPipelineType() == RenderPipelineType::SkiaVulkan) {
415 requireVkContext();
416 }
417}
418
John Reckcec24ae2013-11-05 13:27:50 -0800419} /* namespace renderthread */
420} /* namespace uirenderer */
421} /* namespace android */