[PATCH i-g-t 2/3] lib/igt_kms: Add kmstest_wait_for_pageflip_timeout()

Imre Deak imre.deak at intel.com
Thu Oct 24 10:29:57 UTC 2024


On Thu, Oct 24, 2024 at 08:45:53AM +0300, Srikanth V, NagaVenkata wrote:
> 
> 
> > -----Original Message-----
> > From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of Imre
> > Deak
> > Sent: Tuesday, October 22, 2024 9:23 PM
> > To: igt-dev at lists.freedesktop.org
> > Subject: [PATCH i-g-t 2/3] lib/igt_kms: Add
> > kmstest_wait_for_pageflip_timeout()
> >
> > 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 at 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); }
> > +
> 
> Do we still need this definition of this function ?

kmstest_wait_for_pageflip() is used in many places.

> >  /**
> >   * 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
> 


More information about the igt-dev mailing list