Skip to contentSkip to conversation

tests/kms_content_protection: clamp plane src/dst to output mode

PATCH Superseded Suraj Kandpal 3 participants 4 messages May 15 – May 17

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/kms_content_protection: clamp plane src/dst to output mode

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().

---
 tests/kms_content_protection.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
tests/kms_content_protection.c +28 -1
index c59441f11..d1b7c5863 100644
@@ -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 */
Signature · 1 line
2.34.1
#1 lore raw

✗ Fi.CI.BUILD: failure for tests/kms_content_protection: clamp plane src/dst to output mode

== Series Details ==

== Series Details ==

Series: tests/kms_content_protection: clamp plane src/dst to output mode
URL : https://patchwork.freedesktop.org/series/166632/
State : failure

== Summary ==

Applying: tests/kms_content_protection: clamp plane src/dst to output mode Using index info to reconstruct a base tree...
M tests/kms_content_protection.c
Falling back to patching base and 3-way merge...
Auto-merging tests/kms_content_protection.c
CONFLICT (content): Merge conflict in tests/kms_content_protection.c Patch failed at 0001 tests/kms_content_protection: clamp plane src/dst to output mode When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

#2 lore raw
In reply to Suraj Kandpal

Hi Suraj,

Quoted 9 lines · Suraj Kandpal

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.

Quoted 8 lines

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().

---

The changes LGTM. This patch needs a rebase after the below series is merged.
https://patchwork.freedesktop.org/series/166566/

Regards,
Santhosh> tests/kms_content_protection.c | 29 ++++++++++++++++++++++++++++-

Quoted 98 lines
  1 file changed, 28 insertions(+), 1 deletion(-)
tests/kms_content_protection.c +28 -1
index c59441f11..d1b7c5863 100644
@@ -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 */
#3 lore raw
Quoted 20 lines

Subject: Re: [PATCH i-g-t] tests/kms_content_protection: clamp plane src/dst to output mode

Hi Suraj,

Quoted 14 lines · Suraj Kandpal

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().

Quoted 5 lines
Quoted 3 lines

---

The changes LGTM. This patch needs a rebase after the below series is merged.
https://patchwork.freedesktop.org/series/166566/

Hi Santhosh you can merge this while you are merging this series

Regards,
Suraj Kandpal

Quoted 113 lines

Regards,
Santhosh> tests/kms_content_protection.c | 29
++++++++++++++++++++++++++++-

Quoted 7 lines
  1 file changed, 28 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/tests/kms_content_protection.c index c59441f11..d1b7c5863 100644

tests/kms_content_protection.c static void modeset_with_fb(igt_output_t *output, · line 273

Quoted 10 lines
tests/kms_content_protection.c +3 -0
@@ -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);

tests/kms_content_protection.c static bool test_cp_enable(igt_output_t *output,

Quoted 14 lines
tests/kms_content_protection.c +4 -1
  	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

Quoted 9 lines
tests/kms_content_protection.c +2 -0
  {
  	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

tests/kms_content_protection.c static void test_mst_cp_disable(igt_output_t

Quoted 13 lines

ret = wait_for_prop_value(output, CP_ENABLED,
KERNEL_AUTH_TIME_ALLOWED_MSEC);
if (ret) {

tests/kms_content_protection.c +5 -0
+		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[],

tests/kms_content_protection.c static void test_mst_cp_disable(igt_output_t *hdcp_mst_output[],

Quoted 11 lines
tests/kms_content_protection.c +2 -0
  {
  	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],

tests/kms_content_protection.c static void test_mst_cp_disable(igt_output_t *hdcp_mst_output[],

Quoted 8 lines
tests/kms_content_protection.c +5 -0
 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,

tests/kms_content_protection.c static void test_cp_disable(igt_output_t *output,

Quoted 3 lines
tests/kms_content_protection.c +0 -0
  					  CP_UNDESIRED);
  	}
tests/kms_content_protection.c +0 -0
@@ -343,10 +363,15 @@ static void test_cp_disable(igt_output_t *output,

enum igt_commit_style commit_s

tests/kms_content_protection.c static void test_cp_disable(igt_output_t *output,

Quoted 17 lines
tests/kms_content_protection.c +5 -0
  {
  	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".

tests/kms_content_protection.c +0 -0
@@ -354,6 +379,8 @@ static void test_cp_disable(igt_output_t *output,

enum igt_commit_style commit_s

tests/kms_content_protection.c static void test_cp_disable(igt_output_t *output, · line 379

Quoted 1 line
tests/kms_content_protection.c +0 -0
  	igt_output_set_prop_value(output,

IGT_CONNECTOR_CONTENT_PROTECTION,

Quoted 7 lines
tests/kms_content_protection.c +2 -0
  				  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 */