[Mesa-dev,4/7] gallium/radeon: simplify restoring render condition after flush

Submitted by Marek Olšák on Nov. 8, 2015, 9:48 p.m.

Details

Message ID 1447019312-4825-5-git-send-email-maraeo@gmail.com
State New
Headers show
Series "RadeonSI: Render condition cleanup" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Marek Olšák Nov. 8, 2015, 9:48 p.m.
From: Marek Olšák <marek.olsak@amd.com>

---
 src/gallium/drivers/radeon/r600_pipe_common.c | 22 +++++-----------------
 src/gallium/drivers/radeon/r600_pipe_common.h |  4 ----
 2 files changed, 5 insertions(+), 21 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 8739914..224da11 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -134,17 +134,6 @@  static void r600_memory_barrier(struct pipe_context *ctx, unsigned flags)
 
 void r600_preflush_suspend_features(struct r600_common_context *ctx)
 {
-	/* Disable render condition. */
-	ctx->saved_render_cond = NULL;
-	ctx->saved_render_cond_cond = FALSE;
-	ctx->saved_render_cond_mode = 0;
-	if (ctx->current_render_cond) {
-		ctx->saved_render_cond = ctx->current_render_cond;
-		ctx->saved_render_cond_cond = ctx->current_render_cond_cond;
-		ctx->saved_render_cond_mode = ctx->current_render_cond_mode;
-		ctx->b.render_condition(&ctx->b, NULL, FALSE, 0);
-	}
-
 	/* suspend queries */
 	ctx->queries_suspended_for_flush = false;
 	if (ctx->num_cs_dw_nontimer_queries_suspend) {
@@ -173,12 +162,11 @@  void r600_postflush_resume_features(struct r600_common_context *ctx)
 		r600_resume_timer_queries(ctx);
 	}
 
-	/* Re-enable render condition. */
-	if (ctx->saved_render_cond) {
-		ctx->b.render_condition(&ctx->b, ctx->saved_render_cond,
-					  ctx->saved_render_cond_cond,
-					  ctx->saved_render_cond_mode);
-	}
+	/* Just re-emit PKT3_SET_PREDICATION. */
+	if (ctx->current_render_cond)
+		ctx->b.render_condition(&ctx->b, ctx->current_render_cond,
+					ctx->current_render_cond_cond,
+					ctx->current_render_cond_mode);
 }
 
 static void r600_flush_from_st(struct pipe_context *ctx,
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index 139c377..2a3a3a7 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -422,10 +422,6 @@  struct r600_common_context {
 	boolean				current_render_cond_cond;
 	bool				predicate_drawing;
 	bool				render_cond_force_off; /* for u_blitter */
-	/* For context flushing. */
-	struct pipe_query		*saved_render_cond;
-	boolean				saved_render_cond_cond;
-	unsigned			saved_render_cond_mode;
 
 	/* MSAA sample locations.
 	 * The first index is the sample index.

Comments

On 08.11.2015 22:48, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak@amd.com>
>
> ---
>   src/gallium/drivers/radeon/r600_pipe_common.c | 22 +++++-----------------
>   src/gallium/drivers/radeon/r600_pipe_common.h |  4 ----
>   2 files changed, 5 insertions(+), 21 deletions(-)
>
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
> index 8739914..224da11 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
[snip]
> @@ -173,12 +162,11 @@ void r600_postflush_resume_features(struct r600_common_context *ctx)
>   		r600_resume_timer_queries(ctx);
>   	}
>
> -	/* Re-enable render condition. */
> -	if (ctx->saved_render_cond) {
> -		ctx->b.render_condition(&ctx->b, ctx->saved_render_cond,
> -					  ctx->saved_render_cond_cond,
> -					  ctx->saved_render_cond_mode);
> -	}
> +	/* Just re-emit PKT3_SET_PREDICATION. */
> +	if (ctx->current_render_cond)
> +		ctx->b.render_condition(&ctx->b, ctx->current_render_cond,
> +					ctx->current_render_cond_cond,
> +					ctx->current_render_cond_mode);

Drop the "Just" from the comment, because while it makes sense in the 
context of the diff, it does not make sense when only looking at the new 
code.

Nicolai
On 09.11.2015 10:43, Nicolai Hähnle wrote:
> On 08.11.2015 22:48, Marek Olšák wrote:
>> From: Marek Olšák <marek.olsak@amd.com>
>>
>> ---
>>   src/gallium/drivers/radeon/r600_pipe_common.c | 22
>> +++++-----------------
>>   src/gallium/drivers/radeon/r600_pipe_common.h |  4 ----
>>   2 files changed, 5 insertions(+), 21 deletions(-)
>>
>> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c
>> b/src/gallium/drivers/radeon/r600_pipe_common.c
>> index 8739914..224da11 100644
>> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
>> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> [snip]
>> @@ -173,12 +162,11 @@ void r600_postflush_resume_features(struct
>> r600_common_context *ctx)
>>           r600_resume_timer_queries(ctx);
>>       }
>>
>> -    /* Re-enable render condition. */
>> -    if (ctx->saved_render_cond) {
>> -        ctx->b.render_condition(&ctx->b, ctx->saved_render_cond,
>> -                      ctx->saved_render_cond_cond,
>> -                      ctx->saved_render_cond_mode);
>> -    }
>> +    /* Just re-emit PKT3_SET_PREDICATION. */
>> +    if (ctx->current_render_cond)
>> +        ctx->b.render_condition(&ctx->b, ctx->current_render_cond,
>> +                    ctx->current_render_cond_cond,
>> +                    ctx->current_render_cond_mode);
>
> Drop the "Just" from the comment, because while it makes sense in the
> context of the diff, it does not make sense when only looking at the new
> code.

Never mind, this becomes moot anyway with patch 5.

>
> Nicolai