[PATCH i-g-t] tests/intel/i915_pm_rpm: warn and skip test if reading connector fails
Kamil Konieczny
kamil.konieczny at linux.intel.com
Mon Jun 17 12:02:52 UTC 2024
Hi Luca,
On 2024-06-14 at 14:33:20 +0300, Luca Coelho wrote:
> Fail test requirements if we can't set the initial data. This is
> usually caused by not being able to retrieve a connector due to
> possible race-conditions. In this case, we have issued a warning to
> cause the test to fail and not just skip.
>
> Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/10911
> Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> Cc: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
> Cc: Jani Saarinen <jani.saarinen at intel.com>
> Cc: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> Signed-off-by: Luca Coelho <luciano.coelho at intel.com>
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> ---
> tests/intel/i915_pm_rpm.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/tests/intel/i915_pm_rpm.c b/tests/intel/i915_pm_rpm.c
> index e0f395fa8a84..31758b1a5e35 100644
> --- a/tests/intel/i915_pm_rpm.c
> +++ b/tests/intel/i915_pm_rpm.c
> @@ -506,7 +506,7 @@ static drmModePropertyBlobPtr get_connector_edid(drmModeConnectorPtr connector,
> return blob;
> }
>
> -static void init_mode_set_data(struct mode_set_data *data)
> +static bool init_mode_set_data(struct mode_set_data *data)
> {
> data->res = drmModeGetResources(drm_fd);
> if (data->res) {
> @@ -518,7 +518,7 @@ static void init_mode_set_data(struct mode_set_data *data)
> if (!data->connectors[i]) {
> igt_warn("Could not read connector %u\n",
> data->res->connectors[i]);
> - continue;
> + return false;
> }
>
> data->edids[i] = get_connector_edid(data->connectors[i], i);
> @@ -529,6 +529,8 @@ static void init_mode_set_data(struct mode_set_data *data)
> }
>
> init_modeset_cached_params(&ms_data);
> +
> + return true;
> }
>
> static void fini_mode_set_data(struct mode_set_data *data)
> @@ -598,8 +600,15 @@ static bool setup_environment(bool display_enabled)
>
> ms_data.devid = intel_get_drm_devid(drm_fd);
>
> - if (display_enabled)
> - init_mode_set_data(&ms_data);
> + /*
> + * Fail test requirements if we can't set the initial data.
> + * This is usually caused by not being able to retrieve a
> + * connector due to possible race-conditions. In this case,
> + * we should have issued a warning to cause the test to fail
> + * and not just skip.
> + */
> + if (display_enabled && !init_mode_set_data(&ms_data))
> + return false;
>
> igt_pm_enable_sata_link_power_management();
>
> --
> 2.39.2
>
More information about the igt-dev
mailing list