Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: ville.syrjala@linux.intel.com
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t v2 2/2] tests/kms_force_connector_basic: Add prune-stale-modes subtest
Date: Mon, 7 Dec 2015 09:33:02 +0100	[thread overview]
Message-ID: <20151207083302.GZ10243@phenom.ffwll.local> (raw)
In-Reply-To: <1449252629-12582-1-git-send-email-ville.syrjala@linux.intel.com>

On Fri, Dec 04, 2015 at 08:10:29PM +0200, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Add a new subtest that makes sure old stale modes get pruned from the
> connector's mode list when the EDID changes.
> 
> v2: s/drmModeGetConnector/drmModeGetConnectorCurrent/ since
>     kmstest_force_edid() already takes care of doing the heavier
>     call for us (Daniel)
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

And pretty awesome that we can abuse the force connector stuff to test
these corner-cases in the probe code \o/
-Daniel

> ---
>  lib/igt_kms.c                     | 40 +++++++++++++++++++++++++++++++++++++++
>  lib/igt_kms.h                     |  1 +
>  tests/kms_force_connector_basic.c | 40 +++++++++++++++++++++++++++++++++++++++
>  3 files changed, 81 insertions(+)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index da49f5676641..5d5a95c20106 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -111,6 +111,46 @@ const unsigned char* igt_kms_get_base_edid(void)
>  	return base_edid;
>  }
>  
> +#define VFREQ 60
> +#define CLOCK 101000
> +#define HACTIVE 1400
> +#define HBLANK 160
> +#define VACTIVE 1050
> +#define VBLANK 30
> +#define HOFFSET 48
> +#define HPULSE 32
> +#define VOFFSET 3
> +#define VPULSE 4
> +
> +#define HSIZE 52
> +#define VSIZE 30
> +
> +#define EDID_NAME alt_edid
> +#include "igt_edid_template.h"
> +
> +/**
> + * igt_kms_get_alt_edid:
> + *
> + * Get an alternate edid block, which includes the following modes:
> + *
> + *  - 1400x1050 60Hz
> + *  - 1920x1080 60Hz
> + *  - 1280x720 60Hz
> + *  - 1024x768 60Hz
> + *  - 800x600 60Hz
> + *  - 640x480 60Hz
> + *
> + * This can be extended with further features using functions such as
> + * #kmstest_edid_add_3d.
> + *
> + * Returns: an alternate edid block
> + */
> +const unsigned char* igt_kms_get_alt_edid(void)
> +{
> +	update_edid_csum(alt_edid);
> +
> +	return alt_edid;
> +}
>  
>  /**
>   * SECTION:igt_kms
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 965c47c1c7f4..94f315fe13e2 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -286,6 +286,7 @@ void igt_reset_connectors(void);
>  
>  #define EDID_LENGTH 128
>  const unsigned char* igt_kms_get_base_edid(void);
> +const unsigned char* igt_kms_get_alt_edid(void);
>  
>  
>  #endif /* __IGT_KMS_H__ */
> diff --git a/tests/kms_force_connector_basic.c b/tests/kms_force_connector_basic.c
> index 637f625a852f..bd80caeffd82 100644
> --- a/tests/kms_force_connector_basic.c
> +++ b/tests/kms_force_connector_basic.c
> @@ -178,6 +178,46 @@ int main(int argc, char **argv)
>  
>  	}
>  
> +	igt_subtest("prune-stale-modes") {
> +		int i;
> +
> +		kmstest_force_connector(drm_fd, vga_connector,
> +					FORCE_CONNECTOR_ON);
> +
> +		/* test pruning of stale modes */
> +		kmstest_force_edid(drm_fd, vga_connector,
> +				   igt_kms_get_alt_edid(), EDID_LENGTH);
> +		temp = drmModeGetConnectorCurrent(drm_fd,
> +						  vga_connector->connector_id);
> +
> +		for (i = 0; i < temp->count_modes; i++) {
> +			if (temp->modes[i].hdisplay == 1400 &&
> +			    temp->modes[i].vdisplay == 1050)
> +				break;
> +		}
> +		igt_assert_f(i != temp->count_modes, "1400x1050 not on mode list\n");
> +
> +		drmModeFreeConnector(temp);
> +
> +		kmstest_force_edid(drm_fd, vga_connector,
> +				   igt_kms_get_base_edid(), EDID_LENGTH);
> +		temp = drmModeGetConnectorCurrent(drm_fd,
> +						  vga_connector->connector_id);
> +
> +		for (i = 0; i < temp->count_modes; i++) {
> +			if (temp->modes[i].hdisplay == 1400 &&
> +			    temp->modes[i].vdisplay == 1050)
> +				break;
> +		}
> +		igt_assert_f(i == temp->count_modes, "1400x1050 not pruned from mode list\n");
> +
> +		drmModeFreeConnector(temp);
> +
> +		kmstest_force_edid(drm_fd, vga_connector, NULL, 0);
> +		kmstest_force_connector(drm_fd, vga_connector,
> +					FORCE_CONNECTOR_UNSPECIFIED);
> +	}
> +
>  	igt_fixture {
>  		drmModeFreeConnector(vga_connector);
>  		close(drm_fd);
> -- 
> 2.4.10
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-12-07  8:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-04 14:08 [PATCH i-g-t 1/2] lib/kms: Turn the based_edid into a template ville.syrjala
2015-12-04 14:08 ` [PATCH i-g-t 2/2] tests/kms_force_connector_basic: Add prune-stale-modes subtest ville.syrjala
2015-12-04 16:20   ` Daniel Vetter
2015-12-04 18:10   ` [PATCH i-g-t v2 " ville.syrjala
2015-12-07  8:33     ` Daniel Vetter [this message]
2015-12-07 16:38 ` [PATCH i-g-t 1/2] lib/kms: Turn the based_edid into a template Thomas Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151207083302.GZ10243@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox