freedreno: Cleanup event names
authorConnor Abbott <cwabbott0@gmail.com>
Thu, 5 Mar 2020 16:10:47 +0000 (17:10 +0100)
committerMarge Bot <eric+marge@anholt.net>
Thu, 2 Apr 2020 16:18:25 +0000 (16:18 +0000)
It turns out that every *_TS event, i.e. every event which requires a
seqno pointer, also allows generating an interrupt in the kernel, at
least since a3xx. And furthermore these interrupts are named by the kgsl
kernel driver and already in envytools. Therefore it's possible to map
out what the *_TS events are with 100% certainty, given access to the
hardware, by sending a CP_EVENT_WRITE with bit 31 set, unmasking all
interrupts in the kernel, and logging which ones get hit. I've done this
for a6xx, and I've also looked at the a5xx firmware, and the list of TS
interrupts is the same as a6xx, so I have a pretty good idea of what the
a5xx events are. I also fixed a few related things along the way:

- VIZQUERY_END overlaps with WT_DONE_TS, but VIZQUERY_START was also a
mess, with neither VIZQUERY_START nor HLSQ_FLUSH using variants. I added
what seems like reasonable variants, based on the existing comment
and the fact that HLSQ_FLUSH is only used in Mesa with a3xx and a4xx.
- CACHE_FLUSH_AND_INVALIDATE seems to come straight from R600, and I
have no idea if it's actually valid with a2xx, but given that RB_DONE_TS
exists in the interrupt mask since a3xx, I guessed that RB_DONE_TS
hasn't changed position since then and put it down as a3xx+ and limited
CACHE_FLUSH_AND_INVALIDATE to a2xx. Someone with the relevant hardware
should be able to confirm.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4065>

src/freedreno/registers/adreno_pm4.xml

index a2b69c5..c5d83d0 100644 (file)
@@ -11,9 +11,9 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
        <value name="CACHE_FLUSH_TS" value="4"/>
        <value name="CONTEXT_DONE" value="5"/>
        <value name="CACHE_FLUSH" value="6"/>
-       <value name="HLSQ_FLUSH" value="7"/> <!-- on a3xx -->
-       <value name="VIZQUERY_START" value="7"/> <!-- on a2xx (??) -->
-       <value name="VIZQUERY_END" value="8"/>
+       <value name="VIZQUERY_START" value="7" variants="A2XX"/>
+       <value name="HLSQ_FLUSH" value="7" variants="A3XX,A4XX"/>
+       <value name="VIZQUERY_END" value="8" variants="A2XX"/>
        <value name="SC_WAIT_WC" value="9"/>
        <value name="WRITE_PRIMITIVE_COUNTS" value="9" variants="A6XX"/>
        <value name="START_PRIMITIVE_CTRS" value="11" variants="A6XX"/>
@@ -24,13 +24,15 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
        <value name="STAT_EVENT" value="16"/>
        <value name="CACHE_FLUSH_AND_INV_TS_EVENT" value="20" variants="A2XX,A3XX,A4XX"/>
        <value name="ZPASS_DONE" value="21"/>
-       <value name="CACHE_FLUSH_AND_INV_EVENT" value="22"/>
+       <value name="CACHE_FLUSH_AND_INV_EVENT" value="22" variants="A2XX"/>
+       <value name="RB_DONE_TS" value="22" variants="A3XX-"/>
        <value name="PERFCOUNTER_START" value="23" variants="A2XX,A3XX,A4XX"/>
        <value name="PERFCOUNTER_STOP" value="24" variants="A2XX,A3XX,A4XX"/>
        <value name="VS_FETCH_DONE" value="27"/>
        <value name="FACENESS_FLUSH" value="28" variants="A2XX,A3XX,A4XX"/>
 
        <!-- a5xx events -->
+       <value name="WT_DONE_TS" value="8" variants="A5XX,A6XX"/>
        <value name="FLUSH_SO_0" value="17" variants="A5XX,A6XX"/>
        <value name="FLUSH_SO_1" value="18" variants="A5XX,A6XX"/>
        <value name="FLUSH_SO_2" value="19" variants="A5XX,A6XX"/>