diff mbox

[igt] kms_frontbuffer_tracking: use the dirty ioctl after MMAP_WC calls

Message ID 1436902154-6979-4-git-send-email-przanoni@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paulo Zanoni July 14, 2015, 7:29 p.m. UTC
From: Paulo Zanoni <paulo.r.zanoni@intel.com>

We can't add this to igt_draw since igt_draw doesn't care whether it's
writing on a frontbuffer or not.

PS: the ENOSYS is for Kernels without the patch implementing the
IOCTL.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 tests/kms_frontbuffer_tracking.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff mbox

Patch

diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index e162e91..1c45429 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -826,6 +826,21 @@  static struct rect pat4_get_rect(struct fb_region *fb, int r)
 	return rect;
 }
 
+static void fb_dirty_ioctl(struct fb_region *fb, struct rect *rect)
+{
+	int rc;
+	drmModeClip clip = {
+		.x1 = rect->x,
+		.x2 = rect->x + rect->w,
+		.y1 = rect->y,
+		.y2 = rect->y + rect->h,
+	};
+
+	rc = drmModeDirtyFB(drm.fd, fb->fb->fb_id, &clip, 1);
+
+	igt_assert(rc == 0 || rc == -ENOSYS);
+}
+
 static void draw_rect(struct draw_pattern_info *pattern, struct fb_region *fb,
 		      enum igt_draw_method method, int r)
 {
@@ -834,6 +849,9 @@  static void draw_rect(struct draw_pattern_info *pattern, struct fb_region *fb,
 	igt_draw_rect_fb(drm.fd, drm.bufmgr, NULL, fb->fb, method,
 			 fb->x + rect.x, fb->y + rect.y,
 			 rect.w, rect.h, rect.color);
+
+	if (method == IGT_DRAW_MMAP_WC)
+		fb_dirty_ioctl(fb, &rect);
 }
 
 static void draw_rect_igt_fb(struct draw_pattern_info *pattern,