[PATCH i-g-t v1 1/2] tests/kms_vrr: Add function to return vblank timestamp

B, Jeevan jeevan.b at intel.com
Mon Feb 3 06:41:56 UTC 2025


> -----Original Message-----
> From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of Naladala
> Ramanaidu
> Sent: Friday, January 31, 2025 5:23 AM
> To: igt-dev at lists.freedesktop.org
> Cc: Golani, Mitulkumar Ajitkumar <mitulkumar.ajitkumar.golani at intel.com>;
> Sharma, Swati2 <swati2.sharma at intel.com>; Naladala, Ramanaidu
> <ramanaidu.naladala at intel.com>
> Subject: [PATCH i-g-t v1 1/2] tests/kms_vrr: Add function to return vblank
> timestamp
> 
> This is useful for subtests that require precise vblank timestamps.
> 
> Signed-off-by: Naladala Ramanaidu <ramanaidu.naladala at intel.com>
> ---
>  tests/kms_vrr.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/tests/kms_vrr.c b/tests/kms_vrr.c index e7d2ff1db..fac7cb4f7 100644
> --- a/tests/kms_vrr.c
> +++ b/tests/kms_vrr.c
> @@ -172,6 +172,27 @@ static uint64_t get_kernel_event_ns(data_t *data,
> uint32_t event)
>  	return ev.tv_sec * NSECS_PER_SEC + ev.tv_usec * 1000ull;  }
> 
Can we reuse the existing code for igt_wait_for_vblank ?? 
Also why are we adding this in kms_vrr.c it should be in lib. 

> +/*
> + * Wait for an vblank event and return its timestamp in microseconds.
> + *
> + * This blocks untill the event is received.
> + */
> +static uint64_t wait_for_vblank(data_t *data, int pipe) {
> +	uint32_t pipe_id_flag;
> +	drmVBlank vbl;
> +
> +	memset(&vbl, 0, sizeof(vbl));
> +
> +	pipe_id_flag = kmstest_get_vbl_flag(pipe);
> +
> +	vbl.request.type = DRM_VBLANK_RELATIVE | pipe_id_flag;
> +	vbl.request.sequence = 1;
> +	do_ioctl(data->drm_fd, DRM_IOCTL_WAIT_VBLANK, &vbl);
> +
> +	return (vbl.reply.tval_sec * 1000000 + vbl.reply.tval_usec); }
> +
>  /*
>   * Returns the current CLOCK_MONOTONIC time in nanoseconds.
>   * The regular IGT helpers can't be used since they default to
> --
> 2.25.1



More information about the igt-dev mailing list