summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSimon Ser <simon.ser@intel.com>2019-06-19 10:58:50 +0300
committerSimon Ser <simon.ser@intel.com>2019-07-19 10:55:54 +0300
commit363f340b9b72423fe3686bcb69a70d816da5c0e5 (patch)
treee3890bb47bf1cbc7934e76526c35d89e99bf19b4 /lib
parentc002f3ef5a51b27df0f28e8a64a7a5381aa2e158 (diff)
lib/igt_chamelium: upload one EDID per port
Instead of uploading the EDID in chamelium_new_edid, do it in chamelium_port_set_edid so that we can customize the EDID depending on the port. 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_chamelium.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index 2a49bf56..4df3a456 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -83,8 +83,8 @@
*/
struct chamelium_edid {
- int id;
struct edid *raw;
+ int ids[CHAMELIUM_MAX_PORTS];
struct igt_list link;
};
@@ -563,14 +563,10 @@ struct chamelium_edid *chamelium_new_edid(struct chamelium *chamelium,
const unsigned char *raw_edid)
{
struct chamelium_edid *chamelium_edid;
- int edid_id;
const struct edid *edid = (struct edid *) raw_edid;
size_t edid_size = edid_get_size(edid);
- edid_id = chamelium_upload_edid(chamelium, edid);
-
chamelium_edid = calloc(1, sizeof(struct chamelium_edid));
- chamelium_edid->id = edid_id;
chamelium_edid->raw = malloc(edid_size);
memcpy(chamelium_edid->raw, edid, edid_size);
igt_list_add(&chamelium_edid->link, &chamelium->edids);
@@ -613,8 +609,24 @@ void chamelium_port_set_edid(struct chamelium *chamelium,
struct chamelium_port *port,
struct chamelium_edid *edid)
{
+ int edid_id;
+ size_t port_index;
+ const struct edid *raw_edid;
+
+ if (edid) {
+ port_index = port - chamelium->ports;
+ edid_id = edid->ids[port_index];
+ if (edid_id == 0) {
+ raw_edid = chamelium_edid_get_raw(edid, port);
+ edid_id = chamelium_upload_edid(chamelium, raw_edid);
+ edid->ids[port_index] = edid_id;
+ }
+ } else {
+ edid_id = 0;
+ }
+
xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "ApplyEdid", "(ii)",
- port->id, edid ? edid->id : 0));
+ port->id, edid_id));
}
/**
@@ -1995,7 +2007,10 @@ void chamelium_deinit(struct chamelium *chamelium)
/* Destroy any EDIDs we created to make sure we don't leak them */
igt_list_for_each_safe(pos, tmp, &chamelium->edids, link) {
- chamelium_destroy_edid(chamelium, pos->id);
+ for (i = 0; i < CHAMELIUM_MAX_PORTS; i++) {
+ if (pos->ids[i])
+ chamelium_destroy_edid(chamelium, pos->ids[i]);
+ }
free(pos->raw);
free(pos);
}