1*61046927SAndroid Build Coastguard Worker# DRM shim - Fake GEM kernel drivers in userspace for CI 2*61046927SAndroid Build Coastguard Worker 3*61046927SAndroid Build Coastguard WorkerOn CI systems where we don't control the kernel, it would be nice to 4*61046927SAndroid Build Coastguard Workerbe able to present either no-op GEM devices (for shader-db runs) or 5*61046927SAndroid Build Coastguard Workersimulator-backed GEM devices (for testing against a software simulator 6*61046927SAndroid Build Coastguard Workeror FPGA). This lets us do that by intercepting libc calls and 7*61046927SAndroid Build Coastguard Workerexposing render nodes. 8*61046927SAndroid Build Coastguard Worker 9*61046927SAndroid Build Coastguard Worker## Limitations 10*61046927SAndroid Build Coastguard Worker 11*61046927SAndroid Build Coastguard Worker- Doesn't know how to handle DRM fds getting passed over the wire from 12*61046927SAndroid Build Coastguard Worker X11 (Could we use kmsro to support the X11 case?). 13*61046927SAndroid Build Coastguard Worker- libc interception is rather glibc-specific and fragile. 14*61046927SAndroid Build Coastguard Worker- Can easily break gdb if the libc interceptor code is what's broken. 15*61046927SAndroid Build Coastguard Worker (ulimit -c unlimited and doing gdb on the core after the fact can 16*61046927SAndroid Build Coastguard Worker help) 17*61046927SAndroid Build Coastguard Worker 18*61046927SAndroid Build Coastguard Worker## Using 19*61046927SAndroid Build Coastguard Worker 20*61046927SAndroid Build Coastguard WorkerYou choose the backend by setting `LD_PRELOAD` to the shim you want. 21*61046927SAndroid Build Coastguard WorkerSince this will effectively fake another DRM device to your system, 22*61046927SAndroid Build Coastguard Workeryou may need some work on your userspace to get your test application 23*61046927SAndroid Build Coastguard Workerto use it if it's not the only DRM device present. Setting 24*61046927SAndroid Build Coastguard Worker`DRM_SHIM_DEBUG=1` in the environment will print out what path the 25*61046927SAndroid Build Coastguard Workershim initialized on. 26*61046927SAndroid Build Coastguard Worker 27*61046927SAndroid Build Coastguard WorkerFor piglit tests, you can set: 28*61046927SAndroid Build Coastguard Worker 29*61046927SAndroid Build Coastguard Worker``` 30*61046927SAndroid Build Coastguard WorkerPIGLIT_PLATFORM=gbm 31*61046927SAndroid Build Coastguard WorkerWAFFLE_GBM_DEVICE=<path from DRM_SHIM_DEBUG> 32*61046927SAndroid Build Coastguard Worker``` 33*61046927SAndroid Build Coastguard Worker 34*61046927SAndroid Build Coastguard WorkerSee your drm-shim backend's README for details on how to use it. 35