Mesa (main): freedreno: Document rest of GRAS_LRZ_CNTL, clarify UNK_25 event

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 28 17:53:36 UTC 2022


Module: Mesa
Branch: main
Commit: 5592c366cf1aa09dcc84797a37d62855ad6591e3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5592c366cf1aa09dcc84797a37d62855ad6591e3

Author: Danylo Piliaiev <dpiliaiev at igalia.com>
Date:   Fri May 13 17:10:36 2022 +0300

freedreno: Document rest of GRAS_LRZ_CNTL, clarify UNK_25 event

Signed-off-by: Danylo Piliaiev <dpiliaiev at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16251>

---

 src/freedreno/registers/adreno/a6xx.xml       | 22 +++++++++++++++++-----
 src/freedreno/registers/adreno/adreno_pm4.xml | 13 ++++++++++++-
 src/gallium/drivers/freedreno/a6xx/fd6_gmem.c |  2 +-
 3 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/src/freedreno/registers/adreno/a6xx.xml b/src/freedreno/registers/adreno/a6xx.xml
index 796cfb59825..5cf4495ba65 100644
--- a/src/freedreno/registers/adreno/a6xx.xml
+++ b/src/freedreno/registers/adreno/a6xx.xml
@@ -1773,11 +1773,13 @@ to upconvert to 32b float internally?
 	<reg32 offset="0x80f1" name="GRAS_SC_WINDOW_SCISSOR_BR" type="a6xx_reg_xy"/>
 	<!-- 0x80f2-0x80ff invalid -->
 
+	<enum name="a6xx_lrz_dir_status">
+		<value value="0x1" name="LRZ_DIR_LE"/>
+		<value value="0x2" name="LRZ_DIR_GE"/>
+		<value value="0x3" name="LRZ_DIR_INVALID"/>
+	</enum>
+
 	<reg32 offset="0x8100" name="GRAS_LRZ_CNTL">
-		<!--
-		These bits seems to mostly fit.. but wouldn't hurt to have a 2nd
-		look when we get around to enabling lrz
-		 -->
 		<bitfield name="ENABLE" pos="0" type="boolean"/>
 		<doc>LRZ write also disabled for blend/etc.</doc>
 		<bitfield name="LRZ_WRITE" pos="1" type="boolean"/>
@@ -1787,7 +1789,17 @@ to upconvert to 32b float internally?
 		<!-- set when depth-test + depth-write enabled -->
 		<bitfield name="Z_TEST_ENABLE" pos="4" type="boolean"/>
 		<bitfield name="Z_BOUNDS_ENABLE" pos="5" type="boolean"/>
-		<bitfield name="UNK6" low="6" high="9"/>
+		<bitfield name="DIR" low="6" high="7" type="a6xx_lrz_dir_status"/>
+		<doc>
+			If DISABLE_ON_WRONG_DIR enabled - write new LRZ direction into
+			buffer, in case of mismatched direction writes 0 (disables LRZ).
+		</doc>
+		<bitfield name="DIR_WRITE" pos="8" type="boolean"/>
+		<doc>
+			Disable LRZ based on previous direction and the current one.
+			If DIR_WRITE is not enabled - there is no write to direction buffer.
+		</doc>
+		<bitfield name="DISABLE_ON_WRONG_DIR" pos="9" type="boolean"/>
 	</reg32>
 
 	<enum name="a6xx_fragcoord_sample_mode">
diff --git a/src/freedreno/registers/adreno/adreno_pm4.xml b/src/freedreno/registers/adreno/adreno_pm4.xml
index 0b3bf0f1686..153d01e3afc 100644
--- a/src/freedreno/registers/adreno/adreno_pm4.xml
+++ b/src/freedreno/registers/adreno/adreno_pm4.xml
@@ -43,7 +43,18 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
 	<value name="PC_CCU_FLUSH_DEPTH_TS" value="28" varset="chip" variants="A5XX-"/>
 	<value name="PC_CCU_FLUSH_COLOR_TS" value="29" varset="chip" variants="A5XX-"/>
 	<value name="BLIT" value="30" varset="chip" variants="A5XX-"/>
-	<value name="UNK_25" value="37" varset="chip" variants="A5XX"/>
+	<doc>
+		Clears based on GRAS_LRZ_CNTL configuration, could clear
+		fast-clear buffer or LRZ direction.
+		LRZ direction is stored at lrz_fc_offset + 0x200, has 1 byte which
+		could be expressed by enum:
+			CUR_DIR_DISABLED = 0x0
+			CUR_DIR_GE = 0x1
+			CUR_DIR_LE = 0x2
+			CUR_DIR_UNSET = 0x3
+		Clear of direction means setting the direction to CUR_DIR_UNSET.
+	</doc>
+	<value name="LRZ_CLEAR" value="37" varset="chip" variants="A5XX-"/>
 	<value name="LRZ_FLUSH" value="38" varset="chip" variants="A5XX-"/>
 	<value name="BLIT_OP_FILL_2D" value="39" varset="chip" variants="A5XX-"/>
 	<value name="BLIT_OP_COPY_2D" value="40" varset="chip" variants="A5XX-"/>
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
index 4257b2fe3c3..40c5c85efda 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
@@ -200,7 +200,7 @@ emit_zs(struct fd_ringbuffer *ring, struct pipe_surface *zsbuf,
        * plus this CP_EVENT_WRITE at the end in it's own IB..
        */
       OUT_PKT7(ring, CP_EVENT_WRITE, 1);
-      OUT_RING(ring, CP_EVENT_WRITE_0_EVENT(UNK_25));
+      OUT_RING(ring, CP_EVENT_WRITE_0_EVENT(LRZ_CLEAR));
 
       if (rsc->stencil) {
          stride = fd_resource_pitch(rsc->stencil, zsbuf->u.tex.level);



More information about the mesa-commit mailing list