cnlohr / rawdrawandroid

Build android apps without any java, entirely in C and Make
MIT License
3.55k stars 226 forks source link

Logcat spam (BufferQueueProducer) when suspended #21

Closed dreua closed 1 year ago

dreua commented 4 years ago

Steps to reproduce:

  1. run adb logcat | grep cnfgtest
  2. run rawdrawandroid in another shell
  3. suspend the app, for example go to the homescreen
  4. Log is printing this message at a high rate:
07-25 01:28:34.392   469  3410 E BufferQueueProducer: [org.yourorg.cnfgtest/android.app.NativeActivity] dequeueBuffer: BufferQueue has no connected producer
07-25 01:28:34.409   469   507 E BufferQueueProducer: [org.yourorg.cnfgtest/android.app.NativeActivity] dequeueBuffer: BufferQueue has no connected producer
07-25 01:28:34.409   469  2856 E BufferQueueProducer: [org.yourorg.cnfgtest/android.app.NativeActivity] dequeueBuffer: BufferQueue has no connected producer
07-25 01:28:34.428   469   507 E BufferQueueProducer: [org.yourorg.cnfgtest/android.app.NativeActivity] dequeueBuffer: BufferQueue has no connected producer
07-25 01:28:34.429   469  2856 E BufferQueueProducer: [org.yourorg.cnfgtest/android.app.NativeActivity] dequeueBuffer: BufferQueue has no connected producer
07-25 01:28:34.446   469  3410 E BufferQueueProducer: [org.yourorg.cnfgtest/android.app.NativeActivity] dequeueBuffer: BufferQueue has no connected producer

When closing the app (via recent tasks) it stops. Not sure if this is specific to my Android version / device.

cnlohr commented 4 years ago

I think this looks like it might be related to the accelerometer... Not sure.

DavidVentura commented 1 year ago

I see this also when not using the accelerometer. From what I've seen, there are some buffers/textures that have to be released on suspend

cnlohr commented 1 year ago

I don't actually know how to fix this - if you can investigate, I am def up for some PRs.

DavidVentura commented 1 year ago

I've spent some time looking at this; the minimum code that triggers this is

int main( int argc, char ** argv )
{
        CNFGBGColor = 0x000040ff;
        CNFGSetupFullscreen( "Test Bench", 0 );
        while(1)
        {
                CNFGHandleInput();
                CNFGSwapBuffers();

        }
}

CNFGHandleInput is necessary to process Android events - otherwise the app is just busy looping.

Commenting out CNFGSwapBuffers makes the issue go away. I have a "working" demo, but I am not sure if it's correct.. it does work on my phone!

dreua commented 1 year ago

I think this is solved then, thanks @DavidVentura !