[Nouveau] Question on Conditional Rendering Maxwell/Pascal

Ilia Mirkin imirkin at alum.mit.edu
Mon Jul 1 00:56:30 UTC 2019


Yeah, this is a little confusing. It's important to remember how
queries work in the first place, which informs how conditional
rendering works.

There are two kind of queries (QUERY_ADDRESS_HIGH & co) -- "short" and
"long". A "short" query value is a single 32-bit value, presumably the
value of the thing being queried. Not all queries are available in
this mode, but some are. This mode is useless for conditional
rendering. The long mode is a a value, and, iirc, a timestamp value.
The value itself can be 2x 32-bit values too, while the timestamp is
basically useless (except for the "timestamp" query).

Now, conditional rendering is basically only used with
GL_SAMPLES_PASSED and GL_ANY_SAMPLES_PASSED (and
stream-overflow-predicate). For both of these, you do a long-mode
query, which dumps the following 32-bit values into the 128-bit
record:

seqno (QUERY_ADDRESS_SEQUENCE), count, tslo, tshi

Conditional rendering expects a pair of such 128-bit records to follow
one another, and, I believe, performs the indicated operation on the
first 64-bit value. We pre-initialize the pair of such values here:

https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw.c#n151

      hq->data[0] = hq->sequence; /* initialize sequence */
      hq->data[1] = 1; /* initial render condition = true */
      hq->data[4] = hq->sequence + 1; /* for comparison COND_MODE */
      hq->data[5] = 0;

And we make sure that the EndConditionalRender data query ends up in
data[0:3], while the BeginConditionalRender data ends up in data[4:7].

And so the values RES_NON_ZERO means "data[0:1] != 0", EQUAL means
"data[0:1] == data[4:5]", NOT_EQUAL -- I'll let you guess. And so the
render condition in the common case is NOT_EQUAL, since we only want
to render when there is a difference in the count of samples passed.
(This is a context-level counter, whose enablement is controlled by
SAMPLECNT_ENABLE (and COUNTER_RESET to clear it).

As for what happens when there is no draw, only the draw itself is
skipped. All value updates should happen as normal.

Hope this helps,

  -ilia

On Sun, Jun 30, 2019 at 6:55 PM Fernando Sahmkow <fsahmkow27 at gmail.com> wrote:
>
> So we are currently doing tests and complying with them in our Emulator. Currently the conditional rendering test does not pass (no wonder we not even implement it). I've been looking at the current documentation https://github.com/envytools/envytools/blob/master/rnndb/graph/gf100_3d.xml#L796 So far I don't understand how the cond address is used and to what it's compared. https://github.com/envytools/envytools/blob/0d91b8bcef3ceb47ff0b114025d301edb790d472/rnndb/g80_defs.xml#L61
>
> It says it uses 2 queries, how do I know which query it's talking off and what it's the comparison that should be done.
>
> Also, does failing conditional rendering makes registers not write into the engine or just drawcalls/claers are ignored?
> _______________________________________________
> Nouveau mailing list
> Nouveau at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau


More information about the Nouveau mailing list