public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ser, Simon" <simon.ser@intel.com>
To: "Hiler, Arkadiusz" <arkadiusz.hiler@intel.com>
Cc: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"Peres, Martin" <martin.peres@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t v2 7/9] lib/igt_chamelium: set EDID serial
Date: Tue, 25 Jun 2019 08:06:33 +0000	[thread overview]
Message-ID: <d73e4301c5b37a977a65008d29dbabf6b385eeb1.camel@intel.com> (raw)
In-Reply-To: <20190624121628.c6wqitmfhqyo3e5q@ahiler-desk1.fi.intel.com>

On Mon, 2019-06-24 at 15:16 +0300, Arkadiusz Hiler wrote:
> On Wed, Jun 19, 2019 at 06:55:16PM +0300, Simon Ser wrote:
> > Set a different EDID serial string for each Chamelium port, so that we can
> > easily tell which DRM connector maps to a Chamelium port.
> > 
> > Signed-off-by: Simon Ser <simon.ser@intel.com>
> > ---
> >  lib/igt_chamelium.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
> > index 467f1a458516..dcc59e9f0b04 100644
> > --- a/lib/igt_chamelium.c
> > +++ b/lib/igt_chamelium.c
> > @@ -587,6 +587,17 @@ struct chamelium_edid *chamelium_new_edid(struct chamelium *chamelium,
> >  const struct edid *chamelium_edid_get_raw(struct chamelium_edid *edid,
> >  					  struct chamelium_port *port)
> >  {
> > +	uint32_t *serial;
> > +
> > +	/* Product code: Chamelium */
> > +	edid->raw->prod_code[0] = 'C';
> > +	edid->raw->prod_code[1] = 'H';
> > +
> > +	/* Serial: Chamelium port ID */
> > +	serial = (uint32_t *) &edid->raw->serial;
> > +	*serial = port->id;
> > +
> > +	edid_update_checksum(edid->raw);
> >  	return edid->raw;
> >  }
> 
> Reusing the same memory and modifying it with each call is a pitfall for
> consumers of this API. Either store a copy for each connector, memcpy to
> a user provided pointer or return a copy and make the caller responsible
> for free()-ing it.
> 
> I vaugely remember fixing issues caused by abuse of similar functions
> that modifed a static memory and returning a pointer to it.

Fair enough. I think I'll go with storing a copy for each connector,
since it allows to keep the same simple API.
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-06-25  8:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19 15:55 [igt-dev] [PATCH i-g-t v2 0/9] Chamelium port mapping auto-discovery Simon Ser
2019-06-19 15:55 ` [igt-dev] [PATCH i-g-t v2 1/9] lib/igt_edid: add edid_get_size Simon Ser
2019-06-19 15:55 ` [igt-dev] [PATCH i-g-t v2 2/9] lib/igt_chamelium: fix chamelium_port_set_edid docs Simon Ser
2019-06-19 15:55 ` [igt-dev] [PATCH i-g-t v2 3/9] lib/igt_chamelium: allow EDIDs to be mutated for each port Simon Ser
2019-06-19 15:55 ` [igt-dev] [PATCH i-g-t v2 4/9] lib/igt_chamelium: split chmelium_new_edid Simon Ser
2019-06-19 15:55 ` [igt-dev] [PATCH i-g-t v2 5/9] lib/igt_chamelium: add CHAMELIUM_MAX_PORTS Simon Ser
2019-06-19 15:55 ` [igt-dev] [PATCH i-g-t v2 6/9] lib/igt_chamelium: upload one EDID per port Simon Ser
2019-06-19 15:55 ` [igt-dev] [PATCH i-g-t v2 7/9] lib/igt_chamelium: set EDID serial Simon Ser
2019-06-24 12:16   ` Arkadiusz Hiler
2019-06-25  8:06     ` Ser, Simon [this message]
2019-06-19 15:55 ` [igt-dev] [PATCH i-g-t v2 8/9] lib/igt_edid: add edid_get_mfg Simon Ser
2019-06-19 15:55 ` [igt-dev] [PATCH i-g-t v2 9/9] lib/igt_chamelium: autodiscover Chamelium port mappings Simon Ser
2019-06-20  8:40   ` [igt-dev] [PATCH i-g-t v3] " Simon Ser
2019-06-24 13:22   ` [igt-dev] [PATCH i-g-t v2 9/9] " Arkadiusz Hiler
2019-06-24 14:15     ` Ser, Simon
2019-06-25  7:03       ` Arkadiusz Hiler
2019-06-25  7:23         ` Ser, Simon
2019-06-19 17:38 ` [igt-dev] ✗ Fi.CI.BAT: failure for Chamelium port mapping auto-discovery Patchwork
2019-06-20 10:53 ` [igt-dev] ✓ Fi.CI.BAT: success for Chamelium port mapping auto-discovery (rev2) Patchwork
2019-06-24  8:58 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-06-24  9:32   ` Ser, Simon

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=d73e4301c5b37a977a65008d29dbabf6b385eeb1.camel@intel.com \
    --to=simon.ser@intel.com \
    --cc=arkadiusz.hiler@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