public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v3] tests/kms_atomic: add test to validate immutable zpos
@ 2020-03-16 18:34 Swati Sharma
  2020-03-16 18:59 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_atomic: add test to validate immutable zpos (rev3) Patchwork
  2020-03-17  5:43 ` [igt-dev] [PATCH i-g-t v3] tests/kms_atomic: add test to validate immutable zpos Nautiyal, Ankit K
  0 siblings, 2 replies; 4+ messages in thread
From: Swati Sharma @ 2020-03-16 18:34 UTC (permalink / raw)
  To: igt-dev; +Cc: petri.latvala

i915 implements immutable zpos property whereas the existing test
case is written to validate mutable zpos.

Added new sub-test to validate immutable zpos. In the test, to validate
reported zpos of the plane is correct by making sure a full-screen plane
covers all other planes with the lower zpos, and the plane with the next
available zpos is indeed partially covering the full-screen plane.

v2: -Removed intel only checks [Martin]
    -Used XRGB8888 pixel format as used in other IGTs
    -Added documentation [Martin]
    -Removed skip, instead continue if plane doesn't support zpos [Martin]
    -Sorted planes in increasing order of zpos [Martin]
v3: -Fix description [Martin]
    -Avoid sorting [Ankit]

Issue: https://gitlab.freedesktop.org/drm/intel/issues/404
Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
---
 tests/kms_atomic.c | 159 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 149 insertions(+), 10 deletions(-)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index 8462d128..c55bc97d 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -121,7 +121,7 @@ static void plane_check_current_state(igt_plane_t *plane, const uint64_t *values
 }
 
 static void plane_commit(igt_plane_t *plane, enum igt_commit_style s,
-                                enum kms_atomic_check_relax relax)
+                         enum kms_atomic_check_relax relax)
 {
 	igt_display_commit2(plane->pipe->display, s);
 	plane_check_current_state(plane, plane->values, relax);
@@ -277,9 +277,9 @@ static uint32_t plane_get_igt_format(igt_plane_t *plane)
 }
 
 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)
+plane_primary_overlay_mutable_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);
@@ -320,7 +320,7 @@ plane_primary_overlay_zpos(igt_pipe_t *pipe, igt_output_t *output,
 	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");
+		 "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);
@@ -346,7 +346,7 @@ plane_primary_overlay_zpos(igt_pipe_t *pipe, igt_output_t *output,
 	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");
+		 "which the underlay should be seen\n");
 	plane_commit(primary, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
 
 	/* reset it back to initial state */
@@ -358,6 +358,135 @@ plane_primary_overlay_zpos(igt_pipe_t *pipe, igt_output_t *output,
 	igt_assert_eq_u64(igt_plane_get_prop(overlay, IGT_PLANE_ZPOS), 1);
 }
 
+static void
+plane_immutable_zpos(igt_display_t *display, igt_pipe_t *pipe,
+		     igt_output_t *output)
+{
+	cairo_t *cr;
+	struct igt_fb fb_ref;
+	igt_plane_t *primary;
+	drmModeModeInfo *mode;
+	igt_pipe_crc_t *pipe_crc;
+	igt_crc_t ref_crc, new_crc;
+	int n_planes = pipe->n_planes;
+	igt_plane_t *plane_ptr[n_planes];
+	uint32_t w_lower, h_lower, w_upper, h_upper;
+
+	igt_require(n_planes >= 2);
+
+	mode = igt_output_get_mode(output);
+	primary = igt_pipe_get_plane_type(pipe, DRM_PLANE_TYPE_PRIMARY);
+
+	/* for lower plane */
+	w_lower = mode->hdisplay;
+	h_lower = mode->vdisplay;
+
+	/* for upper plane */
+	w_upper = mode->hdisplay / 2;
+	h_upper = mode->vdisplay / 2;
+
+	igt_create_color_fb(display->drm_fd,
+			    w_lower, h_lower,
+			    DRM_FORMAT_XRGB8888,
+			    I915_TILING_NONE,
+			    0.0, 0.0, 0.0, &fb_ref);
+
+	/* create reference image */
+	cr = igt_get_cairo_ctx(display->drm_fd, &fb_ref);
+	igt_assert(cairo_status(cr) == 0);
+	igt_paint_color(cr, 0, 0, w_lower, h_lower, 0.0, 0.0, 1.0);
+	igt_paint_color(cr, w_upper / 2, h_upper / 2, w_upper, h_upper, 1.0, 1.0, 0.0);
+	igt_put_cairo_ctx(display->drm_fd, &fb_ref, cr);
+	igt_plane_set_fb(primary, &fb_ref);
+	igt_display_commit2(display, COMMIT_ATOMIC);
+
+	/* create the pipe_crc object for this pipe */
+	pipe_crc = igt_pipe_crc_new(pipe->display->drm_fd, pipe->pipe,
+				    INTEL_PIPE_CRC_SOURCE_AUTO);
+
+	/* get reference crc */
+	igt_pipe_crc_start(pipe_crc);
+	igt_pipe_crc_get_current(display->drm_fd, pipe_crc, &ref_crc);
+
+	igt_plane_set_fb(primary, NULL);
+
+	for (int k = 0; k < n_planes; k++) {
+		int zpos;
+		igt_plane_t *temp;
+
+		temp = &display->pipes[pipe->pipe].planes[k];
+
+		if (!igt_plane_has_prop(temp, IGT_PLANE_ZPOS))
+			continue;
+
+		zpos = igt_plane_get_prop(temp, IGT_PLANE_ZPOS);
+		plane_ptr[zpos] = &display->pipes[pipe->pipe].planes[k];
+	}
+
+	/*
+	 * checking only pairs of plane in increasing fashion
+	 * to avoid combinatorial explosion
+	 */
+	for (int i = 0; i < n_planes - 1; i++) {
+		int fb_id_lower, fb_id_upper;
+		struct igt_fb fb_lower, fb_upper;
+		igt_plane_t *plane_lower, *plane_upper;
+
+		if (plane_ptr[i] != NULL) {
+			plane_lower = plane_ptr[i];
+			igt_assert(plane_lower);
+		} else
+			continue;
+
+		while (i  < (n_planes - 1)) {
+			if (plane_ptr[i + 1] != NULL) {
+				plane_upper = plane_ptr[i + 1];
+				break;
+			} else {
+				i++;
+				continue;
+			}
+		}
+
+		if (i == (n_planes - 1))
+			break;
+
+		if ((plane_lower->type == DRM_PLANE_TYPE_CURSOR) ||
+				(plane_upper->type == DRM_PLANE_TYPE_CURSOR))
+			continue;
+
+		fb_id_lower = igt_create_color_fb(display->drm_fd,
+						  w_lower, h_lower,
+						  DRM_FORMAT_XRGB8888,
+						  I915_TILING_NONE,
+						  0.0, 0.0, 1.0, &fb_lower);
+		igt_assert(fb_id_lower);
+
+		fb_id_upper = igt_create_color_fb(display->drm_fd,
+						  w_upper, h_upper,
+						  DRM_FORMAT_XRGB8888,
+						  I915_TILING_NONE,
+						  1.0, 1.0, 0.0, &fb_upper);
+		igt_assert(fb_id_upper);
+
+		igt_plane_set_position(plane_lower, 0, 0);
+		igt_plane_set_fb(plane_lower, &fb_lower);
+
+		igt_plane_set_position(plane_upper, w_upper / 2, h_upper / 2);
+		igt_plane_set_fb(plane_upper, &fb_upper);
+
+		igt_info("Committing with the plane[%d] underneath "\
+			 "plane[%d]\n", i, (i + 1));
+		igt_display_commit2(display, COMMIT_ATOMIC);
+		igt_pipe_crc_get_current(pipe->display->drm_fd, pipe_crc, &new_crc);
+
+		igt_assert_crc_equal(&ref_crc, &new_crc);
+
+		igt_plane_set_fb(plane_lower, NULL);
+		igt_plane_set_fb(plane_upper, NULL);
+	}
+}
+
 static void plane_overlay(igt_pipe_t *pipe, igt_output_t *output, igt_plane_t *plane)
 {
 	drmModeModeInfo *mode = igt_output_get_mode(output);
@@ -987,14 +1116,16 @@ igt_main
 		plane_primary(pipe_obj, primary, &fb);
 	}
 
-	igt_subtest("plane_primary_overlay_zpos") {
+	igt_describe("Verify that the overlay plane can cover the primary one (and "\
+		     "vice versa) by changing their zpos property.");
+	igt_subtest("plane_primary_overlay_mutable_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));
 
@@ -1002,8 +1133,15 @@ igt_main
 		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);
+		plane_primary_overlay_mutable_zpos(pipe_obj, output, primary, overlay,
+					           format_primary, format_overlay);
+	}
+
+	igt_describe("Verify the reported zpos property of planes by making sure "\
+		     "only higher zpos planes cover the lower zpos ones.");
+	igt_subtest("plane_immutable_zpos") {
+		igt_output_set_pipe(output, pipe);
+		plane_immutable_zpos(&display, pipe_obj, output);
 	}
 
 	igt_subtest("test_only") {
@@ -1011,6 +1149,7 @@ igt_main
 
 		test_only(pipe_obj, primary, output);
 	}
+
 	igt_subtest("plane_cursor_legacy") {
 		igt_plane_t *cursor =
 			igt_pipe_get_plane_type(pipe_obj, DRM_PLANE_TYPE_CURSOR);
-- 
2.25.1

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_atomic: add test to validate immutable zpos (rev3)
  2020-03-16 18:34 [igt-dev] [PATCH i-g-t v3] tests/kms_atomic: add test to validate immutable zpos Swati Sharma
@ 2020-03-16 18:59 ` Patchwork
  2020-03-17  5:43 ` [igt-dev] [PATCH i-g-t v3] tests/kms_atomic: add test to validate immutable zpos Nautiyal, Ankit K
  1 sibling, 0 replies; 4+ messages in thread
From: Patchwork @ 2020-03-16 18:59 UTC (permalink / raw)
  To: Swati Sharma; +Cc: igt-dev

== Series Details ==

Series: tests/kms_atomic: add test to validate immutable zpos (rev3)
URL   : https://patchwork.freedesktop.org/series/73956/
State : failure

== Summary ==

CI Bug Log - changes from IGT_5511 -> IGTPW_4312
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with IGTPW_4312 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_4312, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4312/index.html

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_4312:

### IGT changes ###

#### Possible regressions ####

  * igt@kms_flip@basic-flip-vs-modeset:
    - fi-skl-6770hq:      [PASS][1] -> [INCOMPLETE][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5511/fi-skl-6770hq/igt@kms_flip@basic-flip-vs-modeset.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4312/fi-skl-6770hq/igt@kms_flip@basic-flip-vs-modeset.html

  
#### Warnings ####

  * igt@i915_selftest@live@gem_contexts:
    - fi-skl-lmem:        [INCOMPLETE][3] ([i915#424]) -> [DMESG-FAIL][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5511/fi-skl-lmem/igt@i915_selftest@live@gem_contexts.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4312/fi-skl-lmem/igt@i915_selftest@live@gem_contexts.html

  
Known issues
------------

  Here are the changes found in IGTPW_4312 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_exec_suspend@basic-s4-devices:
    - fi-tgl-y:           [PASS][5] -> [FAIL][6] ([CI#94])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5511/fi-tgl-y/igt@gem_exec_suspend@basic-s4-devices.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4312/fi-tgl-y/igt@gem_exec_suspend@basic-s4-devices.html

  * igt@kms_chamelium@hdmi-hpd-fast:
    - fi-kbl-7500u:       [PASS][7] -> [FAIL][8] ([i915#323])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5511/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4312/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html

  
#### Possible fixes ####

  * igt@i915_selftest@live@active:
    - fi-apl-guc:         [DMESG-FAIL][9] ([i915#666]) -> [PASS][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5511/fi-apl-guc/igt@i915_selftest@live@active.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4312/fi-apl-guc/igt@i915_selftest@live@active.html

  * igt@i915_selftest@live@execlists:
    - fi-apl-guc:         [INCOMPLETE][11] ([fdo#103927] / [i915#656]) -> [PASS][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5511/fi-apl-guc/igt@i915_selftest@live@execlists.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4312/fi-apl-guc/igt@i915_selftest@live@execlists.html
    - fi-bxt-dsi:         [INCOMPLETE][13] ([fdo#103927] / [i915#656]) -> [PASS][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5511/fi-bxt-dsi/igt@i915_selftest@live@execlists.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4312/fi-bxt-dsi/igt@i915_selftest@live@execlists.html

  
  [CI#94]: https://gitlab.freedesktop.org/gfx-ci/i915-infra/issues/94
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [i915#323]: https://gitlab.freedesktop.org/drm/intel/issues/323
  [i915#424]: https://gitlab.freedesktop.org/drm/intel/issues/424
  [i915#656]: https://gitlab.freedesktop.org/drm/intel/issues/656
  [i915#666]: https://gitlab.freedesktop.org/drm/intel/issues/666


Participating hosts (49 -> 44)
------------------------------

  Missing    (5): fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-byt-clapper fi-bdw-samus 


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_5511 -> IGTPW_4312

  CI-20190529: 20190529
  CI_DRM_8137: 5786b5e77cc17a1b494b9bdf3c3f29eedc2e2e7d @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_4312: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4312/index.html
  IGT_5511: abbda1426424cf32c134107a0c892bfa61234d0b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools



== Testlist changes ==

+igt@kms_atomic@plane_immutable_zpos
+igt@kms_atomic@plane_primary_overlay_mutable_zpos
-igt@kms_atomic@plane_primary_overlay_zpos

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4312/index.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v3] tests/kms_atomic: add test to validate immutable zpos
  2020-03-16 18:34 [igt-dev] [PATCH i-g-t v3] tests/kms_atomic: add test to validate immutable zpos Swati Sharma
  2020-03-16 18:59 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_atomic: add test to validate immutable zpos (rev3) Patchwork
@ 2020-03-17  5:43 ` Nautiyal, Ankit K
  2020-03-17  7:20   ` Sharma, Swati2
  1 sibling, 1 reply; 4+ messages in thread
From: Nautiyal, Ankit K @ 2020-03-17  5:43 UTC (permalink / raw)
  To: Swati Sharma, igt-dev; +Cc: petri.latvala

Hi Swati,

Have minor comments inline, otherwise the patch looks good to me.


On 3/17/2020 12:04 AM, Swati Sharma wrote:
> i915 implements immutable zpos property whereas the existing test
> case is written to validate mutable zpos.
>
> Added new sub-test to validate immutable zpos. In the test, to validate
> reported zpos of the plane is correct by making sure a full-screen plane
> covers all other planes with the lower zpos, and the plane with the next
> available zpos is indeed partially covering the full-screen plane.

I think this require rephrasing as per the latest changes, as we check 2 
planes at a time.

>
> v2: -Removed intel only checks [Martin]
>      -Used XRGB8888 pixel format as used in other IGTs
>      -Added documentation [Martin]
>      -Removed skip, instead continue if plane doesn't support zpos [Martin]
>      -Sorted planes in increasing order of zpos [Martin]
> v3: -Fix description [Martin]
>      -Avoid sorting [Ankit]
>
> Issue: https://gitlab.freedesktop.org/drm/intel/issues/404
> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
> ---
>   tests/kms_atomic.c | 159 ++++++++++++++++++++++++++++++++++++++++++---
>   1 file changed, 149 insertions(+), 10 deletions(-)
>
> diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
> index 8462d128..c55bc97d 100644
> --- a/tests/kms_atomic.c
> +++ b/tests/kms_atomic.c
> @@ -121,7 +121,7 @@ static void plane_check_current_state(igt_plane_t *plane, const uint64_t *values
>   }
>   
>   static void plane_commit(igt_plane_t *plane, enum igt_commit_style s,
> -                                enum kms_atomic_check_relax relax)
> +                         enum kms_atomic_check_relax relax)
>   {
>   	igt_display_commit2(plane->pipe->display, s);
>   	plane_check_current_state(plane, plane->values, relax);
> @@ -277,9 +277,9 @@ static uint32_t plane_get_igt_format(igt_plane_t *plane)
>   }
>   
>   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)
> +plane_primary_overlay_mutable_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);
> @@ -320,7 +320,7 @@ plane_primary_overlay_zpos(igt_pipe_t *pipe, igt_output_t *output,
>   	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");
> +		 "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);
> @@ -346,7 +346,7 @@ plane_primary_overlay_zpos(igt_pipe_t *pipe, igt_output_t *output,
>   	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");
> +		 "which the underlay should be seen\n");
>   	plane_commit(primary, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
>   
>   	/* reset it back to initial state */
> @@ -358,6 +358,135 @@ plane_primary_overlay_zpos(igt_pipe_t *pipe, igt_output_t *output,
>   	igt_assert_eq_u64(igt_plane_get_prop(overlay, IGT_PLANE_ZPOS), 1);
>   }
>   
> +static void
> +plane_immutable_zpos(igt_display_t *display, igt_pipe_t *pipe,
> +		     igt_output_t *output)
> +{
> +	cairo_t *cr;
> +	struct igt_fb fb_ref;
> +	igt_plane_t *primary;
> +	drmModeModeInfo *mode;
> +	igt_pipe_crc_t *pipe_crc;
> +	igt_crc_t ref_crc, new_crc;
> +	int n_planes = pipe->n_planes;
> +	igt_plane_t *plane_ptr[n_planes];
> +	uint32_t w_lower, h_lower, w_upper, h_upper;
> +
> +	igt_require(n_planes >= 2);
> +
> +	mode = igt_output_get_mode(output);
> +	primary = igt_pipe_get_plane_type(pipe, DRM_PLANE_TYPE_PRIMARY);
> +
> +	/* for lower plane */
> +	w_lower = mode->hdisplay;
> +	h_lower = mode->vdisplay;
> +
> +	/* for upper plane */
> +	w_upper = mode->hdisplay / 2;
> +	h_upper = mode->vdisplay / 2;
> +
> +	igt_create_color_fb(display->drm_fd,
> +			    w_lower, h_lower,
> +			    DRM_FORMAT_XRGB8888,
> +			    I915_TILING_NONE,
> +			    0.0, 0.0, 0.0, &fb_ref);
> +
> +	/* create reference image */
> +	cr = igt_get_cairo_ctx(display->drm_fd, &fb_ref);
> +	igt_assert(cairo_status(cr) == 0);
> +	igt_paint_color(cr, 0, 0, w_lower, h_lower, 0.0, 0.0, 1.0);
> +	igt_paint_color(cr, w_upper / 2, h_upper / 2, w_upper, h_upper, 1.0, 1.0, 0.0);
> +	igt_put_cairo_ctx(display->drm_fd, &fb_ref, cr);
> +	igt_plane_set_fb(primary, &fb_ref);
> +	igt_display_commit2(display, COMMIT_ATOMIC);
> +
> +	/* create the pipe_crc object for this pipe */
> +	pipe_crc = igt_pipe_crc_new(pipe->display->drm_fd, pipe->pipe,
> +				    INTEL_PIPE_CRC_SOURCE_AUTO);
> +
> +	/* get reference crc */
> +	igt_pipe_crc_start(pipe_crc);
> +	igt_pipe_crc_get_current(display->drm_fd, pipe_crc, &ref_crc);
> +
> +	igt_plane_set_fb(primary, NULL);
> +
> +	for (int k = 0; k < n_planes; k++) {
> +		int zpos;
> +		igt_plane_t *temp;
> +
> +		temp = &display->pipes[pipe->pipe].planes[k];
> +
> +		if (!igt_plane_has_prop(temp, IGT_PLANE_ZPOS))
> +			continue;
> +
> +		zpos = igt_plane_get_prop(temp, IGT_PLANE_ZPOS);

I think, here assert (zpos < n_planes) should be there.

> +		plane_ptr[zpos] = &display->pipes[pipe->pipe].planes[k];

Can use temp here.

> +	}
> +
> +	/*
> +	 * checking only pairs of plane in increasing fashion
> +	 * to avoid combinatorial explosion
> +	 */
> +	for (int i = 0; i < n_planes - 1; i++) {
> +		int fb_id_lower, fb_id_upper;
> +		struct igt_fb fb_lower, fb_upper;
> +		igt_plane_t *plane_lower, *plane_upper;
> +
> +		if (plane_ptr[i] != NULL) {
> +			plane_lower = plane_ptr[i];
> +			igt_assert(plane_lower);

No need of assert here, plane_ptr[i] is already checked earlier.

With these minor changes:

Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>


-Ankit

> +		} else
> +			continue;
> +
> +		while (i  < (n_planes - 1)) {
> +			if (plane_ptr[i + 1] != NULL) {
> +				plane_upper = plane_ptr[i + 1];
> +				break;
> +			} else {
> +				i++;
> +				continue;
> +			}
> +		}
> +
> +		if (i == (n_planes - 1))
> +			break;
> +
> +		if ((plane_lower->type == DRM_PLANE_TYPE_CURSOR) ||
> +				(plane_upper->type == DRM_PLANE_TYPE_CURSOR))
> +			continue;
> +
> +		fb_id_lower = igt_create_color_fb(display->drm_fd,
> +						  w_lower, h_lower,
> +						  DRM_FORMAT_XRGB8888,
> +						  I915_TILING_NONE,
> +						  0.0, 0.0, 1.0, &fb_lower);
> +		igt_assert(fb_id_lower);
> +
> +		fb_id_upper = igt_create_color_fb(display->drm_fd,
> +						  w_upper, h_upper,
> +						  DRM_FORMAT_XRGB8888,
> +						  I915_TILING_NONE,
> +						  1.0, 1.0, 0.0, &fb_upper);
> +		igt_assert(fb_id_upper);
> +
> +		igt_plane_set_position(plane_lower, 0, 0);
> +		igt_plane_set_fb(plane_lower, &fb_lower);
> +
> +		igt_plane_set_position(plane_upper, w_upper / 2, h_upper / 2);
> +		igt_plane_set_fb(plane_upper, &fb_upper);
> +
> +		igt_info("Committing with the plane[%d] underneath "\
> +			 "plane[%d]\n", i, (i + 1));
> +		igt_display_commit2(display, COMMIT_ATOMIC);
> +		igt_pipe_crc_get_current(pipe->display->drm_fd, pipe_crc, &new_crc);
> +
> +		igt_assert_crc_equal(&ref_crc, &new_crc);
> +
> +		igt_plane_set_fb(plane_lower, NULL);
> +		igt_plane_set_fb(plane_upper, NULL);
> +	}
> +}
> +
>   static void plane_overlay(igt_pipe_t *pipe, igt_output_t *output, igt_plane_t *plane)
>   {
>   	drmModeModeInfo *mode = igt_output_get_mode(output);
> @@ -987,14 +1116,16 @@ igt_main
>   		plane_primary(pipe_obj, primary, &fb);
>   	}
>   
> -	igt_subtest("plane_primary_overlay_zpos") {
> +	igt_describe("Verify that the overlay plane can cover the primary one (and "\
> +		     "vice versa) by changing their zpos property.");
> +	igt_subtest("plane_primary_overlay_mutable_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));
>   
> @@ -1002,8 +1133,15 @@ igt_main
>   		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);
> +		plane_primary_overlay_mutable_zpos(pipe_obj, output, primary, overlay,
> +					           format_primary, format_overlay);
> +	}
> +
> +	igt_describe("Verify the reported zpos property of planes by making sure "\
> +		     "only higher zpos planes cover the lower zpos ones.");
> +	igt_subtest("plane_immutable_zpos") {
> +		igt_output_set_pipe(output, pipe);
> +		plane_immutable_zpos(&display, pipe_obj, output);
>   	}
>   
>   	igt_subtest("test_only") {
> @@ -1011,6 +1149,7 @@ igt_main
>   
>   		test_only(pipe_obj, primary, output);
>   	}
> +
>   	igt_subtest("plane_cursor_legacy") {
>   		igt_plane_t *cursor =
>   			igt_pipe_get_plane_type(pipe_obj, DRM_PLANE_TYPE_CURSOR);

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v3] tests/kms_atomic: add test to validate immutable zpos
  2020-03-17  5:43 ` [igt-dev] [PATCH i-g-t v3] tests/kms_atomic: add test to validate immutable zpos Nautiyal, Ankit K
