All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petri Latvala <petri.latvala@intel.com>
To: Jessica Zhang <quic_jesszhan@quicinc.com>
Cc: igt-dev@lists.freedesktop.org, quic_aravindh@quicinc.com
Subject: Re: [igt-dev] [PATCH i-g-t v1] tests/kms_pipe_crc_basic: Support custom CRC sources
Date: Thu, 2 Jun 2022 15:54:03 +0300	[thread overview]
Message-ID: <Ypiy61MS536or/rv@platvala-desk.ger.corp.intel.com> (raw)
In-Reply-To: <20220531220313.9537-1-quic_jesszhan@quicinc.com>

On Tue, May 31, 2022 at 03:03:13PM -0700, Jessica Zhang wrote:
> Add a custom command line option that allows user to set a custom CRC
> source. This will allow different drivers to test their own CRC sources
> instead of just the "auto" option.
> 
> Example usage: `./kms_pipe_crc_basic -s intf`
> 
> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
> ---
>  tests/kms_pipe_crc_basic.c | 28 ++++++++++++++++++++++------
>  1 file changed, 22 insertions(+), 6 deletions(-)

While this sounds useful, why only kms_pipe_crc_basic?

How about checking an environment variable in igt_pipe_crc_new*() and
overriding the source string based on that, if the parameter is
"auto"? That would bring this capability to other tests as well.


-- 
Petri Latvala


> 
> diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
> index 0861c46dbd9b..6a593aec4c6c 100644
> --- a/tests/kms_pipe_crc_basic.c
> +++ b/tests/kms_pipe_crc_basic.c
> @@ -36,6 +36,7 @@ typedef struct {
>  	int debugfs;
>  	igt_display_t display;
>  	struct igt_fb fb;
> +	char *crc_source;
>  } data_t;
>  
>  static struct {
> @@ -104,7 +105,7 @@ static void test_read_crc(data_t *data, enum pipe pipe, unsigned flags)
>  		if (flags & TEST_NONBLOCK) {
>  			igt_pipe_crc_t *pipe_crc;
>  
> -			pipe_crc = igt_pipe_crc_new_nonblock(data->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
> +			pipe_crc = igt_pipe_crc_new_nonblock(data->drm_fd, pipe, data->crc_source);
>  			igt_wait_for_vblank(data->drm_fd, display->pipes[pipe].crtc_offset);
>  			igt_pipe_crc_start(pipe_crc);
>  
> @@ -119,7 +120,7 @@ static void test_read_crc(data_t *data, enum pipe pipe, unsigned flags)
>  		} else {
>  			igt_pipe_crc_t *pipe_crc;
>  
> -			pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
> +			pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe, data->crc_source);
>  			igt_pipe_crc_start(pipe_crc);
>  
>  			n_crcs = igt_pipe_crc_get_crcs(pipe_crc, N_CRCS, &crcs);
> @@ -202,8 +203,7 @@ static void test_compare_crc(data_t *data, enum pipe pipe)
>  	igt_plane_set_fb(primary, &fb0);
>  	igt_display_commit(display);
>  
> -	pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe,
> -				    INTEL_PIPE_CRC_SOURCE_AUTO);
> +	pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe, data->crc_source);
>  	igt_pipe_crc_collect_crc(pipe_crc, &ref_crc);
>  
>  	/* Flip FB1 with the Primary plane & compare the CRC with ref CRC. */
> @@ -265,9 +265,25 @@ static void test_disable_crc_after_crtc(data_t *data, enum pipe pipe)
>  	igt_remove_fb(data->drm_fd, &data->fb);
>  }
>  
> -data_t data = {0, };
> +data_t data = {0, .crc_source = "auto"};
>  
> -igt_main
> +static int opt_handler(int opt, int opt_index, void *_data)
> +{
> +	switch (opt) {
> +	case 's':
> +		data.crc_source = optarg;
> +		igt_debug("Setting CRC source to %s\n", data.crc_source);
> +		break;
> +	}
> +
> +	return IGT_OPT_HANDLER_SUCCESS;
> +}
> +
> +static const char help_str[] =
> +	"  -s\tPass in a custom source for crc test (default is \"auto\")\n";
> +
> +
> +igt_main_args("s:", NULL, help_str, opt_handler, NULL)
>  {
>  	enum pipe pipe;
>  
> -- 
> 2.31.0
> 

  parent reply	other threads:[~2022-06-02 12:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-31 22:03 [igt-dev] [PATCH i-g-t v1] tests/kms_pipe_crc_basic: Support custom CRC sources Jessica Zhang
2022-05-31 23:03 ` [igt-dev] ✗ GitLab.Pipeline: warning for " Patchwork
2022-05-31 23:33 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2022-06-01  0:44 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_pipe_crc_basic: Support custom CRC sources (rev2) Patchwork
2022-06-01  2:32 ` [igt-dev] ✗ Fi.CI.IGT: failure for tests/kms_pipe_crc_basic: Support custom CRC sources Patchwork
2022-06-01  4:17 ` [igt-dev] ✗ Fi.CI.IGT: failure for tests/kms_pipe_crc_basic: Support custom CRC sources (rev2) Patchwork
2022-06-01 18:15 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_pipe_crc_basic: Support custom CRC sources (rev3) Patchwork
2022-06-01 22:55 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2022-06-02 12:54 ` Petri Latvala [this message]
2022-06-02 20:41   ` [igt-dev] [PATCH i-g-t v1] tests/kms_pipe_crc_basic: Support custom CRC sources Jessica Zhang
2022-06-03  7:16     ` Petri Latvala
2022-06-03 17:06       ` Jessica Zhang
2022-06-06  8:01         ` Petri Latvala
2022-06-08 17:37           ` Jessica Zhang

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=Ypiy61MS536or/rv@platvala-desk.ger.corp.intel.com \
    --to=petri.latvala@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=quic_aravindh@quicinc.com \
    --cc=quic_jesszhan@quicinc.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.