summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>2021-10-14 18:27:16 +0300
committerJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>2021-10-18 12:21:31 +0300
commit5f1b44b37ad514fd55db978a92e2e2b673a8256e (patch)
treebc970883d32ca473ec2f5c5b80834477e7e6c657
parent01b6be842d74fb86f3226acb4ddcb85231f4b161 (diff)
tests/kms_cursor_crc: move create_cursor_fb above alpha tests
This is so it can be taken into use also in alpha tests. While at it take alpha into account on fb creation by clearing alpha to zero Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
-rw-r--r--tests/kms_cursor_crc.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 9faba1a1..0648a860 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -527,6 +527,32 @@ static void prepare_crtc(data_t *data, igt_output_t *output,
igt_pipe_crc_start(data->pipe_crc);
}
+static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
+{
+ cairo_t *cr;
+ uint32_t fb_id;
+
+ /*
+ * Make the FB slightly taller and leave the extra
+ * line opaque white, so that we can see that the
+ * hardware won't scan beyond what it should (esp.
+ * with non-square cursors).
+ */
+ fb_id = igt_create_color_fb(data->drm_fd, cur_w, cur_h + 1,
+ DRM_FORMAT_ARGB8888,
+ DRM_FORMAT_MOD_LINEAR,
+ 1.0, 1.0, 1.0,
+ &data->fb);
+
+ igt_assert(fb_id);
+
+ cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
+ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+ igt_paint_color_alpha(cr, 0, 0, cur_w, cur_h, 0.0, 0.0, 0.0, 0.0);
+ draw_cursor(cr, &((cursorarea){0, 0, cur_w, cur_h}));
+ igt_put_cairo_ctx(cr);
+}
+
static void test_cursor_alpha(data_t *data, double a)
{
igt_display_t *display = &data->display;
@@ -586,30 +612,6 @@ static void test_cursor_opaque(data_t *data)
test_cursor_alpha(data, 1.0);
}
-static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
-{
- cairo_t *cr;
- uint32_t fb_id;
-
- /*
- * Make the FB slightly taller and leave the extra
- * line opaque white, so that we can see that the
- * hardware won't scan beyond what it should (esp.
- * with non-square cursors).
- */
- fb_id = igt_create_color_fb(data->drm_fd, cur_w, cur_h + 1,
- DRM_FORMAT_ARGB8888,
- DRM_FORMAT_MOD_LINEAR,
- 1.0, 1.0, 1.0,
- &data->fb);
-
- igt_assert(fb_id);
-
- cr = igt_get_cairo_ctx(data->drm_fd, &data->fb);
- draw_cursor(cr, &((cursorarea){0, 0, cur_w, cur_h}));
- igt_put_cairo_ctx(cr);
-}
-
static void require_cursor_size(data_t *data, int w, int h)
{
igt_fb_t primary_fb;