public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Manasi Navare <manasi.d.navare@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: igt-dev@lists.freedesktop.org,
	Madhumitha Tolakanahalli Pradeep
	<madhumitha.tolakanahalli.pradeep@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 2/3] tests/kms_dp_tiled_display: Flatten the page flip handler
Date: Mon, 14 Oct 2019 12:55:44 -0700	[thread overview]
Message-ID: <20191014195543.GB30388@intel.com> (raw)
In-Reply-To: <20191014181315.7430-2-ville.syrjala@linux.intel.com>

On Mon, Oct 14, 2019 at 09:13:14PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> No good reason to inline the crtc->connector lookup loops
> in the page flip handler. Just makes it hard to see what
> we're trying to achieve. Move the connector lookup into a
> separate function.
> 
> Cc: Madhumitha Tolakanahalli Pradeep <madhumitha.tolakanahalli.pradeep@intel.com>
> Cc: Manasi Navare <manasi.d.navare@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>

Manasi

> ---
>  tests/kms_dp_tiled_display.c | 57 +++++++++++++++++++-----------------
>  1 file changed, 30 insertions(+), 27 deletions(-)
> 
> diff --git a/tests/kms_dp_tiled_display.c b/tests/kms_dp_tiled_display.c
> index 7dde0a7132ed..175ff12f453b 100644
> --- a/tests/kms_dp_tiled_display.c
> +++ b/tests/kms_dp_tiled_display.c
> @@ -302,51 +302,54 @@ static void setup_framebuffer(data_t *data)
>  	}
>  }
>  
> +static data_connector_t *conn_for_crtc(data_t *data, unsigned int crtc_id)
> +{
> +	for (int i = 0; i < data->num_h_tiles; i++) {
> +		data_connector_t *conn = &data->conns[i];
> +
> +		if (data->display->pipes[conn->pipe].crtc_id == crtc_id)
> +			return conn;
> +	}
> +
> +	return NULL;
> +}
> +
>  static void page_flip_handler(int fd, unsigned int seq,
>  			      unsigned int tv_sec, unsigned int tv_usec,
>  			      unsigned int crtc_id, void *_data)
>  {
>  	data_t *data = _data;
> -	data_connector_t *conn;
> +	data_connector_t *conn = conn_for_crtc(data, crtc_id);
>  	struct timeval current_ts = {
>  		.tv_sec = tv_sec,
>  		.tv_usec = tv_usec,
>  	};
> -	int i;
> +	struct timeval diff;
> +	long usec;
>  
>  	if (!timerisset(&data->first_ts))
>  		data->first_ts = current_ts;
>  
> +	igt_assert_f(conn, "Got page-flip event for unexpected CRTC %u\n",
> +		     crtc_id);
> +
> +	igt_assert_f(!conn->got_page_flip, "Got two page-flips for CRTC %u\n",
> +		     crtc_id);
> +
>  	igt_debug("Page Flip Event received from CRTC:%d at %u:%u\n", crtc_id,
>  		  tv_sec, tv_usec);
>  
> -	for (i = 0; i < data->num_h_tiles; i++) {
> +	conn->got_page_flip = true;
>  
> -		conn = &data->conns[i];
> -		if (data->display->pipes[conn->pipe].crtc_id == crtc_id) {
> -			struct timeval diff;
> -			long usec;
> -
> -			igt_assert_f(!conn->got_page_flip,
> -				     "Got two page-flips for CRTC %u\n",
> -				     crtc_id);
> -			conn->got_page_flip = true;
> -
> -			timersub(&current_ts, &data->first_ts, &diff);
> -			usec = diff.tv_sec * 1000000 + diff.tv_usec;
> -
> -			/*
> -			 * For seamless tear-free display, the page flip event timestamps
> -			 * from all the tiles should not differ by more than 10us.
> -			 */
> -			igt_fail_on_f(abs(usec) >= 10, "Delayed page flip event from CRTC:%d at %u:%u\n",
> -				      crtc_id, tv_sec, tv_usec);
> -			return;
> -		}
> -	}
> +	timersub(&current_ts, &data->first_ts, &diff);
> +	usec = diff.tv_sec * 1000000 + diff.tv_usec;
>  
> -	igt_assert_f(false, "Got page-flip event for unexpected CRTC %u\n",
> -		     crtc_id);
> +	/*
> +	 * For seamless tear-free display, the page flip event timestamps
> +	 * from all the tiles should not differ by more than 10us.
> +	 */
> +	igt_fail_on_f(abs(usec) >= 10, "Delayed page flip event from CRTC:%d at %u:%u\n",
> +		      crtc_id, tv_sec, tv_usec);
>  }
>  
>  static bool got_all_page_flips(data_t *data)
> -- 
> 2.21.0
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-10-14 19:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-14 18:13 [igt-dev] [PATCH i-g-t 1/3] tests/kms_dp_tiled_display: Fix bogus abs() Ville Syrjala
2019-10-14 18:13 ` [igt-dev] [PATCH i-g-t 2/3] tests/kms_dp_tiled_display: Flatten the page flip handler Ville Syrjala
2019-10-14 19:55   ` Manasi Navare [this message]
2019-10-14 18:13 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_tiled_display: Get rid of DP stuff Ville Syrjala
2019-10-14 19:57   ` Manasi Navare
2019-10-14 20:21     ` Ville Syrjälä
2019-10-14 20:58       ` Manasi Navare
2019-10-15 12:27         ` Ville Syrjälä
2019-10-16 19:32           ` Manasi Navare
2019-10-14 19:11 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] tests/kms_dp_tiled_display: Fix bogus abs() Patchwork
2019-10-14 19:50 ` [igt-dev] [PATCH i-g-t 1/3] " Manasi Navare
2019-10-15  5:06 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/3] " Patchwork

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=20191014195543.GB30388@intel.com \
    --to=manasi.d.navare@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=madhumitha.tolakanahalli.pradeep@intel.com \
    --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