diff options
author | Imre Deak <imre.deak@intel.com> | 2013-05-24 17:26:54 +0300 |
---|---|---|
committer | Imre Deak <imre.deak@intel.com> | 2013-06-06 01:43:51 +0300 |
commit | f68d964c57c9229cad7321463e40f14b3974ec5d (patch) | |
tree | 61d35617b4e102b128d45d40468ca277a9af1b93 /tests/testdisplay.c | |
parent | bfb0cdd668e6ecea56125586f5ddf1cf62cc0383 (diff) |
lib: refactor kmstest_create_fb
Factor out parts that will be used by an upcoming patch adding
kmstest_create_fb2.
Also call the fb paint functions directly, there is not much
point in passing a function pointer for that.
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Diffstat (limited to 'tests/testdisplay.c')
-rw-r--r-- | tests/testdisplay.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/testdisplay.c b/tests/testdisplay.c index 30474afb..e5020c9a 100644 --- a/tests/testdisplay.c +++ b/tests/testdisplay.c @@ -258,15 +258,18 @@ static void paint_image(cairo_t *cr, const char *file) cairo_surface_destroy(image); } -static void -paint_output_info(cairo_t *cr, int l_width, int l_height, void *priv) +static void paint_output_info(struct connector *c, struct kmstest_fb *fb) { - struct connector *c = priv; + cairo_t *cr = kmstest_get_cairo_ctx(drm_fd, fb); + int l_width = fb->width; + int l_height = fb->height; double str_width; double x, y, top_y; double max_width; int i; + kmstest_paint_test_pattern(cr, l_width, l_height); + cairo_select_font_face(cr, "Helvetica", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); @@ -308,6 +311,8 @@ paint_output_info(cairo_t *cr, int l_width, int l_height, void *priv) if (qr_code) paint_image(cr, "./pass.png"); + + assert(!cairo_status(cr)); } static void sighandler(int signo) @@ -362,8 +367,8 @@ set_mode(struct connector *c) height = c->mode.vdisplay; fb_id = kmstest_create_fb(drm_fd, width, height, bpp, depth, - enable_tiling, &fb_info, - paint_output_info, c); + enable_tiling, &fb_info); + paint_output_info(c, &fb_info); fb_ptr = gem_mmap(drm_fd, fb_info.gem_handle, fb_info.size, PROT_READ | PROT_WRITE); |