[PATCH i-g-t 04/12] lib: Add a helper to write a png from a struct kmstest_fb

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Damien Lespiau <damien.lespiau@xxxxxxxxx>
---
 lib/drmtest.c | 11 +++++++++++
 lib/drmtest.h |  1 +
 2 files changed, 12 insertions(+)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 12bd0ff..f7de232 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -1531,6 +1531,17 @@ void kmstest_remove_fb(int fd, struct kmstest_fb *fb)
 	gem_close(fd, fb->gem_handle);
 }
 
+void kmstest_write_fb(int fd, struct kmstest_fb *fb, const char *filename)
+{
+	cairo_surface_t *surface;
+	cairo_status_t status;
+
+	surface = create_image_surface(fd, fb);
+	status = cairo_surface_write_to_png(surface, filename);
+	assert(status == CAIRO_STATUS_SUCCESS);
+	cairo_surface_destroy(surface);
+}
+
 const char *kmstest_format_str(uint32_t drm_format)
 {
 	struct format_desc_struct *f;
diff --git a/lib/drmtest.h b/lib/drmtest.h
index 6591068..542b87e 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -328,6 +328,7 @@ void kmstest_paint_color_gradient(cairo_t *cr, int x, int y, int w, int h,
 void kmstest_paint_test_pattern(cairo_t *cr, int width, int height);
 void kmstest_paint_image(cairo_t *cr, const char *filename,
 			 int dst_x, int dst_y, int dst_width, int dst_height);
+void kmstest_write_fb(int fd, struct kmstest_fb *fb, const char *filename);
 void kmstest_dump_mode(drmModeModeInfo *mode);
 int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id);
 const char *kmstest_format_str(uint32_t drm_format);
-- 
1.8.3.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux