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 1/3] tests/kms_dp_tiled_display: Fix bogus abs()
Date: Mon, 14 Oct 2019 12:50:08 -0700 [thread overview]
Message-ID: <20191014195007.GA30388@intel.com> (raw)
In-Reply-To: <20191014181315.7430-1-ville.syrjala@linux.intel.com>
On Mon, Oct 14, 2019 at 09:13:13PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> We're trying to take an absolute value from a unsigned
> number. Fix it.
>
> And while we're here get rid of the static variables so
> that this can be used for multiple page flips if needed.
>
> 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>
Looks good to me
Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>
Manasi
> ---
> tests/kms_dp_tiled_display.c | 27 ++++++++++++++++-----------
> 1 file changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/tests/kms_dp_tiled_display.c b/tests/kms_dp_tiled_display.c
> index dc4866d2f15a..7dde0a7132ed 100644
> --- a/tests/kms_dp_tiled_display.c
> +++ b/tests/kms_dp_tiled_display.c
> @@ -58,6 +58,7 @@ typedef struct {
> igt_display_t *display;
> data_connector_t *conns;
> enum igt_commit_style commit;
> + struct timeval first_ts;
> } data_t;
>
> static int drm_property_is_tile(drmModePropertyPtr prop)
> @@ -307,10 +308,15 @@ static void page_flip_handler(int fd, unsigned int seq,
> {
> data_t *data = _data;
> data_connector_t *conn;
> - bool is_on_time = false;
> - static unsigned int _tv_sec, _tv_usec;
> + struct timeval current_ts = {
> + .tv_sec = tv_sec,
> + .tv_usec = tv_usec,
> + };
> int i;
>
> + if (!timerisset(&data->first_ts))
> + data->first_ts = current_ts;
> +
> igt_debug("Page Flip Event received from CRTC:%d at %u:%u\n", crtc_id,
> tv_sec, tv_usec);
>
> @@ -318,24 +324,22 @@ static void page_flip_handler(int fd, unsigned int seq,
>
> 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;
>
> - /* Skip the following checks for the first page flip event */
> - if (_tv_sec == 0 || _tv_usec == 0) {
> - _tv_sec = tv_sec;
> - _tv_usec = tv_usec;
> - return;
> - }
> + timersub(¤t_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.
> */
> - is_on_time = tv_sec == _tv_sec && (abs(tv_usec - _tv_usec) < 10);
> -
> - igt_fail_on_f(!is_on_time, "Delayed page flip event from CRTC:%d at %u:%u\n",
> + 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;
> }
> @@ -394,6 +398,7 @@ igt_main
> get_connectors(&data);
> setup_mode(&data);
> setup_framebuffer(&data);
> + timerclear(&data.first_ts);
> igt_display_commit_atomic(data.display, DRM_MODE_ATOMIC_NONBLOCK |
> DRM_MODE_PAGE_FLIP_EVENT, &data);
> while (!got_all_page_flips(&data)) {
> --
> 2.21.0
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-10-14 19:48 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
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 ` Manasi Navare [this message]
2019-10-15 5:06 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20191014195007.GA30388@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 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.