diff options
author | John Reck <jreck@google.com> | 2017-05-17 00:23:44 +0000 |
---|---|---|
committer | John Reck <jreck@google.com> | 2017-05-17 00:23:44 +0000 |
commit | 59069e00a8965cb67350e95f32d62c31d6bf010e (patch) | |
tree | 3c64b4f2e58f1f962753ff55633a892b59b4f372 /libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp | |
parent | b33013fb3c570e0a3ced8729dced9f0d294761a6 (diff) |
Revert "Fix recent apps in system UI for Skia pipeline"
This reverts commit b33013fb3c570e0a3ced8729dced9f0d294761a6.
Reason for revert: Caused a memory leak, b/38330767
Bug: 38136140
Bug: 38330767
Test: manual, verified memory isn't leaking doing the steps in b/38330767
Change-Id: I98b2dfd750be57a15785808e2d5723616e2ce20a
Diffstat (limited to 'libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp')
-rw-r--r-- | libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp b/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp index 4885873e232d..ae1313101f3c 100644 --- a/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp +++ b/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp @@ -28,8 +28,6 @@ #include <cutils/properties.h> #include <strings.h> -#include <SkImagePriv.h> -#include <gl/GrGLTypes.h> using namespace android::uirenderer::renderthread; @@ -199,87 +197,6 @@ void SkiaOpenGLPipeline::invokeFunctor(const RenderThread& thread, Functor* func } } -static void deleteImageTexture(void* context) { - EGLImageKHR EGLimage = reinterpret_cast<EGLImageKHR>(context); - if (EGLimage != EGL_NO_IMAGE_KHR) { - EGLDisplay display = eglGetCurrentDisplay(); - if (EGL_NO_DISPLAY == display) { - display = eglGetDisplay(EGL_DEFAULT_DISPLAY); - } - eglDestroyImageKHR(display, EGLimage); - } -} - -sk_sp<SkImage> SkiaOpenGLPipeline::makeTextureImage( - const uirenderer::renderthread::RenderThread& renderThread, Bitmap* bitmap) { - renderThread.eglManager().initialize(); - - GraphicBuffer* buffer = bitmap->graphicBuffer(); - EGLDisplay display = eglGetCurrentDisplay(); - if (EGL_NO_DISPLAY == display) { - display = eglGetDisplay(EGL_DEFAULT_DISPLAY); - } - LOG_ALWAYS_FATAL_IF(!bitmap->isHardware(), - "Texture image requires a HW bitmap."); - // We use an EGLImage to access the content of the GraphicBuffer - // The EGL image is later bound to a 2D texture - EGLClientBuffer clientBuffer = (EGLClientBuffer) buffer->getNativeBuffer(); - EGLint imageAttrs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE }; - EGLImageKHR EGLimage = eglCreateImageKHR(display, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, - clientBuffer, imageAttrs); - if (EGLimage == EGL_NO_IMAGE_KHR) { - ALOGW("Could not create EGL image, err =%s", - uirenderer::renderthread::EglManager::eglErrorString()); - return nullptr; - } - - GLuint textureId = 0; - glGenTextures(1, &textureId); - glBindTexture(GL_TEXTURE_EXTERNAL_OES, textureId); - glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, EGLimage); - - GLenum status = GL_NO_ERROR; - while ((status = glGetError()) != GL_NO_ERROR) { - ALOGW("glEGLImageTargetTexture2DOES failed (%#x)", status); - eglDestroyImageKHR(display, EGLimage); - return nullptr; - } - - sk_sp<GrContext> grContext = sk_ref_sp(renderThread.getGrContext()); - grContext->resetContext(); - - GrGLTextureInfo textureInfo; - textureInfo.fTarget = GL_TEXTURE_EXTERNAL_OES; - textureInfo.fID = textureId; - - GrBackendTextureDesc textureDescription; - textureDescription.fWidth = bitmap->info().width(); - textureDescription.fHeight = bitmap->info().height(); - textureDescription.fOrigin = kTopLeft_GrSurfaceOrigin; - textureDescription.fTextureHandle = reinterpret_cast<GrBackendObject>(&textureInfo); - PixelFormat format = buffer->getPixelFormat(); - switch (format) { - case PIXEL_FORMAT_RGBA_8888: - textureDescription.fConfig = kRGBA_8888_GrPixelConfig; - break; - case PIXEL_FORMAT_RGBA_FP16: - textureDescription.fConfig = kRGBA_half_GrPixelConfig; - break; - default: - eglDestroyImageKHR(display, EGLimage); - return nullptr; - } - - // TODO: add color correctness - pass null color space for now - sk_sp<SkImage> image = SkImage::MakeFromTexture(grContext.get(), textureDescription, - bitmap->info().alphaType(), nullptr, deleteImageTexture, EGLimage); - if (!image.get()) { - eglDestroyImageKHR(display, EGLimage); - return nullptr; - } - return image; -} - } /* namespace skiapipeline */ } /* namespace uirenderer */ } /* namespace android */ |