google / filament

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
https://google.github.io/filament/
Apache License 2.0
17.35k stars 1.83k forks source link

Android: GraphicBufferProducers counts keep increasing when app switches between the foreground and background #7938

Open cui060417 opened 1 week ago

cui060417 commented 1 week ago

Describe the bug Such as: filament-gltf-viewer-v1.53.0-android.apk,(other sample apps are the same).

  1. Installed in Android Phone
  2. Opened the App
  3. The app switches to the background, then switches back to the foreground, and repeats this cycle.

The counts of System GraphicBufferProducers keep increasing, and not reduce to the original counts. If counts >= MaxCounts, The App will be crashed!!

adb shell
while true;do dumpsys SurfaceFlinger |grep GraphicBufferPro;sleep 1s;done 

Expected behavior The count of GraphicBufferProducers does not increase.

Logs GraphicBufferProducers: 25, max 4096 GraphicBufferProducers: 25, max 4096 GraphicBufferProducers: 25, max 4096 GraphicBufferProducers: 25, max 4096 GraphicBufferProducers: 26, max 4096 GraphicBufferProducers: 25, max 4096 GraphicBufferProducers: 27, max 4096 GraphicBufferProducers: 27, max 4096 GraphicBufferProducers: 28, max 4096 GraphicBufferProducers: 27, max 4096 GraphicBufferProducers: 30, max 4096 GraphicBufferProducers: 30, max 4096 GraphicBufferProducers: 30, max 4096 GraphicBufferProducers: 30, max 4096 GraphicBufferProducers: 30, max 4096 GraphicBufferProducers: 29, max 4096 GraphicBufferProducers: 29, max 4096 GraphicBufferProducers: 29, max 4096 GraphicBufferProducers: 31, max 4096 GraphicBufferProducers: 32, max 4096 GraphicBufferProducers: 31, max 4096 GraphicBufferProducers: 31, max 4096 GraphicBufferProducers: 31, max 4096 GraphicBufferProducers: 31, max 4096 GraphicBufferProducers: 31, max 4096 GraphicBufferProducers: 34, max 4096 GraphicBufferProducers: 34, max 4096 GraphicBufferProducers: 34, max 4096 GraphicBufferProducers: 33, max 4096 GraphicBufferProducers: 33, max 4096 GraphicBufferProducers: 33, max 4096 GraphicBufferProducers: 33, max 4096 GraphicBufferProducers: 33, max 4096 GraphicBufferProducers: 33, max 4096 GraphicBufferProducers: 33, max 4096 GraphicBufferProducers: 33, max 4096 GraphicBufferProducers: 33, max 4096 GraphicBufferProducers: 33, max 4096 GraphicBufferProducers: 33, max 4096 GraphicBufferProducers: 33, max 4096 GraphicBufferProducers: 33, max 4096 GraphicBufferProducers: 33, max 4096 GraphicBufferProducers: 36, max 4096 GraphicBufferProducers: 36, max 4096 GraphicBufferProducers: 35, max 4096 GraphicBufferProducers: 37, max 4096 GraphicBufferProducers: 37, max 4096 GraphicBufferProducers: 38, max 4096 GraphicBufferProducers: 37, max 4096

Smartphone (please complete the following information):

pixelflinger commented 36 minutes ago

I am not able to reproduce this. Can you give more details repro steps? How do you switch the app in the background/foreground? Do you use the Home button or the Back button? Are you able to reproduce this in the Android Emulator? Which specific Phone did you see it happen on? Android 9.0 - 11.0 is very old now, does it reproduce on a more recent Android version?

pixelflinger commented 23 minutes ago

I am able to reproduce indeed with Android 11 in the Emulator.