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

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Apr 19 14:43:53 UTC 2024


Hi Arthur,
On 2024-04-11 at 15:51:14 -0300, Arthur Grillo wrote:
> On the stress_driver(), the fbs and the sync file are not released. Fix
> that by freeing all the allocated resources.
> 
> Signed-off-by: Arthur Grillo <arthurgrillo at riseup.net>

Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

> ---
>  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 bc548fae61f8..76e82e0d76ea 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
> 


More information about the igt-dev mailing list