From: Kunal Joshi <kunal1.joshi@intel.com> To: Intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: stanislav.lisovskiy@intel.com, daniel.vetter@intel.com, arkadiusz.hiler@intel.com Subject: [PATCH v6 1/3] drm: Add helper to compare edids. Date: Wed, 24 Jun 2020 00:27:54 +0530 [thread overview] Message-ID: <20200623185756.19502-2-kunal1.joshi@intel.com> (raw) In-Reply-To: <20200623185756.19502-1-kunal1.joshi@intel.com> From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> Many drivers would benefit from using drm helper to compare edid, rather than bothering with own implementation. v2: Added documentation for this function. Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> --- drivers/gpu/drm/drm_edid.c | 33 +++++++++++++++++++++++++++++++++ include/drm/drm_edid.h | 9 +++++++++ 2 files changed, 42 insertions(+) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index d8372d63851b..34cabfddcdd3 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1615,6 +1615,39 @@ static bool drm_edid_is_zero(const u8 *in_edid, int length) return true; } +/** + * drm_edid_are_equal - compare two edid blobs. + * @edid1: pointer to first blob + * @edid2: pointer to second blob + * This helper can be used during probing to determine if + * edid had changed. + */ +bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2) +{ + int edid1_len, edid2_len; + bool edid1_present = edid1 != NULL; + bool edid2_present = edid2 != NULL; + + if (edid1_present != edid2_present) + return false; + + if (edid1) { + + edid1_len = EDID_LENGTH * (1 + edid1->extensions); + edid2_len = EDID_LENGTH * (1 + edid2->extensions); + + if (edid1_len != edid2_len) + return false; + + if (memcmp(edid1, edid2, edid1_len)) + return false; + } + + return true; +} +EXPORT_SYMBOL(drm_edid_are_equal); + + /** * drm_edid_block_valid - Sanity check the EDID block (base or extension) * @raw_edid: pointer to raw EDID block diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 34b15e3d070c..5c26cc65b786 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -359,6 +359,15 @@ drm_load_edid_firmware(struct drm_connector *connector) } #endif +/** + * drm_edid_are_equal - compare two edid blobs. + * @edid1: pointer to first blob + * @edid2: pointer to second blob + * This helper can be used during probing to determine if + * edid had changed. + */ +bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2); + int drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, struct drm_connector *connector, -- 2.25.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Kunal Joshi <kunal1.joshi@intel.com> To: Intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: daniel.vetter@intel.com Subject: [Intel-gfx] [PATCH v6 1/3] drm: Add helper to compare edids. Date: Wed, 24 Jun 2020 00:27:54 +0530 [thread overview] Message-ID: <20200623185756.19502-2-kunal1.joshi@intel.com> (raw) In-Reply-To: <20200623185756.19502-1-kunal1.joshi@intel.com> From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> Many drivers would benefit from using drm helper to compare edid, rather than bothering with own implementation. v2: Added documentation for this function. Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> --- drivers/gpu/drm/drm_edid.c | 33 +++++++++++++++++++++++++++++++++ include/drm/drm_edid.h | 9 +++++++++ 2 files changed, 42 insertions(+) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index d8372d63851b..34cabfddcdd3 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1615,6 +1615,39 @@ static bool drm_edid_is_zero(const u8 *in_edid, int length) return true; } +/** + * drm_edid_are_equal - compare two edid blobs. + * @edid1: pointer to first blob + * @edid2: pointer to second blob + * This helper can be used during probing to determine if + * edid had changed. + */ +bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2) +{ + int edid1_len, edid2_len; + bool edid1_present = edid1 != NULL; + bool edid2_present = edid2 != NULL; + + if (edid1_present != edid2_present) + return false; + + if (edid1) { + + edid1_len = EDID_LENGTH * (1 + edid1->extensions); + edid2_len = EDID_LENGTH * (1 + edid2->extensions); + + if (edid1_len != edid2_len) + return false; + + if (memcmp(edid1, edid2, edid1_len)) + return false; + } + + return true; +} +EXPORT_SYMBOL(drm_edid_are_equal); + + /** * drm_edid_block_valid - Sanity check the EDID block (base or extension) * @raw_edid: pointer to raw EDID block diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 34b15e3d070c..5c26cc65b786 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -359,6 +359,15 @@ drm_load_edid_firmware(struct drm_connector *connector) } #endif +/** + * drm_edid_are_equal - compare two edid blobs. + * @edid1: pointer to first blob + * @edid2: pointer to second blob + * This helper can be used during probing to determine if + * edid had changed. + */ +bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2); + int drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, struct drm_connector *connector, -- 2.25.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-06-24 6:58 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-23 18:57 [PATCH v6 0/3] Send a hotplug when edid changes Kunal Joshi 2020-06-23 18:57 ` [Intel-gfx] " Kunal Joshi 2020-06-23 18:57 ` Kunal Joshi [this message] 2020-06-23 18:57 ` [Intel-gfx] [PATCH v6 1/3] drm: Add helper to compare edids Kunal Joshi 2020-06-23 18:57 ` [PATCH v6 2/3] drm: Introduce epoch counter to drm_connector Kunal Joshi 2020-06-23 18:57 ` [Intel-gfx] " Kunal Joshi 2020-06-23 18:57 ` [PATCH v6 3/3] drm/i915: Send hotplug event if edid had changed Kunal Joshi 2020-06-23 18:57 ` [Intel-gfx] " Kunal Joshi 2020-06-25 8:36 ` Maarten Lankhorst 2020-06-25 8:36 ` [Intel-gfx] " Maarten Lankhorst 2020-06-25 10:46 ` Lisovskiy, Stanislav 2020-06-25 10:46 ` [Intel-gfx] " Lisovskiy, Stanislav 2020-06-24 10:51 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Send a hotplug when edid changes (rev8) Patchwork 2020-06-26 15:22 ` Jani Nikula 2020-06-26 15:25 ` Lisovskiy, Stanislav 2020-06-26 9:15 ` Kunal Joshi 2020-06-24 10:53 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork 2020-06-24 11:12 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork 2020-06-26 9:59 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork [not found] ` <8bb621ba77744f599364bd096447db3d@intel.com> 2020-06-26 11:34 ` Lisovskiy, Stanislav 2020-06-26 13:02 ` [Intel-gfx] ✓ Fi.CI.IGT: success " Patchwork -- strict thread matches above, loose matches on Subject: below -- 2019-09-06 8:26 [PATCH v6 0/3] Send a hotplug when edid changes Stanislav Lisovskiy 2019-09-06 8:26 ` [PATCH v6 1/3] drm: Add helper to compare edids Stanislav Lisovskiy
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=20200623185756.19502-2-kunal1.joshi@intel.com \ --to=kunal1.joshi@intel.com \ --cc=Intel-gfx@lists.freedesktop.org \ --cc=arkadiusz.hiler@intel.com \ --cc=daniel.vetter@intel.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=stanislav.lisovskiy@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.