[igt-dev] [PATCH i-g-t 1/2] lib/intel_bufops: Avoid overallocate x-tiling and linear surfaces

Dominik Grzegorzek dominik.grzegorzek at intel.com
Tue Sep 29 12:20:42 UTC 2020


From: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>

Height alignment was not properly set to 32 which was to big for
x-tiling and linear surfaces and leads to overallocation.
Linear surfaces currently don't require any height alignment (just 1),
for x-tiling we use 8.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
 lib/intel_bufops.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
index 57aa2a40..a1e9ba55 100644
--- a/lib/intel_bufops.c
+++ b/lib/intel_bufops.c
@@ -712,6 +712,7 @@ static void __intel_buf_init(struct buf_ops *bops,
 	uint32_t size;
 	uint32_t devid;
 	int tile_width;
+	int align_h = 1;
 
 	igt_assert(bops);
 	igt_assert(buf);
@@ -761,6 +762,7 @@ static void __intel_buf_init(struct buf_ops *bops,
 			devid =  intel_get_drm_devid(bops->fd);
 			tile_width = get_stride(devid, tiling);
 			buf->surface[0].stride = ALIGN(width * (bpp / 8), tile_width);
+			align_h = tiling == I915_TILING_X ? 8 : 32;
 		} else {
 			buf->surface[0].stride = ALIGN(width * (bpp / 8), alignment ?: 1);
 		}
@@ -769,7 +771,7 @@ static void __intel_buf_init(struct buf_ops *bops,
 		buf->tiling = tiling;
 		buf->bpp = bpp;
 
-		size = buf->surface[0].stride * ALIGN(height, 32);
+		size = buf->surface[0].stride * ALIGN(height, align_h);
 	}
 
 	if (handle)
-- 
2.20.1



More information about the igt-dev mailing list