mesa/src/intel/tools/intel_stub_gpu.in
Lionel Landwerlin 0f4f1d70bf intel: add stub_gpu tool
Run shaderdb like this :

   intel_stub_gpu -p bxt ./run ./shaders/*

List of platform names is available from
gen_device_name_to_pci_device_id() (src/intel/dev/gen_device_info.c).

v2: Add missing getparam support
    Raise max soft limit of file descriptors

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4594>
2020-04-30 11:32:54 +03:00

73 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
# -*- mode: sh -*-
function show_help() {
cat <<EOF
Usage: intel_stub_gpu [OPTION]... [--] COMMAND ARGUMENTS
Run COMMAND with ARGUMENTS faking a particular device.
-g, --gdb Launch GDB
-p, --platform=NAME Override PCI ID using a platform name
--help Display this help message and exit
EOF
exit 0
}
gdb=""
platform="skl"
while true; do
case "$1" in
--gdb)
gdb=1
shift
;;
-g)
gdb=1
shift
;;
-p)
platform=$2
shift 2
;;
-p*)
platform=${1##-p}
shift
;;
--platform=*)
platform=${1##-p}
shift
;;
--help)
show_help
;;
--)
shift
break
;;
-*)
echo "intel_stub_gpu: invalid option: $1"
echo
show_help
;;
*)
break
;;
esac
done
[ -z $1 ] && show_help
INTEL_STUB_GPU_PLATFORM=$platform
ld_preload="@install_libdir@/libintel_noop_drm_shim.so${LD_PRELOAD:+:$LD_PRELOAD}"
if [ -z $gdb ]; then
LD_PRELOAD=$ld_preload INTEL_STUB_GPU_PLATFORM=$platform exec "$@"
else
gdb -iex "set exec-wrapper env LD_PRELOAD=$ld_preload INTEL_STUB_GPU_PLATFORM=$platform" --args "$@"
fi