PSEUDO-DIRECT RENDERING
-----------------------

Recently some code was added to allow a limited form of direct
rendering with the MGA driver under the 3.3 x servers.  This is not to
be confused with the forthcoming, fully featured, direct rendering
infrastructure under XFree4.0.

Direct rendering cuts out the 'middle man' X server on the main
pathway, allowing the client to talk directly to the hardware.  The
major benefit of this is that vertex data need no longer be encoded
and decoded via GLX, and need no longer be passed through a Unix
socket to the X server.  On single cpu machines, you also gain by not
having to context switch between X server and client.  Further, it is
very easy to support extensions such as CVA on direct rendering, as
you don't have to come up with a network protocol to encode the new
information.

To do this properly, with multiple independent clients talking
directly to hardware, is a major undertaking and is addressed in
Precision Insight's DRI which is a component of the XFree 4.0 servers.
This document does not describe PI's DRI.

This document does describe the a quick and dirty direct rendering
hack which imposes strong restrictions on the number and types of
clients in order to acheive a good and useful speed up with minimal
engineering effort.

The main restrictions are:

    - there can be only one direct rendering client.

    - if there is a direct rendering client, no indirect rendering is
      allowed, either.

    - the direct rendering client must be run as root, or suid root
      [this may eventually be lifted].

    - You need to have DMA enabled. See glx.conf for more information.

If you have used Mesa rendering to a Voodoo 1 or 2 card, this should
be a fairly familiar set of rules.  True, the 3dfx kernel module lifts
the third restriction, and kernel mechanisms could be used to lift the
restriction for the mga as well.

The big improvement over Mesa/FX is that the rendering is to a window,
and that the X server remains fully functional and actually quite
responsive even during heavy rendering.


IF IT CRASHES YOUR MACHINE
--------------------------

The direct rendering code is still experimental, and you can disable it
by setting the environment variable GLX_NO_DIRECT

In bash:
# export GLX_NO_DIRECT=t

In tcsh:
# setenv GLX_NO_DIRECT


SECURITY ISSUES
---------------

In theory, this should be secure. Since only root is allowed to use direct
rendering only a trusted user can access the card directly. However, avoiding
running things as root unless it is absolutely necessary is a basis for good
security. You need to weigh your security considerations against your desire
to get many frames per second in your favourite game.



DOES IT WORK WITH QUAKE 3 ?
---------------------------

What would be the point if it didn't?

The latest version of Quake 3 should work without any problems.
Earlier versions won't work with direct rendering unless you set
LD_PRELOAD=libGL.so


Keith Whitwell
August 1999

(Updated by Andreas Ehliar, January 2000)

