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

Arthur Grillo arthurgrillo at riseup.net
Mon Apr 22 22:18:21 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 | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/benchmarks/kms_fb_stress.c b/benchmarks/kms_fb_stress.c
index e028424bb3e4..8775fabdd164 100644
--- a/benchmarks/kms_fb_stress.c
+++ b/benchmarks/kms_fb_stress.c
@@ -48,10 +48,24 @@ static void plane_setup(struct plane_t *plane, int index)
 
 static void create_fb(int fd, struct plane_t *plane, int fb_index, double r, double g, double b)
 {
-	igt_create_color_fb(fd, plane->rect.width, plane->rect.height,
-			    plane->format, DRM_FORMAT_MOD_LINEAR,
-			    r, g, b,
-			    &plane->fbs[fb_index]);
+	unsigned int stride;
+
+	igt_calc_fb_size(fd, plane->rect.width, plane->rect.height,
+			 plane->format, DRM_FORMAT_MOD_LINEAR,
+			 NULL, &stride);
+
+	if (stride % sizeof(uint32_t) == 0) {
+		igt_create_color_fb(fd,
+				    plane->rect.width, plane->rect.height,
+				    plane->format, DRM_FORMAT_MOD_LINEAR,
+				    r, g, b,
+				    &plane->fbs[fb_index]);
+	} else {
+		igt_create_fb(fd,
+			      plane->rect.width, plane->rect.height,
+			      plane->format, DRM_FORMAT_MOD_LINEAR,
+			      &plane->fbs[fb_index]);
+	}
 }
 
 static void gen_fbs(struct data_t *data)

-- 
2.44.0



More information about the igt-dev mailing list