[v2 2/2] tests/kms_async_flips: Reuse the already mmapped buffer

Vandita Kulkarni vandita.kulkarni at intel.com
Thu Apr 11 08:08:46 UTC 2024


In crc test case where we are trying to update the fb
dont mmap it agian. On some platforms it was found that
updating a newly mmapped buffer takes longer time.

Signed-off-by: Vandita Kulkarni <vandita.kulkarni at intel.com>
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
 tests/kms_async_flips.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
index 2895168f7..05f1f72cf 100644
--- a/tests/kms_async_flips.c
+++ b/tests/kms_async_flips.c
@@ -221,12 +221,19 @@ static void test_init_fbs(data_t *data)
 		prev_modifier = data->modifier;
 
 		if (data->bufs[0].fb_id) {
-			for (i = 0; i < NUM_FBS; i++)
+			for (i = 0; i < NUM_FBS; i++) {
+				if (is_intel_device(data->drm_fd))
+					igt_fb_unmap_buffer(&data->bufs[i], data->bufs[i].driver_priv);
 				igt_remove_fb(data->drm_fd, &data->bufs[i]);
+			}
 		}
 
-		for (i = 0; i < NUM_FBS; i++)
+		for (i = 0; i < NUM_FBS; i++) {
 			make_fb(data, &data->bufs[i], width, height, i);
+			if (is_intel_device(data->drm_fd))
+				data->bufs[i].driver_priv = igt_fb_map_buffer(data->drm_fd,
+									      &data->bufs[i]);
+		}
 	}
 
 	igt_plane_set_fb(data->plane, &data->bufs[0]);
@@ -538,8 +545,7 @@ static void paint_fb(data_t *data, struct igt_fb *fb,
 {
 	if (is_intel_device(data->drm_fd)) {
 		igt_draw_rect_fb(data->drm_fd, data->bops, 0, fb,
-				 igt_draw_supports_method(data->drm_fd, IGT_DRAW_MMAP_GTT) ?
-				 IGT_DRAW_MMAP_GTT : IGT_DRAW_MMAP_WC,
+				 IGT_DRAW_MMAP_PTR,
 				 0, 0, width, height, color);
 	} else {
 		cairo_t *cr;
@@ -730,8 +736,11 @@ igt_main
 	}
 
 	igt_fixture {
-		for (i = 0; i < NUM_FBS; i++)
+		for (i = 0; i < NUM_FBS; i++) {
+			if (is_intel_device(data.drm_fd))
+				igt_fb_unmap_buffer(&data.bufs[i], data.bufs[i].driver_priv);
 			igt_remove_fb(data.drm_fd, &data.bufs[i]);
+		}
 
 		if (is_intel_device(data.drm_fd))
 			buf_ops_destroy(data.bops);
-- 
2.43.2



More information about the Intel-gfx-trybot mailing list