gallium: add support for LODQ opcodes.
[mesa.git] / src / gallium / drivers / svga / svga_screen_cache.h
index f5aa740d408c59839fb4cd1c76b2301eedbfc8ce..96e1e9c52e28496beb218c5ac797b9cf7e3fe991 100644 (file)
@@ -1,3 +1,4 @@
+
 /**********************************************************
  * Copyright 2008-2009 VMware, Inc.  All rights reserved.
  *
@@ -31,7 +32,7 @@
 #include "svga_reg.h"
 #include "svga3d_reg.h"
 
-#include "pipe/p_thread.h"
+#include "os/os_thread.h"
 
 #include "util/u_double_list.h"
 
@@ -39,7 +40,7 @@
 /* Guess the storage size of cached surfaces and try and keep it under
  * this amount:
  */ 
-#define SVGA_HOST_SURFACE_CACHE_BYTES 16*1024*1024
+#define SVGA_HOST_SURFACE_CACHE_BYTES (16 * 1024 * 1024)
 
 /* Maximum number of discrete surfaces in the cache:
  */
@@ -89,13 +90,13 @@ struct svga_host_surface_cache_entry
  * Cache of the host surfaces.
  * 
  * A cache entry can be in the following stages:
- * 1. empty
+ * 1. empty (entry->handle = NULL)
  * 2. holding a buffer in a validate list
  * 3. holding a flushed buffer (not in any validate list) with an active fence
  * 4. holding a flushed buffer with an expired fence
  * 
  * An entry progresses from 1 -> 2 -> 3 -> 4. When we need an entry to put a 
- * buffer into we preferencial take from 1, or from the least recentely used 
+ * buffer into we preferentially take from 1, or from the least recently used 
  * buffer from 3/4.
  */
 struct svga_host_surface_cache 
@@ -117,6 +118,9 @@ struct svga_host_surface_cache
 
    /** The actual storage for the entries */
    struct svga_host_surface_cache_entry entries[SVGA_HOST_SURFACE_CACHE_SIZE];
+
+   /** Sum of sizes of all surfaces (in bytes) */
+   unsigned total_size;
 };
 
 
@@ -140,5 +144,8 @@ svga_screen_surface_destroy(struct svga_screen *svgascreen,
                             const struct svga_host_surface_cache_key *key,
                             struct svga_winsys_surface **handle);
 
+void
+svga_screen_cache_dump(const struct svga_screen *svgascreen);
+
 
 #endif /* SVGA_SCREEN_CACHE_H_ */