From: Marius Vlad <marius.vlad@collabora.com>
To: igt-dev@lists.freedesktop.org
Cc: daniel@ffwll.ch, petri.latvala@intel.com, p.zabel@pengutronix.de,
Tomeu Vizoso <tomeu.vizoso@collabora.com>
Subject: [igt-dev] [PATCH i-g-t 2/2 v3] kms_atomic: Add subtest for testing zpos plane property
Date: Mon, 11 Mar 2019 19:13:09 +0200 [thread overview]
Message-ID: <20190311171309.25383-2-marius.vlad@collabora.com> (raw)
In-Reply-To: <20190311171309.25383-1-marius.vlad@collabora.com>
From: Tomeu Vizoso <tomeu.vizoso@collabora.com>
We use a 16-bit pixel buffer format for the overlay plane, as some older
HW might not be capable of driving a 32-bit pixel format.
Changes since v2:
- use 0 for igt_paint_color_alpha() alpha parameter, as ARGB1555 uses
just 1 bit for (of) alpha.
Changes since v1:
- fix 'commitintg' with 'committing' (Philipp Zabel)
- replace RGB565 with ARGB1555 (Philipp Zabel)
- test plane if it supports the pixel format supplied (Philipp Zabel)
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
---
tests/kms_atomic.c | 101 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 101 insertions(+)
diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index 3aad2d9a..8462d128 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -276,6 +276,88 @@ static uint32_t plane_get_igt_format(igt_plane_t *plane)
return 0;
}
+static void
+plane_primary_overlay_zpos(igt_pipe_t *pipe, igt_output_t *output,
+ igt_plane_t *primary, igt_plane_t *overlay,
+ uint32_t format_primary, uint32_t format_overlay)
+{
+ struct igt_fb fb_primary, fb_overlay;
+ drmModeModeInfo *mode = igt_output_get_mode(output);
+ cairo_t *cr;
+
+ /* for primary */
+ uint32_t w = mode->hdisplay;
+ uint32_t h = mode->vdisplay;
+
+ /* for overlay */
+ uint32_t w_overlay = mode->hdisplay / 2;
+ uint32_t h_overlay = mode->vdisplay / 2;
+
+ igt_create_color_pattern_fb(pipe->display->drm_fd,
+ w, h, format_primary, I915_TILING_NONE,
+ 0.2, 0.2, 0.2, &fb_primary);
+
+ igt_create_color_pattern_fb(pipe->display->drm_fd,
+ w_overlay, h_overlay,
+ format_overlay, I915_TILING_NONE,
+ 0.2, 0.2, 0.2, &fb_overlay);
+
+ /* Draw a hole in the overlay */
+ cr = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_overlay);
+ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+ igt_paint_color_alpha(cr, w_overlay / 4, h_overlay / 4,
+ w_overlay / 2, h_overlay / 2,
+ 0.0, 0.0, 0.0, 0.0);
+ cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
+ igt_put_cairo_ctx(pipe->display->drm_fd, &fb_overlay, cr);
+
+ igt_plane_set_fb(primary, &fb_primary);
+ igt_plane_set_fb(overlay, &fb_overlay);
+
+ igt_plane_set_position(overlay, w_overlay / 2, h_overlay / 2);
+
+ igt_plane_set_prop_value(primary, IGT_PLANE_ZPOS, 0);
+ igt_plane_set_prop_value(overlay, IGT_PLANE_ZPOS, 1);
+
+ igt_info("Committing with overlay on top, it has a hole "\
+ "through which the primary should be seen\n");
+ plane_commit(primary, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+ igt_assert_eq_u64(igt_plane_get_prop(primary, IGT_PLANE_ZPOS), 0);
+ igt_assert_eq_u64(igt_plane_get_prop(overlay, IGT_PLANE_ZPOS), 1);
+
+ igt_plane_set_prop_value(primary, IGT_PLANE_ZPOS, 1);
+ igt_plane_set_prop_value(overlay, IGT_PLANE_ZPOS, 0);
+
+ igt_info("Committing with primary on top, only the primary "\
+ "should be visible\n");
+ plane_commit(primary, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+ igt_assert_eq_u64(igt_plane_get_prop(primary, IGT_PLANE_ZPOS), 1);
+ igt_assert_eq_u64(igt_plane_get_prop(overlay, IGT_PLANE_ZPOS), 0);
+
+ /* Draw a hole in the primary exactly on top of the overlay plane */
+ cr = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_primary);
+ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+ igt_paint_color_alpha(cr, w_overlay / 2, h_overlay / 2,
+ w_overlay, h_overlay,
+ 0.0, 0.0, 0.0, 0.5);
+ cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
+ igt_put_cairo_ctx(pipe->display->drm_fd, &fb_primary, cr);
+
+ igt_info("Committing with a hole in the primary through "\
+ "which the underlay should be seen\n");
+ plane_commit(primary, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+ /* reset it back to initial state */
+ igt_plane_set_prop_value(primary, IGT_PLANE_ZPOS, 0);
+ igt_plane_set_prop_value(overlay, IGT_PLANE_ZPOS, 1);
+ plane_commit(primary, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+ igt_assert_eq_u64(igt_plane_get_prop(primary, IGT_PLANE_ZPOS), 0);
+ igt_assert_eq_u64(igt_plane_get_prop(overlay, IGT_PLANE_ZPOS), 1);
+}
+
static void plane_overlay(igt_pipe_t *pipe, igt_output_t *output, igt_plane_t *plane)
{
drmModeModeInfo *mode = igt_output_get_mode(output);
@@ -905,6 +987,25 @@ igt_main
plane_primary(pipe_obj, primary, &fb);
}
+ igt_subtest("plane_primary_overlay_zpos") {
+ uint32_t format_primary = DRM_FORMAT_ARGB8888;
+ uint32_t format_overlay = DRM_FORMAT_ARGB1555;
+
+ igt_plane_t *overlay =
+ igt_pipe_get_plane_type(pipe_obj, DRM_PLANE_TYPE_OVERLAY);
+
+ igt_require(overlay);
+ igt_require(igt_plane_has_prop(primary, IGT_PLANE_ZPOS));
+ igt_require(igt_plane_has_prop(overlay, IGT_PLANE_ZPOS));
+
+ igt_require(igt_plane_has_format_mod(primary, format_primary, 0x0));
+ igt_require(igt_plane_has_format_mod(overlay, format_overlay, 0x0));
+
+ igt_output_set_pipe(output, pipe);
+ plane_primary_overlay_zpos(pipe_obj, output, primary, overlay,
+ format_primary, format_overlay);
+ }
+
igt_subtest("test_only") {
atomic_clear(&display, pipe, primary, output);
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-03-11 17:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-11 17:13 [igt-dev] [PATCH i-g-t 1/2 v3] lib/igt_kms: Add zpos plane property Marius Vlad
2019-03-11 17:13 ` Marius Vlad [this message]
2019-03-11 17:45 ` [igt-dev] [PATCH i-g-t 2/2 v3] kms_atomic: Add subtest for testing " Philipp Zabel
2019-03-13 7:54 ` Marius Vlad
2019-03-12 10:28 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2,v3] lib/igt_kms: Add " Patchwork
2019-03-12 12:06 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190311171309.25383-2-marius.vlad@collabora.com \
--to=marius.vlad@collabora.com \
--cc=daniel@ffwll.ch \
--cc=igt-dev@lists.freedesktop.org \
--cc=p.zabel@pengutronix.de \
--cc=petri.latvala@intel.com \
--cc=tomeu.vizoso@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox