[igt-dev] [PATCH i-g-t 2/3] tests/i915_load: Add 'load' subtest

Chris Wilson chris at chris-wilson.co.uk
Wed Oct 17 12:31:56 UTC 2018


Quoting Arkadiusz Hiler (2018-10-17 13:15:44)
> This subtest is meant to be run as a first thing on your system, making
> it a catch-all for all the issues we can hit during the HW init, so the
> runner can do its magic by looking for dragons in the dmesg and
> overriding the final result if any were spotted.
> 
> To have full "normal boot" experience it also probes all the connectors.
> 
> The subtest warns if the driver is already loaded, so we know that
> there's something off with the environment configuration.
> 
> It's already blacklisted for Intel's CI, along the other
> module-wrangling subtests.
> 
> Cc: Petri Latvala <petri.latvala at intel.com>
> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
> ---
>  tests/i915_load.c | 39 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/tests/i915_load.c b/tests/i915_load.c
> index cf4aea80..4f61d280 100644
> --- a/tests/i915_load.c
> +++ b/tests/i915_load.c
> @@ -35,6 +35,7 @@
>  #include <signal.h>
>  #include <sys/ioctl.h>
>  #include <fcntl.h>
> +#include <xf86drmMode.h>
>  
>  
>  #define LOCAL_I915_EXEC_BSD_SHIFT      (13)
> @@ -324,8 +325,46 @@ hda_dynamic_debug(bool enable)
>         fclose(fp);
>  }
>  
> +static void
> +reprobe_connectors(int fd)
> +{
> +       int i;
> +       drmModeConnectorPtr conn;
> +
> +       drmModeResPtr res = drmModeGetResources(fd);
> +       if (!res)
> +               return;

You can be really cheeky and do this entirely from the stack.

> +       for (i = 0; i < res->count_connectors; ++i) {
> +               /* drmModeGetConnector forces probe */
> +               conn = drmModeGetConnector(fd, res->connectors[i]);
> +               igt_assert(conn);

And doing so would allow you to inspect the error directly; as this
assert can mean many, many things. It could even be legitimate for DP-MST.

> +               drmModeFreeConnector(conn);
> +       }
> +
> +       drmModeFreeResources(res);
> +}
> +
>  igt_main
>  {
> +       igt_subtest("load") {

load?  This is more of a "probe", I would say.

> +               int fd, load_error;
> +               bool i915_already_loaded;
> +
> +               i915_already_loaded = igt_kmod_is_loaded("i915");
> +               igt_warn_on(i915_already_loaded);

Warn? You didn't unload so randomly warning based on run order.

> +               if (!i915_already_loaded) {
> +                       load_error = igt_i915_driver_load(NULL);
> +                       igt_assert_eq(load_error, 0);
> +               }
> +
> +               fd = __drm_open_driver(DRIVER_INTEL);

__drm_open_driver -> performs a default modprobe of the driver.

> +               igt_assert(fd > 0);
> +               reprobe_connectors(fd);
> +               close(fd);
> +       }
> +
>         igt_subtest("basic-reload") {
>                 int load_error;
>  
> -- 
> 2.17.2
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev


More information about the igt-dev mailing list