[igt-dev] [PATCH] [i-g-t] tests/amdgpu/amd_color: fix test crash within crtc_lut_accuracy
Alex Hung
alex.hung at amd.com
Tue Jun 20 17:21:30 UTC 2023
On 2023-06-20 07:54, Hersen Wu wrote:
> 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);
>
The size check can be placed in "lut_init" so they aren't duplicated at
various places since both data->degamma_lut_size and
data->regamma_lut_size are past to lut_init.
Then similar checks in other functions can also be removed as well.
More information about the igt-dev
mailing list