[igt-dev] [PATCH] [i-g-t] tests/amdgpu/amd_color: fix test crash within crtc_lut_accuracy

Hersen Wu hersenxs.wu at amd.com
Tue Jun 20 13:54:25 UTC 2023


Add reading degamma_lut_size and regamma_lut_size from Linux kernel.
Test crash when lut_size equals to zero.

Signed-off-by: Hersen Wu <hersenxs.wu at amd.com>
---
 tests/amdgpu/amd_color.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/amdgpu/amd_color.c b/tests/amdgpu/amd_color.c
index 9eed1da38..97a3c16ec 100644
--- a/tests/amdgpu/amd_color.c
+++ b/tests/amdgpu/amd_color.c
@@ -340,6 +340,14 @@ static void test_crtc_lut_accuracy(data_t *data)
 	igt_require(igt_pipe_obj_has_prop(data->pipe, IGT_CRTC_DEGAMMA_LUT));
 	igt_require(igt_pipe_obj_has_prop(data->pipe, IGT_CRTC_GAMMA_LUT));
 
+	data->degamma_lut_size =
+		igt_pipe_obj_get_prop(data->pipe, IGT_CRTC_DEGAMMA_LUT_SIZE);
+	igt_assert_lt(0, data->degamma_lut_size);
+
+	data->regamma_lut_size =
+		igt_pipe_obj_get_prop(data->pipe, IGT_CRTC_GAMMA_LUT_SIZE);
+	igt_assert_lt(0, data->regamma_lut_size);
+
 	lut_init(&lut_degamma, data->degamma_lut_size);
 	lut_gen_degamma_srgb(&lut_degamma, 0xffff);
 
-- 
2.25.1



More information about the igt-dev mailing list