[PATCH i-g-t v4 5/7] benchmarks/kms_fb_stress: Don't paint the FB's if the format is not supported by Pixman

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Apr 19 15:00:23 UTC 2024


Hi Arthur,
On 2024-04-11 at 15:51:15 -0300, Arthur Grillo wrote:
> Pixman requires strides to be divisible by sizeof(uint32_t).
> So, don't paint the FB's if the stride is not.

Why are you limiting stress to pixman? What about an option for
non-dword aligned stress benchmark? Btw most hardware use dword
or qword alignment.

> 
> Signed-off-by: Arthur Grillo <arthurgrillo at riseup.net>
> ---
>  benchmarks/kms_fb_stress.c | 62 +++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 48 insertions(+), 14 deletions(-)
> 
> diff --git a/benchmarks/kms_fb_stress.c b/benchmarks/kms_fb_stress.c
> index 76e82e0d76ea..bb85dfb18d2b 100644
> --- a/benchmarks/kms_fb_stress.c
> +++ b/benchmarks/kms_fb_stress.c
> @@ -46,26 +46,60 @@ static void plane_setup(struct plane_t *plane, int index)
>  	igt_plane_set_fb(plane->base, &plane->fbs[index]);
>  }
>  
> +static bool have_supported_pixman_stride(int fd, struct plane_t *plane) {
> +	unsigned stride;
> +
> +	igt_calc_fb_size(fd, plane->rect.width, plane->rect.height,
> +			 plane->format, DRM_FORMAT_MOD_LINEAR,
> +			 NULL, &stride);
> +
> +	return stride % sizeof(uint32_t) == 0;

I do not see int this function pixman related ioctl, all you
do is checking stride is dword aligned, imho it would be better
to rename this function, like has_stride_dw_aligned (you are
free to find out better name).

> +}
> +
>  static void gen_fbs(struct data_t *data)
>  {
>  	struct kms_t *kms = &data->kms;
>  	drmModeModeInfo *mode = igt_output_get_mode(data->wb_output);
>  
>  	for (int i = 0; i < NUM_FBS; i++) {
> -		igt_create_color_fb(data->fd, kms->primary.rect.width, kms->primary.rect.height,
> -				    kms->primary.format, DRM_FORMAT_MOD_LINEAR,
> -				    !i, i, i,
> -				    &kms->primary.fbs[i]);
> -
> -		igt_create_color_fb(data->fd, kms->overlay_a.rect.width, kms->overlay_a.rect.height,
> -				    kms->overlay_a.format, DRM_FORMAT_MOD_LINEAR,
> -				    i, !i, i,
> -				    &kms->overlay_a.fbs[i]);
> -
> -		igt_create_color_fb(data->fd, kms->overlay_b.rect.width, kms->overlay_b.rect.height,
> -				    kms->overlay_b.format, DRM_FORMAT_MOD_LINEAR,
> -				    i, i, !i,
> -				    &kms->overlay_b.fbs[i]);
> +		if (have_supported_pixman_stride(data->fd, &kms->primary)) {
> +			igt_create_color_fb(data->fd,
> +					    kms->primary.rect.width, kms->primary.rect.height,
> +					    kms->primary.format, DRM_FORMAT_MOD_LINEAR,
> +					    !i, i, i,
> +					    &kms->primary.fbs[i]);
> +		} else {
> +			igt_create_fb(data->fd,
> +				      kms->primary.rect.width, kms->primary.rect.height,
> +				      kms->primary.format, DRM_FORMAT_MOD_LINEAR,
> +				      &kms->primary.fbs[i]);
> +		}
> +
> +		if (have_supported_pixman_stride(data->fd, &kms->overlay_a)) {
> +			igt_create_color_fb(data->fd,
> +					    kms->overlay_a.rect.width, kms->overlay_a.rect.height,
> +					    kms->overlay_a.format, DRM_FORMAT_MOD_LINEAR,
> +					    i, !i, i,
> +					    &kms->overlay_a.fbs[i]);
> +		} else {
> +			igt_create_fb(data->fd,
> +				      kms->overlay_a.rect.width, kms->overlay_a.rect.height,
> +				      kms->overlay_a.format, DRM_FORMAT_MOD_LINEAR,
> +				      &kms->overlay_a.fbs[i]);
> +		}

It looks like repeating code, maybe create a function?

Regards,
Kamil

> +
> +		if (have_supported_pixman_stride(data->fd, &kms->overlay_b)) {
> +			igt_create_color_fb(data->fd,
> +					    kms->overlay_b.rect.width, kms->overlay_b.rect.height,
> +					    kms->overlay_b.format, DRM_FORMAT_MOD_LINEAR,
> +					    i, i, !i,
> +					    &kms->overlay_b.fbs[i]);
> +		} else {
> +			igt_create_fb(data->fd,
> +				      kms->overlay_b.rect.width, kms->overlay_b.rect.height,
> +				      kms->overlay_b.format, DRM_FORMAT_MOD_LINEAR,
> +				      &kms->overlay_b.fbs[i]);
> +		}
>  
>  		kms->writeback.rect.width = mode->hdisplay;
>  		kms->writeback.rect.height = mode->vdisplay;
> 
> -- 
> 2.44.0
> 


More information about the igt-dev mailing list