您尚未登录。

楼主 # 2022-01-15 00:32:24

shaoxi2010
会员
注册时间: 2019-06-13
已发帖子: 363
积分: 312

F1C200 linux LVGL双缓冲支持

看到LVGL支持了DRM,按道理F1C200的驱动情况下也能支持双缓冲效果。
简单的测试了下,支持还是很可以的,看上去也就是CPU有点高。
对比了下CPU和top看到的存在较大的差异,可能计算方式不一样吧?

修改使用tslib的ts_uinput来校准输入,模拟为event1
修改使用libdrm的输出,输出双缓冲。

验证代码,应该要修改下Makefile的CFLAGS下的路径
https://github.com/shaoxi2010/lv_port_linux_frame_buffer

离线

#1 2022-01-23 16:36:45

someluo
会员
注册时间: 2022-01-23
已发帖子: 4
积分: 4

Re: F1C200 linux LVGL双缓冲支持

你好,我按照提示修改了Makefile,下载到F1C100S nano的TF卡手动执行,提示:

Welcome to Lichee Pi
Lichee login: root
Password:
# ls
demosss              goodix.ko            littlevgl_demo
demoxx               littlevgl_benchmark
# ./demosss
./demosss: line 1: syntax error: unexpected "("

Makefile修改的内容:

#
# Makefile
#
CC ?= /home/allenz3700/f1c100s/buildroot-2017.08/output/host/bin/arm-buildroot-linux-musleabi-gcc
LVGL_DIR_NAME ?= lvgl
LVGL_DIR ?= ${shell pwd}
CFLAGS ?= -O3 -g0 -I$(LVGL_DIR)/ -Wall -Wshadow -Wundef -Wmissing-prototypes -Wno-discarded-qualifiers -Wall -Wextra -Wno-unused-function -Wno-error=strict-prototypes -Wpointer-arith -fno-strict-aliasing -Wno-error=cpp -Wuninitialized -Wmaybe-uninitialized -Wno-unused-parameter -Wno-missing-field-initializers -Wtype-limits -Wsizeof-pointer-memaccess -Wno-format-nonliteral -Wno-cast-qual -Wunreachable-code -Wno-switch-default -Wreturn-type -Wmultichar -Wformat-security -Wno-ignored-qualifiers -Wno-error=pedantic -Wno-sign-compare -Wno-error=missing-prototypes -Wdouble-promotion -Wclobbered -Wdeprecated -Wempty-body -Wtype-limits -Wshift-negative-value -Wstack-usage=2048 -Wno-unused-value -Wno-unused-parameter -Wno-missing-field-initializers -Wuninitialized -Wmaybe-uninitialized -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wtype-limits -Wsizeof-pointer-memaccess -Wno-format-nonliteral -Wpointer-arith -Wno-cast-qual -Wmissing-prototypes -Wunreachable-code -Wno-switch-default -Wreturn-type -Wmultichar -Wno-discarded-qualifiers -Wformat-security -Wno-ignored-qualifiers -Wno-sign-compare
CFLAGS += -I/home/allenz3700/f1c100s/buildroot-2017.08/output/host/arm-buildroot-linux-musleabi/sysroot/usr/include/drm

LDFLAGS ?= -lm -ldrm
BIN = demo

我是ST7701S 480x480的RGB屏+GT911触摸,有些迷茫,请教一下

离线

楼主 #2 2022-01-23 20:24:03

shaoxi2010
会员
注册时间: 2019-06-13
已发帖子: 363
积分: 312

Re: F1C200 linux LVGL双缓冲支持

可能是编译没选对吧,看下二进制的架构信息吧

离线

#3 2022-01-23 23:03:34

someluo
会员
注册时间: 2022-01-23
已发帖子: 4
积分: 4

Re: F1C200 linux LVGL双缓冲支持

你好,总结下遇到了以下问题:
1. CC ?= xxxxxx,可能我CC被赋值过,所以后面的arm工具链没有被用上,改成CC = arm-linux-xxx就好了。
2. 然后我编译双缓存这个遇到了找不到drm文件的问题,我也尝试了apt install libdrm-dev,之后还是找不到,可能需要在kernel或rootfs里面cc出来?
3. 我拉取lvgl的porting后,编译通过,并且还非得自己编译一套rootfs,终于可以运行了,之前不知道,也许必须要用相同的交叉工具链才能运行

离线

#4 2022-01-27 01:43:59

someluo
会员
注册时间: 2022-01-23
已发帖子: 4
积分: 4

Re: F1C200 linux LVGL双缓冲支持

还有个问题想请教,默认的lvgl配置的是16位色深,但是我的kernel好像总是32位RGBA的色深,显示出来就不对。我找了很多地方,改dts文件等,因为我的屏是86面板屏18位的。请问linux的framebuffer的色深 是如何配置成16bpp的呢?

离线

楼主 #5 2022-01-27 11:06:46

shaoxi2010
会员
注册时间: 2019-06-13
已发帖子: 363
积分: 312

Re: F1C200 linux LVGL双缓冲支持

