public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Alaa Emad <aemad@igalia.com>
To: igt-dev@lists.freedesktop.org
Cc: petri.latvala@intel.com
Subject: [igt-dev] [PATCH RFC i-g-t v2 7/8] tests/kms_universal_plane: decouple verification of ablity to explicitly disable an already implicitly-disabled primary plane
Date: Sat,  7 Jan 2023 15:45:58 +0200	[thread overview]
Message-ID: <e13e9ddefc7aaa22eb8b14be1eeed7944e4eeb58.1673098992.git.aemad@igalia.com> (raw)
In-Reply-To: <cover.1673098992.git.aemad@igalia.com>

decouple verification of ablity to explicitly disable an already implicitly-disabled primary plane
in a separated subtests to be able to run it individually, creating the function.

Signed-off-by: Alaa Emad <aemad@igalia.com>
---
 tests/kms_universal_plane.c | 94 +++++++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)

diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c
index c513eff9..743ccbc6 100644
--- a/tests/kms_universal_plane.c
+++ b/tests/kms_universal_plane.c
@@ -546,6 +546,94 @@ test_set_primary_completely_offscreen(data_t *data, enum pipe pipe, igt_output_t
 	functional_test_fini(&test, output);
 }
 
+//SUCCESS on VKMS and i915
+static void
+test_explicitly_disable_primary(data_t *data, enum pipe pipe, igt_output_t *output)
+{
+	functional_test_t test = {.data = data};
+	igt_display_t *display = &data->display;
+	igt_plane_t *primary, *sprite;
+	int num_primary = 0, num_cursor = 0;
+	int i;
+
+	igt_require_pipe(display, pipe);
+
+	igt_info("Testing connector %s using pipe %s\n", igt_output_name(output),
+			 kmstest_pipe_name(pipe));
+
+	functional_test_init(&test, output, pipe);
+
+	/*
+	 * Make sure we have no more than one primary or cursor plane per crtc.
+	 * If the kernel accidentally calls drm_plane_init() rather than
+	 * drm_universal_plane_init(), the type enum can get interpreted as a
+	 * boolean and show up in userspace as the wrong type.
+	 */
+	for (i = 0; i < display->pipes[pipe].n_planes; i++)
+		if (display->pipes[pipe].planes[i].type == DRM_PLANE_TYPE_PRIMARY)
+			num_primary++;
+		else if (display->pipes[pipe].planes[i].type == DRM_PLANE_TYPE_CURSOR)
+			num_cursor++;
+
+	igt_warn_on(num_primary != 1);
+	igt_warn_on(num_cursor > 1);
+
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+	sprite = igt_output_get_plane_type(output, DRM_PLANE_TYPE_OVERLAY);
+	if (!sprite)
+	{
+		functional_test_fini(&test, output);
+		igt_skip("No sprite plane available\n");
+	}
+
+	igt_plane_set_position(sprite, 100, 100);
+
+	/* Step 3: Legacy API's, yellow primary (CRC 3) */
+	igt_plane_set_fb(primary, &test.yellow_fb);
+	igt_display_commit2(display, COMMIT_LEGACY);
+	igt_pipe_crc_collect_crc(test.pipe_crc, &test.crc_3);
+
+	/* Step 4: Universal API's, blue primary, red sprite (CRC 4) */
+	igt_plane_set_fb(primary, &test.blue_fb);
+	igt_plane_set_fb(sprite, &test.red_fb);
+	igt_display_commit2(display, COMMIT_UNIVERSAL);
+	igt_pipe_crc_collect_crc(test.pipe_crc, &test.crc_4);
+
+	/* Step 5: Universal API's, disable primary plane (CRC 5) */
+	if (!is_amdgpu_device(data->drm_fd)) {
+		igt_plane_set_fb(primary, NULL);
+		igt_display_commit2(display, COMMIT_UNIVERSAL);
+		igt_pipe_crc_collect_crc(test.pipe_crc, &test.crc_5);
+	}
+
+	/*
+	 * Step 15: Explicitly disable primary after it's already been
+	 * implicitly disabled (CRC 10).
+	 */
+	if (!is_amdgpu_device(data->drm_fd)) {
+		igt_plane_set_fb(primary, NULL);
+		igt_display_commit2(display, COMMIT_UNIVERSAL);
+		igt_pipe_crc_collect_crc(test.pipe_crc, &test.crc_10);
+	}
+
+	/* Step 16: Legacy API's, blue primary, red sprite */
+	igt_plane_set_fb(primary, &test.blue_fb);
+	igt_plane_set_fb(sprite, &test.red_fb);
+	igt_display_commit2(display, COMMIT_LEGACY);
+
+	/*
+	 * We should be able to explicitly disable an already
+	 * implicitly-disabled primary plane
+	 */
+	igt_assert_crc_equal(&test.crc_5, &test.crc_10);
+
+	igt_plane_set_fb(primary, NULL);
+	igt_plane_set_fb(sprite, NULL);
+
+	functional_test_fini(&test, output);
+}
+
+
 /*
  * Universal plane functional testing.
  *   - Black primary plane via traditional interfaces, red sprite, grab CRC:1.
@@ -1251,6 +1339,12 @@ run_tests_for_pipe(data_t *data, enum pipe pipe)
 		      kmstest_pipe_name(pipe))
 		for_each_valid_output_on_pipe(&data->display, pipe, output)
 			test_set_primary_completely_offscreen(data, pipe, output);
+	
+	igt_describe("Check the switching between different primary plane fbs with CRTC off");
+	igt_subtest_f("explicitly-disable-primary-%s",
+		      kmstest_pipe_name(pipe))
+		for_each_valid_output_on_pipe(&data->display, pipe, output)
+			test_explicitly_disable_primary(data, pipe, output);
 
 	igt_describe("Check the switching between different primary plane fbs with CRTC off");
 	igt_subtest_f("universal-plane-pipe-%s-functional",
-- 
2.34.1

  parent reply	other threads:[~2023-01-07 13:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-07 13:45 [igt-dev] [PATCH RFC i-g-t v2 0/8] tests/kms_universal_plane: divide `functional_test_pipe` to mini-subtests Alaa Emad
2023-01-07 13:45 ` [igt-dev] [PATCH RFC i-g-t v2 1/8] tests/kms_universal_plane: decouple verification of legacy and atomic api Alaa Emad
2023-01-07 13:45 ` [igt-dev] [PATCH RFC i-g-t v2 2/8] tests/kms_universal_plane: decouple verification of disabling primary plane Alaa Emad
2023-01-07 13:45 ` [igt-dev] [PATCH RFC i-g-t v2 3/8] tests/kms_universal_plane: decouple verification of re-enabling " Alaa Emad
2023-01-07 13:45 ` [igt-dev] [PATCH RFC i-g-t v2 4/8] tests/kms_universal_plane: decouple verification of setup plane FB's while CRTC is disabled Alaa Emad
2023-01-07 13:45 ` [igt-dev] [PATCH RFC i-g-t v2 5/8] tests/kms_universal_plane: decouple verification of ablity to modeset with the primary plane off Alaa Emad
2023-01-07 13:45 ` [igt-dev] [PATCH RFC i-g-t v2 6/8] tests/kms_universal_plane: decouple verification of ablity to move the primary plane completely Alaa Emad
2023-01-07 13:45 ` Alaa Emad [this message]
2023-01-07 13:45 ` [igt-dev] [PATCH RFC i-g-t v2 8/8] tests/kms_universal_plane: create the run_functional_test_pipe and call all tests from it Alaa Emad
2023-01-10 18:43   ` Alex Hung
2023-01-07 14:12 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_universal_plane: divide `functional_test_pipe` to mini-subtests (rev2) Patchwork
2023-01-07 15:42 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-01-10 18:29 ` [igt-dev] [PATCH RFC i-g-t v2 0/8] tests/kms_universal_plane: divide `functional_test_pipe` to mini-subtests Alex Hung

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=e13e9ddefc7aaa22eb8b14be1eeed7944e4eeb58.1673098992.git.aemad@igalia.com \
    --to=aemad@igalia.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@intel.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