Replying to this old message thread to share my findings.
I had the same need, because I want to run a HTPC setup on the same computer as I use to experiment with virtual machines.
My plan was to export /dev/dri/card0 and /dev/dri/controlD64 to the VE, and then convince DRI to use it.
First trouble was this error message from glxinfo:
X Error of failed request: BadRequest (invalid request code or no such operation)
Major opcode of failed request: 136 (DRI2)
Minor opcode of failed request: 1 ()
Serial number of failed request: 16
Current serial number in output stream: 16
I traced it to this check in xorg/hw/xfree86/dri2/dri2ext.c:
if (!LocalClient(client))
return BadRequest;
Bypassing this got me a little further, but only to discover that the /dev/dri/card0 does not work in VE, even though I've set the permissions using vzctl. The other device works, though:
jpa-adm@clefairy:~$ cat /dev/dri/card0
cat: /dev/dri/card0: No such device
jpa-adm@clefairy:~$ cat /dev/dri/controlD64
^C
I guess there is some limitation in either the DRI driver or OpenVZ that stops me from sharing the device. But even if I could, I fear that some shared memory issues might make DRI from VE impossible.
In conclusion, I think it is better to run the desktop system in a chroot on the HN, even if it is not as secure.
--
jpa