OK, I actually looked at the definition of DRILock/DRIUnlock
(programs/Xserver/GL/dri/dri.c), and it does reference counting, so
locking twice might not be an issue, it just increments the reference
count. What I haven't found yet is where the DRM_LOCK/DRM_UNLOCK macros
used in DRILock/DRIUnlock are defined, and I'm not sure how contention is
handled either. So I'm going to try and get a better idea of how the
locking is actually implemented, and hopefully I know what I'm talking
about next time.