summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2014-09-03 13:58:57 +0200
committerEmil Velikov <emil.l.velikov@gmail.com>2014-09-08 16:37:19 +0100
commit8e0f72995f9da16607c16f12a294c3a7556a0c15 (patch)
tree4faa80590f6879079694023034eead51b469d8a0 /src
parentac75d9b6b678d9123a526da60c5e89b21a571395 (diff)
r600g,radeonsi: make sure there's enough CS space before resuming queries
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83432 Cc: "10.2 10.3" <mesa-stable@lists.freedesktop.org> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> (cherry picked from commit 3dbf55c1be5a8867616e475d943c776d8245d0cc)
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeon/r600_query.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c
index 38889fdf2a5..2fc68e7fe1e 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -786,12 +786,40 @@ void r600_suspend_nontimer_queries(struct r600_common_context *ctx)
assert(ctx->num_cs_dw_nontimer_queries_suspend == 0);
}
+static unsigned r600_queries_num_cs_dw_for_resuming(struct r600_common_context *ctx)
+{
+ struct r600_query *query;
+ unsigned num_dw = 0;
+
+ LIST_FOR_EACH_ENTRY(query, &ctx->active_nontimer_queries, list) {
+ /* begin + end */
+ num_dw += query->num_cs_dw * 2;
+
+ /* Workaround for the fact that
+ * num_cs_dw_nontimer_queries_suspend is incremented for every
+ * resumed query, which raises the bar in need_cs_space for
+ * queries about to be resumed.
+ */
+ num_dw += query->num_cs_dw;
+ }
+ /* primitives generated query */
+ num_dw += ctx->streamout.enable_atom.num_dw;
+ /* guess for ZPASS enable or PERFECT_ZPASS_COUNT enable updates */
+ num_dw += 13;
+
+ return num_dw;
+}
+
void r600_resume_nontimer_queries(struct r600_common_context *ctx)
{
struct r600_query *query;
assert(ctx->num_cs_dw_nontimer_queries_suspend == 0);
+ /* Check CS space here. Resuming must not be interrupted by flushes. */
+ ctx->need_gfx_cs_space(&ctx->b,
+ r600_queries_num_cs_dw_for_resuming(ctx), TRUE);
+
LIST_FOR_EACH_ENTRY(query, &ctx->active_nontimer_queries, list) {
r600_emit_query_begin(ctx, query);
}