[Intel-gfx] [PATCH i-g-t] tests/kms_pwrite_crc: Use drmModeSetPlane() instead of igt_plane_set_fb()

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Tue Aug 11 07:01:18 PDT 2015


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

igt_plane_set_fb()+igt_display_commit() have too much overhead, and that
causes the cache to get flushed before we flip, making the test
useless, at least on machines with small LLC. Switch to
drmModeSetPlane() to reduce the chance that the cache gets flushed
before we grab the crc.

Still nowhere near 100% reliable on my IVB laptop with 3 MiB LLC,
but at least it can now hit the problem occasioanally. My desktop
IVB with 8 MiB LLC seems to hit it rather reliably.

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

diff --git a/tests/kms_pwrite_crc.c b/tests/kms_pwrite_crc.c
index 05b9e38..990866f 100644
--- a/tests/kms_pwrite_crc.c
+++ b/tests/kms_pwrite_crc.c
@@ -52,7 +52,6 @@ typedef struct {
 
 static void test(data_t *data)
 {
-	igt_display_t *display = &data->display;
 	igt_output_t *output = data->output;
 	struct igt_fb *fb = &data->fb[1];
 	drmModeModeInfo *mode;
@@ -72,12 +71,20 @@ static void test(data_t *data)
 	cairo_destroy(cr);
 
 	/* flip to it to make it UC/WC and fully flushed */
-	igt_plane_set_fb(data->primary, fb);
-	igt_display_commit(display);
+	drmModeSetPlane(data->drm_fd,
+			data->primary->drm_plane->plane_id,
+			output->config.crtc->crtc_id,
+			fb->fb_id, 0,
+			0, 0, fb->width, fb->height,
+			0, 0, fb->width << 16, fb->height << 16);
 
 	/* flip back the original white buffer */
-	igt_plane_set_fb(data->primary, &data->fb[0]);
-	igt_display_commit(display);
+	drmModeSetPlane(data->drm_fd,
+			data->primary->drm_plane->plane_id,
+			output->config.crtc->crtc_id,
+			data->fb[0].fb_id, 0,
+			0, 0, fb->width, fb->height,
+			0, 0, fb->width << 16, fb->height << 16);
 
 	/* make sure caching mode has become UC/WT */
 	caching = gem_get_caching(data->drm_fd, fb->gem_handle);
@@ -91,8 +98,12 @@ static void test(data_t *data)
 	free(buf);
 
 	/* and flip to it */
-	igt_plane_set_fb(data->primary, fb);
-	igt_display_commit(display);
+	drmModeSetPlane(data->drm_fd,
+			data->primary->drm_plane->plane_id,
+			output->config.crtc->crtc_id,
+			fb->fb_id, 0,
+			0, 0, fb->width, fb->height,
+			0, 0, fb->width << 16, fb->height << 16);
 
 	/* check that the crc is as expected, which requires that caches got flushed */
 	igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
-- 
2.4.6



More information about the Intel-gfx mailing list