libdrm/intel: support GTT maps correctly
authorJesse Barnes <jbarnes@virtuousgeek.org>
Thu, 26 Mar 2009 23:43:00 +0000 (16:43 -0700)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Thu, 26 Mar 2009 23:43:00 +0000 (16:43 -0700)
commite2d7dfb61ad7a97367f050150160c205614d152e
treeeb50b755d5c6b6d981984d19cf7a450a39cd7151
parentc9cfeaa5542e08381a8144d0a5bd96036a19082f
libdrm/intel: support GTT maps correctly

libdrm has some support for GTT mapping already, but there are bugs
with it (no surprise since it hasn't been used much).

In fixing 20803, I found that sharing bo_gem->virtual was a bad idea,
since a previously mapped object might not end up getting GTT mapped,
leading to corruption.  So this patch splits the fields according to
use, taking care to unmap both at free time (but preserving the map
caching).

There's still a risk we might run out of mappings (there's a sysctl
tunable for max number of mappings per process, defaulted to 64k or so
it looks like) but at least GTT maps will work with these changes (and
some others for fixing PAT breakage in the kernel).

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
libdrm/intel/intel_bufmgr.h
libdrm/intel/intel_bufmgr_gem.c