From: Jani Nikula <jani.nikula@intel.com> To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org Subject: [PATCH 03/25] drm/edid: add struct drm_edid container Date: Fri, 6 May 2022 13:10:10 +0300 [thread overview] Message-ID: <263c5eea832947e740cc73b8bb187b91a3f1b79e.1651830938.git.jani.nikula@intel.com> (raw) In-Reply-To: <cover.1651830938.git.jani.nikula@intel.com> Introduce new opaque type struct drm_edid to encapsulate the EDID data and the size allocated for it. The contents will be private to drm_edid.c. There are a number of reasons for adding a container around struct edid: * struct edid is a raw blob pointer to data that usually originates outside of the kernel. Its size is contained within the structure. * There's no way to attach meta information (such as allocated memory size) to struct edid. * Validation of the EDID blob and its size become crucial, and it's spread all over the subsystem, with varying levels of accuracy. * HDMI Forum has introduced an HF-EEODB extension that defines an override EDID size within an EDID extension. The size allocated for an EDID depends on whether the allocator understands the HF-EEODB extension. Given a struct edid *, it's impossible to know how much memory was actually allocated for it. There are also some reasons for making the container type struct drm_edid opaque and private to drm_edid.c: * Have only one place for creating and parsing the EDID, to avoid duplicating bugs. * Prepare for reading a pure DisplayID 2.0 from its own DDC address, and adding it within the same struct drm_edid container, transparently, and for all drivers. * With the idea that the drm_edid objects are immutable during their lifetimes, it will be possible to refcount them and reduce EDID copying everywhere (this is left for future work). Initially, just add the type. In follow-up, we'll start converting the guts of drm_edid.c to use it, and finally add interfaces around it. Signed-off-by: Jani Nikula <jani.nikula@intel.com> --- drivers/gpu/drm/drm_edid.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index dcef92c8887a..480fd9fbe412 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1567,6 +1567,15 @@ static const struct drm_display_mode edid_4k_modes[] = { /*** DDC fetch and block validation ***/ +/* + * The opaque EDID type, internal to drm_edid.c. + */ +struct drm_edid { + /* Size allocated for edid */ + size_t size; + const struct edid *edid; +}; + static int edid_extension_block_count(const struct edid *edid) { return edid->extensions; -- 2.30.2
WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@intel.com> To: dri-devel@lists.freedesktop.org Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 03/25] drm/edid: add struct drm_edid container Date: Fri, 6 May 2022 13:10:10 +0300 [thread overview] Message-ID: <263c5eea832947e740cc73b8bb187b91a3f1b79e.1651830938.git.jani.nikula@intel.com> (raw) In-Reply-To: <cover.1651830938.git.jani.nikula@intel.com> Introduce new opaque type struct drm_edid to encapsulate the EDID data and the size allocated for it. The contents will be private to drm_edid.c. There are a number of reasons for adding a container around struct edid: * struct edid is a raw blob pointer to data that usually originates outside of the kernel. Its size is contained within the structure. * There's no way to attach meta information (such as allocated memory size) to struct edid. * Validation of the EDID blob and its size become crucial, and it's spread all over the subsystem, with varying levels of accuracy. * HDMI Forum has introduced an HF-EEODB extension that defines an override EDID size within an EDID extension. The size allocated for an EDID depends on whether the allocator understands the HF-EEODB extension. Given a struct edid *, it's impossible to know how much memory was actually allocated for it. There are also some reasons for making the container type struct drm_edid opaque and private to drm_edid.c: * Have only one place for creating and parsing the EDID, to avoid duplicating bugs. * Prepare for reading a pure DisplayID 2.0 from its own DDC address, and adding it within the same struct drm_edid container, transparently, and for all drivers. * With the idea that the drm_edid objects are immutable during their lifetimes, it will be possible to refcount them and reduce EDID copying everywhere (this is left for future work). Initially, just add the type. In follow-up, we'll start converting the guts of drm_edid.c to use it, and finally add interfaces around it. Signed-off-by: Jani Nikula <jani.nikula@intel.com> --- drivers/gpu/drm/drm_edid.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index dcef92c8887a..480fd9fbe412 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1567,6 +1567,15 @@ static const struct drm_display_mode edid_4k_modes[] = { /*** DDC fetch and block validation ***/ +/* + * The opaque EDID type, internal to drm_edid.c. + */ +struct drm_edid { + /* Size allocated for edid */ + size_t size; + const struct edid *edid; +}; + static int edid_extension_block_count(const struct edid *edid) { return edid->extensions; -- 2.30.2
next prev parent reply other threads:[~2022-05-06 10:10 UTC|newest] Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-06 10:10 [PATCH 00/25] drm/edid: introduce struct drm_edid Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 01/25] drm/edid: use else-if in CTA extension parsing Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 17:47 ` Ville Syrjälä 2022-05-06 17:47 ` [Intel-gfx] " Ville Syrjälä 2022-05-06 10:10 ` [PATCH 02/25] drm/edid: convert drm_for_each_detailed_block() to edid iter Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 17:50 ` Ville Syrjälä 2022-05-06 17:50 ` [Intel-gfx] " Ville Syrjälä 2022-05-06 10:10 ` Jani Nikula [this message] 2022-05-06 10:10 ` [Intel-gfx] [PATCH 03/25] drm/edid: add struct drm_edid container Jani Nikula 2022-05-10 6:10 ` Nautiyal, Ankit K 2022-05-10 6:10 ` [Intel-gfx] " Nautiyal, Ankit K 2022-05-06 10:10 ` [PATCH 04/25] drm/edid: start propagating drm_edid to lower levels Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 05/25] drm/edid: keep propagating drm_edid to display info Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:16 ` Jani Nikula 2022-05-06 10:16 ` [Intel-gfx] " Jani Nikula 2022-05-10 6:08 ` Nautiyal, Ankit K 2022-05-10 6:08 ` [Intel-gfx] " Nautiyal, Ankit K 2022-05-06 10:10 ` [PATCH 06/25] drm/edid: propagate drm_edid to drm_edid_to_eld() Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 07/25] drm/edid: convert drm_edid_connector_update() to drm_edid fully Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 08/25] drm/edid: convert struct detailed_mode_closure to drm_edid Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 09/25] drm/edid: convert drm_mode_detailed() " Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 10/25] drm/edid: convert drm_dmt_modes_for_range() " Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 11/25] drm/edid: convert drm_gtf_modes_for_range() " Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 12/25] drm/edid: convert drm_cvt_modes_for_range() " Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 13/25] drm/edid: convert drm_mode_std() and children " Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 14/25] drm/edid: convert mode_in_range() and drm_monitor_supports_rb() " Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 15/25] drm/edid: convert get_monitor_name() " Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 16/25] drm/edid: convert drm_for_each_detailed_block() " Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 17/25] drm/edid: add drm_edid helper for drm_edid_to_sad() Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 18:05 ` Ville Syrjälä 2022-05-06 18:05 ` [Intel-gfx] " Ville Syrjälä 2022-05-07 10:21 ` Jani Nikula 2022-05-07 10:21 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 18/25] drm/edid: add drm_edid helper for drm_edid_to_speaker_allocation() Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 19/25] drm/edid: add drm_edid helper for drm_detect_hdmi_monitor() Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 20/25] drm/edid: add drm_edid helper for drm_detect_monitor_audio() Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 21/25] drm/edid: convert cea_db_iter_edid_begin() to drm_edid Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 22/25] drm/edid: convert drm_edid_iter_begin() " Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 23/25] drm/edid: add drm_edid helper for drm_update_tile_info() Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 24/25] drm/displayid: convert to drm_edid Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 10:10 ` [PATCH 25/25] drm/edid: convert version_greater() " Jani Nikula 2022-05-06 10:10 ` [Intel-gfx] " Jani Nikula 2022-05-06 11:12 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/edid: introduce struct drm_edid Patchwork 2022-05-06 11:12 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork 2022-05-06 11:42 ` amdgpu sparse warnings (was: Re: ✗ Fi.CI.SPARSE: warning for drm/edid: introduce struct drm_edid) Jani Nikula 2022-05-06 11:42 ` Jani Nikula 2022-05-06 11:42 ` [Intel-gfx] " Jani Nikula 2022-05-06 14:15 ` Deucher, Alexander 2022-05-06 14:15 ` Deucher, Alexander 2022-05-06 14:15 ` [Intel-gfx] " Deucher, Alexander 2022-05-06 11:38 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/edid: introduce struct drm_edid Patchwork 2022-05-06 12:23 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/edid: introduce struct drm_edid (rev2) Patchwork 2022-05-06 12:23 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork 2022-05-06 12:47 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " 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=263c5eea832947e740cc73b8bb187b91a3f1b79e.1651830938.git.jani.nikula@intel.com \ --to=jani.nikula@intel.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=intel-gfx@lists.freedesktop.org \ /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.