[Mesa-dev] [PATCH v2 2/2] i965: Use the predicate enable bit for conditional rendering without stalling

Daniel Vetter daniel at ffwll.ch
Sun Nov 9 09:19:44 PST 2014

On Fri, Nov 07, 2014 at 06:53:00PM +0000, Neil Roberts wrote:
> Previously whenever a primitive is drawn the driver would call
> _mesa_check_conditional_render which blocks waiting for the result of the
> query to determine whether to render. On Gen7+ there is a bit in the
> 3DPRIMITIVE command which can be used to disable the primitive based on the
> value of a state bit. This state bit can be set based on whether two registers
> have different values using the MI_PREDICATE command. We can load these two
> registers with the pixel count values stored in the query begin and end to
> implement conditional rendering without stalling.
> Unfortunately these two source registers are not in the whitelist of available
> registers in the kernel driver so this needs a kernel patch to work. This
> patch uses the command parser version from intel_screen to detect whether to
> attempt to set the predicate data registers.
> The predicate enable bit is currently only used for drawing 3D primitives. For
> blits, clears, bitmaps, copypixels and drawpixels it still causes a stall. For
> most of these it would probably just work to call the new
> brw_check_conditional_render function instead of
> _mesa_check_conditional_render because they already work in terms of rendering
> primitives. However it's a bit trickier for blits because it can use the BLT
> ring or the blorp codepath. I think these operations are less useful for
> conditional rendering than rendering primitives so it might be best to leave
> it for a later patch.
> v2: Use the command parser version to detect whether we can write to the
>     predicate data registers instead of trying to execute a register load
>     command.
> ---
> Glenn Kennard suggested that instead of trying to send a load register
> command to detect whether the predicate source registers can be set we
> could just increase the command parser version in the kernel driver
> and query that. That seems nicer to me so here is a second version of
> the patch to do that. I will post a v2 of the kernel patch too.

Oh, I guess my earlier mail was too late. One issue still is picking the
numbers, since you seem to assume here that ver >= 2 means the stuff
actually works. But like Ken said the cmd parser in upstream isn't
really enabled yet.
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

More information about the mesa-dev mailing list