12/10/2016

HDMI 및 VPSS 설정

1. HDMI 와 VPSS 설정

아래설정은 기본적으로 DM8148로 SDK기준으로 작성했기때문에, TI BSP에 따라
달라질수 있겠다.
  • HDMI (DM816x AM389x DM814x AM387x)
  1. HDMI Kernel 설정 및  모듈
  2. sysfs 설정방법
  http://processors.wiki.ti.com/index.php/TI81XX_PSP_HDMI_Driver_User_Guide

  • VPSS (HDVPSS) (DM814X AM387X)  관련사항 설정
  HDVPSS의 경우 VIDEO IN/OUT을 담당해주는 Device로 현재 두개까지 지원이 가능하다.
  만약 Display0 or 1 ( VOUTx) 변경하고 싶다면, 아래와 같이 sysfs을 이용하여, 변경해주자.
  sysfs : display0
  아래와 같이 shell program을 수정을하여, LCD or HDMI Mode로 수정을 하자.

$ vi dm8148/targetfs/etc/rc5.d/S01load-hd-firmware.sh
#!/bin/sh
#
# manage HDVICP2 and HDVPSS Engine firmware

PATH=$PATH:/usr/share/ti/ti-media-controller-utils
HDVICP2_ID=1
HDVPSS_ID=2

configure_lcd()
{
    echo "Configuring fb0 to LCD"
    echo 1:dvo2 > /sys/devices/platform/vpss/graphics0/nodes
    echo 0 > /sys/devices/platform/vpss/display1/enabled
    echo 33500,800/164/89/10,480/10/23/10,1 > /sys/devices/platform/vpss/display1/timings
    echo triplediscrete,rgb888 > /sys/devices/platform/vpss/display1/output
    echo 1 > /sys/devices/platform/vpss/display1/enabled
    fbset -xres 800 -yres 480 -vxres 800 -vyres 480
}


case "$1" in
    start)
        echo "Loading HDVICP2 Firmware" 
        prcm_config_app s
        depmod -a
        modprobe syslink
        until [[ -e /dev/syslinkipc_ProcMgr && -e /dev/syslinkipc_ClientNotifyMgr ]]
        do
            sleep 0.5
        done
        firmware_loader $HDVICP2_ID /usr/share/ti/ti-media-controller-utils/dm814x_hdvicp.xem3 start
        echo "Loading HDVPSS Firmware"
        firmware_loader $HDVPSS_ID /usr/share/ti/ti-media-controller-utils/dm814x_hdvpss.xem3 start
        modprobe vpss sbufaddr=0xBFB00000 mode=hdmi:1080p-60 i2c_mode=1
        #modprobe vpss sbufaddr=0xBFB00000 mode=hdmi:720p-60 i2c_mode=1
        modprobe ti81xxfb vram=0:24M,1:16M,2:6M
        modprobe ti81xxhdmi
        modprobe tlc59108
      ;;
    stop)
        echo "Unloading HDVICP2 Firmware"
        firmware_loader $HDVICP2_ID /usr/share/ti/ti-media-controller-utils/dm814x_hdvicp.xem3 stop
        echo "Unloading HDVPSS Firmware"
        rmmod tlc59108
        rmmod ti81xxhdmi
        rmmod ti81xxfb
        rmmod vpss
        firmware_loader $HDVPSS_ID /usr/share/ti/ti-media-controller-utils/dm814x_hdvpss.xem3 stop
        rm /tmp/firmware.$HDVPSS_ID
        rmmod syslink
      ;;
    *)
        echo "Usage: /etc/init.d/load-hd-firmware.sh {start|stop}"
        exit 1
        ;;
esac

exit 0


  • 실제 수정 및 TEST
아래와 같이 HDVICP와 HDVPSS의 Firmware도 변경이 가능하며, HDMI 설정가능

$ cd etc/rc5.d
$ vi S01load-hd-firmware.sh

PATH=$PATH:/usr/share/ti/ti-media-controller-utils                              
HDVICP2_ID=1                                                                    
HDVPSS_ID=2 
....

case "$1" in                                                                    
   
    start)
 depmod -a
        echo "Loading HDVICP2 Firmware"
        prcm_config_app s
        depmod -a 
        modprobe syslink
        until [[ -e /dev/syslinkipc_ProcMgr && -e /dev/syslinkipc_ClientNotifyMgr ]]
        do                                                
            sleep 0.5
        done
        #firmware_loader $HDVICP2_ID /usr/share/ti/ti-media-controller-utils/dm814x_hdvicp.xem3 start
        firmware_loader $HDVICP2_ID /usr/share/ti/ti-media-controller-utils/dm814xbm_m3video_whole_program_debug.xem3 start
        echo "Loading HDVPSS Firmware"
        #firmware_loader $HDVPSS_ID /usr/share/ti/ti-media-controller-utils/dm814x_hdvpss.xem3 start
        firmware_loader $HDVPSS_ID /usr/share/ti/ti-media-controller-utils/dm814xbm_m3vpss_whole_program_debug.xem3 start
        #modprobe vpss sbufaddr=0xBFB00000 mode=hdmi:1080p-60 i2c_mode=1
        modprobe vpss sbufaddr=0xBFB00000 mode=hdmi:720p-60 i2c_mode=1
        modprobe ti81xxfb vram=0:24M,1:16M,2:6M
        modprobe ti81xxhdmi
      ;;
    stop)
        ....
    *)
        echo "Usage: /etc/init.d/load-hd-firmware.sh {start|stop}"
        exit 1
        ;;
