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>
This commit is contained in:
Daniel Vetter
2012-05-22 14:37:19 +02:00
parent 0732cc59ab
commit 662d732199
8 changed files with 272 additions and 225 deletions
+17
View File
@@ -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)