r600g: fixup for MSAA texture support checking
[mesa.git] / src / gallium / drivers / r600 / r600_pipe.h
index 366e866d4edc480b870bab5e863bc9a40caefa29..2a81434155e189ca93f281eed3f7540d7d16273b 100644 (file)
@@ -35,9 +35,7 @@
 #include "r600_public.h"
 #include "r600_resource.h"
 
-#define R600_NUM_ATOMS 40
-
-#define R600_TRACE_CS 0
+#define R600_NUM_ATOMS 41
 
 /* the number of CS dwords for flushing and drawing */
 #define R600_MAX_FLUSH_CS_DWORDS       16
@@ -218,22 +216,6 @@ struct r600_pipe_fences {
        pipe_mutex                      mutex;
 };
 
-enum r600_msaa_texture_mode {
-       /* If the hw can fetch the first sample only (no decompression available).
-        * This means MSAA texturing is not fully implemented. */
-       MSAA_TEXTURE_SAMPLE_ZERO,
-
-       /* If the hw can fetch decompressed MSAA textures.
-        * Supported families: R600, R700, Evergreen.
-        * Cayman cannot use this, because it cannot do the decompression. */
-       MSAA_TEXTURE_DECOMPRESSED,
-
-       /* If the hw can fetch compressed MSAA textures, which means shaders can
-        * read resolved FMASK. This yields the best performance.
-        * Supported families: Evergreen, Cayman. */
-       MSAA_TEXTURE_COMPRESSED
-};
-
 typedef boolean (*r600g_dma_blit_t)(struct pipe_context *ctx,
                                struct pipe_resource *dst,
                                unsigned dst_level,
@@ -245,6 +227,8 @@ typedef boolean (*r600g_dma_blit_t)(struct pipe_context *ctx,
 /* logging */
 #define DBG_TEX_DEPTH          (1 << 0)
 #define DBG_COMPUTE            (1 << 1)
+#define DBG_VM                 (1 << 2)
+#define DBG_TRACE_CS           (1 << 3)
 /* shaders */
 #define DBG_FS                 (1 << 8)
 #define DBG_VS                 (1 << 9)
@@ -257,6 +241,14 @@ typedef boolean (*r600g_dma_blit_t)(struct pipe_context *ctx,
 #define DBG_NO_CP_DMA          (1 << 18)
 #define DBG_NO_ASYNC_DMA       (1 << 19)
 #define DBG_NO_DISCARD_RANGE   (1 << 20)
+/* shader backend */
+#define DBG_SB                 (1 << 21)
+#define DBG_SB_CS              (1 << 22)
+#define DBG_SB_DRY_RUN (1 << 23)
+#define DBG_SB_STAT            (1 << 24)
+#define DBG_SB_DUMP            (1 << 25)
+#define DBG_SB_NO_FALLBACK     (1 << 26)
+#define DBG_SB_DISASM  (1 << 27)
 
 struct r600_tiling_info {
        unsigned num_channels;
@@ -274,7 +266,7 @@ struct r600_screen {
        bool                            has_streamout;
        bool                            has_msaa;
        bool                            has_cp_dma;
-       enum r600_msaa_texture_mode     msaa_texture_support;
+       bool                            has_compressed_msaa_texturing;
        struct r600_tiling_info         tiling_info;
        struct r600_pipe_fences         fences;
 
@@ -283,12 +275,15 @@ struct r600_screen {
         * XXX: Not sure if this is the best place for global_pool.  Also,
         * it's not thread safe, so it won't work with multiple contexts. */
        struct compute_memory_pool *global_pool;
-#if R600_TRACE_CS
        struct r600_resource            *trace_bo;
        uint32_t                        *trace_ptr;
        unsigned                        cs_count;
-#endif
        r600g_dma_blit_t                dma_blit;
+
+       /* Auxiliary context. Mainly used to initialize resources.
+        * It must be locked prior to using and flushed before unlocking. */
+       struct pipe_context             *aux_context;
+       pipe_mutex                      aux_context_lock;
 };
 
 struct r600_pipe_sampler_view {
@@ -550,7 +545,6 @@ struct r600_context {
        void                            *custom_dsa_flush;
        void                            *custom_blend_resolve;
        void                            *custom_blend_decompress;
-       void                            *custom_blend_fmask_decompress;
        /* With rasterizer discard, there doesn't have to be a pixel shader.
         * In that case, we bind this one: */
        void                            *dummy_pixel_shader;
@@ -622,6 +616,7 @@ struct r600_context {
        /* Queries. */
        /* The list of active queries. Only one query of each type can be active. */
        int                             num_occlusion_queries;
+       int                             num_pipelinestat_queries;
        /* Keep track of non-timer queries, because they should be suspended
         * during context flushing.
         * The timer queries (TIME_ELAPSED) shouldn't be suspended. */
@@ -636,6 +631,7 @@ struct r600_context {
        unsigned                        current_render_cond_mode;
        boolean                         predicate_drawing;
 
+       void                            *sb_context;
        struct r600_isa         *isa;
 };
 
@@ -647,19 +643,15 @@ static INLINE void r600_emit_command_buffer(struct radeon_winsys_cs *cs,
        cs->cdw += cb->num_dw;
 }
 
-#if R600_TRACE_CS
 void r600_trace_emit(struct r600_context *rctx);
-#endif
 
 static INLINE void r600_emit_atom(struct r600_context *rctx, struct r600_atom *atom)
 {
        atom->emit(rctx, atom);
        atom->dirty = false;
-#if R600_TRACE_CS
        if (rctx->screen->trace_bo) {
                r600_trace_emit(rctx);
        }
-#endif
 }
 
 static INLINE void r600_set_cso_state(struct r600_cso_state *state, void *cso)
@@ -704,7 +696,6 @@ void evergreen_update_vs_state(struct pipe_context *ctx, struct r600_pipe_shader
 void *evergreen_create_db_flush_dsa(struct r600_context *rctx);
 void *evergreen_create_resolve_blend(struct r600_context *rctx);
 void *evergreen_create_decompress_blend(struct r600_context *rctx);
-void *evergreen_create_fmask_decompress_blend(struct r600_context *rctx);
 boolean evergreen_is_format_supported(struct pipe_screen *screen,
                                      enum pipe_format format,
                                      enum pipe_texture_target target,
@@ -719,6 +710,8 @@ void evergreen_update_db_shader_control(struct r600_context * rctx);
 /* r600_blit.c */
 void r600_copy_buffer(struct pipe_context *ctx, struct pipe_resource *dst, unsigned dstx,
                      struct pipe_resource *src, const struct pipe_box *src_box);
+void r600_screen_clear_buffer(struct r600_screen *rscreen, struct pipe_resource *dst,
+                             unsigned offset, unsigned size, unsigned char value);
 void r600_init_blit_functions(struct r600_context *rctx);
 void r600_blit_decompress_depth(struct pipe_context *ctx,
                struct r600_texture *texture,
@@ -820,6 +813,9 @@ void r600_cp_dma_copy_buffer(struct r600_context *rctx,
                             struct pipe_resource *dst, uint64_t dst_offset,
                             struct pipe_resource *src, uint64_t src_offset,
                             unsigned size);
+void evergreen_cp_dma_clear_buffer(struct r600_context *rctx,
+                                  struct pipe_resource *dst, uint64_t offset,
+                                  unsigned size, uint32_t clear_value);
 void r600_dma_copy(struct r600_context *rctx,
                struct pipe_resource *dst,
                struct pipe_resource *src,
@@ -897,6 +893,9 @@ struct pipe_video_decoder *r600_uvd_create_decoder(struct pipe_context *context,
 struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe,
                                                   const struct pipe_video_buffer *tmpl);
 
+int r600_uvd_get_video_param(struct pipe_screen *screen,
+                            enum pipe_video_profile profile,
+                            enum pipe_video_cap param);
 
 /*
  * Helpers for building command buffers
@@ -1108,6 +1107,15 @@ static INLINE void r600_write_compute_context_reg(struct radeon_winsys_cs *cs, u
        r600_write_value(cs, value);
 }
 
+static INLINE void r600_write_context_reg_flag(struct radeon_winsys_cs *cs, unsigned reg, unsigned value, unsigned flag)
+{
+       if (flag & RADEON_CP_PACKET3_COMPUTE_MODE) {
+               r600_write_compute_context_reg(cs, reg, value);
+       } else {
+               r600_write_context_reg(cs, reg, value);
+       }
+
+}
 static INLINE void r600_write_ctl_const(struct radeon_winsys_cs *cs, unsigned reg, unsigned value)
 {
        r600_write_ctl_const_seq(cs, reg, 1);