[igt-dev] [PATCH i-g-t 10/21] tests/kms_color: Assert gamma look up table sizes
Petri Latvala
petri.latvala at intel.com
Wed Jan 16 11:20:39 UTC 2019
If the properties for gamma tables exist, their sizes must be
non-zero.
Signed-off-by: Petri Latvala <petri.latvala at intel.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
tests/kms_color.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/tests/kms_color.c b/tests/kms_color.c
index 913c70ca..decf3c2a 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -124,9 +124,13 @@ static void paint_rectangles(data_t *data,
static double *generate_table(uint32_t lut_size, double exp)
{
- double *coeffs = malloc(sizeof(double) * lut_size);
+ double *coeffs;
uint32_t i;
+ igt_assert_lt(0, lut_size);
+
+ coeffs = malloc(sizeof(double) * lut_size);
+
for (i = 0; i < lut_size; i++)
coeffs[i] = powf((double) i * 1.0 / (double) (lut_size - 1), exp);
@@ -135,9 +139,12 @@ static double *generate_table(uint32_t lut_size, double exp)
static double *generate_table_max(uint32_t lut_size)
{
- double *coeffs = malloc(sizeof(double) * lut_size);
+ double *coeffs;
uint32_t i;
+ igt_assert_lt(0, lut_size);
+
+ coeffs = malloc(sizeof(double) * lut_size);
coeffs[0] = 0.0;
for (i = 1; i < lut_size; i++)
coeffs[i] = 1.0;
@@ -868,6 +875,8 @@ run_tests_for_pipe(data_t *data, enum pipe p)
igt_pipe_obj_get_prop(&data->display.pipes[p],
IGT_CRTC_GAMMA_LUT_SIZE);
+ igt_assert_lt(0, data->degamma_lut_size);
+ igt_assert_lt(0, data->gamma_lut_size);
igt_display_require_output_on_pipe(&data->display, p);
}
--
2.19.1
More information about the igt-dev
mailing list