When to call FLUSH/SEMA/STALL
Lucas Stach
l.stach at pengutronix.de
Thu May 11 08:45:02 UTC 2017
Am Donnerstag, den 11.05.2017, 08:54 +0200 schrieb Rolf Wöhrmann:
> Hi
>
> first thanks to all the responses to my previous post. The info was
> really helpful!
>
> My question is when exactly to execute the FLUSH/SEMA/STALL sequence?
>
> Let’s assume for simplicity we’ve a chain of lines & rect fills (aka
> clear) with changing color in between. This would result in a sequence
> of LOAD_STATE and START_DE ops.
> Looking into the code it seems that after START_DE and changing the
> state with LOAD_STATE again for the next START_DE a FLUSH/SEMA/STALL
> is performed.
>
> Is this mandatory (like state is “global” to the DE pipe and you have
> to wait until PE is finished before changing it) ?
This really depends on the state and the GPU (which bugs are present in
the core you are targeting). Generally all state is global, so if any
operation depends on any of the states as input, this operation needs to
be finished before you can change the state, or parts of the operation
may use corrupt input.
Some of the states are self-synchronizing, so the FE will will wait
until all consumers are done, before the LOAD_STATE is actually
executed. Even if this is the case for some states on some GPUs, this
doesn't always work across all core revisions, so most of the existing
code assumes that stalls are needed.
The flushes are needed if you change the memory location a cache is
targeting. For example when you change the render target address state,
you need to do a PE flush/stall before the state load, as otherwise the
cache might hold dirty data, which is later flushed to the location
given by the render target address state.
Regards,
Lucas
More information about the etnaviv
mailing list