概要
本文接上一篇文章《am3354 SGX移植》,记录下实际开发过程中遇到的问题。
问题
具体移植步骤可以参考上篇文档,这里说下开发中遇到的问题。在运行./335x-demo
时,提示omaplfb: OMAPLFBInitFBDev: Device 0: Unknown FB format
错误。
# ./335x-demo
0x10205
release8.x
installing 8.x SGX release user libraries
Installing PowerVR Consumer/Embedded DDK 'sgxddk_1.10@2359475' on target
File system installation root is /
Uninstalling existing version sgxddk_1.10@2359475
Uninstallation completed.
boot script rc.pvr -> /etc/init.d/rc.pvr
kernel module pvrsrvkm.ko -> /lib/modules/3.12.10-gba8c5e5-dirty/extra/pvrsrvkm.ko
kernel module omaplfb.ko -> /lib/modules/3.12.10-gba8c5e5-dirty/extra/omaplfb.ko
shared library libGLES_CM.so -> /usr/lib/libGLES_CM.so.1.10.2359475
shared library libusc.so -> /usr/lib/libusc.so.1.10.2359475
shared library libGLESv2.so -> /usr/lib/libGLESv2.so.1.10.2359475
shared library libglslcompiler.so -> /usr/lib/libglslcompiler.so.1.10.2359475
shared library libIMGegl.so -> /usr/lib/libIMGegl.so.1.10.2359475
shared library libEGL.so -> /usr/lib/libEGL.so.1.10.2359475
shared library libpvr2d.so -> /usr/lib/libpvr2d.so.1.10.2359475
shared library libpvrPVR2D_BLITWSEGL.so -> /usr/lib/libpvrPVR2D_BLITWSEGL.so.1.10.2359475
shared library libpvrPVR2D_FLIPWSEGL.so -> /usr/lib/libpvrPVR2D_FLIPWSEGL.so.1.10.2359475
shared library libpvrPVR2D_FRONTWSEGL.so -> /usr/lib/libpvrPVR2D_FRONTWSEGL.so.1.10.2359475
shared library libpvrPVR2D_LINUXFBWSEGL.so -> /usr/lib/libpvrPVR2D_LINUXFBWSEGL.so.1.10.2359475
shared library libsrv_um.so -> /usr/lib/libsrv_um.so.1.10.2359475
shared library libsrv_init.so -> /usr/lib/libsrv_init.so.1.10.2359475
shared library libPVRScopeServices.so -> /usr/lib/libPVRScopeServices.so.1.10.2359475
binary pvrsrvctl -> /usr/local/bin/pvrsrvctl
binary sgx_init_test -> /usr/local/bin/sgx_init_test
binary services_test -> /usr/local/bin/services_test
binary sgx_blit_test -> /usr/local/bin/sgx_blit_test
binary sgx_clipblit_test -> /usr/local/bin/sgx_clipblit_test
binary sgx_flip_test -> /usr/local/bin/sgx_flip_test
binary sgx_render_flip_test -> /usr/local/bin/sgx_render_flip_test
binary pvr2d_test -> /usr/local/bin/pvr2d_test
shader glsltest1_vertshader.txt -> /usr/local/bin/glsltest1_vertshader.txt
shader glsltest1_fragshaderA.txt -> /usr/local/bin/glsltest1_fragshaderA.txt
shader glsltest1_fragshaderB.txt -> /usr/local/bin/glsltest1_fragshaderB.txt
Installation complete!
You may now reboot your target.
omaplfb: OMAPLFBInitFBDev: Device 0: Unknown FB format
Loaded PowerVR consumer services.
基本确认是/dev/fb0设备格式的问题,搜索相关代码。
解决方法
查找报错信息的位置
long@ubuntu:~/Graphics_SDK_5_01_01_02/GFX_Linux_KM/services4/3rdparty/dc_ti335x_linux$ grep OMAPLFBInitFBDev -rn *
omaplfb_displayclass.c:1252: @Function OMAPLFBInitFBDev
omaplfb_displayclass.c:1261:static OMAPLFB_ERROR OMAPLFBInitFBDev(OMAPLFB_DEVINFO *psDevInfo)
omaplfb_displayclass.c:1617: if(OMAPLFBInitFBDev(psDevInfo) != OMAPLFB_OK)
omaplfb_displayclass.c:1620: * Leave it to OMAPLFBInitFBDev to print an error message, if
Binary file omaplfb_displayclass.o matches
Binary file omaplfb.ko matches
Binary file omaplfb.o matches
继续搜索错误信息
long@ubuntu:~/Graphics_SDK_5_01_01_02/GFX_Linux_KM/services4/3rdparty/dc_ti335x_linux$ grep "Unknown FB format" -rn *
omaplfb_displayclass.c:1492: printk(KERN_INFO DRIVER_PREFIX ": %s: Device %u: Unknown FB format\n", __FUNCTION__, uiFBDevID);
omaplfb_displayclass.c:1509: printk(KERN_INFO DRIVER_PREFIX ": %s: Device %u: Unknown FB format\n", __FUNCTION__, uiFBDevID);
omaplfb_displayclass.c:1526: printk(KERN_INFO DRIVER_PREFIX ": %s: Device %u: Unknown FB format\n", __FUNCTION__, uiFBDevID);
omaplfb_displayclass.c:1531: printk(KERN_INFO DRIVER_PREFIX ": %s: Device %u: Unknown FB format\n", __FUNCTION__, uiFBDevID);
Binary file omaplfb_displayclass.o matches
Binary file omaplfb.ko matches
Binary file omaplfb.o matches
代码中是对bits_per_pixel进行检测,只支持16位色和32位色。
目前的配置为24位色,所以修改设备树中bpp为32,如下:
panel {
compatible = "ti,tilcdc,panel";
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&lcd_pins_default>;
panel-info {
ac-bias = <255>;
ac-bias-intrpt = <0>;
dma-burst-sz = <16>;
bpp = <32>;
fdd = <0x80>;
sync-edge = <0>;
sync-ctrl = <1>;
raster-order = <0>;
fifo-th = <0>;
};
同时修改驱动文件drivers/video/da8xx-fb.c
中的bpp配置
long@ubuntu:/work/am335x/tisdk-7/linux-3.12.10$ git diff drivers/video/da8xx-fb.c
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 47c29f9..4fdf294 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1515,7 +1515,7 @@ static struct lcd_ctrl_config *da8xx_fb_create_cfg(struct platform_device *dev)
else
cfg->bpp = 32;
#endif
- cfg->bpp = 24;
+ cfg->bpp = 32;
/*
* For panels so far used with this LCDC, below statement is sufficient.
* For new panels, if required, struct lcd_ctrl_cfg fields to be updated
执行脚本正常加载PowerVR服务,然后运行OGLES2Chameleon
测试程序。