[igt-dev] [PATCH i-g-t 1/4] lib/igt_kms: Fix test_init() crash when <6 pipes

Anson Jacob Anson.Jacob at amd.com
Fri Jun 18 14:28:52 UTC 2021


From: Victor Lu <victorchengchi.lu at amd.com>

[why & how]
An upstream change is causing the common amdgpu test_init() to crash on
ASICs with <6 pipes.

Signed-off-by: Victor Lu <victorchengchi.lu at amd.com>
Acked-by: Anson Jacob <Anson.Jacob at amd.com>
Cc: Petri Latvala <petri.latvala at intel.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira at amd.com>
Cc: Harry Wentland <harry.wentland at amd.com>
Cc: Mark Yacoub <markyacoub at google.com>
---
 lib/igt_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index c7c69b6ea0eb..26c51a384918 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -2164,8 +2164,8 @@ void igt_display_require(igt_display_t *display, int drm_fd)
 	 * pipe display and reading pipe enum for a crtc using GET_PIPE_FROM_CRTC_ID ioctl
 	 * for a pipe to do pipe ordering with respect to crtc list.
 	 */
-	display->n_pipes = IGT_MAX_PIPES;
-	display->pipes = calloc(sizeof(igt_pipe_t), display->n_pipes);
+	display->n_pipes = resources->count_crtcs;
+	display->pipes = calloc(sizeof(igt_pipe_t), IGT_MAX_PIPES);
 	igt_assert_f(display->pipes, "Failed to allocate memory for %d pipes\n", display->n_pipes);
 
 	for (i = 0; i < resources->count_crtcs; i++) {
-- 
2.25.1



More information about the igt-dev mailing list