r600/radeonsi: enable glsl/tgsi on-disk cache
[mesa.git] / src / gallium / drivers / radeon / r600_pipe_common.h
index 2c11551e03a81efd26e3e74cf8801635fe85a482..94cf0fcc055647f338eab0b3d85e8e47691142a3 100644 (file)
@@ -36,6 +36,7 @@
 
 #include "radeon/radeon_winsys.h"
 
+#include "util/disk_cache.h"
 #include "util/u_blitter.h"
 #include "util/list.h"
 #include "util/u_range.h"
@@ -49,6 +50,7 @@
 #define R600_RESOURCE_FLAG_FLUSHED_DEPTH       (PIPE_RESOURCE_FLAG_DRV_PRIV << 1)
 #define R600_RESOURCE_FLAG_FORCE_TILING                (PIPE_RESOURCE_FLAG_DRV_PRIV << 2)
 #define R600_RESOURCE_FLAG_DISABLE_DCC         (PIPE_RESOURCE_FLAG_DRV_PRIV << 3)
+#define R600_RESOURCE_FLAG_UNMAPPABLE          (PIPE_RESOURCE_FLAG_DRV_PRIV << 4)
 
 #define R600_CONTEXT_STREAMOUT_FLUSH           (1u << 0)
 /* Pipeline & streamout query controls. */
@@ -315,6 +317,7 @@ struct r600_surface {
        bool alphatest_bypass;
        bool export_16bpc;
        bool color_is_int8;
+       bool color_is_int10;
 
        /* Color registers. */
        unsigned cb_color_info;
@@ -352,27 +355,43 @@ struct r600_surface {
        unsigned db_preload_control;    /* EG and later */
 };
 
-struct r600_grbm_counter {
+struct r600_mmio_counter {
        unsigned busy;
        unsigned idle;
 };
 
-union r600_grbm_counters {
+union r600_mmio_counters {
        struct {
-               struct r600_grbm_counter spi;
-               struct r600_grbm_counter gui;
-               struct r600_grbm_counter ta;
-               struct r600_grbm_counter gds;
-               struct r600_grbm_counter vgt;
-               struct r600_grbm_counter ia;
-               struct r600_grbm_counter sx;
-               struct r600_grbm_counter wd;
-               struct r600_grbm_counter bci;
-               struct r600_grbm_counter sc;
-               struct r600_grbm_counter pa;
-               struct r600_grbm_counter db;
-               struct r600_grbm_counter cp;
-               struct r600_grbm_counter cb;
+               /* For global GPU load including SDMA. */
+               struct r600_mmio_counter gpu;
+
+               /* GRBM_STATUS */
+               struct r600_mmio_counter spi;
+               struct r600_mmio_counter gui;
+               struct r600_mmio_counter ta;
+               struct r600_mmio_counter gds;
+               struct r600_mmio_counter vgt;
+               struct r600_mmio_counter ia;
+               struct r600_mmio_counter sx;
+               struct r600_mmio_counter wd;
+               struct r600_mmio_counter bci;
+               struct r600_mmio_counter sc;
+               struct r600_mmio_counter pa;
+               struct r600_mmio_counter db;
+               struct r600_mmio_counter cp;
+               struct r600_mmio_counter cb;
+
+               /* SRBM_STATUS2 */
+               struct r600_mmio_counter sdma;
+
+               /* CP_STAT */
+               struct r600_mmio_counter pfp;
+               struct r600_mmio_counter meq;
+               struct r600_mmio_counter me;
+               struct r600_mmio_counter surf_sync;
+               struct r600_mmio_counter dma;
+               struct r600_mmio_counter scratch_ram;
+               struct r600_mmio_counter ce;
        } named;
        unsigned array[0];
 };
@@ -387,6 +406,8 @@ struct r600_common_screen {
        bool                            has_cp_dma;
        bool                            has_streamout;
 
+       struct disk_cache               *disk_shader_cache;
+
        struct slab_parent_pool         pool_transfers;
 
        /* Texture filter settings. */
@@ -410,7 +431,7 @@ struct r600_common_screen {
        /* GPU load thread. */
        pipe_mutex                      gpu_load_mutex;
        pipe_thread                     gpu_load_thread;
-       union r600_grbm_counters        grbm_counters;
+       union r600_mmio_counters        mmio_counters;
        volatile unsigned               gpu_load_stop_thread; /* bool */
 
        char                            renderer_string[100];
@@ -418,12 +439,14 @@ struct r600_common_screen {
        /* Performance counters. */
        struct r600_perfcounters        *perfcounters;
 
-       /* If pipe_screen wants to re-emit the framebuffer state of all
-        * contexts, it should atomically increment this. Each context will
-        * compare this with its own last known value of the counter before
-        * drawing and re-emit the framebuffer state accordingly.
+       /* If pipe_screen wants to recompute and re-emit the framebuffer,
+        * sampler, and image states of all contexts, it should atomically
+        * increment this.
+        *
+        * Each context will compare this with its own last known value of
+        * the counter before drawing and re-emit the states accordingly.
         */
-       unsigned                        dirty_fb_counter;
+       unsigned                        dirty_tex_counter;
 
        /* Atomically increment this counter when an existing texture's
         * metadata is enabled or disabled in a way that requires changing
@@ -431,12 +454,6 @@ struct r600_common_screen {
         */
        unsigned                        compressed_colortex_counter;
 
-       /* Atomically increment this counter when an existing texture's
-        * backing buffer or tile mode parameters have changed that requires
-        * recomputation of shader descriptors.
-        */
-       unsigned                        dirty_tex_descriptor_counter;
-
        struct {
                /* Context flags to set so that all writes from earlier jobs
                 * in the CP are seen by L2 clients.
@@ -555,11 +572,9 @@ struct r600_common_context {
        unsigned                        num_gfx_cs_flushes;
        unsigned                        initial_gfx_cs_size;
        unsigned                        gpu_reset_counter;
-       unsigned                        last_dirty_fb_counter;
+       unsigned                        last_dirty_tex_counter;
        unsigned                        last_compressed_colortex_counter;
-       unsigned                        last_dirty_tex_descriptor_counter;
 
-       struct u_upload_mgr             *uploader;
        struct u_suballocator           *allocator_zeroed_memory;
        struct slab_child_pool          pool_transfers;
 
@@ -708,7 +723,7 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
                                         const struct pipe_resource *templ,
                                         unsigned alignment);
 struct pipe_resource * r600_aligned_buffer_create(struct pipe_screen *screen,
-                                                 unsigned bind,
+                                                 unsigned flags,
                                                  unsigned usage,
                                                  unsigned size,
                                                  unsigned alignment);