[Mesa-dev] [PATCH 1/3] i965/gen7: Skip repeated NULL depth/stencil state emits.

Kenneth Graunke kenneth at whitecape.org
Tue Apr 8 15:21:25 PDT 2014


On 04/08/2014 02:57 PM, Ian Romanick wrote:
> Even though patch 3 doesn't help performance, I think it makes the code
> better.  Series is
> 
> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
> 
> One question below...
> 
> On 04/08/2014 02:31 PM, Eric Anholt wrote:
>> Improves cairo performance on glamor by 2.87752% +/- 0.966977 (n=57).
>> ---
>>  src/mesa/drivers/dri/i965/brw_blorp.cpp      | 1 +
>>  src/mesa/drivers/dri/i965/brw_context.h      | 3 +++
>>  src/mesa/drivers/dri/i965/gen7_misc_state.c  | 8 ++++++++
>>  src/mesa/drivers/dri/i965/gen8_depth_state.c | 8 ++++++++
>>  4 files changed, 20 insertions(+)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp b/src/mesa/drivers/dri/i965/brw_blorp.cpp
>> index 252219e..57ff30a 100644
>> --- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
>> @@ -278,6 +278,7 @@ retry:
>>      */
>>     brw->state.dirty.brw = ~0;
>>     brw->state.dirty.cache = ~0;
>> +   brw->no_depth_or_stencil = false;
>>     brw->ib.type = -1;
>>  
>>     /* Flush the sampler cache so any texturing from the destination is
>> diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
>> index 487142c..f8ca58f 100644
>> --- a/src/mesa/drivers/dri/i965/brw_context.h
>> +++ b/src/mesa/drivers/dri/i965/brw_context.h
>> @@ -1119,6 +1119,9 @@ struct brw_context
>>     /* Whether a meta-operation is in progress. */
>>     bool meta_in_progress;
>>  
>> +   /* Whether the last depth/stencil packets were both NULL. */
>> +   bool no_depth_or_stencil;
>> +
>>     struct {
>>        struct brw_vertex_element inputs[VERT_ATTRIB_MAX];
>>        struct brw_vertex_buffer buffers[VERT_ATTRIB_MAX];
>> diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c b/src/mesa/drivers/dri/i965/gen7_misc_state.c
>> index 8fb0eec..328b01e 100644
>> --- a/src/mesa/drivers/dri/i965/gen7_misc_state.c
>> +++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c
>> @@ -52,6 +52,12 @@ gen7_emit_depth_stencil_hiz(struct brw_context *brw,
>>     const struct intel_renderbuffer *irb = NULL;
>>     const struct gl_renderbuffer *rb = NULL;
>>  
>> +   /* Skip repeated NULL depth/stencil emits (think 2D rendering). */
>> +   if (!mt && brw->no_depth_or_stencil) {
>> +      assert(brw->hw_ctx);
> 
> What does this assertion catch?
> 

Without hardware contexts, your state is potentially lost after
submitting the batch (because any other program can come in and clobber
it).  So, just because we programmed null-depth-state last time, it may
not be present anymore.  Hardware contexts ensure your old state is
still present.

Gen6+ always enables hardware contexts (although ChromeOS patches them out).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140408/6ea398f2/attachment-0001.sig>


More information about the mesa-dev mailing list