r600g: add pausing pipeline & streamout queries into set_active_query_state
authorMarek Olšák <marek.olsak@amd.com>
Fri, 8 Apr 2016 19:10:58 +0000 (21:10 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 12 Apr 2016 12:29:47 +0000 (14:29 +0200)
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/r600_hw_context.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_state.c
src/gallium/drivers/r600/r600_state_common.c

index c1b0b56ece4948584bcc550a65e736e0bb5f6963..f76d7a90595b01d037fb0e32a379adab8dffc344 100644 (file)
@@ -2395,6 +2395,12 @@ static void cayman_init_atom_start_cs(struct r600_context *rctx)
        r600_store_value(cb, PKT3(PKT3_EVENT_WRITE, 0, 0));
        r600_store_value(cb, EVENT_TYPE(EVENT_TYPE_PS_PARTIAL_FLUSH) | EVENT_INDEX(4));
 
+       /* This enables pipeline stat & streamout queries.
+        * They are only disabled by blits.
+        */
+       r600_store_value(cb, PKT3(PKT3_EVENT_WRITE, 0, 0));
+       r600_store_value(cb, EVENT_TYPE(EVENT_TYPE_PIPELINESTAT_START) | EVENT_INDEX(0));
+
        cayman_init_common_regs(cb, rctx->b.chip_class,
                                rctx->b.family, rctx->screen->b.info.drm_minor);
 
@@ -2648,6 +2654,12 @@ void evergreen_init_atom_start_cs(struct r600_context *rctx)
        r600_store_value(cb, PKT3(PKT3_EVENT_WRITE, 0, 0));
        r600_store_value(cb, EVENT_TYPE(EVENT_TYPE_PS_PARTIAL_FLUSH) | EVENT_INDEX(4));
 
+       /* This enables pipeline stat & streamout queries.
+        * They are only disabled by blits.
+        */
+       r600_store_value(cb, PKT3(PKT3_EVENT_WRITE, 0, 0));
+       r600_store_value(cb, EVENT_TYPE(EVENT_TYPE_PIPELINESTAT_START) | EVENT_INDEX(0));
+
        evergreen_init_common_regs(rctx, cb, rctx->b.chip_class,
                                   rctx->b.family, rctx->screen->b.info.drm_minor);
 
index 7a6f957945be9e7a49dfdc8a6a57d029e1e2dac9..63b631ac27ffd38f57f92f21c670cf3ca5356291 100644 (file)
@@ -223,6 +223,16 @@ void r600_flush_emit(struct r600_context *rctx)
                cs->buf[cs->cdw++] = 0x0000000A;      /* POLL_INTERVAL */
        }
 
+       if (rctx->b.flags & R600_CONTEXT_START_PIPELINE_STATS) {
+               radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
+               radeon_emit(cs, EVENT_TYPE(EVENT_TYPE_PIPELINESTAT_START) |
+                               EVENT_INDEX(0));
+       } else if (rctx->b.flags & R600_CONTEXT_STOP_PIPELINE_STATS) {
+               radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
+               radeon_emit(cs, EVENT_TYPE(EVENT_TYPE_PIPELINESTAT_STOP) |
+                               EVENT_INDEX(0));
+       }
+
        if (wait_until) {
                /* Use of WAIT_UNTIL is deprecated on Cayman+ */
                if (rctx->b.family < CHIP_CAYMAN) {
index 0102638723b0e5f2a1bfa28edc655131714412f2..86dd3c8e4c68d1e5a4a4ea527c648a29b9508fb8 100644 (file)
@@ -56,7 +56,7 @@
 #define R600_CONTEXT_WAIT_CP_DMA_IDLE          (R600_CONTEXT_PRIVATE_FLAG << 10)
 
 /* the number of CS dwords for flushing and drawing */
-#define R600_MAX_FLUSH_CS_DWORDS       16
+#define R600_MAX_FLUSH_CS_DWORDS       18
 #define R600_MAX_DRAW_CS_DWORDS                58
 
 #define R600_MAX_USER_CONST_BUFFERS 13
index c4de9639a79b3c6fa67a5483e1facfff8ce3cd1a..02702ae7304ac5ec0a14f044f3925f5248c23c3a 100644 (file)
@@ -2177,6 +2177,12 @@ void r600_init_atom_start_cs(struct r600_context *rctx)
        r600_store_value(cb, PKT3(PKT3_EVENT_WRITE, 0, 0));
        r600_store_value(cb, EVENT_TYPE(EVENT_TYPE_PS_PARTIAL_FLUSH) | EVENT_INDEX(4));
 
+       /* This enables pipeline stat & streamout queries.
+        * They are only disabled by blits.
+        */
+       r600_store_value(cb, PKT3(PKT3_EVENT_WRITE, 0, 0));
+       r600_store_value(cb, EVENT_TYPE(EVENT_TYPE_PIPELINESTAT_START) | EVENT_INDEX(0));
+
        family = rctx->b.family;
        ps_prio = 0;
        vs_prio = 1;
index cdb493dad28cf3b61c99620edc4684a195e28364..c03b75aea52091563b771daf168634e919ca58f7 100644 (file)
@@ -2864,6 +2864,15 @@ static void r600_set_active_query_state(struct pipe_context *ctx, boolean enable
 {
        struct r600_context *rctx = (struct r600_context*)ctx;
 
+       /* Pipeline stat & streamout queries. */
+       if (enable) {
+               rctx->b.flags &= ~R600_CONTEXT_STOP_PIPELINE_STATS;
+               rctx->b.flags |= R600_CONTEXT_START_PIPELINE_STATS;
+       } else {
+               rctx->b.flags &= ~R600_CONTEXT_START_PIPELINE_STATS;
+               rctx->b.flags |= R600_CONTEXT_STOP_PIPELINE_STATS;
+       }
+
        /* Occlusion queries. */
        if (rctx->db_misc_state.occlusion_queries_disabled != !enable) {
                rctx->db_misc_state.occlusion_queries_disabled = !enable;