public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Marius Vlad <marius.vlad@collabora.com>, igt-dev@lists.freedesktop.org
Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>, daniel@ffwll.ch
Subject: Re: [igt-dev] [PATCH i-g-t 2/2] kms_atomic: Add subtest for testing zpos plane property
Date: Fri, 08 Mar 2019 14:30:04 +0100	[thread overview]
Message-ID: <1552051804.4009.12.camel@pengutronix.de> (raw)
In-Reply-To: <20190216182959.8760-2-marius.vlad@collabora.com>

On Sat, 2019-02-16 at 20:29 +0200, Marius Vlad wrote:
> 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.
> 
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
> ---
>  tests/kms_atomic.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 84 insertions(+)
> 
> diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
> index 3aad2d9a..a9bc7f16 100644
> --- a/tests/kms_atomic.c
> +++ b/tests/kms_atomic.c
> @@ -276,6 +276,78 @@ 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)
> +{
> +	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, DRM_FORMAT_ARGB8888, I915_TILING_NONE,
> +				    0.2, 0.2, 0.2, &fb_primary);
> +
> +	igt_create_color_pattern_fb(pipe->display->drm_fd,
> +				    w_overlay, h_overlay,
> +				    DRM_FORMAT_RGB565, 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.5);

How can this draw a hole when the overlay plane has DRM_FORMAT_RGB565? I
would assume the alpha value is ignored in this case.

> +	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("Commiting 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("Commiting with primary on top, only the primary should be visible\n");

Committing

> +	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("Commiting with a hole in the primary through "\
> +		  "which the underlay should be seen\n");
> +	plane_commit(primary, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
> +}
> +
>  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 +977,18 @@ igt_main
>  		plane_primary(pipe_obj, primary, &fb);
>  	}
>  
> +	igt_subtest("plane_primary_overlay_zpos") {
> +		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));

Maybe also check igt_plane_has_format_mod for the formats the test wants
to set.

> +
> +		igt_output_set_pipe(output, pipe);
> +		plane_primary_overlay_zpos(pipe_obj, output, primary, overlay);
> +	}
> +
>  	igt_subtest("test_only") {
>  		atomic_clear(&display, pipe, primary, output);
>  

regards
Philipp
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-03-08 13:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-16 18:29 [igt-dev] [PATCH i-g-t 1/2] lib/igt_kms: Add zpos plane property Marius Vlad via igt-dev
2019-02-16 18:29 ` [igt-dev] [PATCH i-g-t 2/2] kms_atomic: Add subtest for testing " Marius Vlad via igt-dev
2019-03-08 13:30   ` Philipp Zabel [this message]
2019-02-16 19:03 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] lib/igt_kms: Add " Patchwork
2019-02-16 20:54 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-03-08 13:30 ` [igt-dev] [PATCH i-g-t 1/2] " Philipp Zabel
2019-03-12 13:43 ` Daniel Vetter
2019-03-12 14:18   ` Marius Vlad
2019-03-12 15:22     ` Daniel Vetter

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=1552051804.4009.12.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=daniel@ffwll.ch \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=marius.vlad@collabora.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