Eliminate requireGlContext
Bug: 20297820
Change-Id: I37c63bab6f6c0d2337c8c6002046d2ef17e74097
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 8329cd4..706e14e 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -262,8 +262,6 @@
if (drew) {
swapBuffers(dirty, width, height);
- } else {
- mEglManager.cancelFrame();
}
// TODO: Use a fence for real completion?
@@ -297,7 +295,6 @@
ATRACE_CALL();
DrawGlInfo::Mode mode = DrawGlInfo::kModeProcessNoContext;
if (thread.eglManager().hasEglContext()) {
- thread.eglManager().requireGlContext();
mode = DrawGlInfo::kModeProcess;
}
@@ -318,7 +315,6 @@
void CanvasContext::freePrefetechedLayers() {
if (mPrefetechedLayers.size()) {
- requireGlContext();
std::for_each(mPrefetechedLayers.begin(), mPrefetechedLayers.end(), destroyPrefetechedNode);
mPrefetechedLayers.clear();
}
@@ -329,7 +325,6 @@
if (!mEglManager.hasEglContext() || !mCanvas) {
return;
}
- requireGlContext();
// buildLayer() will leave the tree in an unknown state, so we must stop drawing
stopDrawing();
@@ -352,7 +347,6 @@
}
bool CanvasContext::copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap) {
- requireGlContext();
layer->apply();
return LayerRenderer::copyLayer(mRenderThread.renderState(), layer->backingLayer(), bitmap);
}
@@ -360,7 +354,6 @@
void CanvasContext::destroyHardwareResources() {
stopDrawing();
if (mEglManager.hasEglContext()) {
- requireGlContext();
freePrefetechedLayers();
mRootRenderNode->destroyHardwareResources();
Caches::getInstance().flush(Caches::kFlushMode_Layers);
@@ -372,7 +365,6 @@
if (!thread.eglManager().hasEglContext()) return;
ATRACE_CALL();
- thread.eglManager().requireGlContext();
if (level >= TRIM_MEMORY_COMPLETE) {
Caches::getInstance().flush(Caches::kFlushMode_Full);
thread.eglManager().destroy();
@@ -382,7 +374,8 @@
}
void CanvasContext::runWithGlContext(RenderTask* task) {
- requireGlContext();
+ LOG_ALWAYS_FATAL_IF(!mEglManager.hasEglContext(),
+ "GL context not initialized!");
task->run();
}
@@ -391,10 +384,6 @@
return LayerRenderer::createTextureLayer(mRenderThread.renderState());
}
-void CanvasContext::requireGlContext() {
- mEglManager.requireGlContext();
-}
-
void CanvasContext::setTextureAtlas(RenderThread& thread,
const sp<GraphicBuffer>& buffer, int64_t* map, size_t mapSize) {
thread.eglManager().setTextureAtlas(buffer, map, mapSize);