svga: implement surface cache size limit
authorBrian Paul <brianp@vmware.com>
Wed, 7 Dec 2011 23:57:11 +0000 (16:57 -0700)
committerBrian Paul <brianp@vmware.com>
Thu, 23 Feb 2012 14:49:06 +0000 (07:49 -0700)
commit500e7c5860b4d6fdd39f70197511a746eb32910a
treefb96a9730a66df1da7eeaaa8ce48f23b3da1c410
parent32f669e7fc17ff89cf132b7d42c72de75625d32a
svga: implement surface cache size limit

There was a SVGA_HOST_SURFACE_CACHE_BYTES symbol, but it was never
used.

Now when we go to add a newly deleted surface to the cache we check
if the cache size would be exceeded.  If so, try to free the least
recently "unused" surfaces until the cache is smaller.  If we can't
do that, simply don't cache the newly deleted surface.  The alternative
involves flushing and waiting and we don't want to do that.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/gallium/drivers/svga/svga_screen_cache.c
src/gallium/drivers/svga/svga_screen_cache.h