[PATCH i-g-t v1 1/2] lib/igt_whitelist: Add Hdcp Whitelist support

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri May 9 13:11:49 UTC 2025


Hi Santhosh,
On 2025-05-06 at 22:53:36 +0530, Santhosh Reddy Guddati wrote:
> This introduces a mechanism to handle specific panels
> like emulators/dummies that are known to face issues with certain
> features like HDCP.
> 
> Tests are skipped for those outputs connected to prevent false negatives
> and unnecessary debugging,
> 
> Signed-off-by: Santhosh Reddy Guddati <santhosh.reddy.guddati at intel.com>
> ---
>  lib/igt_edid.c      | 27 ++++++++++++++++++++
>  lib/igt_edid.h      |  1 +
>  lib/igt_whitelist.c | 61 +++++++++++++++++++++++++++++++++++++++++++++
>  lib/igt_whitelist.h | 15 +++++++++++

imho this should be named lib/igt_panel.[ch]

as this is panel (display) block.

>  lib/meson.build     |  1 +
>  5 files changed, 105 insertions(+)
>  create mode 100644 lib/igt_whitelist.c
>  create mode 100644 lib/igt_whitelist.h
> 
> diff --git a/lib/igt_edid.c b/lib/igt_edid.c
> index 80dcea112..627201c34 100644
> --- a/lib/igt_edid.c
> +++ b/lib/igt_edid.c
> @@ -210,6 +210,33 @@ void edid_get_mfg(const struct edid *edid, char out[static 3])
>  	out[2] = (edid->mfg_id[1] & 0x1F) + '@';
>  }
>  
> +void edid_get_monitor_name(const struct edid *edid, char *name, size_t name_size)
> +{
> +	const struct detailed_timing *dt;
> +	const struct detailed_non_pixel *np;
> +	const struct detailed_data_string *ds;
> +	size_t i;
> +
> +	assert(name_size > 0);
> +	name[0] = '\0';
> +
> +	for (i = 0; i < DETAILED_TIMINGS_LEN; i++) {
> +		dt = &edid->detailed_timings[i];
> +		np = &dt->data.other_data;
> +
> +		if (np->type != EDID_DETAIL_MONITOR_NAME)
> +			continue;
> +
> +		ds = &np->data.string;
> +		strncpy(name, ds->str, name_size - 1);
> +		name[name_size - 1] = '\0';
> +		igt_debug("Monitor name: %s\n", name);
> +		return;
> +	}
> +	igt_debug("No monitor name found in EDID\n");
> +	name[0] = '\0';

Use perl script checkpatch.pl from Linux kernel for some whitespace
and code style problems.

> +}
> +
>  static void edid_set_mfg(struct edid *edid, const char mfg[static 3])
>  {
>  	edid->mfg_id[0] = (mfg[0] - '@') << 2 | (mfg[1] - '@') >> 3;
> diff --git a/lib/igt_edid.h b/lib/igt_edid.h
> index 02645345f..be0ccf529 100644
> --- a/lib/igt_edid.h
> +++ b/lib/igt_edid.h
> @@ -456,5 +456,6 @@ void *dispid_block_tiled(void *ptr,
>  			 int htile, int vtile,
>  			 int hsize, int vsize,
>  			 const char *topology_id);
> +void edid_get_monitor_name(const struct edid *edid, char *name, size_t name_size);
>  
>  #endif
> diff --git a/lib/igt_whitelist.c b/lib/igt_whitelist.c
> new file mode 100644
> index 000000000..6a210406f
> --- /dev/null
> +++ b/lib/igt_whitelist.c
> @@ -0,0 +1,61 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2025 Intel Corporation
> + */
> +
> +#include <stdbool.h>
> +#include <string.h>
> +
> +#include "drmtest.h"
> +#include "igt_whitelist.h"
> +
> +/**
> + * Blacklist array for HDCP.

s/Blacklist/Blocklist/

or maybe:

 * List od panels which should not run HDCP tests

> + *
> + * This array is used to identify and handle scenarios where the test is
> + * executed on dummy monitors, such as those found on shard machines.
> + * Since these dummy monitors are not real and always the test is not consistent,
> + * the test is skipped in such cases to avoid false negatives or
> + * irrelevant test results.
> + */
> +static const char *const hdcp_blacklist[] = {
> +	"DPF90435", // Example monitor name

Use C-style comments:

	"DPF90435", /* Example monitor name */

> +	// Add more monitor names here as needed

Same here

> +};
> +
> +/**
> + * is_in_blacklist - Checks if a given vendor name is present in a blacklist.

better function name: igt_is_panel_blocked_in_hdcp

If you think more panels should be blocked, consider checking
IGT_PANEL_BLOCKED enviroment var with panels listed like:
IGT_PANEL_BLOCKED=one,two,three

or make name more generic (no only for HDCP but for other features)

igt_is_panel_blocked()

> + *
> + * @vendor_name: The name of the vendor to check for in the blacklist.
> + * @blacklist: An array of strings representing the blacklist.

s/black/block/

> + * @blacklist_size: The number of entries in the blacklist array.

s/black/block/

> + *
> + * Returns:
> + * true if the vendor name is found in the blacklist, false otherwise.

s/black/block/

> + */
> +static bool is_in_blacklist(const char *vendor_name,

is_panel_in_blocked_list()

Same s/[Bb]lack/[Bb]lock/ to apply below.

> +			    const char *const blacklist[],
> +			    size_t blacklist_size)
> +{
> +	int i;
> +
> +	for (i = 0; i < blacklist_size; i++) {
> +		if (strstr(blacklist[i], vendor_name) != NULL)
> +			return true;
> +	}
> +
> +	return false;
> +}
> +
> +/**
> + * is_panel_blacklisted_hdcp - Checks if a panel vendor is blacklisted for HDCP.
> + * @vendor_name: The name of the panel vendor to check.
> + *
> + * Returns:
> + * true if the vendor is blacklisted for HDCP, false otherwise.
> + */
> +bool is_panel_blacklisted_hdcp(const char *vendor_name)

igt_is_panel_blocked_hdcp()


Regards,
Kamil

> +{
> +	return is_in_blacklist(vendor_name, hdcp_blacklist,
> +			       ARRAY_SIZE(hdcp_blacklist));
> +}
> diff --git a/lib/igt_whitelist.h b/lib/igt_whitelist.h
> new file mode 100644
> index 000000000..3ffa35db9
> --- /dev/null
> +++ b/lib/igt_whitelist.h
> @@ -0,0 +1,15 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2025 Intel Corporation
> + */
> +
> +#ifndef IGT_WHITELIST_H
> +#define IGT_WHITELIST_H
> +
> +#include <stdbool.h>
> +#include <string.h>
> +
> +bool is_panel_blacklisted_hdcp(const char *vendor_name);
> +
> +#endif
> +
> diff --git a/lib/meson.build b/lib/meson.build
> index b58976a43..130c01336 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -112,6 +112,7 @@ lib_sources = [
>  	'igt_msm.c',
>  	'igt_dsc.c',
>  	'igt_hook.c',
> +	'igt_whitelist.c',
>  	'xe/xe_gt.c',
>  	'xe/xe_ioctl.c',
>  	'xe/xe_mmio.c',
> -- 
> 2.34.1
> 


More information about the igt-dev mailing list