Re: [igt-dev] [PATCH i-g-t v4 06/10] lib/igt_chamelium: upload one EDID per port

Arkadiusz Hiler
2019-07-18T11:44:46Z

On Tue, Jun 25, 2019 at 04:14:27PM +0300, Simon Ser wrote:
> 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>
> ---
> lib/igt_chamelium.c | 28 +++++++++++++++++++++-------
> 1 file changed, 21 insertions(+), 7 deletions(-)
>
> diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
> index 1b5566f42f44..467f1a458516 100644
> --- a/lib/igt_chamelium.c
> +++ b/lib/igt_chamelium.c
> @@ -82,8 +82,8 @@
> */
>
> struct chamelium_edid {
> - int id;
> struct edid *raw;
> + int ids[CHAMELIUM_MAX_PORTS];
> struct igt_list link;
> };
>
> @@ -562,14 +562,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_get_size(edid));
> igt_list_add(&chamelium_edid->link, &chamelium->edids);
> @@ -612,8 +608,23 @@ 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;

with that:
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>