From 29154b178d6a672decfafbac41c232d8b0d33c88 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 From d20b0cef5c76814c776268b469f9c0928e9ff593 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 CtsIncidentHostTestCases for RVC AAOS emulator Same failure in b/161656795, cherry pick the fix 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: 158029827 Test: run cts -m CtsIncidentHostTestCases -t com.android.server.cts.GraphicsStatsValidationTest#testJankyDrawFrame Change-Id: I057a50a74502918619204f9164f6a954f8e9c5de (cherry picked from commit 7a0d224756195ce81875db0b481a77b87f860dd3) (cherry picked from commit 69525945b9f63fe45e2e1cfa7f63320748a3fc25) --- 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 665f91bdaac08c19dd154ca35ce17060f088deb9 Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Mon, 29 Jun 2020 16:54:21 -0700 Subject: Correctly expose EGL_ANDROID_native_fence_sync to hwui When we moved off of gui/SyncFeatures for retrieving this extension, we accidentally didn't include the eglQueryStringImplementationANDROID path for retrieving extensions. Fortunately this extension is only used for TextureView synchronization, but we should still use the extension when available. Bug: 159921224 Bug: 161767307 Test: Manually inject log statements to verify the extension is correctly visible. Change-Id: Idaa872778afc13e86bdea918da8631b4747fe9c1 Merged-In: Idaa872778afc13e86bdea918da8631b4747fe9c1 (cherry picked from commit 49d87e5c077fed85c48341be65e9eaff98654bef) --- libs/hwui/renderthread/EglManager.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp index 5e0471c08d67..7982ab664c1b 100644 --- a/libs/hwui/renderthread/EglManager.cpp +++ b/libs/hwui/renderthread/EglManager.cpp @@ -208,8 +208,12 @@ EGLConfig EglManager::loadFP16Config(EGLDisplay display, SwapBehavior swapBehavi return config; } +extern "C" EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name); + void EglManager::initExtensions() { auto extensions = StringUtils::split(eglQueryString(mEglDisplay, EGL_EXTENSIONS)); + auto extensionsAndroid = + StringUtils::split(eglQueryStringImplementationANDROID(mEglDisplay, EGL_EXTENSIONS)); // For our purposes we don't care if EGL_BUFFER_AGE is a result of // EGL_EXT_buffer_age or EGL_KHR_partial_update as our usage is covered @@ -228,9 +232,12 @@ void EglManager::initExtensions() { EglExtensions.displayP3 = extensions.has("EGL_EXT_gl_colorspace_display_p3_passthrough"); EglExtensions.contextPriority = extensions.has("EGL_IMG_context_priority"); EglExtensions.surfacelessContext = extensions.has("EGL_KHR_surfaceless_context"); - EglExtensions.nativeFenceSync = extensions.has("EGL_ANDROID_native_fence_sync"); EglExtensions.fenceSync = extensions.has("EGL_KHR_fence_sync"); EglExtensions.waitSync = extensions.has("EGL_KHR_wait_sync"); + + // EGL_ANDROID_native_fence_sync is not exposed to applications, so access + // this through the private Android-specific query instead. + EglExtensions.nativeFenceSync = extensionsAndroid.has("EGL_ANDROID_native_fence_sync"); } bool EglManager::hasEglContext() { -- cgit v1.2.3 From c1942afbff65a606d2adb7f8df8491b73c373ad6 Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Mon, 29 Jun 2020 16:54:21 -0700 Subject: Correctly expose EGL_ANDROID_native_fence_sync to hwui When we moved off of gui/SyncFeatures for retrieving this extension, we accidentally didn't include the eglQueryStringImplementationANDROID path for retrieving extensions. Fortunately this extension is only used for TextureView synchronization, but we should still use the extension when available. Bug: 159921224 Test: Manually inject log statements to verify the extension is correctly visible. Change-Id: Idaa872778afc13e86bdea918da8631b4747fe9c1 (cherry picked from commit 49d87e5c077fed85c48341be65e9eaff98654bef) Merged-In: Idaa872778afc13e86bdea918da8631b4747fe9c1 --- libs/hwui/renderthread/EglManager.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp index 5e0471c08d67..7982ab664c1b 100644 --- a/libs/hwui/renderthread/EglManager.cpp +++ b/libs/hwui/renderthread/EglManager.cpp @@ -208,8 +208,12 @@ EGLConfig EglManager::loadFP16Config(EGLDisplay display, SwapBehavior swapBehavi return config; } +extern "C" EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name); + void EglManager::initExtensions() { auto extensions = StringUtils::split(eglQueryString(mEglDisplay, EGL_EXTENSIONS)); + auto extensionsAndroid = + StringUtils::split(eglQueryStringImplementationANDROID(mEglDisplay, EGL_EXTENSIONS)); // For our purposes we don't care if EGL_BUFFER_AGE is a result of // EGL_EXT_buffer_age or EGL_KHR_partial_update as our usage is covered @@ -228,9 +232,12 @@ void EglManager::initExtensions() { EglExtensions.displayP3 = extensions.has("EGL_EXT_gl_colorspace_display_p3_passthrough"); EglExtensions.contextPriority = extensions.has("EGL_IMG_context_priority"); EglExtensions.surfacelessContext = extensions.has("EGL_KHR_surfaceless_context"); - EglExtensions.nativeFenceSync = extensions.has("EGL_ANDROID_native_fence_sync"); EglExtensions.fenceSync = extensions.has("EGL_KHR_fence_sync"); EglExtensions.waitSync = extensions.has("EGL_KHR_wait_sync"); + + // EGL_ANDROID_native_fence_sync is not exposed to applications, so access + // this through the private Android-specific query instead. + EglExtensions.nativeFenceSync = extensionsAndroid.has("EGL_ANDROID_native_fence_sync"); } bool EglManager::hasEglContext() { -- cgit v1.2.3 From 58f3306d05ca50fab731d66d4df3e839f4f1eedd Mon Sep 17 00:00:00 2001 From: John Reck Date: Mon, 21 Sep 2020 14:37:41 -0700 Subject: Fix override setBufferCount The logic in setBufferCount was still assuming it needed to inject the extra buffers, however that injection was already happening in the min_undequeued query. So it was increasing buffercount by 2x the extraCount, or concretely 5 buffers when it should have been 4 on >75hz devices Bug: 168928692 Test: Boot coral, verify 4 buffers instead of 5 Change-Id: I0908228a6791d90544fbf4cb21170931bd31a9db --- libs/hwui/renderthread/CanvasContext.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libs') diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index a362bd220936..667a7517a24c 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -139,7 +139,7 @@ void CanvasContext::destroy() { mAnimationContext->destroy(); } -static void setBufferCount(ANativeWindow* window, uint32_t extraBuffers) { +static void setBufferCount(ANativeWindow* window) { int query_value; int err = window->query(window, NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &query_value); if (err != 0 || query_value < 0) { @@ -148,7 +148,9 @@ static void setBufferCount(ANativeWindow* window, uint32_t extraBuffers) { } auto min_undequeued_buffers = static_cast(query_value); - int bufferCount = min_undequeued_buffers + 2 + extraBuffers; + // We only need to set min_undequeued + 2 because the renderahead amount was already factored into the + // query for min_undequeued + int bufferCount = min_undequeued_buffers + 2; native_window_set_buffer_count(window, bufferCount); } @@ -179,7 +181,8 @@ void CanvasContext::setSurface(ANativeWindow* window, bool enableTimeout) { mNativeSurface ? mNativeSurface->getNativeWindow() : nullptr, mSwapBehavior); if (mNativeSurface && !mNativeSurface->didSetExtraBuffers()) { - setBufferCount(mNativeSurface->getNativeWindow(), mRenderAheadCapacity); + setBufferCount(mNativeSurface->getNativeWindow()); + } mFrameNumber = -1; -- cgit v1.2.3 From 30f9ba0d2be9f70c9055d5818512febceca56b82 Mon Sep 17 00:00:00 2001 From: Andrii Kulian Date: Tue, 8 Sep 2020 21:33:26 -0700 Subject: Move reference WM Sidecar impl to system_ext Placing the reference implementation in /vendor partition tirggers UnofficialApisUsageTest failures due to hidden API use in the sample. Moving it to system_ext should resolve this issue. Bug: 167214265 Test: com.android.gts.api.UnofficialApisUsageTest#testNonApiReferences Change-Id: I628fd0e00558208a3af26ecf02b82a3cedad8011 (cherry picked from commit 4ebadc8056532cbc59f8c63068678f1f8f93164c) --- libs/WindowManager/Jetpack/Android.bp | 4 ++-- libs/WindowManager/Jetpack/androidx.window.sidecar.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'libs') diff --git a/libs/WindowManager/Jetpack/Android.bp b/libs/WindowManager/Jetpack/Android.bp index 4f4364f72fef..7fbbb61e469d 100644 --- a/libs/WindowManager/Jetpack/Android.bp +++ b/libs/WindowManager/Jetpack/Android.bp @@ -24,14 +24,14 @@ java_library { static_libs: ["window-sidecar"], installable: true, sdk_version: "core_platform", - vendor: true, + system_ext_specific: true, libs: ["framework", "androidx.annotation_annotation",], required: ["androidx.window.sidecar.xml",], } prebuilt_etc { name: "androidx.window.sidecar.xml", - vendor: true, + system_ext_specific: true, sub_dir: "permissions", src: "androidx.window.sidecar.xml", filename_from_src: true, diff --git a/libs/WindowManager/Jetpack/androidx.window.sidecar.xml b/libs/WindowManager/Jetpack/androidx.window.sidecar.xml index f88a5f4ae039..359e69fd9bc1 100644 --- a/libs/WindowManager/Jetpack/androidx.window.sidecar.xml +++ b/libs/WindowManager/Jetpack/androidx.window.sidecar.xml @@ -17,5 +17,5 @@ + file="/system_ext/framework/androidx.window.sidecar.jar"/> -- cgit v1.2.3