From: Simon Ser <simon.ser@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 2/4] lib/igt_kms: drop EDID_LENGTH, replace with EDID_BLOCK_SIZE
Date: Fri, 19 Jul 2019 14:38:45 +0300 [thread overview]
Message-ID: <20190719113847.32626-3-simon.ser@intel.com> (raw)
In-Reply-To: <20190719113847.32626-1-simon.ser@intel.com>
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>
---
lib/igt_edid.h | 2 ++
lib/igt_kms.c | 8 ++++----
lib/igt_kms.h | 1 -
lib/tests/igt_edid.c | 13 ++++++++-----
tests/i915/i915_pm_rpm.c | 13 +++++++------
5 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/lib/igt_edid.h b/lib/igt_edid.h
index 606541ac63b4..319ccc3dc734 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 b7fb165e0678..e66f5af2083c 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 0b9374a16b0e..a3b1bece95be 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -754,7 +754,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 bbbf15058982..8474d29e27bc 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);
+ }
}
}
diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
index e2c7ba217081..2168ff72c97b 100644
--- a/tests/i915/i915_pm_rpm.c
+++ b/tests/i915/i915_pm_rpm.c
@@ -50,6 +50,7 @@
#include "igt_sysfs.h"
#include "igt_debugfs.h"
#include "igt_device.h"
+#include "igt_edid.h"
#define MSR_PKG_CST_CONFIG_CONTROL 0xE2
/* HSW/BDW: */
@@ -655,10 +656,10 @@ static bool i2c_read_edid(const char *connector_name, unsigned char *edid)
return rc >= 0;
}
-static void format_hex_string(const unsigned char edid[static EDID_LENGTH],
- char buf[static EDID_LENGTH * 5 + 1])
+static void format_hex_string(const unsigned char edid[static EDID_BLOCK_SIZE],
+ char buf[static EDID_BLOCK_SIZE * 5 + 1])
{
- for (int i = 0; i < EDID_LENGTH; ++i)
+ for (int i = 0; i < EDID_BLOCK_SIZE; ++i)
sprintf(buf+i*5, "0x%02x ", edid[i]);
}
@@ -670,7 +671,7 @@ static void test_i2c(struct mode_set_data *data)
for (int i = 0; i < data->res->count_connectors; i++) {
unsigned char *drm_edid = data->edids[i] ? data->edids[i]->data : NULL;
- unsigned char i2c_edid[EDID_LENGTH] = {};
+ unsigned char i2c_edid[EDID_BLOCK_SIZE] = {};
igt_output_t *output = igt_output_from_connector(&display,
data->connectors[i]);
@@ -694,13 +695,13 @@ static void test_i2c(struct mode_set_data *data)
continue;
if (got_i2c_edid && got_drm_edid)
- edids_equal = (0 == memcmp(drm_edid, i2c_edid, EDID_LENGTH));
+ edids_equal = (0 == memcmp(drm_edid, i2c_edid, EDID_BLOCK_SIZE));
else
edids_equal = false;
if (!edids_equal) {
- char buf[5 * EDID_LENGTH + 1];
+ char buf[5 * EDID_BLOCK_SIZE + 1];
igt_critical("Detected EDID mismatch on connector %s\n",
connector_name);
--
2.22.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-07-19 11:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-19 11:38 [igt-dev] [PATCH i-g-t 0/4] lib/igt_edid: misc quality-of-life improvements Simon Ser
2019-07-19 11:38 ` [igt-dev] [PATCH i-g-t 1/4] lib/igt_kms: use struct edid instead of unsigned char Simon Ser
2019-07-19 11:38 ` Simon Ser [this message]
2019-07-19 11:38 ` [igt-dev] [PATCH i-g-t 3/4] lib/igt_edid: make HDMI VSDB data array unsigned Simon Ser
2019-07-19 11:38 ` [igt-dev] [PATCH i-g-t 4/4] lib/igt_edid: merge edid_ext_update_cea_checksum into edid_update_checksum Simon Ser
2019-07-19 12:11 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib/igt_edid: misc quality-of-life improvements Patchwork
2019-07-19 12:13 ` Ser, Simon
2019-07-19 13:49 ` Martin Peres
2019-07-19 14:26 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2019-07-19 17:11 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-08-15 8:25 ` [igt-dev] [PATCH i-g-t 0/4] " Arkadiusz Hiler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190719113847.32626-3-simon.ser@intel.com \
--to=simon.ser@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.