RE: [PATCH i-g-t v3] tests/kms_content_protection: Get HDCP capable outputs before modeset

S, Sowmiya
2026-03-16T14:24:13Z

Hi Santhosh,

> -----Original Message-----
> From: igt-dev <igt-dev-bounces@lists.freedesktop.org> On Behalf Of Santhosh
> Reddy Guddati
> Sent: 16 March 2026 10:44
> To: igt-dev@lists.freedesktop.org
> Cc: Kandpal, Suraj <suraj.kandpal@intel.com>; B S, Karthik
> <karthik.b.s@intel.com>; Thasleem, Mohammed
> <mohammed.thasleem@intel.com>; Reddy Guddati, Santhosh
> <santhosh.reddy.guddati@intel.com>
> Subject: [PATCH i-g-t v3] tests/kms_content_protection: Get HDCP capable
> outputs before modeset
>
> Filter out the HDCP capable outputs from the connected outputs before doing
> a modeset. This will make the test to execute on HDCP supported panels and
> avoid commit failures and invalid skips on HDCP supported panels.
>
> A connector needs a valid CRTC to reliably read its debugfs consistently.
> To avoid unwanted modesets before checking HDCP capability checks, collect
> all HDCP‑capable outputs separately.
>
> V2: Add comment describing reasons for invalid skips (Suraj)
>
> Signed-off-by: Santhosh Reddy Guddati <santhosh.reddy.guddati@intel.com>
> Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
> ---
> tests/kms_content_protection.c | 40 ++++++++++++++++++++++++++--------
> 1 file changed, 31 insertions(+), 9 deletions(-)
>
> diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
> index f35c9fa73..96a62bfc5 100644
> --- a/tests/kms_content_protection.c
> +++ b/tests/kms_content_protection.c
> @@ -707,32 +707,54 @@ static bool
> is_output_hdcp_test_exempt(igt_output_t *output)
> return igt_is_panel_blocked(sink_name, hdcp_blocklist,
> ARRAY_SIZE(hdcp_blocklist)); }
>
> +static int get_hdcp_outputs(igt_display_t *display, int content_type,
> + igt_output_t **hdcp_outputs)
> +{
> + igt_output_t *output;
> + int count = 0;
> +
> + for_each_connected_output(display, output) {
> + if (is_output_hdcp_test_exempt(output)) {
> + igt_info("Skipping HDCP test on %s, as the panel is
> blocklisted\n",
> + output->name);
> + continue;
> + }
> +
> + if (!output_hdcp_capable(output, content_type))
> + continue;
> +
> + hdcp_outputs[count++] = output;
> + }
> +
> + return count;
> +}
> +
> static void
> test_content_protection(enum igt_commit_style commit_style, int
> content_type) {
> igt_display_t *display = &data.display;
> igt_output_t *output;
> + igt_output_t *hdcp_outputs[10];

You can use a macro than a magic literal:
#define MAX_HDCP_OUTPUTS 10

When filling the array, check to avoid overflow:
if (count < MAX_HDCP_OUTPUTS) ;

Regards,
Sowmiya.

> igt_crtc_t *crtc;
> + int hdcp_panel_count;
> + int i;
>
> if (data.cp_tests & CP_MEI_RELOAD)
> igt_require_f(igt_kmod_is_loaded("mei_hdcp"),
> "mei_hdcp module is not loaded\n");
>
> + hdcp_panel_count = get_hdcp_outputs(display, content_type,
> hdcp_outputs);
> + igt_skip_on_f(hdcp_panel_count == 0, "No connected output with
> HDCP
> +support found\n");
> +
> if (data.cp_tests & CP_UEVENT) {
> data.uevent_monitor = igt_watch_uevents();
> igt_flush_uevents(data.uevent_monitor);
> }
>
> - for_each_connected_output(display, output) {
> - for_each_crtc(display, crtc) {
> - if (!output_hdcp_capable(output, content_type))
> - continue;
> - if (is_output_hdcp_test_exempt(output)) {
> - igt_info("Skipping HDCP test on %s, as the
> panel is blocklisted\n",
> - output->name);
> - continue;
> - }
> + for (i = 0; i < hdcp_panel_count; i++) {
> + output = hdcp_outputs[i];
>
> + for_each_crtc(display, crtc) {
> igt_display_reset(display);
> igt_output_set_crtc(output,
> crtc);
> --
> 2.34.1