summaryrefslogtreecommitdiff
path: root/lib/tests
diff options
context:
space:
mode:
authorSimon Ser <simon.ser@intel.com>2019-07-19 13:48:27 +0300
committerSimon Ser <simon.ser@intel.com>2019-08-15 13:03:48 +0300
commit8a7b044493e8dcdd7df02a124ea14daf95752cec (patch)
treec3167969f34de3739fc79c91828456273a99cb34 /lib/tests
parent81df2f22385bc275975cf199d962eed9bc10f916 (diff)
lib/igt_kms: use struct edid instead of unsigned char
This has several advantages: * No more need to convert back and forth between these two (everybody should use struct edid, the exception being lib/tests/igt_edid which performs sanity checks) * Makes it clearer that users can call edid_get_size on a returned EDID blob * Improves type safety (it's more obvious is a random blob is used as an EDID) Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'lib/tests')
-rw-r--r--lib/tests/igt_edid.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/tests/igt_edid.c b/lib/tests/igt_edid.c
index fc98f1bb..bbbf1505 100644
--- a/lib/tests/igt_edid.c
+++ b/lib/tests/igt_edid.c
@@ -64,7 +64,7 @@ static bool edid_block_checksum(const unsigned char *raw_edid)
return csum == 0;
}
-typedef const unsigned char *(*get_edid_func)(void);
+typedef const struct edid *(*get_edid_func)(void);
igt_simple_main
{
@@ -80,23 +80,25 @@ igt_simple_main
{ "3d", igt_kms_get_3d_edid, 1 },
{0},
}, *f;
- const unsigned char *edid;
+ const struct edid *edid;
+ const uint8_t *raw_edid;
size_t i;
for (f = funcs; f->f; f++) {
edid = f->f();
+ raw_edid = (uint8_t *) edid;
- igt_assert_f(edid_header_is_valid(edid),
+ igt_assert_f(edid_header_is_valid(raw_edid),
"invalid header on %s EDID", f->desc);
/* check base edid block */
- igt_assert_f(edid_block_checksum(edid),
+ igt_assert_f(edid_block_checksum(raw_edid),
"checksum failed on %s EDID", f->desc);
/* check extension blocks, if any */
- igt_assert_f(edid[126] == f->exts,
+ igt_assert_f(raw_edid[126] == f->exts,
"unexpected number of extensions on %s EDID",
f->desc);
for (i = 0; i < f->exts; i++)
- igt_assert_f(edid_block_checksum(edid + (i + 1) * EDID_LENGTH),
+ igt_assert_f(edid_block_checksum(raw_edid + (i + 1) * EDID_LENGTH),
"CEA block checksum failed on %s EDID", f->desc);
}
}