[igt-dev] [PATCH i-g-t v2 11/17] tests/kms_big_fb: Optimize setup_fb function

venkata.sai.patnana at intel.com venkata.sai.patnana at intel.com
Fri Jun 11 09:59:15 UTC 2021


From: Kunal Joshi <kunal1.joshi at intel.com>

libcario takes a lot of time converting 32bpp fb to 64bpp fb,
When fb memory is given by kernel its zeroed, here two different color fbs,
black and green are created hence if kernel give zeroed fbs there's
possibility to skip zeroing it again thus saving some time

Cc: Karthik B S <karthik.b.s at intel.com>
Cc: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
Signed-off-by: Juha-Pekka Heikkilä <juha-pekka.heikkila at intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi at intel.com>
---
 tests/kms_big_fb.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tests/kms_big_fb.c b/tests/kms_big_fb.c
index 89ea0f23e2..3e19450a42 100644
--- a/tests/kms_big_fb.c
+++ b/tests/kms_big_fb.c
@@ -115,12 +115,15 @@ static void setup_fb(data_t *data, struct igt_fb *newfb, uint32_t width,
 		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,
-			data->planeclearrgb[0],
-			data->planeclearrgb[1],
-			data->planeclearrgb[2]);
-	igt_put_cairo_ctx(cr);
+       if (data->planeclearrgb[0] != 0.0 || data->planeclearrgb[1] != 0.0 ||
+           data->planeclearrgb[2] != 0.0) {
+               cr = igt_get_cairo_ctx(data->drm_fd, newfb);
+               igt_paint_color(cr, 0, 0, newfb->width, newfb->height,
+                               data->planeclearrgb[0],
+                               data->planeclearrgb[1],
+                               data->planeclearrgb[2]);
+               igt_put_cairo_ctx(cr);
+       }
 
 	igt_assert(drmIoctl(data->drm_fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) == 0);
 	newfb->fb_id = f.fb_id;
-- 
2.25.1



More information about the igt-dev mailing list