r600g: cayman initial integer support
[mesa.git] / src / gallium / drivers / r600 / r600.h
index 715501d91d3d5fe3b9110173b76cebf07b036b78..baf09c1d8aafe3efbd3d18e7d12daf3cee50c133 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "../../winsys/radeon/drm/radeon_winsys.h"
 #include "util/u_double_list.h"
-#include "util/u_vbuf_mgr.h"
+#include "util/u_vbuf.h"
 
 #define R600_ERR(fmt, args...) \
        fprintf(stderr, "EE %s:%d %s - "fmt, __FILE__, __LINE__, __func__, ##args)
@@ -88,6 +88,9 @@ struct r600_resource {
        /* Winsys objects. */
        struct pb_buffer                *buf;
        struct radeon_winsys_cs_handle  *cs_buf;
+
+       /* Resource state. */
+       unsigned                        domains;
 };
 
 /* R600/R700 STATES */
@@ -164,7 +167,11 @@ struct r600_range {
 };
 
 struct r600_query {
-       u64                                     result;
+       union {
+               uint64_t                        u64;
+               boolean                         b;
+               struct pipe_query_data_so_statistics so;
+       } result;
        /* The kind of query */
        unsigned                                type;
        /* Offset of the first result for current query */
@@ -178,10 +185,21 @@ struct r600_query {
         * data blocks for current query are stored sequentially from
         * results_start to results_end, with wrapping on the buffer end */
        struct r600_resource                    *buffer;
+       /* The number of dwords for begin_query or end_query. */
+       unsigned                                num_cs_dw;
        /* linked list of queries */
        struct list_head                        list;
 };
 
+struct r600_so_target {
+       struct pipe_stream_output_target b;
+
+       /* The buffer where BUFFER_FILLED_SIZE is stored. */
+       struct r600_resource    *filled_size;
+       unsigned                stride_in_dw;
+       unsigned                so_index;
+};
+
 #define R600_CONTEXT_DRAW_PENDING      (1 << 0)
 #define R600_CONTEXT_DST_CACHES_DIRTY  (1 << 1)
 #define R600_CONTEXT_CHECK_EVENT_FLUSH (1 << 2)
@@ -190,6 +208,9 @@ struct r600_context {
        struct r600_screen      *screen;
        struct radeon_winsys    *ws;
        struct radeon_winsys_cs *cs;
+       struct pipe_context     *pipe;
+
+       void (*flush)(void *pipe, unsigned flags);
 
        struct r600_range       *range;
        unsigned                nblocks;
@@ -197,7 +218,6 @@ struct r600_context {
        struct list_head        dirty;
        struct list_head        resource_dirty;
        struct list_head        enable_list;
-       unsigned                pm4_ndwords;
        unsigned                pm4_dirty_cdwords;
        unsigned                ctx_pm4_ndwords;
        unsigned                init_dwords;
@@ -210,8 +230,9 @@ struct r600_context {
 
        /* The list of active queries. Only one query of each type can be active. */
        struct list_head        active_query_list;
+       unsigned                num_cs_dw_queries_suspend;
+       unsigned                num_cs_dw_streamout_end;
 
-       unsigned                num_query_running;
        unsigned                backend_mask;
        unsigned                max_db; /* for OQ */
        unsigned                num_dest_buffers;
@@ -222,6 +243,12 @@ struct r600_context {
        struct r600_range fs_resources;
        int num_ps_resources, num_vs_resources, num_fs_resources;
        boolean                 have_depth_texture, have_depth_fb;
+
+       unsigned                        num_so_targets;
+       struct r600_so_target           *so_targets[PIPE_MAX_SO_BUFFERS];
+       boolean                         streamout_start;
+       unsigned                        streamout_append_bitmask;
+       unsigned                        *vs_so_stride_in_dw;
 };
 
 struct r600_draw {
@@ -261,6 +288,10 @@ void r600_context_emit_fence(struct r600_context *ctx, struct r600_resource *fen
 void r600_context_flush_all(struct r600_context *ctx, unsigned flush_flags);
 void r600_context_flush_dest_caches(struct r600_context *ctx);
 
+void r600_context_streamout_begin(struct r600_context *ctx);
+void r600_context_streamout_end(struct r600_context *ctx);
+void r600_context_draw_opaque_count(struct r600_context *ctx, struct r600_so_target *t);
+
 int evergreen_context_init(struct r600_context *ctx, struct r600_screen *screen);
 void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *draw);
 void evergreen_context_flush_dest_caches(struct r600_context *ctx);