[igt-dev] [PATCH i-g-t 3/6] tests/kms_color: Reuse some already compute values

Ville Syrjala ville.syrjala at linux.intel.com
Tue Apr 2 16:33:45 UTC 2019


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

We already compute the lut_size*entry_size so let's reuse those
when allocating the LUTs.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 tests/kms_color.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index 43e59dd42b0b..c65bb88cd7dc 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -1079,8 +1079,8 @@ invalid_lut_sizes(data_t *data)
 	size_t degamma_lut_size = data->degamma_lut_size * sizeof(struct drm_color_lut);
 	size_t gamma_lut_size = data->gamma_lut_size * sizeof(struct drm_color_lut);
 
-	struct drm_color_lut *degamma_lut = malloc(data->degamma_lut_size * sizeof(struct drm_color_lut) * 2);
-	struct drm_color_lut *gamma_lut = malloc(data->gamma_lut_size * sizeof(struct drm_color_lut) * 2);
+	struct drm_color_lut *degamma_lut = malloc(degamma_lut_size * 2);
+	struct drm_color_lut *gamma_lut = malloc(gamma_lut_size * 2);
 
 	igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
 
-- 
2.19.2



More information about the igt-dev mailing list