[igt-dev] [PATCH i-g-t 1/6] tests/kms_flip_scaled_crc: Remove open coded igt_create_color_fb()

Ville Syrjala ville.syrjala at linux.intel.com
Fri Apr 16 17:53:07 UTC 2021


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Replace the hand rolled igt_create_color_fb() with the
real thing.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 tests/kms_flip_scaled_crc.c | 27 ++-------------------------
 1 file changed, 2 insertions(+), 25 deletions(-)

diff --git a/tests/kms_flip_scaled_crc.c b/tests/kms_flip_scaled_crc.c
index 35417396e980..8153fb890a17 100644
--- a/tests/kms_flip_scaled_crc.c
+++ b/tests/kms_flip_scaled_crc.c
@@ -94,34 +94,11 @@ const struct {
 static void setup_fb(data_t *data, struct igt_fb *newfb, uint32_t width,
 		     uint32_t height, uint64_t format, uint64_t modifier)
 {
-	struct drm_mode_fb_cmd2 f = {0};
-	cairo_t *cr;
-
 	igt_require(igt_display_has_format_mod(&data->display, format,
 					       modifier));
 
-	igt_create_bo_for_fb(data->drm_fd, width, height, format, modifier,
-			     newfb);
-	igt_assert(newfb->gem_handle > 0);
-
-	f.width = newfb->width;
-	f.height = newfb->height;
-	f.pixel_format = newfb->drm_format;
-	f.flags = LOCAL_DRM_MODE_FB_MODIFIERS;
-
-	for (int n = 0; n < newfb->num_planes; n++) {
-		f.handles[n] = newfb->gem_handle;
-		f.modifier[n] = newfb->modifier;
-		f.pitches[n] = newfb->strides[n];
-		f.offsets[n] = newfb->offsets[n];
-	}
-
-	cr = igt_get_cairo_ctx(data->drm_fd, newfb);
-	igt_paint_color(cr, 0, 0, newfb->width, newfb->height, 0, 1, 0);
-	igt_put_cairo_ctx(cr);
-
-	igt_assert(drmIoctl(data->drm_fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) == 0);
-	newfb->fb_id = f.fb_id;
+	igt_create_color_fb(data->drm_fd, width, height,
+			    format, modifier, 0, 1, 0, newfb);
 }
 
 static void free_fbs(data_t *data)
-- 
2.26.3



More information about the igt-dev mailing list