radeon: add streamout status 1-3 queries.
authorDave Airlie <airlied@redhat.com>
Thu, 9 Jul 2015 06:33:59 +0000 (16:33 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 28 Jul 2015 23:00:37 +0000 (00:00 +0100)
This adds support for queries against the non-0 vertex streams.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/radeon/r600_query.c
src/gallium/drivers/radeon/r600d_common.h

index 6bf0271e14fee19d22ae6ce25cde41922b76f469..909d5029bfa7a93eea614eb5dba5f7fbc193365d 100644 (file)
@@ -54,6 +54,8 @@ struct r600_query {
        uint64_t end_result;
        /* Fence for GPU_FINISHED. */
        struct pipe_fence_handle *fence;
+       /* For transform feedback: which stream the query is for */
+       unsigned stream;
 };
 
 
@@ -155,6 +157,17 @@ static void r600_update_occlusion_query_state(struct r600_common_context *rctx,
        }
 }
 
+static unsigned event_type_for_stream(struct r600_query *query)
+{
+       switch (query->stream) {
+       default:
+       case 0: return EVENT_TYPE_SAMPLE_STREAMOUTSTATS;
+       case 1: return EVENT_TYPE_SAMPLE_STREAMOUTSTATS1;
+       case 2: return EVENT_TYPE_SAMPLE_STREAMOUTSTATS2;
+       case 3: return EVENT_TYPE_SAMPLE_STREAMOUTSTATS3;
+       }
+}
+
 static void r600_emit_query_begin(struct r600_common_context *ctx, struct r600_query *query)
 {
        struct radeon_winsys_cs *cs = ctx->rings.gfx.cs;
@@ -189,7 +202,7 @@ static void r600_emit_query_begin(struct r600_common_context *ctx, struct r600_q
        case PIPE_QUERY_SO_STATISTICS:
        case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
                radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 2, 0));
-               radeon_emit(cs, EVENT_TYPE(EVENT_TYPE_SAMPLE_STREAMOUTSTATS) | EVENT_INDEX(3));
+               radeon_emit(cs, EVENT_TYPE(event_type_for_stream(query)) | EVENT_INDEX(3));
                radeon_emit(cs, va);
                radeon_emit(cs, (va >> 32UL) & 0xFF);
                break;
@@ -246,7 +259,7 @@ static void r600_emit_query_end(struct r600_common_context *ctx, struct r600_que
        case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
                va += query->buffer.results_end + query->result_size/2;
                radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 2, 0));
-               radeon_emit(cs, EVENT_TYPE(EVENT_TYPE_SAMPLE_STREAMOUTSTATS) | EVENT_INDEX(3));
+               radeon_emit(cs, EVENT_TYPE(event_type_for_stream(query)) | EVENT_INDEX(3));
                radeon_emit(cs, va);
                radeon_emit(cs, (va >> 32UL) & 0xFF);
                break;
@@ -371,6 +384,7 @@ static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned q
                /* NumPrimitivesWritten, PrimitiveStorageNeeded. */
                query->result_size = 32;
                query->num_cs_dw = 6;
+               query->stream = index;
                break;
        case PIPE_QUERY_PIPELINE_STATISTICS:
                /* 11 values on EG, 8 on R600. */
index 74c8d8782a693fce7f43903b1dd9ea0001caeeab..5a56a5454bed9eed8a0eb2079eecd105e22241ab 100644 (file)
@@ -66,6 +66,9 @@
 #define PKT3_SET_SH_REG                        0x76 /* SI and later */
 #define PKT3_SET_UCONFIG_REG                   0x79 /* CIK and later */
 
+#define EVENT_TYPE_SAMPLE_STREAMOUTSTATS1      0x1 /* EG and later */
+#define EVENT_TYPE_SAMPLE_STREAMOUTSTATS2      0x2 /* EG and later */
+#define EVENT_TYPE_SAMPLE_STREAMOUTSTATS3      0x3 /* EG and later */
 #define EVENT_TYPE_PS_PARTIAL_FLUSH            0x10
 #define EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT 0x14
 #define EVENT_TYPE_ZPASS_DONE                  0x15