fc5999a86dfd214580cd25bc667c4621397e9c65
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / ti-gfx / S80ti-gfx
1 #!/bin/sh
2
3 start() {
4         echo "ti-gfx: starting pvr driver"
5
6         BITSPERPIXEL="$(fbset | awk '/geom/ {print $6}')"
7         YRES="$(fbset | awk '/geom/ {print $3}')"
8         # Set RGBA ordering to something the drivers like
9         if [ "$BITSPERPIXEL" = "32" ] ; then
10                 fbset -rgba 8/16,8/8,8/0,8/24
11         fi
12         # Try to enable triple buffering when there's enough VRAM
13         fbset -vyres $(( YRES*3 ))
14
15         modprobe pvrsrvkm
16         modprobe omaplfb
17         modprobe bufferclass_ti
18
19         pvr_maj=$(awk '$2=="pvrsrvkm" { print $1; }' /proc/devices)
20         rm -f /dev/pvrsrvkm
21
22         mknod /dev/pvrsrvkm c $pvr_maj 0
23         chmod 600 /dev/pvrsrvkm
24
25         if ! /usr/bin/pvrsrvctl --start --no-module; then
26                 echo "ti-gfx: unable to start server"
27         fi
28 }
29
30 stop() {
31         echo "ti-gfx: stopping pvr driver"
32
33         rmmod bufferclass_ti
34         rmmod omaplfb
35         rmmod pvrsrvkm
36 }
37
38 case "$1" in
39 start)
40         start
41 ;;
42 stop)
43         stop
44 ;;
45 restart)
46         stop
47         start
48 ;;
49 *)
50         echo "ti-gfx: Please use start, stop, or restart."
51         exit 1
52 ;;
53 esac