Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWTK程序的界面刷新率只有LCD时序帧率的一半 #88

Open
ufbycd opened this issue Mar 12, 2022 · 4 comments
Open

AWTK程序的界面刷新率只有LCD时序帧率的一半 #88

ufbycd opened this issue Mar 12, 2022 · 4 comments

Comments

@ufbycd
Copy link

ufbycd commented Mar 12, 2022

LCD接口是RGB,驱动类型是fbdev,用window_manager_set_show_fps(window_manager(), TRUE)显示程序刷新帧率发现在没有更新内容的界面上其FPS只有LCD时序帧率的一半:

  • LCD时序帧率为60fps时AWTK程序的最大FPS为30,LCD为120FPS时AWTK程序最大FPS为60;
  • 已经用示波器检验过LCD的时序信号是正确的;
  • 内核驱动上,我的fbdev是双缓存的。

粗略看了下源码,发现宏__FB_WAIT_VSYNC默认为1即刷新时默认会调用ioctl(fb->fd, FBIO_WAITFORVSYNC, &dummy);来等待垂直同步信号,个人认为:在双缓存的fbdev设备上是不需要等待垂直同步的。

于是,我将文件awtk-port/lcd_linux/lcd_linux_fb.c的宏__FB_WAIT_VSYNC定义改为#define __FB_WAIT_VSYNC 0后程序的最大帧率达到了LCD时序帧率。测试过程也没发现有界面撕裂的情况。

@ufbycd ufbycd changed the title AWTK程序的界面刷新率只有LCD时序刷新率的一半 AWTK程序的界面刷新率只有LCD时序帧率的一半 Mar 12, 2022
@sohide
Copy link
Collaborator

sohide commented Apr 12, 2022

双缓冲需要等垂直同步, 如果每帧渲染时间都超出16ms, 则帧率只有一半, 三缓冲可以得到一定的缓解

https://www.bilibili.com/video/BV1FK4y1x7bk?spm_id_from=333.999.0.0

@ufbycd
Copy link
Author

ufbycd commented May 15, 2022

双缓冲需要等垂直同步, 如果每帧渲染时间都超出16ms, 则帧率只有一半, 三缓冲可以得到一定的缓解

https://www.bilibili.com/video/BV1FK4y1x7bk?spm_id_from=333.999.0.0

双缓冲需不需要进行垂直同步,要看实现方式:如果硬件本身支持双缓冲就不需要垂直同步;如果硬件不支持双缓冲即双缓冲是由软件实现的才需要垂直同步。

@WeSrc-Yin
Copy link

太专业了,什么是垂直同步?

@ufbycd
Copy link
Author

ufbycd commented Oct 26, 2022

太专业了,什么是垂直同步?

ioctl(fb->fd, FBIO_WAITFORVSYNC, &dummy); 就是等待RGB接口时序上的VSYNC信号到来后才刷屏。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants