Mesa (master): freedreno: Use common guardband helper

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 21 14:45:52 UTC 2020


Module: Mesa
Branch: master
Commit: bb5b136b45222c2b70a37384b610fff685d09a35
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bb5b136b45222c2b70a37384b610fff685d09a35

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Fri Jul 17 15:18:33 2020 +0200

freedreno: Use common guardband helper

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

---

 src/gallium/drivers/freedreno/a6xx/fd6_emit.c  |  9 +++++++--
 src/gallium/drivers/freedreno/freedreno_util.h | 12 ------------
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
index 3187fb1e1c8..2d502032bfa 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
@@ -35,6 +35,7 @@
 #include "freedreno_log.h"
 #include "freedreno_resource.h"
 #include "freedreno_query_hw.h"
+#include "common/freedreno_guardband.h"
 
 #include "fd6_emit.h"
 #include "fd6_blend.h"
@@ -904,8 +905,12 @@ fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit)
 				)
 			);
 
-		unsigned guardband_x = fd_calc_guardband(scissor->maxx - scissor->minx);
-		unsigned guardband_y = fd_calc_guardband(scissor->maxy - scissor->miny);
+		unsigned guardband_x =
+			fd_calc_guardband(ctx->viewport.translate[0], ctx->viewport.scale[0],
+							  false);
+		unsigned guardband_y =
+			fd_calc_guardband(ctx->viewport.translate[1], ctx->viewport.scale[1],
+							  false);
 
 		OUT_REG(ring, A6XX_GRAS_CL_GUARDBAND_CLIP_ADJ(
 					.horz = guardband_x,
diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h
index 6f1442192e0..248d6552e78 100644
--- a/src/gallium/drivers/freedreno/freedreno_util.h
+++ b/src/gallium/drivers/freedreno/freedreno_util.h
@@ -203,18 +203,6 @@ fd_half_precision(struct pipe_framebuffer_state *pfb)
 	return true;
 }
 
-/* Note sure if this is same on all gens, but seems to be same on the later
- * gen's
- */
-static inline unsigned
-fd_calc_guardband(unsigned x)
-{
-	float l = log2(x);
-	if (l <= 8)
-		return 511;
-	return 511 - ((l - 8) * 65);
-}
-
 static inline void emit_marker(struct fd_ringbuffer *ring, int scratch_idx);
 
 /* like OUT_RING() but appends a cmdstream patch point to 'buf' */



More information about the mesa-commit mailing list