kmstest: Fix up lifetimes of cairo objects

cairo_t is the short lived drawing context, whereas cairo_surface_t is
the heavyweight object that persists and is also tied to underlying GEM
objects. So make the kmstest API reflect the different weights and fix
the lifetime and underlying object reference leaks.

Based on the fix by Paulo Zanoni.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson
2013-12-30 17:48:43 +00:00
parent 9d6cfa6b59
commit 164d9d26ac
11 changed files with 48 additions and 37 deletions
+2 -1
View File
@@ -54,7 +54,7 @@ struct kmstest_fb {
unsigned stride;
unsigned tiling;
unsigned size;
cairo_t *cairo_ctx;
cairo_surface_t *cairo_surface;
};
enum kmstest_text_align {
@@ -77,6 +77,7 @@ unsigned int kmstest_create_fb2(int fd, int width, int height, uint32_t format,
bool tiled, struct kmstest_fb *fb);
void kmstest_remove_fb(int fd, struct kmstest_fb *fb_info);
cairo_t *kmstest_get_cairo_ctx(int fd, struct kmstest_fb *fb);
cairo_surface_t *kmstest_get_cairo_surface(int fd, struct kmstest_fb *fb);
void kmstest_paint_color(cairo_t *cr, int x, int y, int w, int h,
double r, double g, double b);
void kmstest_paint_color_alpha(cairo_t *cr, int x, int y, int w, int h,