r600g: All EVENT_WRITE packets need the EVENT_INDEX field
authorAlex Deucher <alexdeucher@gmail.com>
Fri, 19 Nov 2010 18:34:22 +0000 (13:34 -0500)
committerAlex Deucher <alexdeucher@gmail.com>
Fri, 19 Nov 2010 18:35:53 +0000 (13:35 -0500)
6xx-evergreen

src/gallium/winsys/r600/drm/r600_hw_context.c
src/gallium/winsys/r600/drm/r600d.h

index b70dffa..71a531f 100644 (file)
@@ -1062,7 +1062,7 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw)
                ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator;
        }
        ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0);
-       ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT;
+       ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE(EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT) | EVENT_INDEX(0);
 
        /* flush color buffer */
        for (int i = 0; i < 8; i++) {
@@ -1099,7 +1099,7 @@ void r600_context_flush(struct r600_context *ctx)
 
        /* emit fence */
        ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE_EOP, 4);
-       ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT | (5 << 8);
+       ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE(EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT) | EVENT_INDEX(5);
        ctx->pm4[ctx->pm4_cdwords++] = 0;
        ctx->pm4[ctx->pm4_cdwords++] = (1 << 29) | (0 << 24);
        ctx->pm4[ctx->pm4_cdwords++] = ctx->fence;
@@ -1279,11 +1279,7 @@ void r600_query_begin(struct r600_context *ctx, struct r600_query *query)
 
        /* emit begin query */
        ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 2);
-       if (ctx->radeon->chip_class == EVERGREEN) {
-               ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_ZPASS_DONE | EG_EVENT_INDEX(1);
-       } else {
-               ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_ZPASS_DONE;
-       }
+       ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE(EVENT_TYPE_ZPASS_DONE) | EVENT_INDEX(1);
        ctx->pm4[ctx->pm4_cdwords++] = query->num_results + r600_bo_offset(query->buffer);
        ctx->pm4[ctx->pm4_cdwords++] = 0;
        ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0);
@@ -1299,11 +1295,7 @@ void r600_query_end(struct r600_context *ctx, struct r600_query *query)
 {
        /* emit begin query */
        ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 2);
-       if (ctx->radeon->chip_class == EVERGREEN) {
-               ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_ZPASS_DONE | EG_EVENT_INDEX(1);
-       } else {
-               ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_ZPASS_DONE;
-       }
+       ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE(EVENT_TYPE_ZPASS_DONE) | EVENT_INDEX(1);
        ctx->pm4[ctx->pm4_cdwords++] = query->num_results + 8 + r600_bo_offset(query->buffer);
        ctx->pm4[ctx->pm4_cdwords++] = 0;
        ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0);
index 3c39b3f..4a08d50 100644 (file)
 #define EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT 0x14
 #define EVENT_TYPE_ZPASS_DONE                  0x15
 #define EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT   0x16
-#define EG_EVENT_INDEX(x)               ((x) << 8)
+#define                EVENT_TYPE(x)                           ((x) << 0)
+#define                EVENT_INDEX(x)                          ((x) << 8)
+                /* 0 - any non-TS event
+                * 1 - ZPASS_DONE
+                * 2 - SAMPLE_PIPELINESTAT
+                * 3 - SAMPLE_STREAMOUTSTAT*
+                * 4 - *S_PARTIAL_FLUSH
+                * 5 - TS events
+                */
 
 #define PKT_TYPE_S(x)                   (((x) & 0x3) << 30)
 #define PKT_TYPE_G(x)                   (((x) >> 30) & 0x3)