17ec681f3Smrg# DRM shim - Fake GEM kernel drivers in userspace for CI
27ec681f3Smrg
37ec681f3SmrgOn CI systems where we don't control the kernel, it would be nice to
47ec681f3Smrgbe able to present either no-op GEM devices (for shader-db runs) or
57ec681f3Smrgsimulator-backed GEM devices (for testing against a software simulator
67ec681f3Smrgor FPGA).  This lets us do that by intercepting libc calls and
77ec681f3Smrgexposing render nodes.
87ec681f3Smrg
97ec681f3Smrg## Limitations
107ec681f3Smrg
117ec681f3Smrg- Doesn't know how to handle DRM fds getting passed over the wire from
127ec681f3Smrg  X11 (Could we use kmsro to support the X11 case?).
137ec681f3Smrg- libc interception is rather glibc-specific and fragile.
147ec681f3Smrg- Can easily break gdb if the libc interceptor code is what's broken.
157ec681f3Smrg  (ulimit -c unlimited and doing gdb on the core after the fact can
167ec681f3Smrg  help)
177ec681f3Smrg
187ec681f3Smrg## Using
197ec681f3Smrg
207ec681f3SmrgYou choose the backend by setting `LD_PRELOAD` to the shim you want.
217ec681f3SmrgSince this will effectively fake another DRM device to your system,
227ec681f3Smrgyou may need some work on your userspace to get your test application
237ec681f3Smrgto use it if it's not the only DRM device present.  Setting
247ec681f3Smrg`DRM_SHIM_DEBUG=1` in the environment will print out what path the
257ec681f3Smrgshim initialized on.
267ec681f3Smrg
277ec681f3SmrgFor piglit tests, you can set:
287ec681f3Smrg
297ec681f3Smrg```
307ec681f3SmrgPIGLIT_PLATFORM=gbm
317ec681f3SmrgWAFFLE_GBM_DEVICE=<path from DRM_SHIM_DEBUG>
327ec681f3Smrg```
337ec681f3Smrg
347ec681f3SmrgSee your drm-shim backend's README for details on how to use it.
35