From d354fd2c66855d116440eb4c936317f124241225 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Tue, 3 Nov 2015 10:33:34 -0800 Subject: Use clang for libhwui bug:25417885 Change-Id: I0ef8034d79ba3682925e3c2a4b7ccd833fd4f156 --- libs/hwui/Android.common.mk | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libs/hwui') diff --git a/libs/hwui/Android.common.mk b/libs/hwui/Android.common.mk index 38e8be9..c80f2cf 100644 --- a/libs/hwui/Android.common.mk +++ b/libs/hwui/Android.common.mk @@ -1,6 +1,9 @@ # getConfig in external/skia/include/core/SkBitmap.h is deprecated. # Allow Gnu extension: in-class initializer of static 'const float' member. # DeferredLayerUpdater.h: private field 'mRenderThread' is not used. + +LOCAL_CLANG := true + LOCAL_CLANG_CFLAGS += \ -Wno-deprecated-declarations \ -Wno-gnu-static-float-init \ -- cgit v1.1 From 492a56cc93fef4c844fc2ce429fb8f4fbfef7674 Mon Sep 17 00:00:00 2001 From: John Reck Date: Wed, 4 Nov 2015 15:21:35 +0000 Subject: Revert "Use clang for libhwui" Bug 25462107 This reverts commit d354fd2c66855d116440eb4c936317f124241225. Change-Id: Ib7c50b5becf247f837f3cc20f9128d9411d22563 --- libs/hwui/Android.common.mk | 3 --- 1 file changed, 3 deletions(-) (limited to 'libs/hwui') diff --git a/libs/hwui/Android.common.mk b/libs/hwui/Android.common.mk index c80f2cf..38e8be9 100644 --- a/libs/hwui/Android.common.mk +++ b/libs/hwui/Android.common.mk @@ -1,9 +1,6 @@ # getConfig in external/skia/include/core/SkBitmap.h is deprecated. # Allow Gnu extension: in-class initializer of static 'const float' member. # DeferredLayerUpdater.h: private field 'mRenderThread' is not used. - -LOCAL_CLANG := true - LOCAL_CLANG_CFLAGS += \ -Wno-deprecated-declarations \ -Wno-gnu-static-float-init \ -- cgit v1.1 From e02ec7c37a92fd63748a610bac6a23d0409788cf Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Wed, 4 Nov 2015 10:12:28 -0800 Subject: Remove -ffast-math from libhwui makefile bug:25417885 Change-Id: I8244bd28c2d46fc449398b9bf5104bf7cbaded8a --- libs/hwui/Android.common.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libs/hwui') diff --git a/libs/hwui/Android.common.mk b/libs/hwui/Android.common.mk index 38e8be9..94bb981 100644 --- a/libs/hwui/Android.common.mk +++ b/libs/hwui/Android.common.mk @@ -119,7 +119,7 @@ endif # Defaults for ATRACE_TAG and LOG_TAG for libhwui LOCAL_CFLAGS += -DATRACE_TAG=ATRACE_TAG_VIEW -DLOG_TAG=\"OpenGLRenderer\" LOCAL_CFLAGS += -Wall -Wno-unused-parameter -Wunreachable-code -LOCAL_CFLAGS += -ffast-math -O3 +LOCAL_CFLAGS += -O3 # b/21698669 ifneq ($(USE_CLANG_PLATFORM_BUILD),true) -- cgit v1.1 From cdce35a7e877ae51e194b03033bbd35b5c10ce06 Mon Sep 17 00:00:00 2001 From: Teng-Hui Zhu Date: Thu, 1 Oct 2015 16:49:16 -0700 Subject: Early return when the scale is 0. b/24534579 Change-Id: Ib3581ec99387ca70ca036026f64857a49657d94b (cherry picked from commit 8d0ec389531d071529fb0a800f10733b057205d9) --- libs/hwui/RenderNode.cpp | 9 +++++++-- libs/hwui/ShadowTessellator.cpp | 4 ++-- libs/hwui/SpotShadow.cpp | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) (limited to 'libs/hwui') diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 0951fc1..642ec25 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -666,7 +666,9 @@ template void RenderNode::issueDrawShadowOperation(const Matrix4& transformFromParent, T& handler) { if (properties().getAlpha() <= 0.0f || properties().getOutline().getAlpha() <= 0.0f - || !properties().getOutline().getPath()) { + || !properties().getOutline().getPath() + || properties().getScaleX() == 0 + || properties().getScaleY() == 0) { // no shadow to draw return; } @@ -856,7 +858,10 @@ void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) { const bool useViewProperties = (!mLayer || drawLayer); if (useViewProperties) { const Outline& outline = properties().getOutline(); - if (properties().getAlpha() <= 0 || (outline.getShouldClip() && outline.isEmpty())) { + if (properties().getAlpha() <= 0 + || (outline.getShouldClip() && outline.isEmpty()) + || properties().getScaleX() == 0 + || properties().getScaleY() == 0) { DISPLAY_LIST_LOGD("%*sRejected display list (%p, %s)", handler.level() * 2, "", this, getName()); return; diff --git a/libs/hwui/ShadowTessellator.cpp b/libs/hwui/ShadowTessellator.cpp index 09d1258..1bca3e7 100644 --- a/libs/hwui/ShadowTessellator.cpp +++ b/libs/hwui/ShadowTessellator.cpp @@ -77,8 +77,8 @@ void ShadowTessellator::tessellateSpotShadow(bool isCasterOpaque, } #if DEBUG_SHADOW - ALOGD("light center %f %f %f", - adjustedLightCenter.x, adjustedLightCenter.y, adjustedLightCenter.z); + ALOGD("light center %f %f %f %d", + adjustedLightCenter.x, adjustedLightCenter.y, adjustedLightCenter.z, lightRadius); #endif // light position (because it's in local space) needs to compensate for receiver transform diff --git a/libs/hwui/SpotShadow.cpp b/libs/hwui/SpotShadow.cpp index b8c9804..7a2b9af 100644 --- a/libs/hwui/SpotShadow.cpp +++ b/libs/hwui/SpotShadow.cpp @@ -1052,7 +1052,7 @@ void SpotShadow::dumpPolygon(const Vector2* poly, int polyLength, const char* po */ void SpotShadow::dumpPolygon(const Vector3* poly, int polyLength, const char* polyName) { for (int i = 0; i < polyLength; i++) { - ALOGD("polygon %s i %d x %f y %f", polyName, i, poly[i].x, poly[i].y); + ALOGD("polygon %s i %d x %f y %f z %f", polyName, i, poly[i].x, poly[i].y, poly[i].z); } } -- cgit v1.1 From cf22d184a37d4dd551b045857e5725601f89236c Mon Sep 17 00:00:00 2001 From: Teng-Hui Zhu Date: Wed, 4 Nov 2015 16:57:53 -0800 Subject: When the incoming light source is invalid, don't generate any shadow b/25417885 Change-Id: I4b87e35ca68091fd0409cb9fe9b9400af860a507 --- libs/hwui/ShadowTessellator.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libs/hwui') diff --git a/libs/hwui/ShadowTessellator.cpp b/libs/hwui/ShadowTessellator.cpp index 09d1258..595c10c 100644 --- a/libs/hwui/ShadowTessellator.cpp +++ b/libs/hwui/ShadowTessellator.cpp @@ -80,6 +80,11 @@ void ShadowTessellator::tessellateSpotShadow(bool isCasterOpaque, ALOGD("light center %f %f %f", adjustedLightCenter.x, adjustedLightCenter.y, adjustedLightCenter.z); #endif + if (isnan(adjustedLightCenter.x) + || isnan(adjustedLightCenter.y) + || isnan(adjustedLightCenter.z)) { + return; + } // light position (because it's in local space) needs to compensate for receiver transform // TODO: should apply to light orientation, not just position -- cgit v1.1 From e0fa7476a5e6f516fe5d2b4e10113355d43a435f Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Thu, 5 Nov 2015 17:58:28 +0000 Subject: Revert "Remove -ffast-math from libhwui makefile" This reverts commit e02ec7c37a92fd63748a610bac6a23d0409788cf. Change-Id: Iea7fadf04c4ffa62be28f783342ae749f89bf931 --- libs/hwui/Android.common.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libs/hwui') diff --git a/libs/hwui/Android.common.mk b/libs/hwui/Android.common.mk index 94bb981..38e8be9 100644 --- a/libs/hwui/Android.common.mk +++ b/libs/hwui/Android.common.mk @@ -119,7 +119,7 @@ endif # Defaults for ATRACE_TAG and LOG_TAG for libhwui LOCAL_CFLAGS += -DATRACE_TAG=ATRACE_TAG_VIEW -DLOG_TAG=\"OpenGLRenderer\" LOCAL_CFLAGS += -Wall -Wno-unused-parameter -Wunreachable-code -LOCAL_CFLAGS += -O3 +LOCAL_CFLAGS += -ffast-math -O3 # b/21698669 ifneq ($(USE_CLANG_PLATFORM_BUILD),true) -- cgit v1.1 From 7f667e7a0823d52eed2ed64a31b125f6b8da21cb Mon Sep 17 00:00:00 2001 From: Matthew Bouyack Date: Tue, 12 Jan 2016 12:01:48 -0800 Subject: In CanvasContext::doFrame, make a separate call to computeFrameTimeNanos and save the result. Then pass that value to UiFrameInfoBuilder::setVsync as both arguments. The order of function argument evaluation is undefined in C++. Because the value returned from TimeLord::latestVsync may be changed by the preceding call to TimeLord::computeFrameTimeNanos the values of the arguments passed to UiFrameInfoBuilder::setVsync is also undefined. This change removes any ambiguity. Change-Id: Ie71ee453f9ccc725edfe5f7cc9b277f2a809dfdc --- libs/hwui/renderthread/CanvasContext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libs/hwui') diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index 6dfb6e8..4cf8b15 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -289,11 +289,11 @@ void CanvasContext::doFrame() { ATRACE_CALL(); + nsecs_t vsync = mRenderThread.timeLord().computeFrameTimeNanos(); int64_t frameInfo[UI_THREAD_FRAME_INFO_SIZE]; UiFrameInfoBuilder(frameInfo) .addFlag(FrameInfoFlags::RTAnimation) - .setVsync(mRenderThread.timeLord().computeFrameTimeNanos(), - mRenderThread.timeLord().latestVsync()); + .setVsync(vsync, vsync); TreeInfo info(TreeInfo::MODE_RT_ONLY, mRenderThread.renderState()); prepareTree(info, frameInfo, systemTime(CLOCK_MONOTONIC)); -- cgit v1.1 From 74dfcf90f18d8d0e1128707a5986c4fa94d70350 Mon Sep 17 00:00:00 2001 From: Nancy Zheng Date: Wed, 13 Jan 2016 15:23:56 -0800 Subject: Pulling in https://android-review.googlesource.com/#/c/186482/1 Fix memory leak in HWUI std::unique_ptr::release just releases the ownership of the managed object. To delete the object, std::unique_ptr::reset function should be called. Bug: 26116596 Change-Id: If65f74085b1fc2be3a9fffc433326e0bcdb40ff3 --- libs/hwui/Caches.cpp | 2 +- libs/hwui/GammaFontRenderer.cpp | 4 ++-- libs/hwui/Layer.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'libs/hwui') diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp index aa73d44..2763e89 100644 --- a/libs/hwui/Caches.cpp +++ b/libs/hwui/Caches.cpp @@ -117,7 +117,7 @@ void Caches::initStaticProperties() { void Caches::terminate() { if (!mInitialized) return; - mRegionMesh.release(); + mRegionMesh.reset(nullptr); fboCache.clear(); diff --git a/libs/hwui/GammaFontRenderer.cpp b/libs/hwui/GammaFontRenderer.cpp index 0bcd83a..070c3d7 100644 --- a/libs/hwui/GammaFontRenderer.cpp +++ b/libs/hwui/GammaFontRenderer.cpp @@ -194,7 +194,7 @@ void Lookup3GammaFontRenderer::endPrecaching() { void Lookup3GammaFontRenderer::clear() { for (int i = 0; i < kGammaCount; i++) { - mRenderers[i].release(); + mRenderers[i].reset(nullptr); } } @@ -215,7 +215,7 @@ void Lookup3GammaFontRenderer::flush() { if (count <= 1 || min < 0) return; - mRenderers[min].release(); + mRenderers[min].reset(nullptr); // Also eliminate the caches for large glyphs, as they consume significant memory for (int i = 0; i < kGammaCount; ++i) { diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp index e16865e..62eeb43 100644 --- a/libs/hwui/Layer.cpp +++ b/libs/hwui/Layer.cpp @@ -251,7 +251,7 @@ void Layer::defer(const OpenGLRenderer& rootRenderer) { void Layer::cancelDefer() { renderNode = nullptr; deferredUpdateScheduled = false; - deferredList.release(); + deferredList.reset(nullptr); } void Layer::flush() { -- cgit v1.1