Reviewed-by: Marta Lofstedt <[email protected]>

> -----Original Message-----
> From: Chris Wilson [mailto:[email protected]]
> Sent: Monday, February 26, 2018 12:44 PM
> To: [email protected]
> Cc: [email protected]; Chris Wilson <[email protected]>;
> Lofstedt, Marta <[email protected]>
> 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 <[email protected]>
> Cc: Marta Lofstedt <[email protected]>
> ---
>  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

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to