不同内核修改方法是不一样的,这个是4.19的修改方法, 将sun4i_frambuffer.c的32修改为16就行了。
我记得5.4应该是要修改panle属性还是什么来着,已经忘记了。

int sun4i_framebuffer_init(struct drm_device *drm)
{
	drm_mode_config_reset(drm);

	drm->mode_config.max_width = 8192;
	drm->mode_config.max_height = 8192;

	drm->mode_config.funcs = &sun4i_de_mode_config_funcs;
	drm->mode_config.helper_private = &sun4i_de_mode_config_helpers;

	return drm_fb_cma_fbdev_init(drm, 16, 0);
}

离线

#6 2022-01-27 12:41:08

memory
会员
注册时间: 2021-08-11
已发帖子: 206
积分: 181

Re: F1C200 linux LVGL双缓冲支持

瞄了一下楼主的源码, 并没有发现启用 tslib,请问是怎么回事呢?

离线

楼主 #7 2022-01-27 13:12:37

shaoxi2010
会员
注册时间: 2019-06-13
已发帖子: 363
积分: 312

Re: F1C200 linux LVGL双缓冲支持

因为用的是ts_uinput,会将原始坐标做一次tslib转换后再生成新的event设备为符合屏幕转换的点信息。
所以没有用tslib驱动,用的evdev驱动

离线

#8 2022-01-27 13:21:28

memory
会员
注册时间: 2021-08-11
已发帖子: 206
积分: 181

Re: F1C200 linux LVGL双缓冲支持

shaoxi2010 说:

因为用的是ts_uinput,会将原始坐标做一次tslib转换后再生成新的event设备为符合屏幕转换的点信息。
所以没有用tslib驱动,用的evdev驱动

https://github.com/libts/tslib/blob/master/tools/ts_uinput.c

是一个后台进程吗?

离线

楼主 #9 2022-01-27 13:30:07

shaoxi2010
会员
注册时间: 2019-06-13
已发帖子: 363
积分: 312

Re: F1C200 linux LVGL双缓冲支持

恩,加个-d就是一个后台的daemon程序

离线

#10 2022-01-27 14:57:26

拉轰的脚踏车
会员
注册时间: 2020-03-20
已发帖子: 288
积分: 222

Re: F1C200 linux LVGL双缓冲支持

shaoxi2010 说:

恩,加个-d就是一个后台的daemon程序

https://www.kernel.org/doc/html/v4.12/input/uinput.html

uinput 是一个内核模块,可以模拟用户空间的输入设备。通过写入 /dev/uinput(或 /dev/input/uinput)设备,进程可以创建具有特定功能的虚拟输入设备。一旦创建了这个虚拟设备,进程就可以通过它发送事件,这些事件将被传递给用户空间和内核消费者。

这玩意真神奇!

离线

楼主 #11 2022-01-27 16:16:49

shaoxi2010
会员
注册时间: 2019-06-13
已发帖子: 363
积分: 312

Re: F1C200 linux LVGL双缓冲支持

挺好用的,最开始是因为qt5的tslib驱动不支持旋转,然后就用了这个方案了。

离线

#12 2022-02-22 23:03:35

小智跑腿
会员
注册时间: 2020-04-26
已发帖子: 76
积分: 76

Re: F1C200 linux LVGL双缓冲支持

shaoxi2010 说:

因为用的是ts_uinput,会将原始坐标做一次tslib转换后再生成新的event设备为符合屏幕转换的点信息。
所以没有用tslib驱动,用的evdev驱动

https://stackoverflow.com/questions/9920561/how-to-enable-dev-input-uinput

CONFIG_INPUT_UINPUT: y/m
    Device Drivers --->
        Input Device Support --->
            Miscellaneous devices --->
                User level driver support

离线

#13 2022-03-08 16:30:07

t123yh
会员
注册时间: 2019-10-15
已发帖子: 18
积分: 44

Re: F1C200 linux LVGL双缓冲支持

楼主你好,你的代码可以跑起来。不过,同样的配置下,drm的fps明显不如fbdev,CPU占用率也会达到100%(fbdev占用率最高50%左右)。在lvgl论坛看到一个bug,不知道是否相关:https://forum.lvgl.io/t/drm-driver-is-slow/3479

最近编辑记录 t123yh (2022-03-08 16:30:29)

离线

楼主 #14 2022-03-08 17:37:58

shaoxi2010
会员
注册时间: 2019-06-13
已发帖子: 363
积分: 312

Re: F1C200 linux LVGL双缓冲支持

lvgl的drm驱动实现我也不是很了解,看他们描述说的是VSYNC信号的同步等待引起的,
但是按理说应该不会引起CPU上升这么多,你可尝试改小usleep值看下呢降低任务延迟看看。
CPU的值你可以去top看看,lvgl的实际值确实要比top统计的高不少,不确定它的计算标准。

离线

#15 2022-05-08 22:47:39

xfdr0805
会员
注册时间: 2020-07-23
已发帖子: 291
积分: 344

Re: F1C200 linux LVGL双缓冲支持

我在f1c200s上也试了,感觉比起framebuffer 帧率没有提高多少,在f1c100s上由于内存不够,第一次是可以执行的,再执行就申请不到内存了无法正常显示了

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn