Loading libs/hwui/AutoBackendTextureRelease.cpp +37 −5 Original line number Diff line number Diff line Loading @@ -35,15 +35,47 @@ AutoBackendTextureRelease::AutoBackendTextureRelease(GrDirectContext* context, AHardwareBuffer_Desc desc; AHardwareBuffer_describe(buffer, &desc); bool createProtectedImage = 0 != (desc.usage & AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT); GrBackendFormat backendFormat = GrAHardwareBufferUtils::GetBackendFormat(context, buffer, desc.format, false); GrBackendFormat backendFormat; GrBackendApi backend = context->backend(); if (backend == GrBackendApi::kOpenGL) { backendFormat = GrAHardwareBufferUtils::GetGLBackendFormat(context, desc.format, false); mBackendTexture = GrAHardwareBufferUtils::MakeGLBackendTexture(context, buffer, desc.width, desc.height, &mDeleteProc, &mUpdateProc, &mImageCtx, createProtectedImage, backendFormat, false); } else if (backend == GrBackendApi::kVulkan) { backendFormat = GrAHardwareBufferUtils::GetVulkanBackendFormat(context, buffer, desc.format, false); mBackendTexture = GrAHardwareBufferUtils::MakeVulkanBackendTexture(context, buffer, desc.width, desc.height, &mDeleteProc, &mUpdateProc, &mImageCtx, createProtectedImage, backendFormat, false); } else { LOG_ALWAYS_FATAL("Unexpected backend %d", backend); } LOG_ALWAYS_FATAL_IF(!backendFormat.isValid(), __FILE__ " Invalid GrBackendFormat. GrBackendApi==%" PRIu32 ", AHardwareBuffer_Format==%" PRIu32 ".", static_cast<int>(context->backend()), desc.format); mBackendTexture = GrAHardwareBufferUtils::MakeBackendTexture( context, buffer, desc.width, desc.height, &mDeleteProc, &mUpdateProc, &mImageCtx, createProtectedImage, backendFormat, false); LOG_ALWAYS_FATAL_IF(!mBackendTexture.isValid(), __FILE__ " Invalid GrBackendTexture. Width==%" PRIu32 ", height==%" PRIu32 ", protected==%d", Loading libs/hwui/pipeline/skia/GLFunctorDrawable.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ #include "SkM44.h" #include <include/gpu/ganesh/SkSurfaceGanesh.h> #include "include/gpu/GpuTypes.h" // from Skia #include <include/gpu/gl/GrGLTypes.h> #include <include/gpu/ganesh/gl/GrGLBackendSurface.h> #include "utils/GLUtils.h" #include <effects/GainmapRenderer.h> #include "renderthread/CanvasContext.h" Loading @@ -47,7 +49,7 @@ static void setScissor(int viewportHeight, const SkIRect& clip) { static void GetFboDetails(SkCanvas* canvas, GLuint* outFboID, SkISize* outFboSize) { GrBackendRenderTarget renderTarget = skgpu::ganesh::TopLayerBackendRenderTarget(canvas); GrGLFramebufferInfo fboInfo; LOG_ALWAYS_FATAL_IF(!renderTarget.getGLFramebufferInfo(&fboInfo), LOG_ALWAYS_FATAL_IF(!GrBackendRenderTargets::GetGLFramebufferInfo(renderTarget, &fboInfo), "getGLFrameBufferInfo failed"); *outFboID = fboInfo.fFBOID; Loading Loading @@ -102,9 +104,10 @@ void GLFunctorDrawable::onDraw(SkCanvas* canvas) { tmpSurface->getCanvas()->clear(SK_ColorTRANSPARENT); GrGLFramebufferInfo fboInfo; if (!SkSurfaces::GetBackendRenderTarget(tmpSurface.get(), SkSurfaces::BackendHandleAccess::kFlushWrite) .getGLFramebufferInfo(&fboInfo)) { if (!GrBackendRenderTargets::GetGLFramebufferInfo( SkSurfaces::GetBackendRenderTarget( tmpSurface.get(), SkSurfaces::BackendHandleAccess::kFlushWrite), &fboInfo)) { ALOGW("Unable to extract renderTarget info from offscreen canvas; aborting GLFunctor"); return; } Loading Loading
libs/hwui/AutoBackendTextureRelease.cpp +37 −5 Original line number Diff line number Diff line Loading @@ -35,15 +35,47 @@ AutoBackendTextureRelease::AutoBackendTextureRelease(GrDirectContext* context, AHardwareBuffer_Desc desc; AHardwareBuffer_describe(buffer, &desc); bool createProtectedImage = 0 != (desc.usage & AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT); GrBackendFormat backendFormat = GrAHardwareBufferUtils::GetBackendFormat(context, buffer, desc.format, false); GrBackendFormat backendFormat; GrBackendApi backend = context->backend(); if (backend == GrBackendApi::kOpenGL) { backendFormat = GrAHardwareBufferUtils::GetGLBackendFormat(context, desc.format, false); mBackendTexture = GrAHardwareBufferUtils::MakeGLBackendTexture(context, buffer, desc.width, desc.height, &mDeleteProc, &mUpdateProc, &mImageCtx, createProtectedImage, backendFormat, false); } else if (backend == GrBackendApi::kVulkan) { backendFormat = GrAHardwareBufferUtils::GetVulkanBackendFormat(context, buffer, desc.format, false); mBackendTexture = GrAHardwareBufferUtils::MakeVulkanBackendTexture(context, buffer, desc.width, desc.height, &mDeleteProc, &mUpdateProc, &mImageCtx, createProtectedImage, backendFormat, false); } else { LOG_ALWAYS_FATAL("Unexpected backend %d", backend); } LOG_ALWAYS_FATAL_IF(!backendFormat.isValid(), __FILE__ " Invalid GrBackendFormat. GrBackendApi==%" PRIu32 ", AHardwareBuffer_Format==%" PRIu32 ".", static_cast<int>(context->backend()), desc.format); mBackendTexture = GrAHardwareBufferUtils::MakeBackendTexture( context, buffer, desc.width, desc.height, &mDeleteProc, &mUpdateProc, &mImageCtx, createProtectedImage, backendFormat, false); LOG_ALWAYS_FATAL_IF(!mBackendTexture.isValid(), __FILE__ " Invalid GrBackendTexture. Width==%" PRIu32 ", height==%" PRIu32 ", protected==%d", Loading
libs/hwui/pipeline/skia/GLFunctorDrawable.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ #include "SkM44.h" #include <include/gpu/ganesh/SkSurfaceGanesh.h> #include "include/gpu/GpuTypes.h" // from Skia #include <include/gpu/gl/GrGLTypes.h> #include <include/gpu/ganesh/gl/GrGLBackendSurface.h> #include "utils/GLUtils.h" #include <effects/GainmapRenderer.h> #include "renderthread/CanvasContext.h" Loading @@ -47,7 +49,7 @@ static void setScissor(int viewportHeight, const SkIRect& clip) { static void GetFboDetails(SkCanvas* canvas, GLuint* outFboID, SkISize* outFboSize) { GrBackendRenderTarget renderTarget = skgpu::ganesh::TopLayerBackendRenderTarget(canvas); GrGLFramebufferInfo fboInfo; LOG_ALWAYS_FATAL_IF(!renderTarget.getGLFramebufferInfo(&fboInfo), LOG_ALWAYS_FATAL_IF(!GrBackendRenderTargets::GetGLFramebufferInfo(renderTarget, &fboInfo), "getGLFrameBufferInfo failed"); *outFboID = fboInfo.fFBOID; Loading Loading @@ -102,9 +104,10 @@ void GLFunctorDrawable::onDraw(SkCanvas* canvas) { tmpSurface->getCanvas()->clear(SK_ColorTRANSPARENT); GrGLFramebufferInfo fboInfo; if (!SkSurfaces::GetBackendRenderTarget(tmpSurface.get(), SkSurfaces::BackendHandleAccess::kFlushWrite) .getGLFramebufferInfo(&fboInfo)) { if (!GrBackendRenderTargets::GetGLFramebufferInfo( SkSurfaces::GetBackendRenderTarget( tmpSurface.get(), SkSurfaces::BackendHandleAccess::kFlushWrite), &fboInfo)) { ALOGW("Unable to extract renderTarget info from offscreen canvas; aborting GLFunctor"); return; } Loading