[PATCH i-g-t v4 5/8] lib/igt_kms: extend igt_plane_set_color_pipeline to accept Bypass
Melissa Wen <[email protected]>
| Newsgroups | org.freedesktop.lists.igt-dev |
|---|---|
| Message-ID | <[email protected]> |
"Bypass" is just the COLOR_PIPELINE enum value with no colorop object behind it, which is what a NULL assigned_color_pipeline already means internally. Accept NULL and set "Bypass" instead of making callers poke the property directly, so a plane's assigned pipeline always matches what was committed. That makes set_color_pipeline_bypass() a plain alias, so remove it from kms_colorop_helper and convert its callers, igt_plane_reset() included. Signed-off-by: Melissa Wen <[email protected]> --- v3: - new patch, replaces the open-coded "Bypass" setting in patch 6 --- lib/igt_kms.c | 13 ++++++++----- tests/chamelium/kms_chamelium_color_pipeline.c | 2 +- tests/kms_color_pipeline.c | 2 +- tests/kms_colorop.c | 6 +++--- tests/kms_colorop_helper.c | 5 ----- tests/kms_colorop_helper.h | 1 - 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 00fd7ee2a..e9a14c991 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -2707,7 +2707,7 @@ static void igt_plane_reset(igt_plane_t *plane) igt_plane_set_prop_value(plane, IGT_PLANE_HOTSPOT_Y, 0); if (igt_plane_has_prop(plane, IGT_PLANE_COLOR_PIPELINE)) - igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_PIPELINE, "Bypass"); + igt_plane_set_color_pipeline(plane, NULL); igt_plane_clear_prop_changed(plane, IGT_PLANE_IN_FENCE_FD); plane->values[IGT_PLANE_IN_FENCE_FD] = ~0ULL; @@ -4429,17 +4429,20 @@ bool igt_plane_is_valid_colorop(igt_plane_t *plane, igt_colorop_t *colorop) /** * igt_plane_set_color_pipeline: * @plane: Target plane. - * @colorop: Colorop to set as color pipeline. + * @colorop: Colorop to set as color pipeline, or NULL for "Bypass". * * This function sets the given @colorop as color pipeline on @plane, or fails - * the test if it's an invalid color pipeline for the plane. + * the test if it's an invalid color pipeline for the plane. Passing NULL sets + * the plane color pipeline to "Bypass". */ void igt_plane_set_color_pipeline(igt_plane_t *plane, igt_colorop_t *colorop) { - igt_assert(igt_plane_is_valid_colorop(plane, colorop)); + igt_assert(!colorop || igt_plane_is_valid_colorop(plane, colorop)); plane->assigned_color_pipeline = colorop; - igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_PIPELINE, colorop->name); + igt_plane_set_prop_enum(plane, + IGT_PLANE_COLOR_PIPELINE, + colorop ? colorop->name : "Bypass"); } /** diff --git a/tests/chamelium/kms_chamelium_color_pipeline.c b/tests/chamelium/kms_chamelium_color_pipeline.c index db6107221..5738c6dd1 100644 --- a/tests/chamelium/kms_chamelium_color_pipeline.c +++ b/tests/chamelium/kms_chamelium_color_pipeline.c @@ -161,7 +161,7 @@ static void _test_plane_colorops(data_t *data, chamelium_destroy_frame_dump(frame); /* Cleanup */ - set_color_pipeline_bypass(plane); + igt_plane_set_color_pipeline(plane, NULL); reset_colorops(colorops); igt_plane_set_fb(plane, NULL); diff --git a/tests/kms_color_pipeline.c b/tests/kms_color_pipeline.c index 78860a845..f71416ce1 100644 --- a/tests/kms_color_pipeline.c +++ b/tests/kms_color_pipeline.c @@ -168,7 +168,7 @@ static void _test_plane_colorops(data_t *data, igt_assert_crc_equal(crc_ref, &crc_pipe); /* Cleanup per-test state */ - set_color_pipeline_bypass(plane); + igt_plane_set_color_pipeline(plane, NULL); reset_colorops(colorops); igt_plane_set_fb(plane, NULL); igt_display_commit_atomic(&data->display, 0, NULL); diff --git a/tests/kms_colorop.c b/tests/kms_colorop.c index 16db0b8ad..8648bd7ce 100644 --- a/tests/kms_colorop.c +++ b/tests/kms_colorop.c @@ -224,7 +224,7 @@ static void colorop_plane_test(igt_display_t *display, /* reset color pipeline*/ - set_color_pipeline_bypass(plane); + igt_plane_set_color_pipeline(plane, NULL); /* Commit */ igt_plane_set_fb(plane, input_fb); @@ -255,7 +255,7 @@ static void colorop_plane_test(igt_display_t *display, if (!colorops[0]) { /* bypass test */ - set_color_pipeline_bypass(plane); + igt_plane_set_color_pipeline(plane, NULL); } else { /* get COLOR_PIPELINE enum */ color_pipeline = get_color_pipeline(display, plane, colorops); @@ -281,7 +281,7 @@ static void colorop_plane_test(igt_display_t *display, igt_assert(compare_with_bracket(&sw_transform_fb, output_fb)); /* reset color pipeline*/ - set_color_pipeline_bypass(plane); + igt_plane_set_color_pipeline(plane, NULL); /* Commit */ igt_plane_set_fb(plane, input_fb); diff --git a/tests/kms_colorop_helper.c b/tests/kms_colorop_helper.c index 5b79fe789..707661378 100644 --- a/tests/kms_colorop_helper.c +++ b/tests/kms_colorop_helper.c @@ -398,11 +398,6 @@ void set_color_pipeline(igt_display_t *display, } } -void set_color_pipeline_bypass(igt_plane_t *plane) -{ - igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_PIPELINE, "Bypass"); -} - static void reset_colorop(kms_colorop_t *colorop) { igt_assert(colorop->colorop); diff --git a/tests/kms_colorop_helper.h b/tests/kms_colorop_helper.h index a081fa02d..4d7d6bb3f 100644 --- a/tests/kms_colorop_helper.h +++ b/tests/kms_colorop_helper.h @@ -102,7 +102,6 @@ void set_color_pipeline(igt_display_t *display, igt_plane_t *plane, kms_colorop_t *colorops[], igt_colorop_t *color_pipeline); -void set_color_pipeline_bypass(igt_plane_t *plane); void reset_colorops(kms_colorop_t *colorops[]); #endif /* __KMS_COLOROP_HELPER_H__ */ -- 2.53.0