tests/kms_color_pipeline: use atomic commit helper consistently
PATCH v3 1/4 tests/kms_color_pipeline: use atomic commit helper consistently
The color pipeline is an atomic-only feature, so kms_color_pipeline should not rely on the legacy-compatible commit path.
Replace igt_display_commit2(COMMIT_ATOMIC) with igt_display_commit_atomic() throughout the test to make the atomic requirement explicit and avoid any ambiguity around commit paths.
No functional change intended.
v2:
- Rebase
--- tests/kms_color_pipeline.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tests/kms_color_pipeline.c +6 -6
@@ -43,7 +43,7 @@ static void test_cleanup(data_t *data) }igt_output_set_crtc (data->output,NULL ); -igt_display_commit2 (&data->display,COMMIT_ATOMIC ); +igt_display_commit_atomic (&data->display,DRM_MODE_ATOMIC_ALLOW_MODESET ,NULL ); }static void test_setup (data_t *data,igt_crtc_t *crtc)
@@ -61,7 +61,7 @@ static void test_setup(data_t *data, igt_crtc_t *crtc) data->pipe_crc =igt_crtc_crc_new (data->primary->crtc,IGT_PIPE_CRC_SOURCE_AUTO ); -igt_display_commit2 (&data->display,COMMIT_ATOMIC ); +igt_display_commit_atomic (&data->display,DRM_MODE_ATOMIC_ALLOW_MODESET ,NULL ); }static bool ctm_colorop_only (kms_colorop_t *colorops[])
@@ -108,14 +108,14 @@ static bool test_plane_colorops(data_t *data,disable_ctm (plane->crtc);disable_degamma (plane->crtc);disable_gamma (plane->crtc); -igt_display_commit2 (display,COMMIT_ATOMIC ); +igt_display_commit_atomic (&data->display,0 ,NULL );/* Reference (software-equivalent) CRC */ set_color_pipeline_bypass (plane);paint_rectangles (data, mode, exp_colors, &fb);igt_plane_set_fb (plane, &fb); -igt_display_commit2 (display,COMMIT_ATOMIC ); +igt_display_commit_atomic (&data->display,0 ,NULL );igt_wait_for_vblank (plane->crtc);igt_pipe_crc_collect_crc (data->pipe_crc, &crc_ref);
@@ -131,7 +131,7 @@ static bool test_plane_colorops(data_t *data,paint_gradient_rectangles (data, mode, fb_colors, &fb);igt_plane_set_fb (plane, &fb); -igt_display_commit2 (display,COMMIT_ATOMIC ); +igt_display_commit_atomic (&data->display,0 ,NULL );igt_wait_for_vblank (plane->crtc);igt_pipe_crc_collect_crc (data->pipe_crc, &crc_pipe);
@@ -141,7 +141,7 @@ static bool test_plane_colorops(data_t *data,set_color_pipeline_bypass (plane);reset_colorops (colorops);igt_plane_set_fb (plane,NULL ); -igt_display_commit2 (display,COMMIT_ATOMIC ); +igt_display_commit_atomic (&data->display,0 ,NULL );igt_remove_fb (data->drm_fd, &fb);
Signature · 1 line
2.25.1
PATCH v3 2/4 tests/kms_color_pipeline: Run tests on all supported planes
Extend the color pipeline tests to run on all planes of a pipe that exposes COLOR_PIPELINE property instead of only the primary plane.
v3:
- Rebase
v2:
- Rebase
- Remove unused variable (Swati)
--- tests/kms_color_pipeline.c | 57 +++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 25 deletions(-)
tests/kms_color_pipeline.c +32 -25
@@ -58,7 +58,7 @@ static void test_setup(data_t *data, igt_crtc_t *crtc) data->mode =igt_output_get_mode (data->output);igt_require (data->mode); - data->pipe_crc =igt_crtc_crc_new (data->primary->crtc, + data->pipe_crc =igt_crtc_crc_new (crtc,IGT_PIPE_CRC_SOURCE_AUTO );igt_display_commit_atomic (&data->display,DRM_MODE_ATOMIC_ALLOW_MODESET ,NULL );
@@ -79,18 +79,17 @@ static bool ctm_colorop_only(kms_colorop_t *colorops[])return true; } -static bool test_plane_colorops (data_t *data, -const color_t *fb_colors, -const color_t *exp_colors, -kms_colorop_t *colorops[]) +static void _test_plane_colorops (data_t *data, +igt_plane_t *plane, +const color_t *fb_colors, +const color_t *exp_colors, +kms_colorop_t *colorops[]) { -igt_plane_t *plane = data->primary;igt_display_t *display = &data->display;drmModeModeInfo *mode = data->mode;igt_colorop_t *color_pipeline;igt_crc_t crc_ref, crc_pipe;struct igt_fb fb; -bool ret; color_pipeline =get_color_pipeline (display, plane, colorops);igt_skip_on (!color_pipeline);
@@ -135,7 +134,7 @@ static bool test_plane_colorops(data_t *data,igt_wait_for_vblank (plane->crtc);igt_pipe_crc_collect_crc (data->pipe_crc, &crc_pipe); - ret =igt_check_crc_equal (&crc_ref, &crc_pipe); +igt_assert_crc_equal (&crc_ref, &crc_pipe);/* Cleanup per-test state */ set_color_pipeline_bypass (plane);
@@ -144,8 +143,26 @@ static bool test_plane_colorops(data_t *data,igt_display_commit_atomic (&data->display,0 ,NULL );igt_remove_fb (data->drm_fd, &fb); +} -return ret; +static void test_plane_colorops (data_t *data,igt_crtc_t *crtc, +const color_t *fb_colors, +const color_t *exp_colors, +kms_colorop_t *colorops[]) +{ +int n_planes = crtc->n_planes; +igt_output_t *output = data->output; +igt_plane_t *plane; + +for (int plane_id =0 ; plane_id < n_planes; plane_id++) { + plane =igt_output_get_plane (output, plane_id); + +if (!igt_plane_has_prop (plane,IGT_PLANE_COLOR_PIPELINE )) +continue ; + + igt_dynamic_f("pipe-%s-plane-%u", kmstest_pipe_name(crtc->pipe), plane_id) +_test_plane_colorops (data, plane, fb_colors, exp_colors, colorops); + } } static void
@@ -282,23 +299,13 @@ run_tests_for_plane(data_t *data)test_setup (data, crtc); -if (!igt_plane_has_prop (data->primary,IGT_PLANE_COLOR_PIPELINE )) { -test_cleanup (data); -continue ; - } - -igt_dynamic_f ("pipe-%s-%s" , -igt_crtc_name (crtc), - igt_output_name(data->output)) { - data->color_depth =8 ; - data->drm_format =DRM_FORMAT_XRGB8888 ; - -igt_assert (test_plane_colorops (data, - plane_colorops_tests[i].fb_colors, - plane_colorops_tests[i].exp_colors, - plane_colorops_tests[i].colorops)); - } + data->color_depth =8 ; + data->drm_format =DRM_FORMAT_XRGB8888 ; +test_plane_colorops (data, crtc, + plane_colorops_tests[i].fb_colors, + plane_colorops_tests[i].exp_colors, + plane_colorops_tests[i].colorops);test_cleanup (data); } }
Signature · 1 line
2.25.1
PATCH v3 3/4 tests/kms_color_pipeline: Disable pipe color properties in test setup
In reply to Chaitanya Kumar BorahMove disabling of pipe-level color properties (CTM, degamma, gamma) from the individual plane color tests into the common test setup.
v2:
- Rebase
--- tests/kms_color_pipeline.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
tests/kms_color_pipeline.c +5 -4
@@ -61,6 +61,11 @@ static void test_setup(data_t *data, igt_crtc_t *crtc) data->pipe_crc =igt_crtc_crc_new (crtc,IGT_PIPE_CRC_SOURCE_AUTO ); +/* Disable Pipe color props. */ +disable_ctm (crtc); +disable_degamma (crtc); +disable_gamma (crtc); +igt_display_commit_atomic (&data->display,DRM_MODE_ATOMIC_ALLOW_MODESET ,NULL ); }
@@ -103,10 +108,6 @@ static void _test_plane_colorops(data_t *data, &fb));igt_plane_set_fb (plane, &fb); -/* Disable Pipe color props. */ -disable_ctm (plane->crtc); -disable_degamma (plane->crtc); -disable_gamma (plane->crtc);igt_display_commit_atomic (&data->display,0 ,NULL );/* Reference (software-equivalent) CRC */
Signature · 1 line
2.25.1
PATCH v3 4/4 tests/kms_color_pipeline: collect reference CRC once per pipe
In reply to Chaitanya Kumar BorahThe reference (software-equivalent) CRC is being recomputed for every plane even though it is identical across planes for a given test configuration. Refactor the test to collect the reference CRC once per pipe and reuse it for all planes.
v3:
- Rebase
v2:
- Rebase
- s/test_grab_crc/capture_ref_crc (Swati)
- Use DRM_PLANE_TYPE_PRIMARY (Swati)
- s/igt_skip_on/igt_assert/ (Swati)
- Add a comment explaining why CRC capture on the primary plane is sufficient (Swati)
- Wait for vblank before CRC collection (Swati)
- s/reference_crc/ref_crc (Swati)
--- tests/kms_color_pipeline.c | 66 +++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 16 deletions(-)
tests/kms_color_pipeline.c +50 -16
@@ -84,16 +84,58 @@ static bool ctm_colorop_only(kms_colorop_t *colorops[])return true; } +static void +capture_ref_crc (data_t *data,igt_output_t *output, +const color_t *fb_color,igt_crc_t *crc/* out */ ) +{ +struct igt_fb fb; +drmModeModeInfo *mode; +igt_plane_t *primary; +char *crc_str; +int ret; + +/* +* Since CRC is collected at Pipe level, +* collecting crc for primary plane +* is enough for reference. +*/ + primary =igt_output_get_plane (output,DRM_PLANE_TYPE_PRIMARY ); + + mode =igt_output_get_mode (output); +igt_assert_fd (igt_create_fb (data->drm_fd, + mode->hdisplay, mode->vdisplay, +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_MOD_LINEAR , + &fb)); + +paint_rectangles (data, mode, fb_color, &fb); +igt_plane_set_fb (primary, &fb); + ret =igt_display_try_commit_atomic (&data->display,0 ,NULL ); +igt_assert (!ret); + +igt_wait_for_vblank (primary->crtc); +igt_pipe_crc_collect_crc (data->pipe_crc, crc); + +igt_plane_set_fb (primary,NULL ); +igt_display_commit_atomic (&data->display,0 ,NULL ); + +igt_remove_fb (data->drm_fd, &fb); + + crc_str =igt_crc_to_string (crc); +igt_debug ("CRC for reference fb: %s\n" , crc_str); +free (crc_str); +} +static void _test_plane_colorops (data_t *data,igt_plane_t *plane,const color_t *fb_colors, -const color_t *exp_colors, +igt_crc_t *crc_ref,kms_colorop_t *colorops[]) {igt_display_t *display = &data->display;drmModeModeInfo *mode = data->mode;igt_colorop_t *color_pipeline; -igt_crc_t crc_ref, crc_pipe; +igt_crc_t crc_pipe;struct igt_fb fb; color_pipeline =get_color_pipeline (display, plane, colorops);
@@ -106,18 +148,6 @@ static void _test_plane_colorops(data_t *data,DRM_FORMAT_XRGB8888 ,DRM_FORMAT_MOD_LINEAR , &fb)); -igt_plane_set_fb (plane, &fb); - -igt_display_commit_atomic (&data->display,0 ,NULL ); - -/* Reference (software-equivalent) CRC */ -set_color_pipeline_bypass (plane); -paint_rectangles (data, mode, exp_colors, &fb); - -igt_plane_set_fb (plane, &fb); -igt_display_commit_atomic (&data->display,0 ,NULL ); -igt_wait_for_vblank (plane->crtc); -igt_pipe_crc_collect_crc (data->pipe_crc, &crc_ref);/* Hardware pipeline CRC */ set_color_pipeline (display, plane, colorops, color_pipeline);
@@ -135,7 +165,7 @@ static void _test_plane_colorops(data_t *data,igt_wait_for_vblank (plane->crtc);igt_pipe_crc_collect_crc (data->pipe_crc, &crc_pipe); -igt_assert_crc_equal (&crc_ref, &crc_pipe); +igt_assert_crc_equal (crc_ref, &crc_pipe);/* Cleanup per-test state */ set_color_pipeline_bypass (plane);
@@ -154,6 +184,9 @@ static void test_plane_colorops(data_t *data, igt_crtc_t *crtc,int n_planes = crtc->n_planes;igt_output_t *output = data->output;igt_plane_t *plane; +igt_crc_t ref_crc; + +capture_ref_crc (data, output, exp_colors, &ref_crc);for (int plane_id =0 ; plane_id < n_planes; plane_id++) { plane =igt_output_get_plane (output, plane_id);
@@ -162,7 +195,8 @@ static void test_plane_colorops(data_t *data, igt_crtc_t *crtc,continue ; igt_dynamic_f("pipe-%s-plane-%u", kmstest_pipe_name(crtc->pipe), plane_id) -_test_plane_colorops (data, plane, fb_colors, exp_colors, colorops); +_test_plane_colorops (data, plane, fb_colors, + &ref_crc, colorops); } }
Signature · 1 line
2.25.1