Wait for next drawable more than 1/60 second. After enable screen recorder it become normal.

This project is work for android and iOS, so I use a CAEAGLLayer to present live video which is 60fps. All code work well at iPhone11 and older devices. But at iPhone 12 and iPhone 13, it becomes strange. The layer drops some frames. I profile with Instrument and find some drawable are waited more than 1/60 second. And after I turn on Screen Recorder, it work well. All drawables are waited less than 1/60 second. The layer present video with 60fps. After I turn off the screen recorder, it didn't work again.

Is there anyone can tell me what happened and how to workaround it?

I'm experiencing essentially the same thing with my OpenGL app. Xcode shows its performance as continuous 60fps with only about 25% GPU utilization, yet every 4th frame or so simply doesn't get drawn to the screen, and the final result looks juddery. In my case, no frames are taking longer than 1/60 second to compute.

Interestingly, when UIKit elements are displayed on top of the OpenGL layer, that sometimes "fixes" the problem and the animation temporarily becomes buttery smooth 60fps, then when the UIKit elements are hidden, it gets choppy again. EAGLLayer doesn't respond to [setNeedsDisplay], so I don't know how to force the layer to be drawn to screen; it's as if the call to glPresentRenderBuffer() is simply ignored. Very puzzling, and very frustrating. I'm going to try adding 120fps support to see if that improves the situation at all.

Confirmed that adding 120fps support does fix the choppiness; my app now runs perfectly at 120fps. But this drains power, and it still runs choppily at 60fps even when using the new ProMotion CADisplayLink API. If I could, I would dynamically switch the app to 60fps most of the time, and reserve 120fps for critical animations. I'll keep trying things and post again if I find a workaround; hopefully Apple will fix it themselves in a forthcoming iOS update!

Wait for next drawable more than 1/60 second. After enable screen recorder it become normal.
 
 
Q