[PATCH i-g-t 2/3] tests/kms_async_flips: Reuse the already mmapped buffer

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Tue Mar 19 13:24:42 UTC 2024


On Fri, Mar 15, 2024 at 11:41:41AM +0530, Vandita Kulkarni wrote:
> In crc test case where we are trying to update the fb
> dont mmap it agian. On some platforms it was found that
> updating a newly mmapped buffer takes longer time.
> 
> Signed-off-by: Vandita Kulkarni <vandita.kulkarni at intel.com>
> ---
>  tests/kms_async_flips.c | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
> index 2895168f7..4658ca4c0 100644
> --- a/tests/kms_async_flips.c
> +++ b/tests/kms_async_flips.c
> @@ -221,12 +221,19 @@ static void test_init_fbs(data_t *data)
>  		prev_modifier = data->modifier;
>  
>  		if (data->bufs[0].fb_id) {
> -			for (i = 0; i < NUM_FBS; i++)
> +			for (i = 0; i < NUM_FBS; i++) {
> +				if (is_intel_device(data->drm_fd))
> +					igt_fb_unmap_buffer(&data->bufs[i], data->bufs[i].driver_priv);

Ok, you're smuggling mmaped fb via driver_priv field. It's fine for me,
I see only nouveau is using this field on their need but this won't
interfere. From me:

Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>

--
Zbigniew

>  				igt_remove_fb(data->drm_fd, &data->bufs[i]);
> +			}
>  		}
>  
> -		for (i = 0; i < NUM_FBS; i++)
> +		for (i = 0; i < NUM_FBS; i++) {
>  			make_fb(data, &data->bufs[i], width, height, i);
> +			if (is_intel_device(data->drm_fd))
> +				data->bufs[i].driver_priv = igt_fb_map_buffer(data->drm_fd,
> +									      &data->bufs[i]);
> +		}
>  	}
>  
>  	igt_plane_set_fb(data->plane, &data->bufs[0]);
> @@ -730,8 +737,11 @@ igt_main
>  	}
>  
>  	igt_fixture {
> -		for (i = 0; i < NUM_FBS; i++)
> +		for (i = 0; i < NUM_FBS; i++) {
> +			if (is_intel_device(data.drm_fd))
> +				igt_fb_unmap_buffer(&data.bufs[i], data.bufs[i].driver_priv);
>  			igt_remove_fb(data.drm_fd, &data.bufs[i]);
> +		}
>  
>  		if (is_intel_device(data.drm_fd))
>  			buf_ops_destroy(data.bops);
> -- 
> 2.34.1
> 


More information about the igt-dev mailing list