svga: fix ordering of mksstats counter strings
[mesa.git] / src / gallium / drivers / svga / svga_screen_cache.h
index 62156e3f522a16659bb6f53aca908bf51a906522..9365f751f72c634adda37f676c07333ff02ab19d 100644 (file)
@@ -1,3 +1,4 @@
+
 /**********************************************************
  * Copyright 2008-2009 VMware, Inc.  All rights reserved.
  *
 
 #include "os/os_thread.h"
 
-#include "util/u_double_list.h"
+#include "util/list.h"
 
 
 /* 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:
  */
@@ -61,9 +62,12 @@ struct svga_host_surface_cache_key
    SVGA3dSurfaceFlags flags;
    SVGA3dSurfaceFormat format;
    SVGA3dSize size;
-   uint32_t numFaces:24;
-   uint32_t numMipLevels:7;
+   uint32_t numFaces:3;
+   uint32_t arraySize:16;
+   uint32_t numMipLevels:6;
    uint32_t cachable:1;         /* False if this is a shared surface */
+   uint32_t sampleCount:5;
+   uint32_t scanout:1;
 };
 
 
@@ -89,14 +93,15 @@ 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
+ * 3. holding a buffer in an invalidate list
+ * 4. holding a flushed buffer (not in any validate list) with an active fence
+ * 5. 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 from 3/4.
+ * An entry progresses from 1 -> 2 -> 3 -> 4 -> 5. When we need an entry to put a 
+ * buffer into we preferentially take from 1, or from the least recently used 
+ * buffer from 4/5.
  */
 struct svga_host_surface_cache 
 {
@@ -109,14 +114,20 @@ struct svga_host_surface_cache
     * (3 and 4) */
    struct list_head unused;
    
-   /* Entries with buffers still in validate lists (2) */
+   /* Entries with buffers still in validate list (2) */
    struct list_head validated;
    
+   /* Entries with buffers still in invalidate list (3) */
+   struct list_head invalidated;
+   
    /** Empty entries (1) */
    struct list_head empty;
 
    /** 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;
 };
 
 
@@ -133,6 +144,7 @@ svga_screen_cache_init(struct svga_screen *svgascreen);
 
 struct svga_winsys_surface *
 svga_screen_surface_create(struct svga_screen *svgascreen,
+                           unsigned bind_flags, enum pipe_resource_usage usage,
                            struct svga_host_surface_cache_key *key);
 
 void
@@ -140,5 +152,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_ */