diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2015-12-17 01:39:31 +0200 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2016-01-08 15:01:59 +0200 |
commit | 5b113d323dde18ef3bbae2f57d613be4ab7eb267 (patch) | |
tree | cd2bc3a7b496e985bd856f2c341e553c3315ec71 /tests/kms_atomic.c | |
parent | 7cb35109645e6495f67981b9930587c1ddfe4f90 (diff) |
lib: Extract some common fb create+fill methods into helpers
Several tests do one or more of the following:
* igt_create_fb() + igt_paint_test_pattern()
* igt_create_color_fb() + igt_paint_test_pattern()
* igt_create_fb() + igt_paint_image()
Extract them into new helpers: igt_create_pattern_fb(),
igt_create_color_pattern_fb(), igt_create_image_fb().
v2: Fix typos, and improve API docs (Thomas)
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'tests/kms_atomic.c')
-rw-r--r-- | tests/kms_atomic.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c index 7006e5ea..501093cc 100644 --- a/tests/kms_atomic.c +++ b/tests/kms_atomic.c @@ -867,7 +867,6 @@ static void plane_overlay(struct kms_atomic_crtc_state *crtc, uint32_t format = plane_get_igt_format(&plane); drmModeAtomicReq *req = drmModeAtomicAlloc(); struct igt_fb fb; - cairo_t *cr; igt_require(req); igt_require(format != 0); @@ -881,12 +880,9 @@ static void plane_overlay(struct kms_atomic_crtc_state *crtc, plane.crtc_w = mode->hdisplay / 2; plane.crtc_h = mode->vdisplay / 2; plane.crtc_id = crtc->obj; - plane.fb_id = igt_create_fb(plane.state->desc->fd, - plane.crtc_w, plane.crtc_h, - format, I915_TILING_NONE, &fb); - - cr = igt_get_cairo_ctx(plane.state->desc->fd, &fb); - igt_paint_test_pattern(cr, plane.crtc_w, plane.crtc_h); + plane.fb_id = igt_create_pattern_fb(plane.state->desc->fd, + plane.crtc_w, plane.crtc_h, + format, I915_TILING_NONE, &fb); /* Enable the overlay plane using the atomic API, and double-check * state is what we think it should be. */ @@ -916,7 +912,6 @@ static void plane_primary(struct kms_atomic_crtc_state *crtc, uint32_t *connectors; int num_connectors; struct igt_fb fb; - cairo_t *cr; int i; connectors = calloc(crtc->state->num_connectors, sizeof(*connectors)); @@ -939,12 +934,9 @@ static void plane_primary(struct kms_atomic_crtc_state *crtc, plane.crtc_w = mode->hdisplay; plane.crtc_h = mode->vdisplay; plane.crtc_id = crtc->obj; - plane.fb_id = igt_create_fb(plane.state->desc->fd, - plane.crtc_w, plane.crtc_h, - format, I915_TILING_NONE, &fb); - - cr = igt_get_cairo_ctx(plane.state->desc->fd, &fb); - igt_paint_test_pattern(cr, plane.crtc_w, plane.crtc_h); + plane.fb_id = igt_create_pattern_fb(plane.state->desc->fd, + plane.crtc_w, plane.crtc_h, + format, I915_TILING_NONE, &fb); /* Flip the primary plane using the atomic API, and double-check * state is what we think it should be. */ @@ -1044,7 +1036,6 @@ static void plane_invalid_params(struct kms_atomic_crtc_state *crtc, uint32_t format = plane_get_igt_format(&plane); drmModeAtomicReq *req = drmModeAtomicAlloc(); struct igt_fb fb; - cairo_t *cr; /* Pass a series of invalid object IDs for the FB ID. */ plane.fb_id = plane.obj; @@ -1098,12 +1089,9 @@ static void plane_invalid_params(struct kms_atomic_crtc_state *crtc, plane.crtc_w = mode->hdisplay; plane.crtc_h = mode->vdisplay; plane.crtc_id = crtc->obj; - plane.fb_id = igt_create_fb(plane.state->desc->fd, - plane.crtc_w - 1, plane.crtc_h - 1, - format, I915_TILING_NONE, &fb); - - cr = igt_get_cairo_ctx(plane.state->desc->fd, &fb); - igt_paint_test_pattern(cr, plane.crtc_w - 1, plane.crtc_h - 1); + plane.fb_id = igt_create_pattern_fb(plane.state->desc->fd, + plane.crtc_w - 1, plane.crtc_h - 1, + format, I915_TILING_NONE, &fb); plane_commit_atomic_err(&plane, plane_old, req, ATOMIC_RELAX_NONE, ENOSPC); |