[igt-dev] [PATCH i-g-t] lib/igt_kms: Improve connector probing in igt_display_init()

Arkadiusz Hiler arkadiusz.hiler at intel.com
Tue Mar 27 13:28:40 UTC 2018


On Mon, Mar 26, 2018 at 01:22:06PM +0200, Maarten Lankhorst wrote:
> Only do a full probe when the initial connector status is unknown, and
> otherwise skip it. This should speed up kms tests ever so slightly.
> 
> Also set pipe to PIPE_NONE for igt_output_refresh(), to make the
> connector info slightly more accurate.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> ---
>  lib/igt_kms.c | 17 +++++++++++++----
>  lib/igt_kms.h |  2 +-
>  2 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index d8f69d3db9ca..f47c32a79222 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -974,7 +974,7 @@ _kmstest_connector_config_find_encoder(int drm_fd, drmModeConnector *connector,
>  static bool _kmstest_connector_config(int drm_fd, uint32_t connector_id,
>  				      unsigned long crtc_idx_mask,
>  				      struct kmstest_connector_config *config,
> -				      bool probe)
> +				      int probe)
>  {
>  	drmModeRes *resources;
>  	drmModeConnector *connector;
> @@ -988,11 +988,19 @@ static bool _kmstest_connector_config(int drm_fd, uint32_t connector_id,
>  	}
>  
>  	/* First, find the connector & mode */
> -	if (probe)
> +	if (probe > 0)
>  		connector = drmModeGetConnector(drm_fd, connector_id);
> -	else
> +	else {
>  		connector = drmModeGetConnectorCurrent(drm_fd, connector_id);
>  
> +		if (probe < 0 && connector &&
> +		    connector->connection == DRM_MODE_UNKNOWNCONNECTION) {
> +			drmModeFreeConnector(connector);
> +
> +			connector = drmModeGetConnector(drm_fd, connector_id);
> +		}
> +	}
> +
>  	if (!connector)
>  		goto err2;
>  
> @@ -2028,7 +2036,8 @@ void igt_display_init(igt_display_t *display, int drm_fd)
>  		 * We don't assign each output a pipe unless
>  		 * a pipe is set with igt_output_set_pipe().
>  		 */
> -		output->force_reprobe = true;
> +		output->force_reprobe = -1;
> +		output->pending_pipe = PIPE_NONE;
>  		output->id = resources->connectors[i];
>  		output->display = display;
>  
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 6f16dc8cf85e..9e734ab1a5b8 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -340,7 +340,7 @@ typedef struct {
>  	uint32_t id;					/* KMS id */
>  	struct kmstest_connector_config config;
>  	char *name;
> -	bool force_reprobe;
> +	int force_reprobe;

I am all for doing full probe only when requested or necessary, but I
find keeping the name 'force_reprobe' and mixing -1, false and true
rather confusing.

What about changing the name to just "reprobe" and use enum values
NO_REPROBE, FORCE_REPROBE and IF_NECESSARY_REPROBE (or some better
names)?

-Arek

>  	enum pipe pending_pipe;
>  	bool use_override_mode;
>  	drmModeModeInfo override_mode;
> -- 
> 2.16.3
> 
> _______________________________________________
> 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