From: Imre Deak <imre.deak@intel.com>
To: <igt-dev@lists.freedesktop.org>
Subject: [PATCH i-g-t 2/3] lib/igt_kms: Add kmstest_wait_for_pageflip_timeout()
Date: Tue, 22 Oct 2024 18:53:10 +0300 [thread overview]
Message-ID: <20241022155311.2797257-3-imre.deak@intel.com> (raw)
In-Reply-To: <20241022155311.2797257-1-imre.deak@intel.com>
Add a function to wait for a page flip completion providing the timeout
duration. This is required by the next patch, using an Intel HW specific
pageflip timeout.
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
lib/igt_kms.c | 21 +++++++++++++++++----
lib/igt_kms.h | 1 +
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 99231d6e7..81a9930a2 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -2377,15 +2377,16 @@ unsigned int kmstest_get_vblank(int fd, int pipe, unsigned int flags)
}
/**
- * kmstest_wait_for_pageflip:
+ * kmstest_wait_for_pageflip_timeout:
* @fd: Opened drm file descriptor
+ * @timeout_us: timeout used for waiting
*
* Blocks until pageflip is completed
*/
-void kmstest_wait_for_pageflip(int fd)
+void kmstest_wait_for_pageflip_timeout(int fd, uint64_t timeout_us)
{
drmEventContext evctx = { .version = 2 };
- struct timeval timeout = { .tv_sec = 0, .tv_usec = 50000 };
+ struct timeval timeout = { .tv_sec = 0, .tv_usec = timeout_us };
fd_set fds;
int ret;
@@ -2398,7 +2399,8 @@ void kmstest_wait_for_pageflip(int fd)
} while (ret < 0 && errno == EINTR);
igt_fail_on_f(ret == 0,
- "Exceeded timeout (50ms) while waiting for a pageflip\n");
+ "Exceeded timeout (%" PRIu64 " us) while waiting for a pageflip\n",
+ timeout_us);
igt_assert_f(ret == 1,
"Waiting for pageflip failed with %d from select(drmfd)\n",
@@ -2407,6 +2409,17 @@ void kmstest_wait_for_pageflip(int fd)
igt_assert(drmHandleEvent(fd, &evctx) == 0);
}
+/**
+ * kmstest_wait_for_pageflip:
+ * @fd: Opened drm file descriptor
+ *
+ * Blocks until pageflip is completed using a 50 ms timeout.
+ */
+void kmstest_wait_for_pageflip(int fd)
+{
+ kmstest_wait_for_pageflip_timeout(fd, 50000);
+}
+
/**
* kms_has_vblank:
* @fd: DRM fd
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index fc7e4cda1..57e62d86c 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -310,6 +310,7 @@ void *kmstest_dumb_map_buffer(int fd, uint32_t handle, uint64_t size,
unsigned prot);
void kmstest_dumb_destroy(int fd, uint32_t handle);
void kmstest_wait_for_pageflip(int fd);
+void kmstest_wait_for_pageflip_timeout(int fd, uint64_t timeout_us);
unsigned int kmstest_get_vblank(int fd, int pipe, unsigned int flags);
bool kms_has_vblank(int fd);
--
2.44.2
next prev parent reply other threads:[~2024-10-22 15:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-22 15:53 [PATCH i-g-t 0/3] tests/i915/kms_flip_tiling: Fix timeouts with low vrefresh modes Imre Deak
2024-10-22 15:53 ` [PATCH i-g-t 1/3] lib/igt_kms: Add igt_kms_frame_time_from_vrefresh() Imre Deak
2024-10-24 4:12 ` Srikanth V, NagaVenkata
2024-11-15 11:48 ` Sharma, Swati2
2024-10-22 15:53 ` Imre Deak [this message]
2024-10-24 5:45 ` [PATCH i-g-t 2/3] lib/igt_kms: Add kmstest_wait_for_pageflip_timeout() Srikanth V, NagaVenkata
2024-10-24 10:29 ` Imre Deak
2024-11-15 11:55 ` Sharma, Swati2
2024-10-22 15:53 ` [PATCH i-g-t 3/3] tests/i915/kms_flip_tiling: Fix pageflip timeout for low vrefresh modes Imre Deak
2024-11-15 11:44 ` Sharma, Swati2
2024-11-15 17:11 ` Imre Deak
2024-11-18 8:01 ` Sharma, Swati2
2024-11-18 11:31 ` Imre Deak
2024-10-22 18:56 ` ✓ Fi.CI.BAT: success for tests/i915/kms_flip_tiling: Fix timeouts with " Patchwork
2024-10-22 19:43 ` ✓ CI.xeBAT: " Patchwork
2024-10-23 1:14 ` ✗ CI.xeFULL: failure " Patchwork
2024-10-23 2:49 ` ✗ 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=20241022155311.2797257-3-imre.deak@intel.com \
--to=imre.deak@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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