Android framerate not correct

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Android framerate not correct

跳至解决方案
1,965 次查看
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 项奖励
回复
1 解答
1,459 次查看
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 项奖励
回复
2 回复数
1,459 次查看
SergioSolis
NXP Employee
NXP Employee

Thank you for posting the solution

0 项奖励
回复
1,460 次查看
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 项奖励
回复