Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Reddy Guddati, Santhosh" <santhosh.reddy.guddati@intel.com>
To: <igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH i-g-t v5 2/3] tests/kms_content_protection: Pass crtc parameter and use per-CRTC FBs
Date: Wed, 6 May 2026 16:35:37 +0530	[thread overview]
Message-ID: <b4107214-bc8d-4a27-87b0-128fc628befb@intel.com> (raw)
In-Reply-To: <20260330032205.467130-3-jason-jh.lin@mediatek.com>



On 30-03-2026 08:50, Jason-JH Lin wrote:
> Refactor functions to accept crtc parameter and use per-CRTC
> framebuffers (data.fbs[crtc->crtc_index]).
> 
> Modified: modeset_with_fb(), test_cp_enable/disable(),
> test_cp_enable_with_retry(), test_mst_cp_disable(),
> prepare_modeset_on_mst_output(), test_fini(),
> test_content_protection_cleanup().
> 
> Signed-off-by: Jason-JH Lin <jason-jh.lin@mediatek.com>
> ---
>   tests/kms_content_protection.c | 74 ++++++++++++++++++++--------------
>   1 file changed, 43 insertions(+), 31 deletions(-)
> 
> diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
> index df9ff5efcaa2..b302d4cfd47d 100644
> --- a/tests/kms_content_protection.c
> +++ b/tests/kms_content_protection.c
> @@ -263,7 +263,7 @@ commit_display_and_wait_for_flip(enum igt_commit_style commit_style)
>   	}
>   }
>   
> -static void modeset_with_fb(igt_output_t *output,
> +static void modeset_with_fb(igt_output_t *output, igt_crtc_t *crtc,
>   			    enum igt_commit_style commit_style)
>   {
>   	igt_display_t *display = &data.display;
> @@ -273,18 +273,19 @@ static void modeset_with_fb(igt_output_t *output,
>   	mode = igt_output_get_mode(output);
>   
>   	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
> -	igt_plane_set_fb(primary, &data.red);
> -	igt_fb_set_size(&data.red, primary, mode->hdisplay, mode->vdisplay);
> +	igt_plane_set_fb(primary, &data.fbs[crtc->crtc_index].red);
> +	igt_fb_set_size(&data.fbs[crtc->crtc_index].red, primary, mode->hdisplay, mode->vdisplay);
>   
>   	igt_display_commit2(display, commit_style);
>   
> -	igt_plane_set_fb(primary, &data.green);
> +	igt_plane_set_fb(primary, &data.fbs[crtc->crtc_index].green);
>   
>   	/* Wait for Flip completion before starting the HDCP authentication */
>   	commit_display_and_wait_for_flip(commit_style);
>   }
>   
> -static bool test_cp_enable(igt_output_t *output, enum igt_commit_style commit_style,
> +static bool test_cp_enable(igt_output_t *output, igt_crtc_t *crtc,
> +			   enum igt_commit_style commit_style,
>   			   int content_type, bool type_change)
>   {
>   	igt_display_t *display = &data.display;
> @@ -307,7 +308,7 @@ static bool test_cp_enable(igt_output_t *output, enum igt_commit_style commit_st
>   	ret = wait_for_prop_value(output, CP_ENABLED,
>   				  KERNEL_AUTH_TIME_ALLOWED_MSEC);
>   	if (ret) {
> -		igt_plane_set_fb(primary, &data.green);
> +		igt_plane_set_fb(primary, &data.fbs[crtc->crtc_index].green);
>   		igt_display_commit2(display, commit_style);
>   	}
>   
> @@ -320,13 +321,15 @@ static void test_mst_cp_disable(igt_output_t *hdcp_mst_output[],
>   {
>   	igt_display_t *display = &data.display;
>   	igt_plane_t *primary;
> +	igt_crtc_t *crtc;
>   	bool ret;
>   	int count;
>   	u64 val;
>   
>   	for (count = 0; count < valid_outputs; count++) {
> +		crtc = igt_output_get_driving_crtc(hdcp_mst_output[count]);
>   		primary = igt_output_get_plane_type(hdcp_mst_output[count], DRM_PLANE_TYPE_PRIMARY);
> -		igt_plane_set_fb(primary, &data.red);
> +		igt_plane_set_fb(primary, &data.fbs[crtc->crtc_index].red);
>   		igt_output_set_prop_value(hdcp_mst_output[count], IGT_CONNECTOR_CONTENT_PROTECTION,
>   					  CP_UNDESIRED);
>   	}
> @@ -344,7 +347,8 @@ static void test_mst_cp_disable(igt_output_t *hdcp_mst_output[],
>   	igt_assert_f(ret, "Content Protection not cleared on all MST outputs\n");
>   }
>   
> -static void test_cp_disable(igt_output_t *output, enum igt_commit_style commit_style)
> +static void test_cp_disable(igt_output_t *output, igt_crtc_t *crtc,
> +			    enum igt_commit_style commit_style)
>   {
>   	igt_display_t *display = &data.display;
>   	igt_plane_t *primary;
> @@ -358,7 +362,7 @@ static void test_cp_disable(igt_output_t *output, enum igt_commit_style commit_s
>   	 */
>   	igt_output_set_prop_value(output, IGT_CONNECTOR_CONTENT_PROTECTION,
>   				  CP_UNDESIRED);
> -	igt_plane_set_fb(primary, &data.red);
> +	igt_plane_set_fb(primary, &data.fbs[crtc->crtc_index].red);
>   	igt_display_commit2(display, commit_style);
>   
>   	/* Wait for HDCP to be disabled, before crtc off */
> @@ -367,7 +371,7 @@ static void test_cp_disable(igt_output_t *output, enum igt_commit_style commit_s
>   	igt_assert_f(ret, "Content Protection not cleared\n");
>   }
>   
> -static void test_cp_enable_with_retry(igt_output_t *output,
> +static void test_cp_enable_with_retry(igt_output_t *output, igt_crtc_t *crtc,
>   				      enum igt_commit_style commit_style,
>   				      int retry, int content_type,
>   				      bool expect_failure,
> @@ -378,16 +382,16 @@ static void test_cp_enable_with_retry(igt_output_t *output,
>   
>   	do {
>   		if (!type_change || retry_orig != retry)
> -			test_cp_disable(output, commit_style);
> +			test_cp_disable(output, crtc, commit_style);
>   
> -		ret = test_cp_enable(output, commit_style, content_type, type_change);
> +		ret = test_cp_enable(output, crtc, commit_style, content_type, type_change);
>   
>   		if (!ret && --retry)
>   			igt_debug("Retry (%d/2) ...\n", 3 - retry);
>   	} while (retry && !ret);
>   
>   	if (!ret)
> -		test_cp_disable(output, commit_style);
> +		test_cp_disable(output, crtc, commit_style);
>   
>   	if (expect_failure)
>   		igt_assert_f(!ret,
> @@ -457,16 +461,16 @@ static void test_content_protection_on_output(igt_output_t *output,
>   	igt_display_t *display = &data.display;
>   	bool ret;
>   
> -	test_cp_enable_with_retry(output, commit_style, 3, content_type, false,
> +	test_cp_enable_with_retry(output, crtc, commit_style, 3, content_type, false,
>   				  false);
>   
>   	if (data.cp_tests & CP_TYPE_CHANGE) {
>   		/* Type 1 -> Type 0 */
> -		test_cp_enable_with_retry(output, commit_style, 3,
> +		test_cp_enable_with_retry(output, crtc, commit_style, 3,
>   					  HDCP_CONTENT_TYPE_0, false,
>   					  true);
>   		/* Type 0 -> Type 1 */
> -		test_cp_enable_with_retry(output, commit_style, 3,
> +		test_cp_enable_with_retry(output, crtc, commit_style, 3,
>   					  content_type, false,
>   					  true);
>   	}
> @@ -476,14 +480,14 @@ static void test_content_protection_on_output(igt_output_t *output,
>   			     "mei_hdcp unload failed");
>   
>   		/* Expected to fail */
> -		test_cp_enable_with_retry(output, commit_style, 3,
> +		test_cp_enable_with_retry(output, crtc, commit_style, 3,
>   					  content_type, true, false);
>   
>   		igt_assert_f(!igt_kmod_load("mei_hdcp", NULL),
>   			     "mei_hdcp load failed");
>   
>   		/* Expected to pass */
> -		test_cp_enable_with_retry(output, commit_style, 3,
> +		test_cp_enable_with_retry(output, crtc, commit_style, 3,
>   					  content_type, false, false);
>   	}
>   
> @@ -502,7 +506,7 @@ static void test_content_protection_on_output(igt_output_t *output,
>   		ret = wait_for_prop_value(output, CP_ENABLED,
>   					  KERNEL_AUTH_TIME_ALLOWED_MSEC);
>   		if (!ret)
> -			test_cp_enable_with_retry(output, commit_style, 2,
> +			test_cp_enable_with_retry(output, crtc, commit_style, 2,
>   						  content_type, false,
>   						  false);
>   	}
> @@ -513,7 +517,7 @@ static void test_content_protection_on_output(igt_output_t *output,
>   		ret = wait_for_prop_value(output, CP_ENABLED,
>   					  KERNEL_AUTH_TIME_ALLOWED_MSEC);
>   		if (!ret)
> -			test_cp_enable_with_retry(output, commit_style, 2,
> +			test_cp_enable_with_retry(output, crtc, commit_style, 2,
>   						  content_type, false,
>   						  false);
>   	}
> @@ -583,21 +587,24 @@ static bool sink_hdcp2_capable(igt_output_t *output)
>   	return strstr(buf, "HDCP2.2");
>   }
>   
> -static void prepare_modeset_on_mst_output(igt_output_t *output, bool is_enabled)
> +static void prepare_modeset_on_mst_output(igt_output_t *output, igt_crtc_t *crtc, bool is_enabled)
>   {
>   	drmModeModeInfo *mode;
>   	igt_plane_t *primary;
>   	int width, height;
> +	struct igt_fb *fb;
>   
>   	mode = igt_output_get_mode(output);
>   
>   	width = mode->hdisplay;
>   	height = mode->vdisplay;
>   
> +	fb = is_enabled ? &data.fbs[crtc->crtc_index].green : &data.fbs[crtc->crtc_index].red;
> +
>   	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
>   	igt_plane_set_fb(primary, NULL);
> -	igt_plane_set_fb(primary, is_enabled ? &data.green : &data.red);
> -	igt_fb_set_size(is_enabled ? &data.green : &data.red, primary, width, height);
> +	igt_plane_set_fb(primary, fb);
> +	igt_fb_set_size(fb, primary, width, height);
>   	igt_plane_set_size(primary, width, height);
>   }
>   
> @@ -669,11 +676,11 @@ static void reset_i915_force_hdcp14(igt_output_t *output)
>   }
>   
>   static void
> -test_fini(igt_output_t *output, enum igt_commit_style commit_style)
> +test_fini(igt_output_t *output, igt_crtc_t *crtc, enum igt_commit_style commit_style)
>   {
>   	igt_plane_t *primary;
>   
> -	test_cp_disable(output, commit_style);
> +	test_cp_disable(output, crtc, commit_style);
>   	primary = igt_output_get_plane_type(output,
>   					    DRM_PLANE_TYPE_PRIMARY);
>   	igt_plane_set_fb(primary, NULL);
> @@ -769,7 +776,7 @@ test_content_protection(enum igt_commit_style commit_style, int content_type)
>   			if (!intel_pipe_output_combo_valid(display))
>   				continue;
>   
> -			modeset_with_fb(output, commit_style);
> +			modeset_with_fb(output, crtc, commit_style);
>   			if (data.is_force_hdcp14)
>   				set_i915_force_hdcp14(output);
>   
> @@ -783,7 +790,7 @@ test_content_protection(enum igt_commit_style commit_style, int content_type)
>   			if (data.is_force_hdcp14)
>   				reset_i915_force_hdcp14(output);
>   
> -			test_fini(output, commit_style);
> +			test_fini(output, crtc, commit_style);
>   			/*
>   			 * Testing a output with a pipe is enough for HDCP
>   			 * testing. No ROI in testing the connector with other
> @@ -876,8 +883,11 @@ test_mst_cp_enable_with_retry(igt_output_t *hdcp_mst_output[], int valid_outputs
>   		if (!ret || retries)
>   			igt_debug("Retry %d/3\n", 3 - retries);
>   
> -		for (i = 0; i < valid_outputs; i++)
> -			prepare_modeset_on_mst_output(hdcp_mst_output[i], ret);
> +		for (i = 0; i < valid_outputs; i++) {
> +			igt_crtc_t *crtc = igt_output_get_driving_crtc(hdcp_mst_output[i]);
> +
> +			prepare_modeset_on_mst_output(hdcp_mst_output[i], crtc, ret);
> +		}
>   
>   		igt_display_commit2(display, COMMIT_ATOMIC);
>   	} while (retries && !ret);
> @@ -919,7 +929,7 @@ test_content_protection_mst(int content_type)
>   		igt_assert_f(pipe_found, "No valid pipe found for %s\n", output->name);
>   
>   		igt_output_set_crtc(output, crtc);
> -		prepare_modeset_on_mst_output(output, false);
> +		prepare_modeset_on_mst_output(output, crtc, false);
>   		dp_mst_outputs++;
>   		if (output_hdcp_capable(output, content_type))
>   			hdcp_mst_output[valid_outputs++] = output;
> @@ -982,6 +992,7 @@ static void test_content_protection_cleanup(void)
>   {
>   	igt_display_t *display = &data.display;
>   	igt_output_t *output;
> +	igt_crtc_t *crtc;
>   	uint64_t val;
>   
>   	for_each_connected_output(display, output) {
> @@ -994,7 +1005,8 @@ static void test_content_protection_cleanup(void)
>   			continue;
>   
>   		igt_info("CP Prop being UNDESIRED on %s\n", output->name);
> -		test_cp_disable(output, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
> +		crtc = igt_output_get_driving_crtc(output);
nit, Do we need to guard this for NULL?
Rest LGTM,
  Tested-by: Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
  Reviewed-by: Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
> +		test_cp_disable(output, crtc, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
>   	}
>   }
>   


  parent reply	other threads:[~2026-05-06 11:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30  3:20 [PATCH i-g-t v5 0/3] Optimize framebuffer management Jason-JH Lin
2026-03-30  3:20 ` [PATCH i-g-t v5 1/3] tests/kms_content_protection: Add per-CRTC framebuffer infrastructure Jason-JH Lin
2026-04-29 20:31   ` Manasi Navare
2026-04-30 22:59     ` Manasi Navare
2026-05-04  8:31       ` Karthik B S
2026-05-04 20:32         ` Manasi Navare
2026-05-05 22:28           ` Manasi Navare
2026-05-06 12:15             ` Karthik B S
2026-05-06 18:15               ` Manasi Navare
2026-05-06 10:57           ` Reddy Guddati, Santhosh
2026-03-30  3:20 ` [PATCH i-g-t v5 2/3] tests/kms_content_protection: Pass crtc parameter and use per-CRTC FBs Jason-JH Lin
2026-04-17  4:12   ` Fei Shao
2026-05-06 11:05   ` Reddy Guddati, Santhosh [this message]
2026-03-30  3:20 ` [PATCH i-g-t v5 3/3] tests/kms_content_protection: Add FB cleanup for MST tests Jason-JH Lin
2026-05-06 11:13   ` Reddy Guddati, Santhosh
2026-03-30  4:14 ` ✓ Xe.CI.BAT: success for Optimize framebuffer management Patchwork
2026-03-30  4:37 ` ✓ i915.CI.BAT: " Patchwork
2026-03-30  4:37 ` Patchwork
2026-03-30  4:38 ` Patchwork
2026-03-30  4:38 ` Patchwork
2026-03-30  4:38 ` Patchwork
2026-03-30  5:10 ` ✓ Xe.CI.FULL: " Patchwork
2026-03-30  6:37 ` ✗ i915.CI.Full: failure " Patchwork
2026-04-14  5:59 ` [PATCH i-g-t v5 0/3] " Jason-JH Lin (林睿祥)

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=b4107214-bc8d-4a27-87b0-128fc628befb@intel.com \
    --to=santhosh.reddy.guddati@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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