summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSimon Ser <simon.ser@intel.com>2019-06-17 17:05:01 +0300
committerSimon Ser <simon.ser@intel.com>2019-07-02 13:58:24 +0300
commit44af059741593587f1c500b00e7b07c5d7240c61 (patch)
tree71a3b725fa9157c0a06903014a5bb513074aab05 /lib
parenta1186616d25fabb951119709ed17e161b501d323 (diff)
lib/igt_edid: add edid_get_size
This is a simple helper to get the size in bytes of an arbitrary EDID. Signed-off-by: Simon Ser <simon.ser@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_chamelium.c6
-rw-r--r--lib/igt_edid.c10
-rw-r--r--lib/igt_edid.h1
3 files changed, 13 insertions, 4 deletions
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index b83ff395..966d78dc 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 e71136f4..6cc5e7dd 100644
--- a/lib/igt_edid.c
+++ b/lib/igt_edid.c
@@ -275,6 +275,16 @@ void edid_update_checksum(struct edid *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)
* @sampling_rates: bitfield of enum cea_sad_sampling_rate
diff --git a/lib/igt_edid.h b/lib/igt_edid.h
index 00596ef1..8d8e30ec 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,