Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Jason-JH Lin (林睿祥)" <Jason-JH.Lin@mediatek.com>
To: "suraj.kandpal@intel.com" <suraj.kandpal@intel.com>,
	"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"intel-gfx-trybot@lists.freedesktop.org"
	<intel-gfx-trybot@lists.freedesktop.org>
Cc: "navaremanasi@google.com" <navaremanasi@google.com>,
	"Singo Chang (張興國)" <Singo.Chang@mediatek.com>,
	"markyacoub@chromium.org" <markyacoub@chromium.org>,
	"santhosh.reddy.guddati@intel.com"
	<santhosh.reddy.guddati@intel.com>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	"Nancy Lin (林欣螢)" <Nancy.Lin@mediatek.com>,
	"swati2.sharma@intel.com" <swati2.sharma@intel.com>,
	"Paul-pl Chen (陳柏霖)" <Paul-pl.Chen@mediatek.com>
Subject: Re: tests/kms_content_protection: clamp plane src/dst to output mode
Date: Fri, 15 May 2026 08:02:54 +0000	[thread overview]
Message-ID: <3f66cca0183086ab8ff8436e5baa81ffc763ffed.camel@mediatek.com> (raw)
In-Reply-To: <20260515052433.903588-1-suraj.kandpal@intel.com>

On Fri, 2026-05-15 at 10:54 +0530, Suraj Kandpal wrote:
> create_fbs() sizes the shared red/green FBs to the max width and
> height across all connected outputs. With panels of differing native
> resolutions (e.g. 3504x2190 and 3840x2160), the FB ends up larger
> than
> at least one panel in some dimension. igt_plane_set_fb() resets the
> plane src and dst rectangles to the full FB size, so subsequent
> commits submit a source rect that exceeds the CRTC active area and
> atomic check rejects them with -EINVAL before HDCP authentication can
> start.
> 
> Clamp the plane source (igt_fb_set_size) and destination
> (igt_plane_set_size) to the output's current mode after every
> igt_plane_set_fb() in modeset_with_fb(), test_cp_enable(),
> test_cp_disable() and test_mst_cp_disable().
> 
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>

Hi Suraj,

After reverting my series:
- https://patchwork.freedesktop.org/series/164052/

This patch can resolve my previous issue.
Thank you for your patch.

Tested-by: Jason-JH Lin <jason-jh.lin@mediatek.com>

> ---
>  tests/kms_content_protection.c | 29 ++++++++++++++++++++++++++++-
>  1 file changed, 28 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/kms_content_protection.c
> b/tests/kms_content_protection.c
> index c59441f11..d1b7c5863 100644
> --- a/tests/kms_content_protection.c
> +++ b/tests/kms_content_protection.c
> @@ -264,16 +264,22 @@ static void modeset_with_fb(igt_output_t
> *output,
>  	igt_display_t *display = &data.display;
>  	drmModeModeInfo *mode;
>  	igt_plane_t *primary;
> +	int width, height;
>  
>  	mode = igt_output_get_mode(output);
> +	width = mode->hdisplay;
> +	height = mode->vdisplay;
>  
>  	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_fb_set_size(&data.red, primary, width, height);
> +	igt_plane_set_size(primary, width, height);
>  
>  	igt_display_commit2(display, commit_style);
>  
>  	igt_plane_set_fb(primary, &data.green);
> +	igt_fb_set_size(&data.green, primary, width, height);
> +	igt_plane_set_size(primary, width, height);
>  
>  	/* Wait for Flip completion before starting the HDCP
> authentication */
>  	commit_display_and_wait_for_flip(commit_style);
> @@ -284,6 +290,8 @@ static bool test_cp_enable(igt_output_t *output,
> enum igt_commit_style commit_st
>  {
>  	igt_display_t *display = &data.display;
>  	igt_plane_t *primary;
> +	drmModeModeInfo *mode;
> +	int width, height;
>  	bool ret;
>  
>  	primary = igt_output_get_plane_type(output,
> DRM_PLANE_TYPE_PRIMARY);
> @@ -302,7 +310,12 @@ 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) {
> +		mode = igt_output_get_mode(output);
> +		width = mode->hdisplay;
> +		height = mode->vdisplay;
>  		igt_plane_set_fb(primary, &data.green);
> +		igt_plane_set_size(primary, width, height);
> +		igt_fb_set_size(&data.green, primary, width,
> height);
>  		igt_display_commit2(display, commit_style);
>  	}
>  
> @@ -315,13 +328,20 @@ static void test_mst_cp_disable(igt_output_t
> *hdcp_mst_output[],
>  {
>  	igt_display_t *display = &data.display;
>  	igt_plane_t *primary;
> +	drmModeModeInfo *mode;
> +	int width, height;
>  	bool ret;
>  	int count;
>  	u64 val;
>  
>  	for (count = 0; count < valid_outputs; count++) {
>  		primary =
> igt_output_get_plane_type(hdcp_mst_output[count],
> DRM_PLANE_TYPE_PRIMARY);
> +		mode = igt_output_get_mode(hdcp_mst_output[count]);
> +		width = mode->hdisplay;
> +		height = mode->vdisplay;
>  		igt_plane_set_fb(primary, &data.red);
> +		igt_fb_set_size(&data.red, primary, width, height);
> +		igt_plane_set_size(primary, width, height);
>  		igt_output_set_prop_value(hdcp_mst_output[count],
> IGT_CONNECTOR_CONTENT_PROTECTION,
>  					  CP_UNDESIRED);
>  	}
> @@ -343,10 +363,15 @@ static void test_cp_disable(igt_output_t
> *output, enum igt_commit_style commit_s
>  {
>  	igt_display_t *display = &data.display;
>  	igt_plane_t *primary;
> +	drmModeModeInfo *mode;
> +	int width, height;
>  	bool ret;
>  
>  	primary = igt_output_get_plane_type(output,
> DRM_PLANE_TYPE_PRIMARY);
>  
> +	mode = igt_output_get_mode(output);
> +	width = mode->hdisplay;
> +	height = mode->vdisplay;
>  	/*
>  	 * Even on HDCP enable failed scenario, IGT should exit
> leaving the
>  	 * "content protection" at "UNDESIRED".
> @@ -354,6 +379,8 @@ 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_size(primary, width, height);
> +	igt_fb_set_size(&data.red, primary, width, height);
>  	igt_display_commit2(display, commit_style);
>  
>  	/* Wait for HDCP to be disabled, before crtc off */


           reply	other threads:[~2026-05-15  8:03 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20260515052433.903588-1-suraj.kandpal@intel.com>]

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=3f66cca0183086ab8ff8436e5baa81ffc763ffed.camel@mediatek.com \
    --to=jason-jh.lin@mediatek.com \
    --cc=Nancy.Lin@mediatek.com \
    --cc=Paul-pl.Chen@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=Singo.Chang@mediatek.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx-trybot@lists.freedesktop.org \
    --cc=markyacoub@chromium.org \
    --cc=navaremanasi@google.com \
    --cc=santhosh.reddy.guddati@intel.com \
    --cc=suraj.kandpal@intel.com \
    --cc=swati2.sharma@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