[PATCH i-g-t v5 4/8] benchmarks/kms_fb_stress: Free resources on the stress procedure

Louis Chauvet louis.chauvet at bootlin.com
Wed May 22 09:04:12 UTC 2024


Reviewed-by: Louis Chauvet <louis.chauvet at bootlin.com>
Tested-by: Louis Chauvet <louis.chauvet at bootlin.com>

Le 22/04/24 - 19:18, Arthur Grillo a écrit :
> On the stress_driver(), the fbs and the sync file are not released. Fix
> that by freeing all the allocated resources.
> 
> Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> Signed-off-by: Arthur Grillo <arthurgrillo at riseup.net>
> ---
>  benchmarks/kms_fb_stress.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/benchmarks/kms_fb_stress.c b/benchmarks/kms_fb_stress.c
> index d2d7bd12ca86..433e751273e6 100644
> --- a/benchmarks/kms_fb_stress.c
> +++ b/benchmarks/kms_fb_stress.c
> @@ -165,11 +165,30 @@ static void stress_driver(struct data_t *data)
>  		igt_output_set_writeback_fb(data->wb_output, &data->kms.writeback.fbs[fb_index]);
>  
>  		igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +
> +		if (data->wb_output->writeback_out_fence_fd != -1) {
> +			close(data->wb_output->writeback_out_fence_fd);
> +			data->wb_output->writeback_out_fence_fd = -1;
> +		}
>  	}
>  
>  	igt_assert_eq(igt_gettime(&now), 0);
>  	elapsed = igt_time_elapsed(&then, &now);
>  
> +	igt_plane_set_fb(data->kms.primary.base, NULL);
> +	igt_plane_set_fb(data->kms.overlay_a.base, NULL);
> +	igt_plane_set_fb(data->kms.overlay_b.base, NULL);
> +	igt_output_set_writeback_fb(data->wb_output, NULL);
> +
> +	for (int i = 0; i < NUM_FBS; i++) {
> +		igt_remove_fb(data->fd, &data->kms.primary.fbs[i]);
> +		igt_remove_fb(data->fd, &data->kms.overlay_a.fbs[i]);
> +		igt_remove_fb(data->fd, &data->kms.overlay_b.fbs[i]);
> +		igt_remove_fb(data->fd, &data->kms.writeback.fbs[i]);
> +	}
> +
> +	igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +
>  	igt_info("Time spent in the loop with %d frames: %lfs.\n", FRAME_COUNT, elapsed);
>  }
>  
> 
> -- 
> 2.44.0
> 

-- 
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


More information about the igt-dev mailing list