[igt-dev] [PATCH i-g-t v2 3/3] lib/igt_fb: Align min_stride to 256 bytes for YUV buffers on amdgpu

Nicholas Kazlauskas nicholas.kazlauskas at amd.com
Fri Mar 15 15:04:42 UTC 2019


The chroma address needs to be 256 byte aligned on amdgpu and the
easiest way to do so is to align the minimum stride for the luma.

v2: added this patch

Cc: Leo Li <sunpeng.li at amd.com>
Cc: Harry Wentland <harry.wentland at amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas at amd.com>
---
 lib/igt_fb.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 6a9a9341..e86b5cbc 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -467,6 +467,12 @@ static uint32_t calc_plane_stride(struct igt_fb *fb, int plane)
 		stride = roundup_power_of_two(stride);
 
 		return stride;
+	} else if (igt_format_is_yuv(fb->drm_format) && is_amdgpu_device(fb->fd)) {
+		/*
+		 * Chroma address needs to be aligned to 256 bytes on AMDGPU
+		 * so the easiest way is to align the luma stride to 256.
+		 */
+		return ALIGN(min_stride, 256);
 	} else {
 		unsigned int tile_width, tile_height;
 
-- 
2.17.1



More information about the igt-dev mailing list