From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Simon Ser <simon.ser@intel.com>
Cc: igt-dev@lists.freedesktop.org, martin.peres@intel.com
Subject: Re: [igt-dev] [PATCH i-g-t v4 08/10] lib/igt_edid: add edid_get_mfg
Date: Tue, 25 Jun 2019 17:22:21 +0300 [thread overview]
Message-ID: <20190625142221.GL5942@intel.com> (raw)
In-Reply-To: <20190625131431.29336-9-simon.ser@intel.com>
On Tue, Jun 25, 2019 at 04:14:29PM +0300, Simon Ser wrote:
> This returns the 3-letter manufacturer identifier of an EDID.
>
> Signed-off-by: Simon Ser <simon.ser@intel.com>
> ---
> lib/igt_edid.c | 13 +++++++++++++
> lib/igt_edid.h | 1 +
> tests/kms_chamelium.c | 10 +++-------
> 3 files changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/lib/igt_edid.c b/lib/igt_edid.c
> index 6cc5e7dd42c4..cbb7eefff70d 100644
> --- a/lib/igt_edid.c
> +++ b/lib/igt_edid.c
> @@ -172,6 +172,19 @@ void detailed_timing_set_string(struct detailed_timing *dt,
> ds->str[len] = '\n';
> }
>
> +/**
> + * edid_get_mfg: reads the 3-letter manufacturer identifier
> + *
> + * The string is *not* NULL-terminated.
Maybe we should make it NULL terminated to avoid mishaps?
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> + */
> +void edid_get_mfg(const struct edid *edid, char out[static 3])
> +{
> + out[0] = ((edid->mfg_id[0] & 0x7C) >> 2) + '@';
> + out[1] = (((edid->mfg_id[0] & 0x03) << 3) |
> + ((edid->mfg_id[1] & 0xE0) >> 5)) + '@';
> + out[2] = (edid->mfg_id[1] & 0x1F) + '@';
> +}
> +
> static void edid_set_mfg(struct edid *edid, const char mfg[static 3])
> {
> edid->mfg_id[0] = (mfg[0] - '@') << 2 | (mfg[1] - '@') >> 3;
> diff --git a/lib/igt_edid.h b/lib/igt_edid.h
> index 8d8e30ec0554..47581bb778b0 100644
> --- a/lib/igt_edid.h
> +++ b/lib/igt_edid.h
> @@ -298,6 +298,7 @@ void edid_init(struct edid *edid);
> void edid_init_with_mode(struct edid *edid, drmModeModeInfo *mode);
> void edid_update_checksum(struct edid *edid);
> size_t edid_get_size(const struct edid *edid);
> +void edid_get_mfg(const struct edid *edid, char out[static 3]);
> void detailed_timing_set_mode(struct detailed_timing *dt, drmModeModeInfo *mode,
> int width_mm, int height_mm);
> void detailed_timing_set_monitor_range_mode(struct detailed_timing *dt,
> diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
> index 175e5032c973..1d5c0ded8a56 100644
> --- a/tests/kms_chamelium.c
> +++ b/tests/kms_chamelium.c
> @@ -184,7 +184,7 @@ check_analog_bridge(data_t *data, struct chamelium_port *port)
> drmModeConnector *connector = chamelium_port_get_connector(
> data->chamelium, port, false);
> uint64_t edid_blob_id;
> - unsigned char *edid;
> + const struct edid *edid;
> char edid_vendor[3];
>
> if (chamelium_port_get_type(port) != DRM_MODE_CONNECTOR_VGA) {
> @@ -198,12 +198,8 @@ check_analog_bridge(data_t *data, struct chamelium_port *port)
> igt_assert(edid_blob = drmModeGetPropertyBlob(data->drm_fd,
> edid_blob_id));
>
> - edid = (unsigned char *) edid_blob->data;
> -
> - edid_vendor[0] = ((edid[8] & 0x7c) >> 2) + '@';
> - edid_vendor[1] = (((edid[8] & 0x03) << 3) |
> - ((edid[9] & 0xe0) >> 5)) + '@';
> - edid_vendor[2] = (edid[9] & 0x1f) + '@';
> + edid = (const struct edid *) edid_blob->data;
> + edid_get_mfg(edid, edid_vendor);
>
> drmModeFreePropertyBlob(edid_blob);
> drmModeFreeConnector(connector);
> --
> 2.22.0
>
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
--
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-06-25 14:22 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 ` [igt-dev] [PATCH i-g-t v4 04/10] lib/igt_chamelium: split chamelium_new_edid Simon Ser
2019-07-18 10:24 ` 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ä [this message]
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=20190625142221.GL5942@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=martin.peres@intel.com \
--cc=simon.ser@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