aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSimon Ser <simon.ser@intel.com>2019-07-19 14:01:13 +0300
committerSimon Ser <simon.ser@intel.com>2019-08-15 13:03:59 +0300
commit7b759f271519af74afa4f2f1d85e64cf367644dc (patch)
tree18069c65b26afd3c624b043a918e98eef252745c /lib
parent8a7b044493e8dcdd7df02a124ea14daf95752cec (diff)
downloadplatform_external_igt-gpu-tools-7b759f271519af74afa4f2f1d85e64cf367644dc.tar.gz
platform_external_igt-gpu-tools-7b759f271519af74afa4f2f1d85e64cf367644dc.tar.bz2
platform_external_igt-gpu-tools-7b759f271519af74afa4f2f1d85e64cf367644dc.zip
lib/igt_kms: drop EDID_LENGTH, replace with EDID_BLOCK_SIZE
EDID_LENGTH is misleading because EDIDs are a variable size (they contain one or more 128-byte EDID blocks). This commit renames it to EDID_BLOCK_SIZE which makes it clear users need to call edid_get_size to get the total size. The declaration has also been moved to igt_edid. ("Size" has been chosen over "length" because it's clearer that it's a number of bytes, not a number of elements) Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_edid.h2
-rw-r--r--lib/igt_kms.c8
-rw-r--r--lib/igt_kms.h1
-rw-r--r--lib/tests/igt_edid.c13
4 files changed, 14 insertions, 10 deletions
diff --git a/lib/igt_edid.h b/lib/igt_edid.h
index 606541ac..319ccc3d 100644
--- a/lib/igt_edid.h
+++ b/lib/igt_edid.h
@@ -32,6 +32,8 @@
#include <xf86drmMode.h>
+#define EDID_BLOCK_SIZE 128
+
/**
* est_timings: set of established timings
*/
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index e6e8b93b..0a10bc60 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -158,10 +158,10 @@ const struct edid *igt_kms_get_alt_edid(void)
return &edid;
}
-#define AUDIO_EDID_LENGTH (2 * EDID_LENGTH)
+#define AUDIO_EDID_SIZE (2 * EDID_BLOCK_SIZE)
static const struct edid *
-generate_audio_edid(unsigned char raw_edid[static AUDIO_EDID_LENGTH],
+generate_audio_edid(unsigned char raw_edid[static AUDIO_EDID_SIZE],
bool with_vsdb, struct cea_sad *sad,
struct cea_speaker_alloc *speaker_alloc)
{
@@ -214,7 +214,7 @@ const struct edid *igt_kms_get_hdmi_audio_edid(void)
{
int channels;
uint8_t sampling_rates, sample_sizes;
- static unsigned char raw_edid[AUDIO_EDID_LENGTH] = {0};
+ static unsigned char raw_edid[AUDIO_EDID_SIZE] = {0};
struct cea_sad sad = {0};
struct cea_speaker_alloc speaker_alloc = {0};
@@ -238,7 +238,7 @@ const struct edid *igt_kms_get_dp_audio_edid(void)
{
int channels;
uint8_t sampling_rates, sample_sizes;
- static unsigned char raw_edid[AUDIO_EDID_LENGTH] = {0};
+ static unsigned char raw_edid[AUDIO_EDID_SIZE] = {0};
struct cea_sad sad = {0};
struct cea_speaker_alloc speaker_alloc = {0};
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 2b1c072e..51207e4d 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -755,7 +755,6 @@ void igt_reset_connectors(void);
uint32_t kmstest_get_vbl_flag(uint32_t pipe_id);
-#define EDID_LENGTH 128
const struct edid *igt_kms_get_base_edid(void);
const struct edid *igt_kms_get_alt_edid(void);
const struct edid *igt_kms_get_hdmi_audio_edid(void);
diff --git a/lib/tests/igt_edid.c b/lib/tests/igt_edid.c
index bbbf1505..8474d29e 100644
--- a/lib/tests/igt_edid.c
+++ b/lib/tests/igt_edid.c
@@ -57,7 +57,7 @@ static bool edid_block_checksum(const unsigned char *raw_edid)
size_t i;
unsigned char csum = 0;
- for (i = 0; i < EDID_LENGTH; i++) {
+ for (i = 0; i < EDID_BLOCK_SIZE; i++) {
csum += raw_edid[i];
}
@@ -81,7 +81,7 @@ igt_simple_main
{0},
}, *f;
const struct edid *edid;
- const uint8_t *raw_edid;
+ const uint8_t *raw_edid, *raw_block;
size_t i;
for (f = funcs; f->f; f++) {
@@ -97,8 +97,11 @@ igt_simple_main
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(raw_edid + (i + 1) * EDID_LENGTH),
- "CEA block checksum failed on %s EDID", f->desc);
+ for (i = 0; i < f->exts; i++) {
+ raw_block = raw_edid + (i + 1) * EDID_BLOCK_SIZE;
+ igt_assert_f(edid_block_checksum(raw_block),
+ "CEA block checksum failed on %s EDID",
+ f->desc);
+ }
}
}