Android framerate not correct

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Android framerate not correct

Jump to solution
1,967 Views
emilmyhrman
Contributor IV


Hello,

I'm running Android 5.1.1_2.1.0-ga release with kernel 3.14.52 and are having problem getting the framerate up to 60fps (this worked earlier on kitkat release with kernel 3.0.35).

The display is configured with a pixelclock for 60fps (for our display and resolution pclk is 10MHz) but framerate for Android's SurfaceFlinger get limited to 30fps (limited by IPU interrupts?).

When running a camera overlay in 60fps it seems to output in the correct rate, so I believe the display setup is correct. But for some reason the default framebuffer is rate limited to 30fps.

Has anyone else experienced this problem also?

We're using MIPI DSI (but problem also seen with MIPI DPI).

Framerate is shown in logcat after "setprop debug.sf.showfps 1" and "killing" surfaceflinger process.

0 Kudos
Reply
1 Solution
1,461 Views
emilmyhrman
Contributor IV

The problem was found in hwcomposer HAL. A nanosleep in vsync thread was too long, causing ioctl MXCFB_WAIT_FOR_VSYNC to sometimes miss first vsync (NF-ACK from IPU), and instead wait for second vsync, causing time to wait for vsync to double.

diff --git a/mx6/hwcomposer/hwc_vsync.cpp b/mx6/hwcomposer/hwc_vsync.cpp

index fc6b9bf..8fec0a6 100644

--- a/mx6/hwcomposer/hwc_vsync.cpp

+++ b/mx6/hwcomposer/hwc_vsync.cpp

@@ -125,7 +125,7 @@ void VSyncThread::performVSync()

     struct timespec tm;

     struct timespec ts;

-    const nsecs_t wake_up = 400000;

+    const nsecs_t wake_up = 800000; // Allow for some time to reschedule this thread and start wait on next VSYNC ioctl

     double m_frame_period_ns = mCtx->mDispInfo[HWC_DISPLAY_PRIMARY].vsync_period;

View solution in original post

0 Kudos
Reply
2 Replies
1,461 Views
SergioSolis
NXP Employee
NXP Employee

Thank you for posting the solution

0 Kudos
Reply
1,462 Views
emilmyhrman
Contributor IV

The problem was found in hwcomposer HAL. A nanosleep in vsync thread was too long, causing ioctl MXCFB_WAIT_FOR_VSYNC to sometimes miss first vsync (NF-ACK from IPU), and instead wait for second vsync, causing time to wait for vsync to double.

diff --git a/mx6/hwcomposer/hwc_vsync.cpp b/mx6/hwcomposer/hwc_vsync.cpp

index fc6b9bf..8fec0a6 100644

--- a/mx6/hwcomposer/hwc_vsync.cpp

+++ b/mx6/hwcomposer/hwc_vsync.cpp

@@ -125,7 +125,7 @@ void VSyncThread::performVSync()

     struct timespec tm;

     struct timespec ts;

-    const nsecs_t wake_up = 400000;

+    const nsecs_t wake_up = 800000; // Allow for some time to reschedule this thread and start wait on next VSYNC ioctl

     double m_frame_period_ns = mCtx->mDispInfo[HWC_DISPLAY_PRIMARY].vsync_period;

0 Kudos
Reply