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

venkata.sai.patnana at intel.com venkata.sai.patnana at intel.com
Fri Jun 18 10:44:57 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>
Reviewed-by: Karthik B S <karthik.b.s 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 3cbf3e2e..dbb9ac46 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.32.0



More information about the igt-dev mailing list