@ 2020-03-17  7:20   ` Sharma, Swati2
  0 siblings, 0 replies; 4+ messages in thread
From: Sharma, Swati2 @ 2020-03-17  7:20 UTC (permalink / raw)
  To: Nautiyal, Ankit K, igt-dev; +Cc: petri.latvala

Thanks Martin and Ankit for the review.

On 17-Mar-20 11:13 AM, Nautiyal, Ankit K wrote:
> Hi Swati,
> 
> Have minor comments inline, otherwise the patch looks good to me.
> 
> 
> On 3/17/2020 12:04 AM, Swati Sharma wrote:
>> i915 implements immutable zpos property whereas the existing test
>> case is written to validate mutable zpos.
>>
>> Added new sub-test to validate immutable zpos. In the test, to validate
>> reported zpos of the plane is correct by making sure a full-screen plane
>> covers all other planes with the lower zpos, and the plane with the next
>> available zpos is indeed partially covering the full-screen plane.
> 
> I think this require rephrasing as per the latest changes, as we check 2 
> planes at a time.
> 
Thanks Ankit for pointing this out :) Done in v4.
>>
>> v2: -Removed intel only checks [Martin]
>>      -Used XRGB8888 pixel format as used in other IGTs
>>      -Added documentation [Martin]
>>      -Removed skip, instead continue if plane doesn't support zpos 
>> [Martin]
>>      -Sorted planes in increasing order of zpos [Martin]
>> v3: -Fix description [Martin]
>>      -Avoid sorting [Ankit]
>>
>> Issue: https://gitlab.freedesktop.org/drm/intel/issues/404
>> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
>> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
>> ---
>>   tests/kms_atomic.c | 159 ++++++++++++++++++++++++++++++++++++++++++---
>>   1 file changed, 149 insertions(+), 10 deletions(-)
>>
>> diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
>> index 8462d128..c55bc97d 100644
>> --- a/tests/kms_atomic.c
>> +++ b/tests/kms_atomic.c
>> @@ -121,7 +121,7 @@ static void plane_check_current_state(igt_plane_t 
>> *plane, const uint64_t *values
>>   }
>>   static void plane_commit(igt_plane_t *plane, enum igt_commit_style s,
>> -                                enum kms_atomic_check_relax relax)
>> +                         enum kms_atomic_check_relax relax)
>>   {
>>       igt_display_commit2(plane->pipe->display, s);
>>       plane_check_current_state(plane, plane->values, relax);
>> @@ -277,9 +277,9 @@ static uint32_t plane_get_igt_format(igt_plane_t 
>> *plane)
>>   }
>>   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)
>> +plane_primary_overlay_mutable_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);
>> @@ -320,7 +320,7 @@ plane_primary_overlay_zpos(igt_pipe_t *pipe, 
>> igt_output_t *output,
>>       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");
>> +         "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);
>> @@ -346,7 +346,7 @@ plane_primary_overlay_zpos(igt_pipe_t *pipe, 
>> igt_output_t *output,
>>       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");
>> +         "which the underlay should be seen\n");
>>       plane_commit(primary, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
>>       /* reset it back to initial state */
>> @@ -358,6 +358,135 @@ plane_primary_overlay_zpos(igt_pipe_t *pipe, 
>> igt_output_t *output,
>>       igt_assert_eq_u64(igt_plane_get_prop(overlay, IGT_PLANE_ZPOS), 1);
>>   }
>> +static void
>> +plane_immutable_zpos(igt_display_t *display, igt_pipe_t *pipe,
>> +             igt_output_t *output)
>> +{
>> +    cairo_t *cr;
>> +    struct igt_fb fb_ref;
>> +    igt_plane_t *primary;
>> +    drmModeModeInfo *mode;
>> +    igt_pipe_crc_t *pipe_crc;
>> +    igt_crc_t ref_crc, new_crc;
>> +    int n_planes = pipe->n_planes;
>> +    igt_plane_t *plane_ptr[n_planes];
>> +    uint32_t w_lower, h_lower, w_upper, h_upper;
>> +
>> +    igt_require(n_planes >= 2);
>> +
>> +    mode = igt_output_get_mode(output);
>> +    primary = igt_pipe_get_plane_type(pipe, DRM_PLANE_TYPE_PRIMARY);
>> +
>> +    /* for lower plane */
>> +    w_lower = mode->hdisplay;
>> +    h_lower = mode->vdisplay;
>> +
>> +    /* for upper plane */
>> +    w_upper = mode->hdisplay / 2;
>> +    h_upper = mode->vdisplay / 2;
>> +
>> +    igt_create_color_fb(display->drm_fd,
>> +                w_lower, h_lower,
>> +                DRM_FORMAT_XRGB8888,
>> +                I915_TILING_NONE,
>> +                0.0, 0.0, 0.0, &fb_ref);
>> +
>> +    /* create reference image */
>> +    cr = igt_get_cairo_ctx(display->drm_fd, &fb_ref);
>> +    igt_assert(cairo_status(cr) == 0);
>> +    igt_paint_color(cr, 0, 0, w_lower, h_lower, 0.0, 0.0, 1.0);
>> +    igt_paint_color(cr, w_upper / 2, h_upper / 2, w_upper, h_upper, 
>> 1.0, 1.0, 0.0);
>> +    igt_put_cairo_ctx(display->drm_fd, &fb_ref, cr);
>> +    igt_plane_set_fb(primary, &fb_ref);
>> +    igt_display_commit2(display, COMMIT_ATOMIC);
>> +
>> +    /* create the pipe_crc object for this pipe */
>> +    pipe_crc = igt_pipe_crc_new(pipe->display->drm_fd, pipe->pipe,
>> +                    INTEL_PIPE_CRC_SOURCE_AUTO);
>> +
>> +    /* get reference crc */
>> +    igt_pipe_crc_start(pipe_crc);
>> +    igt_pipe_crc_get_current(display->drm_fd, pipe_crc, &ref_crc);
>> +
>> +    igt_plane_set_fb(primary, NULL);
>> +
>> +    for (int k = 0; k < n_planes; k++) {
>> +        int zpos;
>> +        igt_plane_t *temp;
>> +
>> +        temp = &display->pipes[pipe->pipe].planes[k];
>> +
>> +        if (!igt_plane_has_prop(temp, IGT_PLANE_ZPOS))
>> +            continue;
>> +
>> +        zpos = igt_plane_get_prop(temp, IGT_PLANE_ZPOS);
> 
> I think, here assert (zpos < n_planes) should be there.
Done in v4.
> 
>> +        plane_ptr[zpos] = &display->pipes[pipe->pipe].planes[k];
> 
> Can use temp here.
Sorry, missed that. Done in v4.
> 
>> +    }
>> +
>> +    /*
>> +     * checking only pairs of plane in increasing fashion
>> +     * to avoid combinatorial explosion
>> +     */
>> +    for (int i = 0; i < n_planes - 1; i++) {
>> +        int fb_id_lower, fb_id_upper;
>> +        struct igt_fb fb_lower, fb_upper;
>> +        igt_plane_t *plane_lower, *plane_upper;
>> +
>> +        if (plane_ptr[i] != NULL) {
>> +            plane_lower = plane_ptr[i];
>> +            igt_assert(plane_lower);
> 
> No need of assert here, plane_ptr[i] is already checked earlier.
> 
Okay.

> With these minor changes:
> 
> Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> 
> 
> -Ankit
> 
>> +        } else
>> +            continue;
>> +
>> +        while (i  < (n_planes - 1)) {
>> +            if (plane_ptr[i + 1] != NULL) {
>> +                plane_upper = plane_ptr[i + 1];
>> +                break;
>> +            } else {
>> +                i++;
>> +                continue;
>> +            }
>> +        }
>> +
>> +        if (i == (n_planes - 1))
>> +            break;
>> +
>> +        if ((plane_lower->type == DRM_PLANE_TYPE_CURSOR) ||
>> +                (plane_upper->type == DRM_PLANE_TYPE_CURSOR))
>> +            continue;
>> +
>> +        fb_id_lower = igt_create_color_fb(display->drm_fd,
>> +                          w_lower, h_lower,
>> +                          DRM_FORMAT_XRGB8888,
>> +                          I915_TILING_NONE,
>> +                          0.0, 0.0, 1.0, &fb_lower);
>> +        igt_assert(fb_id_lower);
>> +
>> +        fb_id_upper = igt_create_color_fb(display->drm_fd,
>> +                          w_upper, h_upper,
>> +                          DRM_FORMAT_XRGB8888,
>> +                          I915_TILING_NONE,
>> +                          1.0, 1.0, 0.0, &fb_upper);
>> +        igt_assert(fb_id_upper);
>> +
>> +        igt_plane_set_position(plane_lower, 0, 0);
>> +        igt_plane_set_fb(plane_lower, &fb_lower);
>> +
>> +        igt_plane_set_position(plane_upper, w_upper / 2, h_upper / 2);
>> +        igt_plane_set_fb(plane_upper, &fb_upper);
>> +
>> +        igt_info("Committing with the plane[%d] underneath "\
>> +             "plane[%d]\n", i, (i + 1));
>> +        igt_display_commit2(display, COMMIT_ATOMIC);
>> +        igt_pipe_crc_get_current(pipe->display->drm_fd, pipe_crc, 
>> &new_crc);
>> +
>> +        igt_assert_crc_equal(&ref_crc, &new_crc);
>> +
>> +        igt_plane_set_fb(plane_lower, NULL);
>> +        igt_plane_set_fb(plane_upper, NULL);
>> +    }
>> +}
>> +
>>   static void plane_overlay(igt_pipe_t *pipe, igt_output_t *output, 
>> igt_plane_t *plane)
>>   {
>>       drmModeModeInfo *mode = igt_output_get_mode(output);
>> @@ -987,14 +1116,16 @@ igt_main
>>           plane_primary(pipe_obj, primary, &fb);
>>       }
>> -    igt_subtest("plane_primary_overlay_zpos") {
>> +    igt_describe("Verify that the overlay plane can cover the primary 
>> one (and "\
>> +             "vice versa) by changing their zpos property.");
>> +    igt_subtest("plane_primary_overlay_mutable_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));
>> @@ -1002,8 +1133,15 @@ igt_main
>>           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);
>> +        plane_primary_overlay_mutable_zpos(pipe_obj, output, primary, 
>> overlay,
>> +                               format_primary, format_overlay);
>> +    }
>> +
>> +    igt_describe("Verify the reported zpos property of planes by 
>> making sure "\
>> +             "only higher zpos planes cover the lower zpos ones.");
>> +    igt_subtest("plane_immutable_zpos") {
>> +        igt_output_set_pipe(output, pipe);
>> +        plane_immutable_zpos(&display, pipe_obj, output);
>>       }
>>       igt_subtest("test_only") {
>> @@ -1011,6 +1149,7 @@ igt_main
>>           test_only(pipe_obj, primary, output);
>>       }
>> +
>>       igt_subtest("plane_cursor_legacy") {
>>           igt_plane_t *cursor =
>>               igt_pipe_get_plane_type(pipe_obj, DRM_PLANE_TYPE_CURSOR);
> 

-- 
~Swati Sharma
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-03-17  7:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-16 18:34 [igt-dev] [PATCH i-g-t v3] tests/kms_atomic: add test to validate immutable zpos Swati Sharma
2020-03-16 18:59 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_atomic: add test to validate immutable zpos (rev3) Patchwork
2020-03-17  5:43 ` [igt-dev] [PATCH i-g-t v3] tests/kms_atomic: add test to validate immutable zpos Nautiyal, Ankit K
2020-03-17  7:20   ` Sharma, Swati2

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox