mesa/src/drm-shim
Eric Anholt 75b1f3d39d drm-shim: Return -EINVAL instead of abort()ing on unknown ioctls.
I had this as abort() in my original implementation since I was doing
drm-shim and my kernel driver in parallel based around using a SW
simulator, and I wanted to always update both, but it means that people's
new feature detection code can easily end up breaing their drm-shim
shader-db runs (such as intel's kernel_has_dynamic_config_support()
checking for -ENOENT instead of -EINVAL for a feature, which showed up on
my personal runner but not fd.o's for reasons I'm unclear on).

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5994>
2020-07-30 19:59:20 +00:00
..
README.md
device.c drm-shim: Return -EINVAL instead of abort()ing on unknown ioctls. 2020-07-30 19:59:20 +00:00
drm_shim.c drm-shim: silence warnings 2020-04-30 11:32:54 +03:00
drm_shim.h drm-shim: don't create a memfd per BO 2020-04-30 11:32:54 +03:00
meson.build meson: use gnu_symbol_visibility argument 2020-06-01 18:59:18 +00:00

README.md

DRM shim - Fake GEM kernel drivers in userspace for CI

On CI systems where we don't control the kernel, it would be nice to be able to present either no-op GEM devices (for shader-db runs) or simulator-backed GEM devices (for testing against a software simulator or FPGA). This lets us do that by intercepting libc calls and exposing render nodes.

Limitations

  • Doesn't know how to handle DRM fds getting passed over the wire from X11 (Could we use kmsro to support the X11 case?).
  • libc interception is rather glibc-specific and fragile.
  • Can easily break gdb if the libc interceptor code is what's broken. (ulimit -c unlimited and doing gdb on the core after the fact can help)

Using

You choose the backend by setting LD_PRELOAD to the shim you want. Since this will effectively fake another DRM device to your system, you may need some work on your userspace to get your test application to use it if it's not the only DRM device present. Setting DRM_SHIM_DEBUG=1 in the environment will print out what path the shim initialized on.

For piglit tests, you can set:

PIGLIT_PLATFORM=gbm
WAFFLE_GBM_DEVICE=<path from DRM_SHIM_DEBUG>

See your drm-shim backend's README for details on how to use it.