summaryrefslogtreecommitdiff
path: root/tests/kms_panel_fitting.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2015-12-17 01:39:31 +0200
committerVille Syrjälä <ville.syrjala@linux.intel.com>2016-01-08 15:01:59 +0200
commit5b113d323dde18ef3bbae2f57d613be4ab7eb267 (patch)
treecd2bc3a7b496e985bd856f2c341e553c3315ec71 /tests/kms_panel_fitting.c
parent7cb35109645e6495f67981b9930587c1ddfe4f90 (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_panel_fitting.c')
-rw-r--r--tests/kms_panel_fitting.c42
1 files changed, 9 insertions, 33 deletions
diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
index f8726e27..829d9cdd 100644
--- a/tests/kms_panel_fitting.c
+++ b/tests/kms_panel_fitting.c
@@ -53,26 +53,6 @@ typedef struct {
#define FILE_NAME "1080p-left.png"
-static void
-paint_color(data_t *d, struct igt_fb *fb, uint16_t w, uint16_t h)
-{
- cairo_t *cr;
-
- cr = igt_get_cairo_ctx(d->drm_fd, fb);
- igt_paint_test_pattern(cr, w, h);
- cairo_destroy(cr);
-}
-
-static void
-paint_image(data_t *d, struct igt_fb *fb, uint16_t w, uint16_t h)
-{
- cairo_t *cr;
-
- cr = igt_get_cairo_ctx(d->drm_fd, fb);
- igt_paint_image(cr, FILE_NAME, 0, 0, w, h);
- cairo_destroy(cr);
-}
-
static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
igt_plane_t *plane, drmModeModeInfo *mode, enum igt_commit_style s)
{
@@ -91,15 +71,13 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
}
/* allocate fb for plane 1 */
- data->fb_id1 = igt_create_fb(data->drm_fd,
- mode->hdisplay, mode->vdisplay,
- DRM_FORMAT_XRGB8888,
- LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */
- &data->fb1);
+ data->fb_id1 = igt_create_pattern_fb(data->drm_fd,
+ mode->hdisplay, mode->vdisplay,
+ DRM_FORMAT_XRGB8888,
+ LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */
+ &data->fb1);
igt_assert(data->fb_id1);
- paint_color(data, &data->fb1, mode->hdisplay, mode->vdisplay);
-
/*
* We always set the primary plane to actually enable the pipe as
* there's no way (that works) to light up a pipe with only a sprite
@@ -188,13 +166,11 @@ static void test_panel_fitting(data_t *d)
d->image_h = cairo_image_surface_get_height(image);
cairo_surface_destroy(image);
- d->fb_id2 = igt_create_fb(d->drm_fd,
- d->image_w, d->image_h,
- DRM_FORMAT_XRGB8888,
- LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */
- &d->fb2);
+ d->fb_id2 = igt_create_image_fb(d->drm_fd, 0, 0,
+ DRM_FORMAT_XRGB8888,
+ LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */
+ FILE_NAME, &d->fb2);
igt_assert(d->fb_id2);
- paint_image(d, &d->fb2, d->fb2.width, d->fb2.height);
/* Set up display to enable panel fitting */
mode->hdisplay = 640;