[igt-dev] [PATCH i-g-t] tests: Check and skip tests when driver don't have display enabled

Ville Syrjälä ville.syrjala at linux.intel.com
Fri Sep 7 14:48:28 UTC 2018


On Thu, Sep 06, 2018 at 05:44:54PM -0700, José Roberto de Souza wrote:
> Right now i915 is not doing the full job to complete disable display
> when i915.disable_display parameters is set, when that is completed
> it will cause several tests to fail, so here skiping all the tests
> that depends on modeset or display block when those are not
> available.
> 
> Cc: Jani Nikula <jani.nikula at intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
> ---
>  lib/igt_kms.c                     | 20 ++++++++++++++++++++
>  lib/igt_kms.h                     |  1 +
>  tests/debugfs_test.c              |  1 +
>  tests/gem_exec_nop.c              |  1 +
>  tests/kms_3d.c                    |  1 +
>  tests/kms_addfb_basic.c           |  4 +++-
>  tests/kms_atomic.c                |  1 +
>  tests/kms_atomic_interruptible.c  |  1 +
>  tests/kms_available_modes_crc.c   |  1 +
>  tests/kms_busy.c                  |  1 +
>  tests/kms_ccs.c                   |  1 +
>  tests/kms_chamelium.c             |  1 +
>  tests/kms_chv_cursor_fail.c       |  1 +
>  tests/kms_color.c                 |  1 +
>  tests/kms_concurrent.c            |  1 +
>  tests/kms_crtc_background_color.c |  1 +
>  tests/kms_cursor_crc.c            |  1 +
>  tests/kms_cursor_legacy.c         |  1 +
>  tests/kms_draw_crc.c              |  1 +
>  tests/kms_fbcon_fbt.c             |  1 +
>  tests/kms_fence_pin_leak.c        |  1 +
>  tests/kms_flip.c                  |  1 +
>  tests/kms_flip_event_leak.c       |  1 +
>  tests/kms_flip_tiling.c           |  1 +
>  tests/kms_force_connector_basic.c |  1 +
>  tests/kms_frontbuffer_tracking.c  |  1 +
>  tests/kms_getfb.c                 |  4 +++-
>  tests/kms_hdmi_inject.c           |  1 +
>  tests/kms_invalid_dotclock.c      |  1 +
>  tests/kms_legacy_colorkey.c       |  1 +
>  tests/kms_mmap_write_crc.c        |  1 +
>  tests/kms_panel_fitting.c         |  1 +
>  tests/kms_pipe_b_c_ivb.c          |  1 +
>  tests/kms_pipe_crc_basic.c        |  1 +
>  tests/kms_plane.c                 |  1 +
>  tests/kms_plane_lowres.c          |  1 +
>  tests/kms_plane_multiple.c        |  1 +
>  tests/kms_plane_scaling.c         |  1 +
>  tests/kms_properties.c            |  1 +
>  tests/kms_psr.c                   |  1 +
>  tests/kms_pwrite_crc.c            |  1 +
>  tests/kms_rmfb.c                  |  1 +
>  tests/kms_rotation_crc.c          |  1 +
>  tests/kms_setmode.c               |  1 +
>  tests/kms_sysfs_edid_timing.c     |  5 +++++
>  tests/kms_tv_load_detect.c        |  1 +
>  tests/kms_universal_plane.c       |  1 +
>  tests/kms_vblank.c                |  1 +
>  tests/perf_pmu.c                  |  1 +
>  tests/pm_backlight.c              |  5 ++++-
>  tests/pm_lpsp.c                   |  1 +
>  tests/pm_rpm.c                    |  1 +
>  tests/prime_vgem.c                |  2 ++
>  tests/testdisplay.c               |  1 +
>  54 files changed, 85 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 62d84684..7578a10b 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -2018,6 +2018,26 @@ int igt_display_get_n_pipes(igt_display_t *display)
>  	return display->n_pipes;
>  }
>  
> +/**
> + * igt_display_require_output:
> + * @drm_fd: a drm file descriptor
> + *
> + * Checks if driver supports modeset and have display enabled.
> + */
> +void igt_require_display(int fd)
> +{
> +	drmModeRes *resources;
> +	int pipes;
> +
> +	resources = drmModeGetResources(fd);
> +	igt_require_f(resources, "drm driver do not support modeset\n");
> +
> +	pipes = resources->count_crtcs;
> +	drmModeFreeResources(resources);
> +
> +	igt_require_f(pipes > 0, "drm driver without display hardware\n");
> +}
> +
>  /**
>   * igt_display_require_output:
>   * @display: A pointer to an #igt_display_t structure
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 3a12f278..037bcb23 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -388,6 +388,7 @@ void igt_display_commit_atomic(igt_display_t *display, uint32_t flags, void *use
>  int  igt_display_try_commit2(igt_display_t *display, enum igt_commit_style s);
>  int  igt_display_drop_events(igt_display_t *display);
>  int  igt_display_get_n_pipes(igt_display_t *display);
> +void igt_require_display(int fd);
>  void igt_display_require_output(igt_display_t *display);
>  void igt_display_require_output_on_pipe(igt_display_t *display, enum pipe pipe);
>  
> diff --git a/tests/debugfs_test.c b/tests/debugfs_test.c
> index 2e87e442..6d77ee72 100644
> --- a/tests/debugfs_test.c
> +++ b/tests/debugfs_test.c
> @@ -99,6 +99,7 @@ igt_main
>  	igt_fixture {
>  		fd = drm_open_driver_master(DRIVER_INTEL);
>  		igt_require_gem(fd);
> +		igt_require_display(fd);
>  		debugfs = igt_debugfs_dir(fd);
>  
>  		kmstest_set_vt_graphics_mode();

I guess we lose the emon subtest here. But that's ilk only so meh.

<snip>
> diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
> index 6ab2595b..6c347acc 100644
> --- a/tests/perf_pmu.c
> +++ b/tests/perf_pmu.c
> @@ -1397,6 +1397,7 @@ test_rc6(int gem_fd, unsigned int flags)
>  	if (flags & TEST_RUNTIME_PM) {
>  		drmModeRes *res;
>  
> +		igt_require_display(gem_fd);

Might we want to just skip the display interaction here but still
execute the rest of the subtest? Or is that redundant when there is no
display anyway?

>  		res = drmModeGetResources(gem_fd);
>  		igt_assert(res);
>  
<snip> 
> diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
> index c24fd95b..627b1a1a 100644
> --- a/tests/pm_rpm.c
> +++ b/tests/pm_rpm.c
> @@ -719,6 +719,7 @@ static bool setup_environment(void)
>  
>  	debugfs = igt_debugfs_dir(drm_fd);
>  	igt_require(debugfs != -1);
> +	igt_require_display(drm_fd);

Somewhat the same question here. Although this test looks like it's
expecting display stuff all over, so probably can't easily exclude it.

The perf_pmu thing is I guess the only real
concern I have, but I guess someone can think of that later so
Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

>  
>  	init_mode_set_data(&ms_data);
>  
> diff --git a/tests/prime_vgem.c b/tests/prime_vgem.c
> index b821fbb8..a99cd8a9 100644
> --- a/tests/prime_vgem.c
> +++ b/tests/prime_vgem.c
> @@ -747,6 +747,8 @@ static void test_flip(int i915, int vgem, unsigned hang)
>  	struct vgem_bo bo[2];
>  	uint32_t fb_id[2], handle[2], crtc_id;
>  
> +	igt_require_display(i915);
> +
>  	signal(SIGHUP, sighandler);
>  
>  	for (int i = 0; i < 2; i++) {
> diff --git a/tests/testdisplay.c b/tests/testdisplay.c
> index 0ff98a2b..a770b29f 100644
> --- a/tests/testdisplay.c
> +++ b/tests/testdisplay.c
> @@ -716,6 +716,7 @@ int main(int argc, char **argv)
>  		test_all_modes = 1;
>  
>  	drm_fd = drm_open_driver(DRIVER_ANY);
> +	igt_require_display(drm_fd);
>  
>  	if (test_stereo_modes &&
>  	    drmSetClientCap(drm_fd, DRM_CLIENT_CAP_STEREO_3D, 1) < 0) {
> -- 
> 2.18.0
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Ville Syrjälä
Intel


More information about the igt-dev mailing list