[igt-dev] [PATCH i-g-t 1/2] igt_eld: add igt_is_igt

Andi Shyti andi.shyti at intel.com
Thu Sep 12 15:01:51 UTC 2019


Hi Simon,

> +/** eld_is_igt: check whether the ELD blob comes from an IGT EDID */
> +bool eld_is_igt(const char *eld, size_t eld_size)
> +{
> +	char name[17];
> +	int name_size;
> +
> +	igt_assert_f(eld_size >= 20 && eld_size <= 256,
> +		     "Invalid ELD size: %zu\n", eld_size);
> +
> +	name_size = eld[4] & 0x1F;
> +	igt_assert_f(name_size <= 16 && 20 + name_size <= eld_size,
> +		     "Invalid monitor name size in ELD: %d\n", name_size);
> +	if (name_size == 0) {
> +		igt_debug("ELD doesn't contain a monitor name\n");
> +		return false;
> +	}
> +
> +	memcpy(name, &eld[20], name_size);

17/20/256/4/0x1f/16/20/20 too many constants and no comments.
Overdefining constants is not nice, but then you need to explain
them.

Andi


More information about the igt-dev mailing list