public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
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 v4 04/10] lib/igt_chamelium: split chamelium_new_edid
Date: Tue, 25 Jun 2019 16:14:25 +0300	[thread overview]
Message-ID: <20190625131431.29336-5-simon.ser@intel.com> (raw)
In-Reply-To: <20190625131431.29336-1-simon.ser@intel.com>

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>
---
 lib/igt_chamelium.c | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index 9ea483eee717..8e6db445330e 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -523,6 +523,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
@@ -541,33 +561,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_get_size(edid));
 	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
-- 
2.22.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-06-25 13:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-25 13:14 [igt-dev] [PATCH i-g-t v4 00/10] Chamelium port mapping auto-discovery Simon Ser
2019-06-25 13:14 ` [igt-dev] [PATCH i-g-t v4 01/10] lib/igt_edid: add edid_get_size Simon Ser
2019-06-25 14:19   ` Ville Syrjälä
2019-06-25 13:14 ` [igt-dev] [PATCH i-g-t v4 02/10] lib/igt_chamelium: fix chamelium_port_set_edid docs Simon Ser
2019-07-18 10:08   ` Arkadiusz Hiler
2019-06-25 13:14 ` [igt-dev] [PATCH i-g-t v4 03/10] lib/igt_chamelium: allow EDIDs to be mutated for each port Simon Ser
2019-07-18 10:10   ` Arkadiusz Hiler
2019-06-25 13:14 ` Simon Ser [this message]
2019-07-18 10:24   ` [igt-dev] [PATCH i-g-t v4 04/10] lib/igt_chamelium: split chamelium_new_edid Arkadiusz Hiler
2019-06-25 13:14 ` [igt-dev] [PATCH i-g-t v4 05/10] lib/igt_chamelium: add CHAMELIUM_MAX_PORTS Simon Ser
2019-07-18 10:41   ` Arkadiusz Hiler
2019-06-25 13:14 ` [igt-dev] [PATCH i-g-t v4 06/10] lib/igt_chamelium: upload one EDID per port Simon Ser
2019-07-18 11:44   ` Arkadiusz Hiler
2019-06-25 13:14 ` [igt-dev] [PATCH i-g-t v4 07/10] lib/igt_chamelium: set EDID serial Simon Ser
2019-07-18 12:05   ` Arkadiusz Hiler
2019-06-25 13:14 ` [igt-dev] [PATCH i-g-t v4 08/10] lib/igt_edid: add edid_get_mfg Simon Ser
2019-06-25 14:22   ` Ville Syrjälä
2019-06-25 13:14 ` [igt-dev] [PATCH i-g-t v4 09/10] lib/igt_chamelium: add chamelium_get_video_ports Simon Ser
2019-07-18 12:17   ` Arkadiusz Hiler
2019-06-25 13:14 ` [igt-dev] [PATCH i-g-t v4 10/10] lib/igt_chamelium: autodiscover Chamelium port mappings Simon Ser
2019-07-19  6:14   ` Arkadiusz Hiler
2019-06-25 14:33 ` [igt-dev] ✓ Fi.CI.BAT: success for Chamelium port mapping auto-discovery (rev3) Patchwork
2019-06-25 15:42 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20190625131431.29336-5-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