[PATCH i-g-t v3 3/4] tests/intel/kms_pm_dc: Add polling for deep-pkgc

Kandpal, Suraj suraj.kandpal at intel.com
Mon Jul 29 06:49:34 UTC 2024



> -----Original Message-----
> From: Naladala, Ramanaidu <ramanaidu.naladala at intel.com>
> Sent: Friday, July 26, 2024 3:38 PM
> To: igt-dev at lists.freedesktop.org
> Cc: B, Jeevan <jeevan.b at intel.com>; Kandpal, Suraj
> <suraj.kandpal at intel.com>; Konieczny, Kamil <kamil.konieczny at intel.com>;
> Naladala, Ramanaidu <ramanaidu.naladala at intel.com>
> Subject: [PATCH i-g-t v3 3/4] tests/intel/kms_pm_dc: Add polling for deep-
> pkgc
> 
> Added vblank wait to synchronize with frame time. Replaced
> read_pkgc_counter function with igt_wait function to poll for
> PKGC10 every 5ms until 2 frame times are reached.

Use imperative here too.

> 
> v2: Address and correct review comments (Suraj, Jeevan)
> v3: Update commit subject/message.  (Kamil)
> 
> Signed-off-by: Naladala Ramanaidu <ramanaidu.naladala at intel.com>
> ---
>  tests/intel/kms_pm_dc.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/intel/kms_pm_dc.c b/tests/intel/kms_pm_dc.c index
> 09d362694..92c146d6c 100644
> --- a/tests/intel/kms_pm_dc.c
> +++ b/tests/intel/kms_pm_dc.c
> @@ -635,23 +635,24 @@ static void test_deep_pkgc_state(data_t *data)
>  	setup_videoplayback(data);
> 
>  	primary = igt_output_get_plane_type(data->output,
> DRM_PLANE_TYPE_PRIMARY);
> -	pre_val = read_pkgc_counter(data->debugfs_root_fd);
> -	delay = 1 * (MSECS / (data->mode->vrefresh - 10));
> -
>  	igt_plane_set_fb(primary, &data->fb_rgb);
>  	igt_display_commit(&data->display);
> +	/* Waiting for the vblank to sync the frame time */
> +	igt_wait_for_vblank_count(data->drm_fd, data-
> >display.pipes[pipe].crtc_offset, 1);
> +	pre_val = read_pkgc_counter(data->debugfs_root_fd);

Why sleep ? not explained 0.5 seems like a magic number here
> +	usleep(delay * 0.5);
> 
>  	while (time(NULL) - start < duration) {
>  		flip = !flip;
>  		igt_plane_set_fb(primary, flip ? &data->fb_rgb : &data-
> >fb_rgr);
>  		igt_display_commit(&data->display);
> +		igt_wait((cur_val = read_pkgc_counter(data-
> >debugfs_root_fd)) > pre_val,
> +			 delay * 2, 5);

Once again do not use magic numbers like this (5) it causes confusion either have a define or a variable.

Regards,
Suraj Kandpal

> 
> -		cur_val = read_pkgc_counter(data->debugfs_root_fd);
>  		if (cur_val > pre_val) {
>  			pkgc_flag = true;
>  			break;
>  		}
> -		usleep(delay);
>  	}
> 
>  	cleanup_dc3co_fbs(data);
> --
> 2.43.0



More information about the igt-dev mailing list