[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
Arthur Grillo
arthurgrillo at riseup.net
Thu Apr 11 18:51:15 UTC 2024
Pixman requires strides to be divisible by sizeof(uint32_t).
So, don't paint the FB's if the stride is not.
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;
+}
+
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]);
+ }
+
+ 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