转载 am3354 SGX移植

am3354 SGX移植

什么是SGX

官方手册上说明TI am3354使用POWERVR SGX530图形核心,加速2D/3D图形应用。那么如果要使用3D加速,就必须基于SGX技术,使用视频加速需要Opengl ES2.0,需要调用SGX驱动。

而SGX core并没有包含在ARM core中,但是它的Graphics drivers需要跑在ARM核上,Graphics drivers中含有OS specific driver,它能够将SGX core做内存映射,因此可在ARM core上对图形引擎SGX编程。

  • 首先,移植Qt需要指定它的platform,也就是eglfsdirectfblinuxfb等等;
  • 其次,安装eglfs需要OpenGL图形库;
  • 最后,OpenGL会调用SGX,驱动delicated hardware

linux主线代码中并没有SGX Driver,这部分代码并未开源,而TI提供的Linux SDK添加了这部分代码。

编译SDK

首先从官方获Graphics SDK

http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/latest/index_FDS.html

在编译Graphics SDK前,需要保证内核符号表是新的,因为Graphics SDK需要调用内核符号表。

执行安装Graphics_SDK_setuplinux_hardfp_5_01_01_02.bin

$ ./Graphics_SDK_setuplinux_hardfp_5_01_01_02.bin
This will install Graphics SDK on your computer.  Continue? [n/Y]    y
Type 'y' if you agree to the license agreement [y/N]  y
Where do you want to install Graphics SDK? [/home/long/Graphics_SDK_5_01_01_02] 
 
    • 修改默认Rules.make文件
    HOME=$(SDK_INSTALL_DIR)/graphics
    
    # Set Toolchain path (ex /home/user/toolchain/arago-2011.09/armv7a)
    CSTOOL_DIR=$(LINUX_DEVKIT_PATH)
    
    # Set Tool chain prefix (ex arm-arago-linux-gnueabi- )
    CSTOOL_PREFIX=`basename $CROSS_COMPILE`
    
    # Set kernel installation path ( ex /home/user/linux-04.00.01.13 )
    KERNEL_INSTALL_DIR=$(LINUXKERNEL_INSTALL_DIR)
    
    # Set Target filesystem path ( ex /home/user/targetfs )
    TARGETFS_INSTALL_DIR=$(DESTDIR)
    
    # Set installation folder
    GRAPHICS_INSTALL_DIR=$(HOME)/Graphics_SDK_5_01_01_02
     

      修改为

      HOME=/home/long
      
      # Set Toolchain path (ex /home/user/toolchain/arago-2011.09/armv7a)
      CSTOOL_DIR=/work/am335x/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux
      
      # Set Tool chain prefix (ex arm-arago-linux-gnueabi- )
      CSTOOL_PREFIX=arm-linux-gnueabihf-
      
      # Set kernel installation path ( ex /home/user/linux-04.00.01.13 )
      KERNEL_INSTALL_DIR=/work/am335x/tisdk-7/am335x-linux-3.12.10
      
      # Set Target filesystem path ( ex /home/user/targetfs )
      TARGETFS_INSTALL_DIR=/work/am335x/tisdk-7/rootfs
      
      # Set installation folder
      GRAPHICS_INSTALL_DIR=$(HOME)/Graphics_SDK_5_01_01_02
       
        • 执行编译
        $ make help
        Usage (for build): make BUILD={debug | release} OMAPES={ 5.x | 8.x | 9.x} FBDEV={yes | no} all
              Platform                       OMAPES
              --------                    ------
              OMAP37x/AM37x(SGX core 1.2.5)                5.x
              335x(SGX core 1.2.5 )                      8.x
              43xx(SGX core 1.2.5 )                      9.x
        --> Specifying OMAPES is mandatory. BUILD=release and FBDEV=yes by default
        Usage (for install): make BUILD=(debug | release} OMAPES={ 5.x | 8.x | 9.x} install
        --> See online Graphics Getting Started Guide for further details.
         

          执行编译命令 make BUILD=release OMAPES=8.x SUPPORT_XORG=0 FBDEV=yes all

          $ make BUILD=release OMAPES=8.x SUPPORT_XORG=0 FBDEV=yes all
          ...
          $ find -name *.ko
          ./gfx_dbg_es8.x/bufferclass_ti.ko
          ./gfx_dbg_es8.x/omaplfb.ko
          ./gfx_dbg_es8.x/pvrsrvkm.ko
          ./GFX_Linux_KM/pvrsrvkm.ko
          ./GFX_Linux_KM/services4/3rdparty/dc_ti335x_linux/omaplfb.ko
          ./GFX_Linux_KM/services4/3rdparty/bufferclass_ti/bufferclass_ti.ko
          ./gfx_dbg_es9.x/bufferclass_ti.ko
          ./gfx_dbg_es9.x/omaplfb.ko
          ./gfx_dbg_es9.x/pvrsrvkm.ko
          ./gfx_rel_es8.x/bufferclass_ti.ko
          ./gfx_rel_es8.x/omaplfb.ko
          ./gfx_rel_es8.x/pvrsrvkm.ko
          ./gfx_rel_es9.x/bufferclass_ti.ko
          ./gfx_rel_es9.x/omaplfb.ko
          ./gfx_rel_es9.x/pvrsrvkm.ko
           

            编译生成omaplfb.kopvrsrvkm.kobufferclass_ti.ko三个模块文件,其中omaplfs负责和framebuffer的接口,pvrsrvkm负责和用户层服务的接口,bufferclass_ti负责使用proprietary extension,它允许streaming playback through SGX。

            • 安装make OMAPES=8.x install,安装模块到指定TARGETFS_INSTALL_DIR目录
            $ make OMAPES=8.x install
            exporting necessary variables and installing...
            ########################################################
            Please ensure that PSP Linux kernel is re-built atleast once,
            Please refer online guide for further details.
            ########################################################
            creating directories...
            copying startup files...
            copying user space graphics libraries to target file system...
            copying install information to target file system...
            copying graphics SDK demos to target file system...
            
            $ find -name *.ko
            ./opt/gfxlibraries/gfx_rel_es8.x/bufferclass_ti.ko
            ./opt/gfxlibraries/gfx_rel_es8.x/omaplfb.ko
            ./opt/gfxlibraries/gfx_rel_es8.x/pvrsrvkm.ko
             
              • 编译安装内核相关模块
              $ make modules
              $ make modules_install INSTALL_MOD_PATH=/work/am335x/tisdk-7/rootfs
               
                • 修改./lib/modules/3.12.10/modules.dep文件,结尾添加
                extra/omaplfb.ko:
                extra/pvrsrvkm.ko:
                 

                  测试验证

                  • 安装驱动模块
                  # modprobe pvrsrvkm.ko
                  # modprobe omaplfb.ko
                  # lsmod
                  Module                  Size  Used by    Tainted: G
                  omaplfb                11188  0
                  pvrsrvkm              173366  1 omaplfb
                  
                  
                   
                  • 运行测试demo
                  # cd /opt/gfxsdkdemos/
                  # ls
                  335x-demo           gfxinstallinfo.txt  ogles2
                  devmem2             ogles               rc.pvr
                  # ./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/extra/pvrsrvkm.ko
                  kernel module omaplfb.ko -> /lib/modules/3.12.10/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.
                  
                  
                  

                  测试程序可以正常运行,基本完成了这方面的移植。

                  已标记关键词 清除标记
                  相关推荐
                  ©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页