From fc869035b6883bd9cfa6a83c5191405aebb426a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zhiyin=20Luo=20=28=E7=BD=97=E6=A4=8D=E5=B0=B9=29?= Date: Sat, 11 Jan 2020 17:14:05 +0800 Subject: fix uninitialization issue in JankTracker We should initialize mSwapDeadline in JankTracker, or it can be a very large randomized value and then makes jank tracker not collect concrete jank type of frames appropriately as expected. Bug: 161656795 Test: run cts -m CtsIncidentHostTestCases -t com.android.server.cts.GraphicsStatsValidationTest#testJankyDrawFrame Change-Id: I057a50a74502918619204f9164f6a954f8e9c5de Merged-In: I057a50a74502918619204f9164f6a954f8e9c5de (cherry picked from commit 7a0d224756195ce81875db0b481a77b87f860dd3) --- libs/hwui/JankTracker.cpp | 3 +++ libs/hwui/JankTracker.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/hwui/JankTracker.cpp b/libs/hwui/JankTracker.cpp index d25fc4b0b03e..b2c39c90071a 100644 --- a/libs/hwui/JankTracker.cpp +++ b/libs/hwui/JankTracker.cpp @@ -139,6 +139,9 @@ void JankTracker::finishFrame(const FrameInfo& frame) { (*mGlobalData)->reportJank(); } + if (mSwapDeadline < 0) { + mSwapDeadline = frame[FrameInfoIndex::IntendedVsync] + mFrameInterval; + } bool isTripleBuffered = (mSwapDeadline - frame[FrameInfoIndex::IntendedVsync]) > (mFrameInterval * 0.1); mSwapDeadline = std::max(mSwapDeadline + mFrameInterval, diff --git a/libs/hwui/JankTracker.h b/libs/hwui/JankTracker.h index 4460266276f9..b3fbbfe98669 100644 --- a/libs/hwui/JankTracker.h +++ b/libs/hwui/JankTracker.h @@ -75,7 +75,7 @@ private: std::array mThresholds; int64_t mFrameInterval; - nsecs_t mSwapDeadline; + nsecs_t mSwapDeadline = -1; // The amount of time we will erase from the total duration to account // for SF vsync offsets with HWC2 blocking dequeueBuffers. // (Vsync + mDequeueBlockTolerance) is the point at which we expect -- cgit v1.2.3 From 7f12a30e74af5475f58792ea96caf9019c15be3d Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Thu, 6 Aug 2020 12:57:43 +0000 Subject: Do not leak dump objects. Bug: 163024455 Change-Id: Ia0710c3462f03a85bc22aaac7b190961da1f8be3 Merged-in: I9c1737647d762f478c0e452e5b72f98ec3d43c28 --- libs/hwui/service/GraphicsStatsService.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'libs') diff --git a/libs/hwui/service/GraphicsStatsService.cpp b/libs/hwui/service/GraphicsStatsService.cpp index 644d5fbd5bf9..e4198017aee0 100644 --- a/libs/hwui/service/GraphicsStatsService.cpp +++ b/libs/hwui/service/GraphicsStatsService.cpp @@ -559,6 +559,7 @@ void GraphicsStatsService::finishDumpInMemory(Dump* dump, AStatsEventList* data, AStatsEvent_writeBool(event, !lastFullDay); AStatsEvent_build(event); } + delete dump; } -- cgit v1.2.3