summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSimon Ser <simon.ser@intel.com>2019-06-18 17:59:32 +0300
committerSimon Ser <simon.ser@intel.com>2019-07-19 10:52:54 +0300
commit043dae641dd5b2d403eda0a94da9a4d81ebff244 (patch)
tree284c823124399edd9f1ecd2a7198792ec4059013 /lib
parent26d8543681efc78e68dcce7273e7c39084d022ca (diff)
lib/igt_chamelium: split chamelium_new_edid
Split the part that uploads an EDID to the Chamelium board into a new chamelium_upload_edid function. The function will be called in chamelium_set_edid instead of chamelium_new_edid when automatic Chamelium port mapping is implemented. 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.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index ae10bf4c..7198df63 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -524,6 +524,26 @@ void chamelium_schedule_hpd_toggle(struct chamelium *chamelium,
"(iii)", port->id, delay_ms, rising_edge));
}
+static int chamelium_upload_edid(struct chamelium *chamelium,
+ const struct edid *edid)
+{
+ xmlrpc_value *res;
+ int edid_id;
+
+ res = chamelium_rpc(chamelium, NULL, "CreateEdid", "(6)",
+ edid, edid_get_size(edid));
+ xmlrpc_read_int(&chamelium->env, res, &edid_id);
+ xmlrpc_DECREF(res);
+
+ return edid_id;
+}
+
+static void chamelium_destroy_edid(struct chamelium *chamelium, int edid_id)
+{
+ xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "DestroyEdid", "(i)",
+ edid_id));
+}
+
/**
* chamelium_new_edid:
* @chamelium: The Chamelium instance to use
@@ -542,33 +562,22 @@ void chamelium_schedule_hpd_toggle(struct chamelium *chamelium,
struct chamelium_edid *chamelium_new_edid(struct chamelium *chamelium,
const unsigned char *raw_edid)
{
- xmlrpc_value *res;
struct chamelium_edid *chamelium_edid;
int edid_id;
const struct edid *edid = (struct edid *) raw_edid;
size_t edid_size = edid_get_size(edid);
- res = chamelium_rpc(chamelium, NULL, "CreateEdid", "(6)",
- raw_edid, edid_size);
-
- xmlrpc_read_int(&chamelium->env, res, &edid_id);
- xmlrpc_DECREF(res);
+ 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, raw_edid, edid_size);
+ memcpy(chamelium_edid->raw, edid, edid_size);
igt_list_add(&chamelium_edid->link, &chamelium->edids);
return chamelium_edid;
}
-static void chamelium_destroy_edid(struct chamelium *chamelium, int edid_id)
-{
- xmlrpc_DECREF(chamelium_rpc(chamelium, NULL, "DestroyEdid", "(i)",
- edid_id));
-}
-
/**
* chamelium_edid_get_raw: get the raw EDID
* @edid: the Chamelium EDID