summaryrefslogtreecommitdiff
path: root/recipes/powervr-drivers/libgles-omap3/rc.pvr
blob: b0b9043b8218c2f69c50da50678ba160458aacb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh
PATH=$PATH:/usr/sbin

BITSPERPIXEL="$(fbset | grep geom | awk '{print $6}')"
YRES="$(fbset | grep geom | awk '{print $3}')"

CPUTYPE="$(cputype)"

if [ "$1" = "" ]; then
	echo PVR-INIT: Please use start, stop, or restart.
	exit 1
fi

if [ "$1" = "stop" -o  "$1" = "restart" ]; then
	echo Stopping PVR
	#rmmod bc_example
	rmmod omaplfb 2>/dev/null
	rmmod pvrsrvkm 2>/dev/null
fi

if [ "$1" = "stop" ]; then
	exit 0
fi

# Set RGBA ordering to something the drivers like
if [ "$BITSPERPIXEL" = "32" ] ; then
	fbset -rgba 8/16,8/8,8/0,8/24
fi

# Try to enable triple buffering when there's enough VRAM
fbset -vyres $(expr $YRES \* 3) 

if [ $CPUTYPE = "OMAP3530" ]; then
	echo Starting PVR
	insmod $(busybox find /lib/modules/$(uname -r) -name "pvrsrvkm.ko")
	#modprobe bc_example
	modprobe omaplfb
	modprobe bufferclass_ti

	pvr_maj=`grep "pvrsrvkm$" /proc/devices | cut -b1,2,3`
        bc_maj=`grep "bc" /proc/devices | cut -b1,2,3`

	if [ -e /dev/pvrsrvkm ] ; then 
		rm -f /dev/pvrsrvkm
	fi

	mknod /dev/pvrsrvkm c $pvr_maj 0 
	chmod 666 /dev/pvrsrvkm

	mknod /dev/bc_cat c $bc_maj 0
	chmod 666 /dev/bc_cat

	touch /etc/powervr-esrev

	SAVED_ESREVISION="$(cat /etc/powervr-esrev)"

	devmem2 0x48004B48 w 0x2 > /dev/null
	devmem2 0x48004B10 w 0x1 > /dev/null
	devmem2 0x48004B00 w 0x2 > /dev/null

	ES_REVISION="$(devmem2 0x50000014 | sed -e s:0x10205:5: -e s:0x10201:3: -e s:0x10003:2: | tail -n1 | awk -F': ' '{print $2}')"

	if [ "${ES_REVISION}" != "${SAVED_ESREVISION}" ] ; then
		echo -n "Starting SGX fixup for"
		echo " ES${ES_REVISION}.x"
		cp -a /usr/lib/ES${ES_REVISION}.0/* /usr/lib
		cp -a /usr/bin/ES${ES_REVISION}.0/* /usr/bin	
		echo "${ES_REVISION}" > /etc/powervr-esrev
	fi
	/usr/bin/pvrsrvinit
else
	echo No SGX hardware, not starting PVR
fi