[igt-dev] [i-g-t,v2] tests/kms_color: Change in commit style

swati2.sharma at intel.com swati2.sharma at intel.com
Tue Jan 29 14:08:52 UTC 2019


From: Swati Sharma <swati2.sharma at intel.com>

Existing kms_color i-g-t, commit style by default is legacy for
all the ctm/gamma/degamma subtests.

In this patch, provision for both legacy and atomic commit is
provided. Patch is floated as RFC to gather feedback on the idea
and infrastructure proposed.

Other approach could be getting the value of is_atomic as done in
kms_available_modes_crc like
data.commit = data.display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY
However with this approach we won't be able to test both the paths.

v1: As per Daniel's comments switching over to atomic.
v2: Rebase

Signed-off-by: Swati Sharma <swati2.sharma at intel.com>
---
 tests/kms_color.c | 44 +++++++++++++++++++++++---------------------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/tests/kms_color.c b/tests/kms_color.c
index decf3c2..aa000e5 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -61,9 +61,9 @@ typedef struct {
 	uint32_t color_depth;
 	uint64_t degamma_lut_size;
 	uint64_t gamma_lut_size;
+	enum igt_commit_style commit;
 } data_t;
 
-
 static void paint_gradient_rectangles(data_t *data,
 				      drmModeModeInfo *mode,
 				      color_t *colors,
@@ -311,12 +311,12 @@ static void test_pipe_degamma(data_t *data,
 		disable_ctm(primary->pipe);
 		disable_degamma(primary->pipe);
 		set_gamma(data, primary->pipe, gamma_linear);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 
 		/* Draw solid colors with no degamma transformation. */
 		paint_rectangles(data, mode, red_green_blue, &fb);
 		igt_plane_set_fb(primary, &fb);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 		igt_wait_for_vblank(data->drm_fd, primary->pipe->pipe);
 		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
 
@@ -326,7 +326,7 @@ static void test_pipe_degamma(data_t *data,
 		paint_gradient_rectangles(data, mode, red_green_blue, &fb);
 		igt_plane_set_fb(primary, &fb);
 		set_degamma(data, primary->pipe, degamma_full);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 		igt_wait_for_vblank(data->drm_fd, primary->pipe->pipe);
 		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
 
@@ -391,12 +391,12 @@ static void test_pipe_gamma(data_t *data,
 		disable_ctm(primary->pipe);
 		disable_degamma(primary->pipe);
 		set_gamma(data, primary->pipe, gamma_full);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 
 		/* Draw solid colors with no gamma transformation. */
 		paint_rectangles(data, mode, red_green_blue, &fb);
 		igt_plane_set_fb(primary, &fb);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 		igt_wait_for_vblank(data->drm_fd, primary->pipe->pipe);
 		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
 
@@ -405,7 +405,7 @@ static void test_pipe_gamma(data_t *data,
 		 */
 		paint_gradient_rectangles(data, mode, red_green_blue, &fb);
 		igt_plane_set_fb(primary, &fb);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 		igt_wait_for_vblank(data->drm_fd, primary->pipe->pipe);
 		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
 
@@ -477,12 +477,12 @@ static void test_pipe_legacy_gamma(data_t *data,
 		disable_degamma(primary->pipe);
 		disable_gamma(primary->pipe);
 		disable_ctm(primary->pipe);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 
 		/* Draw solid colors with no gamma transformation. */
 		paint_rectangles(data, mode, red_green_blue, &fb);
 		igt_plane_set_fb(primary, &fb);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 		igt_wait_for_vblank(data->drm_fd, primary->pipe->pipe);
 		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
 
@@ -497,7 +497,7 @@ static void test_pipe_legacy_gamma(data_t *data,
 			red_lut[i] = green_lut[i] = blue_lut[i] = 0xffff;
 		igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe->crtc_id,
 						  legacy_lut_size, red_lut, green_lut, blue_lut), 0);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 		igt_wait_for_vblank(data->drm_fd, primary->pipe->pipe);
 		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullgamma);
 
@@ -512,7 +512,7 @@ static void test_pipe_legacy_gamma(data_t *data,
 
 		igt_assert_eq(drmModeCrtcSetGamma(data->drm_fd, primary->pipe->crtc_id,
 						  legacy_lut_size, red_lut, green_lut, blue_lut), 0);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 
 		igt_plane_set_fb(primary, NULL);
 		igt_output_set_pipe(output, PIPE_NONE);
@@ -566,7 +566,7 @@ static void test_pipe_legacy_gamma_reset(data_t *data,
 		disable_degamma(primary->pipe);
 		disable_ctm(primary->pipe);
 		disable_gamma(primary->pipe);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 
 		/* Set a degama & gamma LUT and a CTM using the
 		 * properties and verify the content of the
@@ -574,7 +574,7 @@ static void test_pipe_legacy_gamma_reset(data_t *data,
 		set_degamma(data, primary->pipe, degamma_linear);
 		set_ctm(primary->pipe, ctm_identity);
 		set_gamma(data, primary->pipe, gamma_zero);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 
 		blob = get_blob(data, primary->pipe, IGT_CRTC_DEGAMMA_LUT);
 		igt_assert(blob &&
@@ -617,7 +617,7 @@ static void test_pipe_legacy_gamma_reset(data_t *data,
 						  legacy_lut_size,
 						  red_lut, green_lut, blue_lut),
 			      0);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 
 		igt_assert(get_blob(data, primary->pipe,
 				    IGT_CRTC_DEGAMMA_LUT) == NULL);
@@ -699,12 +699,12 @@ static bool test_pipe_ctm(data_t *data,
 		set_degamma(data, primary->pipe, degamma_linear);
 		set_gamma(data, primary->pipe, gamma_linear);
 		disable_ctm(primary->pipe);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 
 		paint_rectangles(data, mode, after, &fb);
 		igt_plane_set_fb(primary, &fb);
 		set_ctm(primary->pipe, ctm_identity);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 		igt_wait_for_vblank(data->drm_fd, primary->pipe->pipe);
 		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_software);
 
@@ -712,7 +712,7 @@ static bool test_pipe_ctm(data_t *data,
 		paint_rectangles(data, mode, before, &fb);
 		igt_plane_set_fb(primary, &fb);
 		set_ctm(primary->pipe, ctm_matrix);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 		igt_wait_for_vblank(data->drm_fd, primary->pipe->pipe);
 		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_hardware);
 
@@ -807,7 +807,7 @@ static void test_pipe_limited_range_ctm(data_t *data,
 		igt_output_set_prop_value(output, IGT_CONNECTOR_BROADCAST_RGB, BROADCAST_RGB_FULL);
 		paint_rectangles(data, mode, red_green_blue_limited, &fb);
 		igt_plane_set_fb(primary, &fb);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 		igt_wait_for_vblank(data->drm_fd, primary->pipe->pipe);
 		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_full);
 
@@ -815,7 +815,7 @@ static void test_pipe_limited_range_ctm(data_t *data,
 		igt_output_set_prop_value(output, IGT_CONNECTOR_BROADCAST_RGB, BROADCAST_RGB_16_235);
 		paint_rectangles(data, mode, red_green_blue_full, &fb);
 		igt_plane_set_fb(primary, &fb);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 		igt_wait_for_vblank(data->drm_fd, primary->pipe->pipe);
 		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_limited);
 
@@ -1043,7 +1043,7 @@ run_tests_for_pipe(data_t *data, enum pipe p)
 		disable_degamma(primary->pipe);
 		disable_gamma(primary->pipe);
 		disable_ctm(primary->pipe);
-		igt_display_commit(&data->display);
+		igt_display_commit2(&data->display, data->commit);
 
 		igt_pipe_crc_free(data->pipe_crc);
 		data->pipe_crc = NULL;
@@ -1085,7 +1085,7 @@ invalid_lut_sizes(data_t *data)
 	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);
 
-	igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
+	igt_display_commit2(display, data->commit);
 
 	if (igt_pipe_obj_has_prop(pipe, IGT_CRTC_DEGAMMA_LUT)) {
 		igt_assert_eq(pipe_set_property_blob(pipe, IGT_CRTC_DEGAMMA_LUT,
@@ -1174,6 +1174,8 @@ igt_main
 
 		igt_display_require(&data.display, data.drm_fd);
 	}
+	
+	data.commit = data.display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY;
 
 	for_each_pipe_static(pipe)
 		igt_subtest_group
-- 
1.9.1



More information about the igt-dev mailing list