From 23c31af2f8097f14dfc4a71dad3553d84a10c35f Mon Sep 17 00:00:00 2001 From: Marin Shalamanov Date: Wed, 9 Sep 2020 15:01:47 +0200 Subject: SF: Clean framebuffer cache on hotplug This CL cleans the framebuffer cache when a hotplug event for already connected display is processed. This way when we destruct the DisplayDevice the framebuffers will be completely deallocated, so they can later be reallocated. Test: 1. unplug HDMI 2. adb shell dumpsys SurfaceFlinger | grep FramebufferSurface verify only 3 framebuffers are allocated 3. plug HDMI 5. adb shell dumpsys SurfaceFlinger | grep FramebufferSurface verify only 3 framebuffers are allocated Test: Using dev SurfaceFlinger backdoor (1036) which injects hotplug: adb shell service call SurfaceFlinger 1036 && \ adb shell dumpsys SurfaceFlinger | grep FramebufferSurface Bug: 160112047 Bug: 167670568 Change-Id: I96282bec439ebf413dcd5d57f6b884eccef19c5f --- services/surfaceflinger/SurfaceFlinger.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'services/surfaceflinger/SurfaceFlinger.cpp') diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 6478497b8f..9d35a3fca6 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2684,6 +2684,7 @@ void SurfaceFlinger::processDisplayChanged(const wp& displayToken, const sp drawingBinder = IInterface::asBinder(drawingState.surface); if (currentBinder != drawingBinder || currentState.sequenceId != drawingState.sequenceId) { // changing the surface is like destroying and recreating the DisplayDevice + getRenderEngine().cleanFramebufferCache(); if (const auto display = getDisplayDeviceLocked(displayToken)) { display->disconnect(); } -- cgit v1.2.3-59-g8ed1b