[Mesa-dev] [PATCH] i965: Use software primitive restart when transform feedback active.

Paul Berry stereotype441 at gmail.com
Mon Apr 8 11:03:53 PDT 2013


On 8 April 2013 10:40, Ian Romanick <idr at freedesktop.org> wrote:

> On 04/06/2013 08:25 PM, Paul Berry wrote:
>
>> When transform feedback is active, the driver manually counts the
>> number of primitives that run through the pipeline, so that if a batch
>> buffer flush happens, the next batch buffer can pick up transform
>> feedback where the last batch buffer left off.  Hardware-accelerated
>> primitive restart interferes with this process (because it makes the
>> primitive count depend not just on the number of vertices entering the
>> pipeline, but also on the contents of the index buffer).  So, when
>> transform feedback is active, we need to fall back to the software
>> implementation of primitive restart.
>>
>> Fixes piglit test "spec/!OpenGL 3.1/primitive-restart-xfb flush".
>>
>> NOTE: This is a candidate for stable release branches.
>>
>
> Oof.  This shouldn't be a performance hit on too many applications,
> thankfully.  Do we know when we're going to get real hardware counting
> support? :(
>

We just had a discussion about that this morning.  There's no hardware
limitation, just kernel limitations.  As far as this bug is concerned, all
we need is hardware context support (which we have today).  I believe Eric
is working on this.

As for the GL_PRIMITIVES_GENERATED and
GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN queries, I believe we need some
kernel changes to allow us to read the hardware counters.  I believe Eric
is pinging some of the kernel folks on IRC to request that.

All of this stuff needs to get sorted out before we can implement geometry
shaders, so I'm highly motivated to keep an eye on it and make sure it gets
settled soon :)


>
> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
>
>
>  ---
>>   src/mesa/drivers/dri/i965/brw_**primitive_restart.c | 10 +++++++++-
>>   1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/**brw_primitive_restart.c
>> b/src/mesa/drivers/dri/i965/**brw_primitive_restart.c
>> index e6902b4..d0f0038 100644
>> --- a/src/mesa/drivers/dri/i965/**brw_primitive_restart.c
>> +++ b/src/mesa/drivers/dri/i965/**brw_primitive_restart.c
>> @@ -27,6 +27,7 @@
>>
>>   #include "main/imports.h"
>>   #include "main/bufferobj.h"
>> +#include "main/transformfeedback.h"
>>
>>   #include "brw_context.h"
>>   #include "brw_defines.h"
>> @@ -81,11 +82,18 @@ can_cut_index_handle_prims(**struct gl_context *ctx,
>>      struct brw_context *brw = brw_context(ctx);
>>
>>      if (brw->sol.counting_primitives_**generated ||
>> -       brw->sol.counting_primitives_**written) {
>> +       brw->sol.counting_primitives_**written ||
>> +       _mesa_is_xfb_active_and_**unpaused(ctx)) {
>>         /* Counting primitives generated in hardware is not currently
>>          * supported, so take the software path. We need to investigate
>>          * the *_PRIMITIVES_COUNT registers to allow this to be handled
>>          * entirely in hardware.
>> +       *
>> +       * Note that when transform feedback is active, we also count
>> primitives
>> +       * (even if the client hasn't requested it), since that is the
>> only way
>> +       * we can start at the proper place in the transform feedback
>> buffer
>> +       * after a flush.  So we also have to fall back to software when
>> +       * transform feedback is active and unpaused.
>>          */
>>         return false;
>>      }
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130408/3e65850a/attachment.html>


More information about the mesa-dev mailing list