[igt-dev] [PATCH igt] igt/kms_force_connector_basic: Clear any previous connector override
Lofstedt, Marta
marta.lofstedt at intel.com
Mon Feb 26 11:35:37 UTC 2018
Reviewed-by: Marta Lofstedt <marta.lofstedt at intel.com>
> -----Original Message-----
> From: Chris Wilson [mailto:chris at chris-wilson.co.uk]
> Sent: Monday, February 26, 2018 12:44 PM
> To: intel-gfx at lists.freedesktop.org
> Cc: igt-dev at lists.freedesktop.org; Chris Wilson <chris at chris-wilson.co.uk>;
> Lofstedt, Marta <marta.lofstedt at intel.com>
> Subject: [PATCH igt] igt/kms_force_connector_basic: Clear any previous
> connector override
>
> When searching for a VGA connector to use to test overriding the connector
> status, we require the system to have a disconnected VGA connector, but if
> a previous test left an override inplace, that may not exist. Before we check
> whether the connector is attached to real HW, first reset the connector
> status override so that we always get the actual HW result.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Marta Lofstedt <marta.lofstedt at intel.com>
> ---
> tests/kms_force_connector_basic.c | 24 +++++++++++++++++-------
> 1 file changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/tests/kms_force_connector_basic.c
> b/tests/kms_force_connector_basic.c
> index d2c804c8..c51b5cdf 100644
> --- a/tests/kms_force_connector_basic.c
> +++ b/tests/kms_force_connector_basic.c
> @@ -86,29 +86,39 @@ int main(int argc, char **argv)
> opt_handler,
> NULL);
>
> igt_fixture {
> + unsigned vga_connector_id = 0;
> +
> drm_fd =
> drm_open_driver_master(DRIVER_INTEL);
> res = drmModeGetResources(drm_fd);
> igt_assert(res);
>
> /* find the vga connector */
> for (int i = 0; i < res->count_connectors; i++) {
> -
> vga_connector =
> drmModeGetConnectorCurrent(drm_fd,
>
> res->connectors[i]);
>
> if (vga_connector-
> >connector_type == DRM_MODE_CONNECTOR_VGA) {
> - start_n_modes =
> vga_connector->count_modes;
> - start_connection =
> vga_connector->connection;
> - break;
> + /* Ensure that no
> override was left in place */
> +
> kmstest_force_connector(drm_fd,
> +
> vga_connector,
> +
> FORCE_CONNECTOR_UNSPECIFIED);
> +
> + /* only use the first
> connector */
> + if
> (!vga_connector_id)
> +
> vga_connector_id = res->connectors[i];
> }
>
>
> drmModeFreeConnector(vga_connector);
> -
> - vga_connector = NULL;
> }
>
> - igt_require(vga_connector);
> + igt_require(vga_connector_id);
> +
> + /* Reacquire status after clearing any previous
> overrides */
> + vga_connector =
> drmModeGetConnector(drm_fd, vga_connector_id);
> igt_skip_on(vga_connector->connection ==
> DRM_MODE_CONNECTED);
> +
> + start_n_modes = vga_connector-
> >count_modes;
> + start_connection = vga_connector->connection;
> }
>
> igt_subtest("force-load-detect") {
> --
> 2.16.2
More information about the igt-dev
mailing list