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

Arthur Grillo arthurgrillo at riseup.net
Fri Sep 13 00:39:30 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 | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/benchmarks/kms_fb_stress.c b/benchmarks/kms_fb_stress.c
index 25673d57f593..dce69d0b5b81 100644
--- a/benchmarks/kms_fb_stress.c
+++ b/benchmarks/kms_fb_stress.c
@@ -45,10 +45,27 @@ 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]);
+	struct igt_fb stride_lookup_fb;
+
+	igt_init_fb(&stride_lookup_fb, fd, plane->rect.width, plane->rect.height,
+		    plane->format, DRM_FORMAT_MOD_LINEAR,
+		    IGT_COLOR_YCBCR_BT709,
+		    IGT_COLOR_YCBCR_LIMITED_RANGE);
+
+	igt_calc_fb_size(&stride_lookup_fb);
+
+	if (stride_lookup_fb.strides[0] % 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.46.0



More information about the igt-dev mailing list