Added few more stubs so that control reaches to DestroyDevice().
[mesa.git] / src / intel / tools / intel_stub_gpu.in
1 #!/bin/bash
2 # -*- mode: sh -*-
3
4 function show_help() {
5 cat <<EOF
6 Usage: intel_stub_gpu [OPTION]... [--] COMMAND ARGUMENTS
7
8 Run COMMAND with ARGUMENTS faking a particular device.
9
10 -g, --gdb Launch GDB
11
12 -p, --platform=NAME Override PCI ID using a platform name
13
14 --help Display this help message and exit
15
16 EOF
17
18 exit 0
19 }
20
21 gdb=""
22 platform="skl"
23
24 while true; do
25 case "$1" in
26 --gdb)
27 gdb=1
28 shift
29 ;;
30 -g)
31 gdb=1
32 shift
33 ;;
34 -p)
35 platform=$2
36 shift 2
37 ;;
38 -p*)
39 platform=${1##-p}
40 shift
41 ;;
42 --platform=*)
43 platform=${1##-p}
44 shift
45 ;;
46 --help)
47 show_help
48 ;;
49 --)
50 shift
51 break
52 ;;
53 -*)
54 echo "intel_stub_gpu: invalid option: $1"
55 echo
56 show_help
57 ;;
58 *)
59 break
60 ;;
61 esac
62 done
63
64 [ -z $1 ] && show_help
65
66 INTEL_STUB_GPU_PLATFORM=$platform
67
68 ld_preload="@install_libdir@/libintel_noop_drm_shim.so${LD_PRELOAD:+:$LD_PRELOAD}"
69 if [ -z $gdb ]; then
70 LD_PRELOAD=$ld_preload INTEL_STUB_GPU_PLATFORM=$platform exec "$@"
71 else
72 gdb -iex "set exec-wrapper env LD_PRELOAD=$ld_preload INTEL_STUB_GPU_PLATFORM=$platform" --args "$@"
73 fi