esac


$ ls
S01load-hd-firmware.sh  S10telnetd              S99rmnologin
S02dbus-1               S20syslog
S10dropbear             S99gplv3-notice

/etc/rc5.d# ls -al
drwxr-sr-x    2 root     root          672 Dec 30  2015 .
drwxr-sr-x   35 root     root         5504 Dec 30  2015 ..
lrwxrwxrwx    1 root     root           29 Dec 31 05:23 S01load-hd-firmware.sh -> ../init.d/load-hd-firmware.sh
lrwxrwxrwx    1 root     root           16 Dec 30  2015 S02dbus-1 -> ../init.d/dbus-1
lrwxrwxrwx    1 root     root           18 Dec 31 05:23 S10dropbear -> ../init.d/dropbear
lrwxrwxrwx    1 root     root           17 Dec 31 05:22 S10telnetd -> ../init.d/telnetd
lrwxrwxrwx    1 root     root           16 Dec 31 05:23 S20syslog -> ../init.d/syslog
lrwxrwxrwx    1 root     root           22 Dec 31 05:22 S99gplv3-notice -> ../init.d/gplv3-notice
lrwxrwxrwx    1 root     root           19 Dec 31 05:22 S99rmnologin -> ../init.d/rmnologin


~/dm8148/targetfs/etc/rc5.d$ ll
합계 8
drwxr-sr-x  2 jhlee jhlee 4096 12월 15 16:27 ./
drwxr-sr-x 35 jhlee jhlee 4096 12월 15 14:47 ../
lrwxrwxrwx  1 jhlee jhlee   29 12월 31  2012 S01load-hd-firmware.sh -> ../init.d/load-hd-firmware.sh*
lrwxrwxrwx  1 root  jhlee   16 12월 13 14:42 S02dbus-1 -> ../init.d/dbus-1*
lrwxrwxrwx  1 jhlee jhlee   18 12월 31  2012 S10dropbear -> ../init.d/dropbear*
lrwxrwxrwx  1 jhlee jhlee   17 12월 31  2012 S10telnetd -> ../init.d/telnetd*
lrwxrwxrwx  1 jhlee jhlee   17 12월 31  2012 S20netperf -> ../init.d/netperf*
lrwxrwxrwx  1 jhlee jhlee   16 12월 31  2012 S20syslog -> ../init.d/syslog*
lrwxrwxrwx  1 jhlee jhlee   16 12월 31  2012 S20thttpd -> ../init.d/thttpd*
lrwxrwxrwx  1 jhlee jhlee   18 12월 31  2012 S30pvr-init -> ../init.d/pvr-init*
lrwxrwxrwx  1 jhlee jhlee   22 12월 31  2012 S99gplv3-notice -> ../init.d/gplv3-notice*
lrwxrwxrwx  1 jhlee jhlee   22 12월 31  2012 S99matrix-gui-e -> ../init.d/matrix-gui-e*
lrwxrwxrwx  1 jhlee jhlee   19 12월 31  2012 S99rmnologin -> ../init.d/rmnologin*

  • VPSS 설정방법
Video in/out 설정방법

  http://processors.wiki.ti.com/index.php/DM814X_AM387X_VPSS_Video_Driver_User_Guide_PSP_04.01.00.05#SYSFS_Software_Interfaces

  • VPSS와 VICP Firmware
VPSS와 VICP는 OS즉, BIOS6으로 기반으로한 Firmware를 사용한다.
다만, TI DSP가 C6xx 이 아닌 ARM의 Cortex-M3을 사용하여 TI용으로 별도로 Build 한 다음 Linux Booting 후에 이부분을 Loading 하는 방식으로 동작이 된다.

  http://processors.wiki.ti.com/index.php/EZSDK_Reducing_Size_Of_Media_Controller_Firmware
  • HDMI EDID 분석 
Device에서 아래와 같이 EDID를 분석을 하여 영상의 정보를 확인하자.

$ cat /sys/devices/platform/vpss/display0/edid

  https://en.wikipedia.org/wiki/Extended_Display_Identification_Data#Enhanced_EDID_.28E-EDID.29

  • HDMI 기본 VIDEO TEST 
아래 프로그램을 이용하여 frame buffer를 TEST 해보자.
이제 제대로 설정이 되었다면, /dev/fb0, /dev/fb1 /dev/fb2 test

/home/root/dm814x-evm/usr/share/ti/ti-psp-examples/saFbdevDisplayPan를 이용하여 TEST


$ cd ~/dm8148/targetfs   // device targetfs 이동 
$ cd home/root/dm814x-evm/usr/share/ti/ti-psp-examples
$ ls
ReadMe        minimal_capture   saFbdevDisplay     saFbdevHdmiDisplay    saFbdevScalingDisplay  saLoopBackFbdev  saMmapDisplay     saWatchdog
edma_test.ko  minimal_playback  saFbdevDisplayPan  saFbdevMovingDisplay  saLoopBack             saLoopBackScale  saUserptrDisplay

나머지 기능을 프로그램을 이용하여 다양한 TEST도 해보자.


2. DM8167 관련 경우

RDK 관련사항 수정

$ vi ./dvr_rdk/mcfw/src_linux/mcfw_api/ti_vdis.c
....
                enableConfigExtVideoEncoder = TRUE;
....