diff mbox

[i-g-t,v2,09/17] lib: Add igt_dirty_fb

Message ID 1457448699-9778-10-git-send-email-tomeu.vizoso@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomeu Vizoso March 8, 2016, 2:51 p.m. UTC
Just wraps drmModeDirtyFB and for now invalidates the whole FB.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
---

Changes in v2:
- Add igt_dirty_fb

 lib/igt_fb.c | 14 ++++++++++++++
 lib/igt_fb.h |  1 +
 2 files changed, 15 insertions(+)
diff mbox

Patch

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index f936961a484f..9d6cff0edd23 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -979,6 +979,20 @@  static void create_cairo_surface__blit(int fd, struct igt_fb *fb)
 				    blit, destroy_cairo_surface__blit);
 }
 
+/**
+ * igt_dirty_fb:
+ * @fd: open drm file descriptor
+ * @fb: pointer to an #igt_fb structure
+ *
+ * Flushes out the whole framebuffer.
+ *
+ * Returns: 0 upon success.
+ */
+int igt_dirty_fb(int fd, struct igt_fb *fb)
+{
+	return drmModeDirtyFB(fb->fd, fb->fb_id, NULL, 0);
+}
+
 static void destroy_cairo_surface__gtt(void *arg)
 {
 	struct igt_fb *fb = arg;
diff --git a/lib/igt_fb.h b/lib/igt_fb.h
index 6cfd1bbd5008..ec88854ddeb7 100644
--- a/lib/igt_fb.h
+++ b/lib/igt_fb.h
@@ -97,6 +97,7 @@  unsigned int igt_create_image_fb(int drm_fd,  int width, int height,
 unsigned int igt_create_stereo_fb(int drm_fd, drmModeModeInfo *mode,
 				  uint32_t format, uint64_t tiling);
 void igt_remove_fb(int fd, struct igt_fb *fb);
+int igt_dirty_fb(int fd, struct igt_fb *fb);
 
 /* cairo-based painting */
 cairo_t *igt_get_cairo_ctx(int fd, struct igt_fb *fb);