On Tue, Oct 10, 2017 at 06:04:28PM +0200, Maarten Lankhorst wrote: > If all outputs are disabled before this test is run, then the test > will fail because actual_brightness stays at 0 instead of the value > of the desired brightness. Fix this by enabling all outputs at the > start of this test. > > Sample failure: > IGT-Version: 1.20-g01c550a27986 (x86_64) (Linux: 4.14.0-rc3-fbconhax+ x86_64) > (pm_backlight:1203) CRITICAL: Test assertion failure function test_and_verify, file pm_backlight.c:111: > (pm_backlight:1203) CRITICAL: Failed assertion: ({ typeof(0) _a = (0); typeof(val - tolerance) _b = (val - tolerance); _a > _b ? _a : _b; }) <= result > (pm_backlight:1203) CRITICAL: error: 91200 > 0 > > Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx> > --- > tests/pm_backlight.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/tests/pm_backlight.c b/tests/pm_backlight.c > index 8258d4e4c124..b365c7f6dc60 100644 > --- a/tests/pm_backlight.c > +++ b/tests/pm_backlight.c > @@ -155,13 +155,37 @@ igt_main > { > struct context context = {0}; > int old; > + igt_display_t display; > > igt_skip_on_simulation(); > > igt_fixture { > + enum pipe pipe; > + > /* Get the max value and skip the whole test if sysfs interface not available */ > igt_skip_on(backlight_read(&old, "brightness")); > igt_assert(backlight_read(&context.max, "max_brightness") > -1); > + > + /* > + * Backlight tests requires the output to be enabled, > + * try to enable all. > + */ > + kmstest_set_vt_graphics_mode(); > + igt_display_init(&display, drm_open_driver(DRIVER_INTEL)); > + > + for_each_pipe(&display, pipe) { > + igt_output_t *output; > + > + for_each_valid_output_on_pipe(&display, pipe, output) { > + if (output->pending_pipe != PIPE_NONE) > + continue; > + > + igt_output_set_pipe(output, pipe); > + break; > + } > + } Since the test depends on intel_backlight I think we could even look up the correct backlight based on the connector. Would actually guarantee that we manage to light up the correct connector instead of wasting our precious pipes lighting up stuff we don't need. > + > + igt_display_commit2(&display, display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY); > } > > igt_subtest("basic-brightness") > @@ -174,5 +198,8 @@ igt_main > igt_fixture { > /* Restore old brightness */ > backlight_write(old, "brightness"); > + > + igt_display_fini(&display); > + close(display.drm_fd); > } > } > -- > 2.14.1 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx