From: Simon Ser <simon.ser@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: martin.peres@intel.com
Subject: [igt-dev] [PATCH i-g-t 1/3] lib/igt_edid: add edid_get_size
Date: Mon, 17 Jun 2019 18:35:13 +0300 [thread overview]
Message-ID: <20190617153515.12151-2-simon.ser@intel.com> (raw)
In-Reply-To: <20190617153515.12151-1-simon.ser@intel.com>
This is a simple helper to get the size in bytes of an arbitrary EDID.
Signed-off-by: Simon Ser <simon.ser@intel.com>
---
lib/igt_chamelium.c | 6 ++----
lib/igt_edid.c | 10 ++++++++++
lib/igt_edid.h | 1 +
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index b83ff395d44b..966d78dce146 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -538,12 +538,10 @@ struct chamelium_edid *chamelium_new_edid(struct chamelium *chamelium,
xmlrpc_value *res;
struct chamelium_edid *chamelium_edid;
int edid_id;
- struct edid *edid = (struct edid *) raw_edid;
- size_t edid_size = sizeof(struct edid) +
- edid->extensions_len * sizeof(struct edid_ext);
+ const struct edid *edid = (struct edid *) raw_edid;
res = chamelium_rpc(chamelium, NULL, "CreateEdid", "(6)",
- raw_edid, edid_size);
+ raw_edid, edid_get_size(edid));
xmlrpc_read_int(&chamelium->env, res, &edid_id);
xmlrpc_DECREF(res);
diff --git a/lib/igt_edid.c b/lib/igt_edid.c
index e71136f48e14..6cc5e7dd42c4 100644
--- a/lib/igt_edid.c
+++ b/lib/igt_edid.c
@@ -274,6 +274,16 @@ void edid_update_checksum(struct edid *edid)
sizeof(struct edid));
}
+/**
+ * edid_get_size: return the size of the EDID block in bytes including EDID
+ * extensions, if any.
+ */
+size_t edid_get_size(const struct edid *edid)
+{
+ return sizeof(struct edid) +
+ edid->extensions_len * sizeof(struct edid_ext);
+}
+
/**
* cea_sad_init_pcm:
* @channels: the number of supported channels (max. 8)
diff --git a/lib/igt_edid.h b/lib/igt_edid.h
index 00596ef1a46f..8d8e30ec0554 100644
--- a/lib/igt_edid.h
+++ b/lib/igt_edid.h
@@ -297,6 +297,7 @@ struct edid {
void edid_init(struct edid *edid);
void edid_init_with_mode(struct edid *edid, drmModeModeInfo *mode);
void edid_update_checksum(struct edid *edid);
+size_t edid_get_size(const struct edid *edid);
void detailed_timing_set_mode(struct detailed_timing *dt, drmModeModeInfo *mode,
int width_mm, int height_mm);
void detailed_timing_set_monitor_range_mode(struct detailed_timing *dt,
--
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-06-17 15:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 15:35 [igt-dev] [PATCH i-g-t 0/3] lib/igt_chamelium: some more auto-EDID preliminary changes Simon Ser
2019-06-17 15:35 ` Simon Ser [this message]
2019-06-17 15:35 ` [igt-dev] [PATCH i-g-t 2/3] lib/igt_chamelium: fix chamelium_port_set_edid docs Simon Ser
2019-06-17 15:35 ` [igt-dev] [PATCH i-g-t 3/3] lib/igt_chamelium: allow EDIDs to be mutated for each port Simon Ser
2019-06-17 17:17 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib/igt_chamelium: some more auto-EDID preliminary changes Patchwork
2019-06-18 8:37 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib/igt_chamelium: some more auto-EDID preliminary changes (rev2) Patchwork
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=20190617153515.12151-2-simon.ser@intel.com \
--to=simon.ser@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=martin.peres@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox