[igt-dev] [PATCH i-g-t v4 04/10] lib/igt_chamelium: split chamelium_new_edid
Arkadiusz Hiler
arkadiusz.hiler at intel.com
Thu Jul 18 10:24:59 UTC 2019
On Tue, Jun 25, 2019 at 04:14:25PM +0300, Simon Ser wrote:
> 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 at 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));
We still have edid_size defined which we use just for malloc. Any
particular reason switching here to edid_get_size(edid)?
Other than that
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
> 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
>
More information about the igt-dev
mailing list