diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-05-22 14:37:19 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-05-22 15:56:29 +0200 |
commit | 662d73219976ca820f878f63b5222e22e17c6328 (patch) | |
tree | a09dfb89044211a529c4c8f37996bcc288b5b8d6 /lib/drmtest.h | |
parent | 0732cc59abc06151b8756a6890f13885cde7403b (diff) |
lib: extract kmstest_create_fb
We should get more kms tests soon, and not needing to copy-paste a
nice test pattern should be useful.
That establishes a firm depency of i-g-t on cairo over everything, but
I don't care so much about that.
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib/drmtest.h')
-rw-r--r-- | lib/drmtest.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/drmtest.h b/lib/drmtest.h index b0940f3a..36f28255 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -31,6 +31,7 @@ #include <assert.h> #include <errno.h> #include <stdbool.h> +#include <cairo.h> #include "xf86drm.h" #include "intel_batchbuffer.h" @@ -74,6 +75,22 @@ void drmtest_init_aperture_trashers(drm_intel_bufmgr *bufmgr); void drmtest_trash_aperture(void); void drmtest_cleanup_aperture_trashers(void); +/* helpers to create nice-looking framebuffers */ +struct kmstest_fb { + uint32_t fb_id; + uint32_t gem_handle; + unsigned stride; + unsigned size; +}; + +typedef void (*kmstest_paint_func)(cairo_t *cr, int width, int height, void *priv); + +unsigned int kmstest_create_fb(int fd, int width, int height, int bpp, + int depth, bool tiled, + struct kmstest_fb *fb_info, + kmstest_paint_func paint_func, + void *func_arg); + inline static void _do_or_die(const char *function, int line, int ret) { if (ret == 0) |