From: Suraj Kandpal <suraj.kandpal@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: swati2.sharma@intel.com, santhosh.reddy.guddati@intel.com,
Suraj Kandpal <suraj.kandpal@intel.com>,
Jason-JH Lin <jason-jh.lin@mediatek.com>
Subject: [PATCH i-g-t] tests/kms_content_protection: clamp plane src/dst to output mode
Date: Fri, 15 May 2026 13:44:27 +0530 [thread overview]
Message-ID: <20260515081427.973496-1-suraj.kandpal@intel.com> (raw)
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().
Tested-by: Jason-JH Lin <jason-jh.lin@mediatek.com>
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.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 */
--
2.34.1
next reply other threads:[~2026-05-15 8:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 8:14 Suraj Kandpal [this message]
2026-05-15 15:31 ` ✗ Fi.CI.BUILD: failure for tests/kms_content_protection: clamp plane src/dst to output mode Patchwork
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=20260515081427.973496-1-suraj.kandpal@intel.com \
--to=suraj.kandpal@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jason-jh.lin@mediatek.com \
--cc=santhosh.reddy.guddati@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