public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Lisovskiy, Stanislav" <stanislav.lisovskiy@intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"martin.peres@linux.intel.com" <martin.peres@linux.intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t] igt: tests: kms_vblank: Stop using magic value
Date: Tue, 2 Apr 2019 13:45:17 +0000	[thread overview]
Message-ID: <20aa13d59ee5a4e3e09bdb23bc89474c486241b0.camel@intel.com> (raw)
In-Reply-To: <ccdc1bc1-d9f4-97ef-43be-1263542a8b29@linux.intel.com>

On Tue, 2019-04-02 at 16:16 +0300, Martin Peres wrote:
> On 02/04/2019 16:00, Lisovskiy, Stanislav wrote:
> > On Tue, 2019-03-19 at 15:46 +0200, Stanislav Lisovskiy wrote:
> > > Lot of tests fail, when assertion checking
> > > how many vblanks should have passed during
> > > suspend/resume is compared to magic value 150.
> > > 
> > > At the same time even for failed cases, sometimes
> > > it is clearly visible that there were no issue -
> > > simply suspend took longer on that machine.
> > > If suspend took around 10 s and we get roughly
> > > 60 vblanks per second the value then should be
> > > around 600 and not 150.
> > > 
> > > This change removes 150 magic value and starts
> > > to use calculation of what it is expected to
> > > be instead of being hardcoded.
> > > 
> > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104894
> > > Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com
> > > >
> > > ---
> > >  tests/kms_vblank.c | 15 +++++++++++++--
> > >  1 file changed, 13 insertions(+), 2 deletions(-)
> > 
> > Martin, could you please comment, what was I supposed to fix
> > here, based on our offline discussion, as I seem to have forgotten
> > this already..
> 
> Pretty sure what I was asking was to make a window of acceptable
> vblank
> values, for example [expected-2, expected+2].
> 
> The reason why we can't be sure what value this will be is because we
> don't know how early vblank gets disabled compared to when the
> monotonic
> counter gets disabled. This is especially true in the presence of
> multiple monitors (no idea if we first wait for vblank on all
> monitors
> before suspend or not).
> 
> I hope this is what you wanted to hear!

Yes, exactly. Thank you, I remember now :)

> > 
> > > 
> > > diff --git a/tests/kms_vblank.c b/tests/kms_vblank.c
> > > index dafadb58..80b2a23a 100644
> > > --- a/tests/kms_vblank.c
> > > +++ b/tests/kms_vblank.c
> > > @@ -338,8 +338,13 @@ static void vblank_ts_cont(data_t *data, int
> > > fd,
> > > int nchildren)
> > >  	igt_output_t *output = data->output;
> > >  	int seq1, seq2;
> > >  	union drm_wait_vblank vbl;
> > > +	struct timespec start, end;
> > > +	int estimated_vblanks = 0;
> > > +	int vrefresh = igt_output_get_mode(output)->vrefresh;
> > > +	double time_elapsed;
> > >  
> > >  	seq1 = get_vblank(fd, data->pipe, 0);
> > > +	clock_gettime(CLOCK_MONOTONIC, &start);
> > >  
> > >  	if (data->flags & DPMS) {
> > >  		igt_output_set_prop_value(output, IGT_CONNECTOR_DPMS,
> > > DRM_MODE_DPMS_OFF);
> > > @@ -377,11 +382,17 @@ static void vblank_ts_cont(data_t *data,
> > > int
> > > fd, int nchildren)
> > >  	}
> > >  
> > >  	seq2 = get_vblank(fd, data->pipe, 0);
> > > +	clock_gettime(CLOCK_MONOTONIC, &end);
> > > +
> > > +	time_elapsed = igt_time_elapsed(&start, &end);
> > > +	estimated_vblanks = (int)(time_elapsed * vrefresh) + 1;
> > >  
> > >  	igt_debug("testing ts continuity: Current frame %u, old frame
> > > %u\n", seq2, seq1);
> > >  
> > > -	igt_assert_f(seq2 - seq1 >= 0, "unexpected vblank seq %u,
> > > should be >= %u\n", seq2, seq1);
> > > -	igt_assert_f(seq2 - seq1 <= 150, "unexpected vblank seq %u,
> > > should be < %u\n", seq2, seq1 + 150);
> > > +	igt_assert_f(seq2 - seq1 >= 0, "elapsed %f(%d vblanks)
> > > unexpected vblank seq %u, should be >= %u\n", time_elapsed,
> > > +			estimated_vblanks, seq2, seq1);
> > > +	igt_assert_f(seq2 - seq1 <= estimated_vblanks, "elapsed %f(%d
> > > vblanks) unexpected vblank seq %u, should be < %u\n",
> > > time_elapsed,
> > > +			estimated_vblanks, seq2, seq1 +
> > > estimated_vblanks);
> > >  }
> > >  
> > >  static void run_subtests_for_pipe(data_t *data)
> 
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

      reply	other threads:[~2019-04-02 13:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19 13:46 [igt-dev] [PATCH i-g-t] igt: tests: kms_vblank: Stop using magic value Stanislav Lisovskiy
2019-03-19 14:48 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-03-19 21:21 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-04-02 13:00 ` [igt-dev] [PATCH i-g-t] " Lisovskiy, Stanislav
2019-04-02 13:16   ` Martin Peres
2019-04-02 13:45     ` Lisovskiy, Stanislav [this message]

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=20aa13d59ee5a4e3e09bdb23bc89474c486241b0.camel@intel.com \
    --to=stanislav.lisovskiy@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=martin.peres@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