GamePad response slowly in iPadOS app running on M1 Mac

I connected the native PS4/Xbox joystick to my M1 MacBook to test my iPad Game, choose "My Mac (Designed for iPad)" and run it via xcode/ archive and install it as an mac app.

But the joystick buttons response very slowly and have large delay (detect input via GCController.extendedGamepad.valueChangedHanlder).

The same code runs property if I build the app to iPad and connect the same joystick.

My app CPU Percentage Used is over 100%, is it relative to this question?

Replies

Hi SaltyLeung

Please capture a spindump [1] while the CPU usage is at 100%. You can post the spindump file here (if you are comfortable doing so), or submit a feedback report with the spindump file attached and post the feedback ID.

[1] Open Terminal. Enter sudo spindump. The spindump command will run for a bit and save a file to /tmp/spindump.txt. Please make sure you are reproducing the issue (CPU usage at 100%) while the spindump command runs.

  • Hey bro, the spindump is too long to upload. =v=

  • Hi SaltyLeung. You can create a feedback report and attach the spindump there. Please post the feedback ID.

  • Hi, here is the feedback ID, FB11663176 (FB11663146 uploading was not completed).

Hi, here is the feedback ID, FB11663176 (FB11663146 uploading was not completed).

  • Thank you for submitting the feedback report! I looked at the spindump but didn't see anything that immediately implicates GameController framework as the cause of poor performance. I see a lot of time spent inside Metal API calls, but that is unfortunately not my area of expertise. You may want to consider contacting Developer Technical Support if this is a high priority issue.

  • Thanks! After investigating, we found that the frame limit logic in our app may lead to the lagging problem (we use std::sleep_for() or run a busy waiting “while loop” to limit the cpu rendering submitting rate every frame). However, we guess it may affect the GCD process and let the thread async callbacks block in the queue while the Main Runloop thought our app is running too busy. I don’t know whether my conjecture is right.

  • But the problem only shows on iOS app running on Apple Silicon Mac. The same code running on actual iOS device has no input lagging. Is it because the runloop implementation has difference between two environments?

Add a Comment