drm/amd/display: more drm_edid to AMD display driver
Subsystems (5)
v5 cover drm/amd/display: more drm_edid to AMD display driver
Hi,
Siqueira and I have been working on a solution to reduce the usage of drm_edid_raw in the AMD display driver, since the current guideline in the DRM subsystem is to stop handling raw edid data in driver-specific implementation and use opaque drm_edid object with common-code helpers.
In short, this series approaches the issue of maintaining DC as an OS-agnostic component by creating a mid layer to isolate drm_edid helpers that need to be called in the DC code, while allowing other OSes to implement their specific implementation. This is an extension of [1].
- Patch 1 addresses a possible leak added by previous migration to drm_edid.
- Patch 2 allocates a temporary drm_edid from raw edid for parsing.
- Patches 3-7 use common-code, drm_edid helpers to parse edid capabilities instead of driver-specific solutions. For this, patch 4 introduces a new helper that gets monitor name from drm_edid.
- Patches 8-9 are groundwork to reduce the noise of Linux/DRM specific code in the DC shared code
- Patch 10 creates a mid layer to make DC embraces different ways of handling EDID by platforms.
- Patch 11 move open-coded management of raw EDID data to the mid layer created before.
- Patch 12 introduces a helper that compares EDIDs from two drm_edids.
- Patch 13 adds drm_edid to dc_sink struct and a mid-layer helper to free drm_edid.
- Patch 14 switch dc_edid to drm_edid across the driver in a way that the DC shared code is little affected by Linux specific stuff.
[v1] https://lore.kernel.org/dri-devel/[email protected]/
Changes:
- fix broken approach to get monitor name from eld (Jani)
- I introduced a new helper that gets monitor name from drm_edid
- rename drm_edid_eq to drm_edid_eq_buf and doc fixes (Jani)
- add NULL edid checks (Jani)
- fix mishandling of product_id.manufacturer_name (Michel)
- I directly set it to manufacturer_id since sparse didn't complain.
- add Mario's r-b in the first fix patch and fix commit msg typo.
[v2] https://lore.kernel.org/dri-devel/[email protected]/
Changes:
- kernel-doc and commit msg fixes (Jani)
- use drm_edid_legacy_init instead of open coded (Jani)
- place drm_edid new func into the right section (Jani)
- paramenter names fix (Jani)
- add Jani's r-b to the patch 12
- remove unnecessary include (Jani)
- call dc_edid_sink_edid_free in link_detection, instead of drm_edid_free
- rebase on top of asdn
[v3] https://lore.kernel.org/dri-devel/[email protected]/
Changes:
- rebase to asdn
- some kernel-doc fixes
- move some changes to the right commit
[v4] https://lore.kernel.org/amd-gfx/[email protected]/
Changes:
- fix comments and commit messages (Mario)
- remove unnecessary drm_edid dup and fix mem leak (Mario)
- add Mario's rb to patches 5-7
---
There are three specific points where we still use drm_edid_raw() in the driver:
1. raw edid data for write EDID checksum in DP_TEST_EDID_CHECKSUM via drm_dp_dpcd_write(), that AFAIK there is no common code solution yet;
2. open-coded connectivity log for dc link detection, that maybe can be moved to drm (?);
3. open-coded parser that I suspect is a lot of duplicated code, but needs careful examining.
I suggest to address those points in a next phase for regression control.
Finally, I'm not sure amdgpu_dm/dc_edid is the right place and file name for the mid-layer. Suggestions?
[1] https://lore.kernel.org/amd-gfx/[email protected]/
Let me know yours thoughts!
Melissa
Melissa Wen (12):
drm/amd/display: make sure drm_edid stored in aconnector doesn't leak drm/amd/display: start using drm_edid helpers to parse EDID caps drm/amd/display: use drm_edid_product_id for parsing EDID product info drm/edid: introduce a helper that gets monitor name from drm_edid drm/amd/display: get panel id with drm_edid helper drm/amd/display: get SAD from drm_eld when parsing EDID caps drm/amd/display: get SADB from drm_eld when parsing EDID caps drm/amd/display: simplify dm_helpers_parse_edid_caps signature drm/amd/display: change DC functions to accept private types for edid drm/edid: introduce a helper that compares edid data from two drm_edid drm/amd/display: add drm_edid to dc_sink
drm/amd/display: move dc_sink from dc_edid to drm_edid
Rodrigo Siqueira (2):
drm/amd/display: add a mid-layer file to handle EDID in DC drm/amd/display: create a function to fill dc_sink with edid data
.../gpu/drm/amd/display/amdgpu_dm/Makefile | 1 + .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 33 +++--- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 105 +++++++----------- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 21 ++-- .../gpu/drm/amd/display/amdgpu_dm/dc_edid.c | 33 ++++++ .../gpu/drm/amd/display/amdgpu_dm/dc_edid.h | 15 +++ .../drm/amd/display/dc/core/dc_link_exports.c | 9 +- drivers/gpu/drm/amd/display/dc/core/dc_sink.c | 3 + drivers/gpu/drm/amd/display/dc/dc.h | 10 +- drivers/gpu/drm/amd/display/dc/dm_helpers.h | 7 +- drivers/gpu/drm/amd/display/dc/inc/link.h | 9 +- .../drm/amd/display/dc/link/link_detection.c | 30 ++--- .../drm/amd/display/dc/link/link_detection.h | 9 +- drivers/gpu/drm/bridge/sil-sii8620.c | 2 +- drivers/gpu/drm/display/drm_dp_mst_topology.c | 2 +- drivers/gpu/drm/drm_edid.c | 54 +++++++-- include/drm/drm_edid.h | 10 +- 17 files changed, 193 insertions(+), 160 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h
Signature · 1 line
2.47.2
PATCH v5 1/14 drm/amd/display: make sure drm_edid stored in aconnector doesn't leak
Make sure the drm_edid container stored in aconnector is freed when destroying the aconnector.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
@@ -7252,6 +7252,8 @@ static void amdgpu_dm_connector_destroy(struct drm_connector *connector)dc_sink_release (aconnector->dc_sink); aconnector->dc_sink =NULL ; +drm_edid_free (aconnector->drm_edid); +drm_dp_cec_unregister_connector (&aconnector->dm_dp_aux.aux);drm_connector_unregister (connector);drm_connector_cleanup (connector);
Signature · 1 line
2.47.2
PATCH v5 2/14 drm/amd/display: start using drm_edid helpers to parse EDID caps
In reply to Melissa WenGroundwork that allocates a temporary drm_edid from raw edid to take advantage of DRM common-code helpers instead of driver-specific code.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +9 -3
@@ -108,18 +108,21 @@ enum dc_edid_status dm_helpers_parse_edid_caps(struct drm_connector *connector = &aconnector->base;struct drm_device *dev = connector->dev;struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid :NULL ; +const struct drm_edid *drm_edid;struct cea_sad *sads;int sad_count =-1 ;int sadb_count =-1 ;int i =0 ;uint8_t *sadb =NULL ; -enum dc_edid_status result =EDID_OK ; +if (!edid_caps || !edid)return EDID_BAD_INPUT ; -if (!drm_edid_is_valid (edid_buf)) + drm_edid =drm_edid_alloc (edid_buf,EDID_LENGTH * (edid_buf->extensions +1 )); + +if (!drm_edid_valid (drm_edid)) result =EDID_BAD_CHECKSUM ; edid_caps->manufacturer_id = (uint16_t) edid_buf->mfg_id[0] |
@@ -139,8 +142,10 @@ enum dc_edid_status dm_helpers_parse_edid_caps(apply_edid_quirks (dev, edid_buf, edid_caps); sad_count =drm_edid_to_sad ((struct edid *) edid->raw_edid, &sads); -if (sad_count <=0 ) +if (sad_count <=0 ) { +drm_edid_free (drm_edid);return result; + } edid_caps->audio_mode_count =min (sad_count,DC_MAX_AUDIO_DESC_COUNT );for (i =0 ; i < edid_caps->audio_mode_count; ++i) {
@@ -166,6 +171,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps(kfree (sads);kfree (sadb); +drm_edid_free (drm_edid);return result; }
Signature · 1 line
2.47.2
PATCH v5 3/14 drm/amd/display: use drm_edid_product_id for parsing EDID product info
In reply to Melissa WenUse drm_edid_product_id [1] to get debug info from drm_edid instead of directly parsing raw EDID.
[1] 3ddbd345539e ("drm/edid: add drm_edid_get_product_id()").
--
v5:
- replace series url to commit hash (Mario)
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +8 -7
@@ -109,6 +109,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps(struct drm_device *dev = connector->dev;struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid :NULL ;const struct drm_edid *drm_edid; +struct drm_edid_product_id product_id;struct cea_sad *sads;int sad_count =-1 ;int sadb_count =-1 ;
@@ -125,13 +126,13 @@ enum dc_edid_status dm_helpers_parse_edid_caps(if (!drm_edid_valid (drm_edid)) result =EDID_BAD_CHECKSUM ; - edid_caps->manufacturer_id = (uint16_t ) edid_buf->mfg_id[0 ] | - ((uint16_t ) edid_buf->mfg_id[1 ])<<8 ; - edid_caps->product_id = (uint16_t ) edid_buf->prod_code[0 ] | - ((uint16_t ) edid_buf->prod_code[1 ])<<8 ; - edid_caps->serial_number = edid_buf->serial; - edid_caps->manufacture_week = edid_buf->mfg_week; - edid_caps->manufacture_year = edid_buf->mfg_year; +drm_edid_get_product_id (drm_edid, &product_id); + + edid_caps->manufacturer_id = product_id.manufacturer_name; + edid_caps->product_id =le16_to_cpu (product_id.product_code); + edid_caps->serial_number =le32_to_cpu (product_id.serial_number); + edid_caps->manufacture_week = product_id.week_of_manufacture; + edid_caps->manufacture_year = product_id.year_of_manufacture; drm_edid_get_monitor_name(edid_buf, edid_caps->display_name,
Signature · 1 line
2.47.2
PATCH v5 4/14 drm/edid: introduce a helper that gets monitor name from drm_edid
In reply to Melissa WenOriginal drm_edid_get_monitor_name encapsulates raw edid in drm_edid and then call get_monitor_name. AMD still stores the display name for debugging, but it is migrating to drm_edid, on the other hand, drm_dp_mst_topology and sil-sii8620 still use the raw edid version.
Split drm_edid_get_monitor_name into two helpers, one that gets monitor name from raw edid and another from drm_edid. It's temporary and the raw edid version should be removed later.
v3:
- kernel-doc and commit msg mentionind raw edid stuff is deprecated (jani)
- use drm_edid_legacy_init instead of open coded (jani)
- move drm_edid new func declaration to its section (jani)
--- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +- drivers/gpu/drm/bridge/sil-sii8620.c | 2 +- drivers/gpu/drm/display/drm_dp_mst_topology.c | 2 +- drivers/gpu/drm/drm_edid.c | 30 +++++++++++++------ include/drm/drm_edid.h | 8 +++-- 5 files changed, 29 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +1 -1
@@ -134,7 +134,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps( edid_caps->manufacture_week = product_id.week_of_manufacture; edid_caps->manufacture_year = product_id.year_of_manufacture; -drm_edid_get_monitor_name (edid_buf, +drm_edid_get_monitor_name (drm_edid, edid_caps->display_name,AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS );
drivers/gpu/drm/bridge/sil-sii8620.c +1 -1
@@ -505,7 +505,7 @@ static void sii8620_identify_sink(struct sii8620 *ctx)else ctx->sink_type =SINK_DVI ; -drm_edid_get_monitor_name (ctx->edid, sink_name,ARRAY_SIZE (sink_name)); +drm_edid_raw_get_monitor_name (ctx->edid, sink_name,ARRAY_SIZE (sink_name));dev_info (dev,"detected sink(type: %s): %s\n" , sink_str[ctx->sink_type], sink_name);
drivers/gpu/drm/display/drm_dp_mst_topology.c +1 -1
@@ -4896,7 +4896,7 @@ static void fetch_monitor_name(struct drm_dp_mst_topology_mgr *mgr,struct edid *mst_edid; mst_edid =drm_dp_mst_get_edid (port->connector, mgr, port); -drm_edid_get_monitor_name (mst_edid, name, namelen); +drm_edid_raw_get_monitor_name (mst_edid, name, namelen);kfree (mst_edid); }
drivers/gpu/drm/drm_edid.c +21 -9
@@ -5575,27 +5575,23 @@ static int get_monitor_name(const struct drm_edid *drm_edid, char name[13]) }/** -* drm_edid_get_monitor_name - fetch the monitor name from the edid -* @edid: monitor EDID information +* drm_edid_get_monitor_name - fetch the monitor name from the drm_edid +* @drm_edid: EDID * @name: pointer to a character array to hold the name of the monitor * @bufsize: The size of the name buffer (should be at least 14 chars.) * */ -void drm_edid_get_monitor_name (const struct edid *edid,char *name,int bufsize) +void drm_edid_get_monitor_name (const struct drm_edid *drm_edid,char *name,int bufsize) {int name_length =0 ;if (bufsize <=0 )return ; -if (edid) { +if (drm_edid->edid) {char buf[13 ]; -struct drm_edid drm_edid = { - .edid = edid, - .size =edid_size (edid), - }; - name_length =min (get_monitor_name (&drm_edid, buf), bufsize -1 ); + name_length =min (get_monitor_name (drm_edid, buf), bufsize -1 );memcpy (name, buf, name_length); }
@@ -5603,6 +5599,22 @@ void drm_edid_get_monitor_name(const struct edid *edid, char *name, int bufsize) }EXPORT_SYMBOL (drm_edid_get_monitor_name); +/** +* drm_edid_raw_get_monitor_name - fetch the monitor name from raw edid +* @edid: monitor EDID information +* @name: pointer to a character array to hold the name of the monitor +* @bufsize: The size of the name buffer (should be at least 14 chars.) +* +* This function is deprecated. Use drm_edid_get_monitor_name() instead. +*/ +void drm_edid_raw_get_monitor_name (const struct edid *edid,char *name,int bufsize) +{ +struct drm_edid drm_edid; + +drm_edid_get_monitor_name (drm_edid_legacy_init (&drm_edid, edid), name, bufsize); +} +EXPORT_SYMBOL (drm_edid_raw_get_monitor_name); +static void clear_eld (struct drm_connector *connector) {mutex_lock (&connector->eld_mutex);
include/drm/drm_edid.h +5 -3
@@ -441,8 +441,8 @@ int drm_add_modes_noedid(struct drm_connector *connector,int drm_edid_header_is_valid (const void *edid);bool drm_edid_is_valid (struct edid *edid); -void drm_edid_get_monitor_name (const struct edid *edid,char *name, -int buflen); +void drm_edid_raw_get_monitor_name (const struct edid *edid,char *name, +int bufsize);struct drm_display_mode *drm_mode_find_dmt (struct drm_device *dev,int hsize,int vsize,int fresh,bool rb);
@@ -476,5 +476,7 @@ void drm_edid_print_product_id(struct drm_printer *p,u32 drm_edid_get_panel_id (const struct drm_edid *drm_edid);bool drm_edid_match (const struct drm_edid *drm_edid,const struct drm_edid_ident *ident); - +void drm_edid_get_monitor_name (const struct drm_edid *drm_edid, +char *name, +int bufsize);#endif /* __DRM_EDID_H__ */
Signature · 1 line
2.47.2
PATCH v5 5/14 drm/amd/display: get panel id with drm_edid helper
In reply to Melissa WenInstead of using driver-specific code, use DRM helpers.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +5 -10
@@ -48,16 +48,11 @@#include "ddc_service_types.h" #include "clk_mgr.h" -static u32 edid_extract_panel_id (struct edid *edid) +static void apply_edid_quirks (struct drm_device *dev, +const struct drm_edid *drm_edid, +struct dc_edid_caps *edid_caps) { -return (u32 )edid->mfg_id[0 ] <<24 | - (u32 )edid->mfg_id[1 ] <<16 | - (u32 )EDID_PRODUCT_ID (edid); -} - -static void apply_edid_quirks (struct drm_device *dev,struct edid *edid,struct dc_edid_caps *edid_caps) -{ -uint32_t panel_id =edid_extract_panel_id (edid); +uint32_t panel_id =drm_edid_get_panel_id (drm_edid);switch (panel_id) {/* Workaround for monitors that need a delay after detecting the link */
@@ -140,7 +135,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps( edid_caps->edid_hdmi = connector->display_info.is_hdmi; -apply_edid_quirks (dev, edid_buf, edid_caps); +apply_edid_quirks (dev, drm_edid, edid_caps); sad_count =drm_edid_to_sad ((struct edid *) edid->raw_edid, &sads);if (sad_count <=0 ) {
Signature · 1 line
2.47.2
PATCH v5 6/14 drm/amd/display: get SAD from drm_eld when parsing EDID caps
In reply to Melissa Wendrm_edid_connector_update() updates display info, filling ELD with audio info from Short-Audio Descriptors in the last step of update_dislay_info(). Our goal is stopping using raw edid, so we can extract SAD from drm_eld instead of access raw edid to get audio caps.
--- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +12 -10
@@ -33,6 +33,7 @@#include <drm/drm_probe_helper.h> #include <drm/amdgpu_drm.h> #include <drm/drm_edid.h> +#include <drm/drm_eld.h> #include <drm/drm_fixed.h> #include "dm_services.h"
@@ -105,9 +106,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps(struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid :NULL ;const struct drm_edid *drm_edid;struct drm_edid_product_id product_id; -struct cea_sad *sads; -int sad_count =-1 ; -int sadb_count =-1 ; +int sad_count, sadb_count;int i =0 ;uint8_t *sadb =NULL ;enum dc_edid_status result =EDID_OK ;
@@ -121,6 +120,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps(if (!drm_edid_valid (drm_edid)) result =EDID_BAD_CHECKSUM ; +drm_edid_connector_update (connector, drm_edid);drm_edid_get_product_id (drm_edid, &product_id); edid_caps->manufacturer_id = product_id.manufacturer_name;
@@ -137,7 +137,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps(apply_edid_quirks (dev, drm_edid, edid_caps); - sad_count =drm_edid_to_sad ((struct edid *) edid->raw_edid, &sads); + sad_count =drm_eld_sad_count (connector->eld);if (sad_count <=0 ) {drm_edid_free (drm_edid);return result;
@@ -145,12 +145,15 @@ enum dc_edid_status dm_helpers_parse_edid_caps( edid_caps->audio_mode_count =min (sad_count,DC_MAX_AUDIO_DESC_COUNT );for (i =0 ; i < edid_caps->audio_mode_count; ++i) { -struct cea_sad *sad = &sads[i]; +struct cea_sad sad; - edid_caps->audio_modes[i].format_code = sad->format; - edid_caps->audio_modes[i].channel_count = sad->channels +1 ; - edid_caps->audio_modes[i].sample_rate = sad->freq; - edid_caps->audio_modes[i].sample_size = sad->byte2; +if (drm_eld_sad_get (connector->eld, i, &sad) <0 ) +continue ; + + edid_caps->audio_modes[i].format_code = sad.format; + edid_caps->audio_modes[i].channel_count = sad.channels +1 ; + edid_caps->audio_modes[i].sample_rate = sad.freq; + edid_caps->audio_modes[i].sample_size = sad.byte2; } sadb_count =drm_edid_to_speaker_allocation ((struct edid *) edid->raw_edid, &sadb);
@@ -165,7 +168,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps(else edid_caps->speaker_flags =DEFAULT_SPEAKER_LOCATION ; -kfree (sads);kfree (sadb);drm_edid_free (drm_edid);
Signature · 1 line
2.47.2
PATCH v5 7/14 drm/amd/display: get SADB from drm_eld when parsing EDID caps
In reply to Melissa Wendrm_edid_connector_update() updates display info, filling ELD with speaker allocation data in the last step of update_dislay_info(). Our goal is stopping using raw edid, so we can extract SADB from drm_eld instead of access raw edid to get audio caps.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +3 -12
@@ -106,9 +106,8 @@ enum dc_edid_status dm_helpers_parse_edid_caps(struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid :NULL ;const struct drm_edid *drm_edid;struct drm_edid_product_id product_id; -int sad_count, sadb_count; +int sad_count;int i =0 ; -uint8_t *sadb =NULL ;enum dc_edid_status result =EDID_OK ;
@@ -156,19 +155,11 @@ enum dc_edid_status dm_helpers_parse_edid_caps( edid_caps->audio_modes[i].sample_size = sad.byte2; } - sadb_count =drm_edid_to_speaker_allocation ((struct edid *) edid->raw_edid, &sadb); - -if (sadb_count <0 ) { -DRM_ERROR ("Couldn't read Speaker Allocation Data Block: %d\n" , sadb_count); - sadb_count =0 ; - } - -if (sadb_count) - edid_caps->speaker_flags = sadb[0 ]; +if (connector->eld[DRM_ELD_SPEAKER ]) + edid_caps->speaker_flags = connector->eld[DRM_ELD_SPEAKER ];else edid_caps->speaker_flags =DEFAULT_SPEAKER_LOCATION ; -kfree (sadb);drm_edid_free (drm_edid);return result;
Signature · 1 line
2.47.2
PATCH v5 8/14 drm/amd/display: simplify dm_helpers_parse_edid_caps signature
In reply to Melissa WenPass dc_sink to dm_helpers_parse_edid_caps(), since it already contains edid info. It's a groundwork to get rid of raw edid stored as dc_edid.
---
v4:
- fix kernel-doc
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +--- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 23 ++++++++----------- drivers/gpu/drm/amd/display/dc/dm_helpers.h | 7 ++---- .../drm/amd/display/dc/link/link_detection.c | 5 +--- 4 files changed, 13 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -4
@@ -7384,10 +7384,7 @@ static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector)memset (&dc_em_sink->edid_caps,0 ,sizeof (struct dc_edid_caps ));memmove (dc_em_sink->dc_edid.raw_edid, edid, (edid->extensions +1 ) *EDID_LENGTH ); -dm_helpers_parse_edid_caps ( - dc_link, - &dc_em_sink->dc_edid, - &dc_em_sink->edid_caps); +dm_helpers_parse_edid_caps (dc_link, dc_em_sink); } }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +9 -14
@@ -89,29 +89,27 @@ static void apply_edid_quirks(struct drm_device *dev,/** * dm_helpers_parse_edid_caps() - Parse edid caps * -* @link: current detected link -* @edid: [in] pointer to edid -* @edid_caps: [in] pointer to edid caps +* @link: current detected link (connector) +* @sink: current detected sink (display) * * Return: void */ -enum dc_edid_status dm_helpers_parse_edid_caps ( -struct dc_link *link, -const struct dc_edid *edid, -struct dc_edid_caps *edid_caps) +enum dc_edid_status dm_helpers_parse_edid_caps (struct dc_link *link, +struct dc_sink *sink) {struct amdgpu_dm_connector *aconnector = link->priv;struct drm_connector *connector = &aconnector->base;struct drm_device *dev = connector->dev; -struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid :NULL ; +struct edid *edid_buf;const struct drm_edid *drm_edid;struct drm_edid_product_id product_id; +struct dc_edid_caps *edid_caps = &sink->edid_caps;int sad_count;int i =0 ;enum dc_edid_status result =EDID_OK ; - -if (!edid_caps || !edid) + edid_buf = (struct edid *) &sink->dc_edid.raw_edid; +if (!edid_caps || !edid_buf)return EDID_BAD_INPUT ; drm_edid =drm_edid_alloc (edid_buf,EDID_LENGTH * (edid_buf->extensions +1 ));
@@ -1030,10 +1028,7 @@ enum dc_edid_status dm_helpers_read_local_edid(/* We don't need the original edid anymore */ drm_edid_free (drm_edid); - edid_status =dm_helpers_parse_edid_caps ( - link, - &sink->dc_edid, - &sink->edid_caps); + edid_status =dm_helpers_parse_edid_caps (link, sink); }while (edid_status ==EDID_BAD_CHECKSUM && --retry >0 );
drivers/gpu/drm/amd/display/dc/dm_helpers.h +2 -5
@@ -59,11 +59,8 @@ void dm_helpers_free_gpu_mem(enum dc_gpu_mem_alloc_type type, void *pvMem); -enum dc_edid_status dm_helpers_parse_edid_caps ( -struct dc_link *link, -const struct dc_edid *edid, -struct dc_edid_caps *edid_caps); - +enum dc_edid_status dm_helpers_parse_edid_caps (struct dc_link *link, +struct dc_sink *sink);/* * Update DP branch info
drivers/gpu/drm/amd/display/dc/link/link_detection.c +1 -4
@@ -1420,10 +1420,7 @@ struct dc_sink *link_add_remote_sink( dc_sink)) goto fail_add_sink; - edid_status =dm_helpers_parse_edid_caps ( - link, - &dc_sink->dc_edid, - &dc_sink->edid_caps); + edid_status =dm_helpers_parse_edid_caps (link, dc_sink);/* * Treat device as no EDID device if EDID
Signature · 1 line
2.47.2
PATCH v5 9/14 drm/amd/display: change DC functions to accept private types for edid
In reply to Melissa WenThere is an opaque obj in Linux/DRM to encapsulate edid data as drm_edid. This obj isn't present in other platforms but we need to pass it through DC when adding sink. To pass this data without compromise the independence of DC code, make some DC functions accept edid data as private options.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c | 9 ++++----- drivers/gpu/drm/amd/display/dc/dc.h | 9 ++++----- drivers/gpu/drm/amd/display/dc/inc/link.h | 9 ++++----- drivers/gpu/drm/amd/display/dc/link/link_detection.c | 4 ++-- drivers/gpu/drm/amd/display/dc/link/link_detection.h | 9 ++++----- 5 files changed, 18 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c +4 -5
@@ -278,11 +278,10 @@ unsigned int dc_dp_trace_get_link_loss_count(struct dc_link *link)return link->dc->link_srv->dp_trace_get_link_loss_count (link); } -struct dc_sink *dc_link_add_remote_sink ( -struct dc_link *link, -const uint8_t *edid, -int len, -struct dc_sink_init_data *init_data) +struct dc_sink *dc_link_add_remote_sink (struct dc_link *link, +const void *edid, +int len, +struct dc_sink_init_data *init_data) {return link->dc->link_srv->add_remote_sink (link, edid, len, init_data); }
drivers/gpu/drm/amd/display/dc/dc.h +4 -5
@@ -1911,11 +1911,10 @@ struct dc_sink_init_data;* @len - size of the edid in byte * @init_data - */ -struct dc_sink *dc_link_add_remote_sink ( -struct dc_link *dc_link, -const uint8_t *edid, -int len, -struct dc_sink_init_data *init_data); +struct dc_sink *dc_link_add_remote_sink (struct dc_link *dc_link, +const void *edid, +int len, +struct dc_sink_init_data *init_data);/* Remove remote sink from a link with dc_connection_mst_branch connection type. * @link - link the sink should be removed from
drivers/gpu/drm/amd/display/dc/inc/link.h +4 -5
@@ -107,11 +107,10 @@ struct link_service {bool (*detect_link)(struct dc_link *link,enum dc_detect_reason reason);bool (*detect_connection_type)(struct dc_link *link,enum dc_connection_type *type); -struct dc_sink *(*add_remote_sink)( -struct dc_link *link, -const uint8_t *edid, -int len, -struct dc_sink_init_data *init_data); +struct dc_sink *(*add_remote_sink)(struct dc_link *link, +const void *edid, +int len, +struct dc_sink_init_data *init_data);void (*remove_remote_sink)(struct dc_link *link,struct dc_sink *sink);bool (*get_hpd_state)(struct dc_link *link); struct gpio *(*get_hpd_gpio)(struct dc_bios *dcb,
drivers/gpu/drm/amd/display/dc/link/link_detection.c +2 -2
@@ -1385,7 +1385,7 @@ static bool link_add_remote_sink_helper(struct dc_link *dc_link, struct dc_sinkstruct dc_sink *link_add_remote_sink (struct dc_link *link, -const uint8_t *edid, +const void *edid,int len,struct dc_sink_init_data *init_data) {
@@ -1412,7 +1412,7 @@ struct dc_sink *link_add_remote_sink(if (!dc_sink)return NULL ; -memmove (dc_sink->dc_edid.raw_edid, edid, len); +memmove (dc_sink->dc_edid.raw_edid, (const uint8_t *) edid, len); dc_sink->dc_edid.length = len; if (!link_add_remote_sink_helper(
drivers/gpu/drm/amd/display/dc/link/link_detection.h +4 -5
@@ -29,11 +29,10 @@bool link_detect (struct dc_link *link,enum dc_detect_reason reason);bool link_detect_connection_type (struct dc_link *link,enum dc_connection_type *type); -struct dc_sink *link_add_remote_sink ( -struct dc_link *link, -const uint8_t *edid, -int len, -struct dc_sink_init_data *init_data); +struct dc_sink *link_add_remote_sink (struct dc_link *link, +const void *edid, +int len, +struct dc_sink_init_data *init_data);void link_remove_remote_sink (struct dc_link *link,struct dc_sink *sink);bool link_reset_cur_dp_mst_topology (struct dc_link *link);const struct dc_link_status *link_get_status (const struct dc_link *link);
Signature · 1 line
2.47.2
PATCH v5 10/14 drm/amd/display: add a mid-layer file to handle EDID in DC
In reply to Melissa WenFrom: Rodrigo Siqueira <[email protected]>
Since DC is a shared code, this commit introduces a new file to work as a mid-layer in DC for the edid manipulation.
---
v3:
- rebase on top of asdn
--- .../gpu/drm/amd/display/amdgpu_dm/Makefile | 1 + .../gpu/drm/amd/display/amdgpu_dm/dc_edid.c | 19 +++++++++++++++++++ .../gpu/drm/amd/display/amdgpu_dm/dc_edid.h | 11 +++++++++++ .../drm/amd/display/dc/link/link_detection.c | 17 +++-------------- 4 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h
drivers/gpu/drm/amd/display/amdgpu_dm/Makefile +1 -0
@@ -39,6 +39,7 @@ AMDGPUDM = \ amdgpu_dm_psr.o \ amdgpu_dm_replay.o \ amdgpu_dm_quirks.o \ + dc_edid.o \ amdgpu_dm_wb.o ifdef CONFIG_DRM_AMD_DC_FP
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c new file +19 -0
@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT +#include "dc.h" +#include "dc_edid.h" + +bool dc_edid_is_same_edid (struct dc_sink *prev_sink, +struct dc_sink *current_sink) +{ +struct dc_edid *old_edid = &prev_sink->dc_edid; +struct dc_edid *new_edid = ¤t_sink->dc_edid; + +if (old_edid->length != new_edid->length) +return false; + +if (new_edid->length ==0 ) +return false; + +return (memcmp (old_edid->raw_edid, + new_edid->raw_edid, new_edid->length) ==0 ); +}
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: MIT */ + +#ifndef __DC_EDID_H__ +#define __DC_EDID_H__ + +#include "dc.h" + +bool dc_edid_is_same_edid (struct dc_sink *prev_sink, +struct dc_sink *current_sink); + +#endif /* __DC_EDID_H__ */
drivers/gpu/drm/amd/display/dc/link/link_detection.c +3 -14
@@ -48,6 +48,8 @@#include "dm_helpers.h" #include "clk_mgr.h" +#include "amdgpu_dm/dc_edid.h" +// Offset DPCD 050Eh == 0x5A #define MST_HUB_ID_0x5A 0x5A
@@ -617,18 +619,6 @@ static bool detect_dp(struct dc_link *link,return true; } -static bool is_same_edid (struct dc_edid *old_edid,struct dc_edid *new_edid) -{ -if (old_edid->length != new_edid->length) -return false; - -if (new_edid->length ==0 ) -return false; - -return (memcmp (old_edid->raw_edid, - new_edid->raw_edid, new_edid->length) ==0 ); -} -static bool wait_for_entering_dp_alt_mode (struct dc_link *link) {
@@ -1105,8 +1095,7 @@ static bool detect_link_and_local_sink(struct dc_link *link,// Check if edid is the same if ((prev_sink) && (edid_status ==EDID_THE_SAME || edid_status ==EDID_OK )) - same_edid =is_same_edid (&prev_sink->dc_edid, - &sink->dc_edid); + same_edid =dc_edid_is_same_edid (prev_sink, sink);if (sink->edid_caps.panel_patch.skip_scdc_overwrite) link->ctx->dc->debug.hdmi20_disable = true;
Signature · 1 line
2.47.2
Harry Wentland
maintainerRe: [PATCH v5 10/14] drm/amd/display: add a mid-layer file to handle EDID in DC
Quoted 13 lines · Melissa Wen
From: Rodrigo Siqueira <[email protected]>
Since DC is a shared code, this commit introduces a new file to work as a mid-layer in DC for the edid manipulation.
Signed-off-by Rodrigo Siqueira <[email protected]>Co-developed-by Melissa Wen <[email protected]>Signed-off-by Melissa Wen <[email protected]>---
v3:
- rebase on top of asdn
Quoted 8 lines
--- .../gpu/drm/amd/display/amdgpu_dm/Makefile | 1 + .../gpu/drm/amd/display/amdgpu_dm/dc_edid.c | 19 +++++++++++++++++++ .../gpu/drm/amd/display/amdgpu_dm/dc_edid.h | 11 +++++++++++ .../drm/amd/display/dc/link/link_detection.c | 17 +++-------------- 4 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h
It'd be better to name this amdgpu_dm_edid.h/c. Otherwise reviewers like me will think we're looking at DC code.
It looks like dc_fpu.h/c set a precedent. Maybe we should rename that as well.
Quoted 19 lines
drivers/gpu/drm/amd/display/amdgpu_dm/Makefile +1
-0@@ -39,6 +39,7 @@ AMDGPUDM = \ amdgpu_dm_psr.o \ amdgpu_dm_replay.o \ amdgpu_dm_quirks.o \ + dc_edid.o \ amdgpu_dm_wb.o ifdef CONFIG_DRM_AMD_DC_FPdrivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c new file +0
-0
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c line 6
Quoted 6 lines
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c new file +6
-0@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT +#include "dc.h" +#include "dc_edid.h" + +bool dc_edid_is_same_edid (struct dc_sink *prev_sink, +struct dc_sink *current_sink)
Please avoid dc_ prefix in amdgpu_dm. Use dm_ prefix instead, or dm_helpers_.
Harry
Quoted 35 lines
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c new file +13
-0+{ +struct dc_edid *old_edid = &prev_sink->dc_edid; +struct dc_edid *new_edid = ¤t_sink->dc_edid; + +if (old_edid->length != new_edid->length) +return false; + +if (new_edid->length ==0 ) +return false; + +return (memcmp (old_edid->raw_edid, + new_edid->raw_edid, new_edid->length) ==0 ); +}drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h new file +11
-0@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: MIT */ + +#ifndef __DC_EDID_H__ +#define __DC_EDID_H__ + +#include "dc.h" + +bool dc_edid_is_same_edid (struct dc_sink *prev_sink, +struct dc_sink *current_sink); + +#endif /* __DC_EDID_H__ */ drivers/gpu/drm/amd/display/dc/link/link_detection.c +0
-0
drivers/gpu/drm/amd/display/dc/link/link_detection.c line 51
Quoted 4 lines
drivers/gpu/drm/amd/display/dc/link/link_detection.c +1
-0@@ -48,6 +48,8 @@#include "dm_helpers.h" #include "clk_mgr.h" +#include "amdgpu_dm/dc_edid.h"
DC should be stand-alone from amdgpu_dm. Please put the function definition into dm_helpers.h. That way each OS can implement their own version.
Harry
Quoted 33 lines
drivers/gpu/drm/amd/display/dc/link/link_detection.c +2
-14+// Offset DPCD 050Eh == 0x5A #define MST_HUB_ID_0x5A 0x5A@@ -617,18 +619,6 @@ static bool detect_dp(struct dc_link *link,return true; } -static bool is_same_edid (struct dc_edid *old_edid,struct dc_edid *new_edid) -{ -if (old_edid->length != new_edid->length) -return false; - -if (new_edid->length ==0 ) -return false; - -return (memcmp (old_edid->raw_edid, - new_edid->raw_edid, new_edid->length) ==0 ); -} -static bool wait_for_entering_dp_alt_mode (struct dc_link *link) {@@ -1105,8 +1095,7 @@ static bool detect_link_and_local_sink(struct dc_link *link,// Check if edid is the same if ((prev_sink) && (edid_status ==EDID_THE_SAME || edid_status ==EDID_OK )) - same_edid =is_same_edid (&prev_sink->dc_edid, - &sink->dc_edid); + same_edid =dc_edid_is_same_edid (prev_sink, sink);if (sink->edid_caps.panel_patch.skip_scdc_overwrite) link->ctx->dc->debug.hdmi20_disable = true;
Re: [PATCH v5 10/14] drm/amd/display: add a mid-layer file to handle EDID in DC
Quoted 23 lines · Harry Wentland
Quoted 13 lines · Melissa Wen
From: Rodrigo Siqueira <[email protected]>
Since DC is a shared code, this commit introduces a new file to work as a mid-layer in DC for the edid manipulation.
Signed-off-by Rodrigo Siqueira <[email protected]>Co-developed-by Melissa Wen <[email protected]>Signed-off-by Melissa Wen <[email protected]>---
v3:
- rebase on top of asdnQuoted 8 lines
--- .../gpu/drm/amd/display/amdgpu_dm/Makefile | 1 + .../gpu/drm/amd/display/amdgpu_dm/dc_edid.c | 19 +++++++++++++++++++ .../gpu/drm/amd/display/amdgpu_dm/dc_edid.h | 11 +++++++++++ .../drm/amd/display/dc/link/link_detection.c | 17 +++-------------- 4 files changed, 34 insertions(+), 14 deletions(-)create mode 100644
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.ccreate mode 100644drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h
Quoted 5 lines
It'd be better to name this amdgpu_dm_edid.h/c. Otherwise reviewers like me will think we're looking at DC code.
It looks like dc_fpu.h/c set a precedent. Maybe we should rename that as well.
Ack. I'll change both in the next version.
Thanks,
Melissa
Quoted 108 lines
Quoted 19 lines
drivers/gpu/drm/amd/display/amdgpu_dm/Makefile +1
-0@@ -39,6 +39,7 @@ AMDGPUDM = \ amdgpu_dm_psr.o \ amdgpu_dm_replay.o \ amdgpu_dm_quirks.o \ + dc_edid.o \ amdgpu_dm_wb.o ifdef CONFIG_DRM_AMD_DC_FPdrivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c new file +0
-0drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c line 6
Quoted 6 lines
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c new file +6
-0@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT +#include "dc.h" +#include "dc_edid.h" + +bool dc_edid_is_same_edid (struct dc_sink *prev_sink, +struct dc_sink *current_sink)Please avoid
dc_prefix inamdgpu_dm. Usedm_prefix instead, ordm_helpers_.Harry
Quoted 35 lines
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c new file +13
-0+{ +struct dc_edid *old_edid = &prev_sink->dc_edid; +struct dc_edid *new_edid = ¤t_sink->dc_edid; + +if (old_edid->length != new_edid->length) +return false; + +if (new_edid->length ==0 ) +return false; + +return (memcmp (old_edid->raw_edid, + new_edid->raw_edid, new_edid->length) ==0 ); +}drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h new file +11
-0@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: MIT */ + +#ifndef __DC_EDID_H__ +#define __DC_EDID_H__ + +#include "dc.h" + +bool dc_edid_is_same_edid (struct dc_sink *prev_sink, +struct dc_sink *current_sink); + +#endif /* __DC_EDID_H__ */ drivers/gpu/drm/amd/display/dc/link/link_detection.c +0
-0drivers/gpu/drm/amd/display/dc/link/link_detection.c line 51
Quoted 4 lines
drivers/gpu/drm/amd/display/dc/link/link_detection.c +1
-0@@ -48,6 +48,8 @@#include "dm_helpers.h" #include "clk_mgr.h" +#include "amdgpu_dm/dc_edid.h" DC should be stand-alone from
amdgpu_dm. Please put the function definition intodm_helpers.h. That way each OS can implement their own version.Harry
Quoted 33 lines
drivers/gpu/drm/amd/display/dc/link/link_detection.c +2
-14+// Offset DPCD 050Eh == 0x5A #define MST_HUB_ID_0x5A 0x5A@@ -617,18 +619,6 @@ static bool detect_dp(struct dc_link *link,return true; } -static bool is_same_edid (struct dc_edid *old_edid,struct dc_edid *new_edid) -{ -if (old_edid->length != new_edid->length) -return false; - -if (new_edid->length ==0 ) -return false; - -return (memcmp (old_edid->raw_edid, - new_edid->raw_edid, new_edid->length) ==0 ); -} -static bool wait_for_entering_dp_alt_mode (struct dc_link *link) {@@ -1105,8 +1095,7 @@ static bool detect_link_and_local_sink(struct dc_link *link,// Check if edid is the same if ((prev_sink) && (edid_status ==EDID_THE_SAME || edid_status ==EDID_OK )) - same_edid =is_same_edid (&prev_sink->dc_edid, - &sink->dc_edid); + same_edid =dc_edid_is_same_edid (prev_sink, sink);if (sink->edid_caps.panel_patch.skip_scdc_overwrite) link->ctx->dc->debug.hdmi20_disable = true;
PATCH v5 11/14 drm/amd/display: create a function to fill dc_sink with edid data
In reply to Melissa WenFrom: Rodrigo Siqueira <[email protected]>
As part of the effort of stopping using raw edid, this commit move the copy of the edid in DC to a dedicated function that will allow the usage of drm_edid in the next steps.
---
v3:
- remove superfulous cast (jani)
--- drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c | 8 ++++++++ drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h | 2 ++ drivers/gpu/drm/amd/display/dc/link/link_detection.c | 3 +-- 3 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c +8 -0
@@ -17,3 +17,11 @@ bool dc_edid_is_same_edid(struct dc_sink *prev_sink,return (memcmp (old_edid->raw_edid, new_edid->raw_edid, new_edid->length) ==0 ); } + +void dc_edid_copy_edid_to_dc (struct dc_sink *dc_sink, +const void *edid, +int len) +{ +memmove (dc_sink->dc_edid.raw_edid, edid, len); + dc_sink->dc_edid.length = len; +}
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h +2 -0
@@ -7,5 +7,7 @@bool dc_edid_is_same_edid (struct dc_sink *prev_sink,struct dc_sink *current_sink); +void dc_edid_copy_edid_to_dc (struct dc_sink *dc_sink, +const void *edid,int len);#endif /* __DC_EDID_H__ */
drivers/gpu/drm/amd/display/dc/link/link_detection.c +1 -2
@@ -1401,8 +1401,7 @@ struct dc_sink *link_add_remote_sink(if (!dc_sink)return NULL ; -memmove (dc_sink->dc_edid.raw_edid, (const uint8_t *) edid, len); - dc_sink->dc_edid.length = len; +dc_edid_copy_edid_to_dc (dc_sink, edid, len); if (!link_add_remote_sink_helper( link,
Signature · 1 line
2.47.2
Harry Wentland
maintainerRe: [PATCH v5 11/14] drm/amd/display: create a function to fill dc_sink with edid data
Quoted 41 lines · Melissa Wen
From: Rodrigo Siqueira <[email protected]>
As part of the effort of stopping using raw edid, this commit move the copy of the edid in DC to a dedicated function that will allow the usage of
drm_edidin the next steps.Signed-off-by Rodrigo Siqueira <[email protected]>Co-developer-by Melissa Wen <[email protected]>Signed-off-by Melissa Wen <[email protected]>---
v3:
- remove superfulous cast (jani)--- drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c | 8 ++++++++ drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h | 2 ++ drivers/gpu/drm/amd/display/dc/link/link_detection.c | 3 +-- 3 files changed, 11 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c +8
-0@@ -17,3 +17,11 @@ bool dc_edid_is_same_edid(struct dc_sink *prev_sink,return (memcmp (old_edid->raw_edid, new_edid->raw_edid, new_edid->length) ==0 ); } + +void dc_edid_copy_edid_to_dc (struct dc_sink *dc_sink, +const void *edid, +int len) +{ +memmove (dc_sink->dc_edid.raw_edid, edid, len); + dc_sink->dc_edid.length = len; +}drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h +0
-0
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h line 11
Quoted 5 lines
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h +2
-0@@ -7,5 +7,7 @@bool dc_edid_is_same_edid (struct dc_sink *prev_sink,struct dc_sink *current_sink); +void dc_edid_copy_edid_to_dc (struct dc_sink *dc_sink, +const void *edid,int len);
Same comment as before, please put the definition into dm_helpers and rename the dc_edid.c to amdgpu_dm_edid. and function to use dm_helpers_ prefix.
Harry
Quoted 16 lines
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h +0
-0#endif /* __DC_EDID_H__ */ drivers/gpu/drm/amd/display/dc/link/link_detection.c +1
-2@@ -1401,8 +1401,7 @@ struct dc_sink *link_add_remote_sink(if (!dc_sink)return NULL ; -memmove (dc_sink->dc_edid.raw_edid, (const uint8_t *) edid, len); - dc_sink->dc_edid.length = len; +dc_edid_copy_edid_to_dc (dc_sink, edid, len); if (!link_add_remote_sink_helper( link,
Re: [PATCH v5 11/14] drm/amd/display: create a function to fill dc_sink with edid data
Quoted 44 lines · Harry Wentland
Quoted 42 lines · Melissa Wen
From: Rodrigo Siqueira <[email protected]>
As part of the effort of stopping using raw edid, this commit move the copy of the edid in DC to a dedicated function that will allow the usage of
drm_edidin the next steps.Signed-off-by Rodrigo Siqueira <[email protected]>Co-developer-by Melissa Wen <[email protected]>Signed-off-by Melissa Wen <[email protected]>---
v3:
- remove superfulous cast (jani)--- drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c | 8 ++++++++ drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h | 2 ++ drivers/gpu/drm/amd/display/dc/link/link_detection.c | 3 +-- 3 files changed, 11 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c +8
-0@@ -17,3 +17,11 @@ bool dc_edid_is_same_edid(struct dc_sink *prev_sink,return (memcmp (old_edid->raw_edid, new_edid->raw_edid, new_edid->length) ==0 ); } + +void dc_edid_copy_edid_to_dc (struct dc_sink *dc_sink, +const void *edid, +int len) +{ +memmove (dc_sink->dc_edid.raw_edid, edid, len); + dc_sink->dc_edid.length = len; +}drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h +0
-0@@ -7,5 +7,7 @@
Quoted 7 lines
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h line 11
Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h +2
-0bool dc_edid_is_same_edid (struct dc_sink *prev_sink,struct dc_sink *current_sink); +void dc_edid_copy_edid_to_dc (struct dc_sink *dc_sink, +const void *edid,int len);Same comment as before, please put the definition into
dm_helpersand rename thedc_edid.ctoamdgpu_dm_edid. and function to usedm_helpers_prefix.
Ack
Melissa
Quoted 19 lines
Harry
Quoted 16 lines
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h +0
-0#endif /* __DC_EDID_H__ */ drivers/gpu/drm/amd/display/dc/link/link_detection.c +1
-2@@ -1401,8 +1401,7 @@ struct dc_sink *link_add_remote_sink(if (!dc_sink)return NULL ; -memmove (dc_sink->dc_edid.raw_edid, (const uint8_t *) edid, len); - dc_sink->dc_edid.length = len; +dc_edid_copy_edid_to_dc (dc_sink, edid, len); if (!link_add_remote_sink_helper( link,
PATCH v5 12/14 drm/edid: introduce a helper that compares edid data from two drm_edid
In reply to Melissa WenAMD driver has a function used to compare if two edid are the same; this is useful to some of the link detection algorithms implemented by amdgpu. Since the amdgpu function can be helpful for other drivers, this commit abstracts the AMD function to make it available at the DRM level by wrapping existent drm_edid_eq().
v2:
- rename drm_edid_eq to drm_edid_eq_buf (jani)
- add NULL checks (jani)
v3:
- fix kernel-doc (jani)
- fix parameter names
--- drivers/gpu/drm/drm_edid.c | 24 +++++++++++++++++++++--- include/drm/drm_edid.h | 2 ++ 2 files changed, 23 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +21 -3
@@ -1820,8 +1820,8 @@ static bool edid_block_is_zero(const void *edid)return mem_is_zero (edid,EDID_LENGTH ); } -static bool drm_edid_eq (const struct drm_edid *drm_edid, -const void *raw_edid,size_t raw_edid_size) +static bool drm_edid_eq_buf (const struct drm_edid *drm_edid, +const void *raw_edid,size_t raw_edid_size) {bool edid1_present = drm_edid && drm_edid->edid && drm_edid->size;bool edid2_present = raw_edid && raw_edid_size;
@@ -6915,7 +6915,7 @@ static int _drm_edid_connector_property_update(struct drm_connector *connector,const void *old_edid = connector->edid_blob_ptr->data;size_t old_edid_size = connector->edid_blob_ptr->length; -if (old_edid && !drm_edid_eq (drm_edid, old_edid, old_edid_size)) { +if (old_edid && !drm_edid_eq_buf (drm_edid, old_edid, old_edid_size)) { connector->epoch_counter++; drm_dbg_kms(dev, "[CONNECTOR:%d:%s] EDID changed, epoch counter %llu\n", connector->base.id, connector->name,
@@ -7520,3 +7520,21 @@ bool drm_edid_is_digital(const struct drm_edid *drm_edid) drm_edid->edid->input &DRM_EDID_INPUT_DIGITAL ; }EXPORT_SYMBOL (drm_edid_is_digital); + +/** +* drm_edid_eq - Check if EDIDs are equal +* +* @drm_edid_1: first drm_edid to compare edid +* @drm_edid_2: second drm_edid to compare edid +* +* Return true if EDIDs are equal. +*/ +bool drm_edid_eq (const struct drm_edid *drm_edid_1, +const struct drm_edid *drm_edid_2) +{ +const void *edid_1 = drm_edid_1 ? drm_edid_1->edid :NULL ; +size_t edid_1_size = drm_edid_1 ? drm_edid_1->size :0 ; + +return drm_edid_eq_buf (drm_edid_2, edid_1, edid_1_size); +} +EXPORT_SYMBOL (drm_edid_eq);
include/drm/drm_edid.h +2 -0
@@ -469,6 +469,8 @@ int drm_edid_connector_update(struct drm_connector *connector, const struct drm_edid *edid);int drm_edid_connector_add_modes (struct drm_connector *connector);bool drm_edid_is_digital (const struct drm_edid *drm_edid); +bool drm_edid_eq (const struct drm_edid *drm_edid_1, +const struct drm_edid *drm_edid_2);void drm_edid_get_product_id (const struct drm_edid *drm_edid,struct drm_edid_product_id *id); void drm_edid_print_product_id(struct drm_printer *p,
Signature · 1 line
2.47.2
PATCH v5 13/14 drm/amd/display: add drm_edid to dc_sink
In reply to Melissa WenAdd Linux opaque object to dc_sink for storing EDID data cross driver, drm_edid. Also include the Linux call to free this object, the drm_edid_free()
---
v3:
- remove uneccessary include (jani)
v5:
- fix comment (Mario)
--- drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c | 6 ++++++ drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h | 1 + drivers/gpu/drm/amd/display/dc/core/dc_sink.c | 3 +++ drivers/gpu/drm/amd/display/dc/dc.h | 1 + 4 files changed, 11 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c +6 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: MIT #include "dc.h" #include "dc_edid.h" +#include <drm/drm_edid.h> bool dc_edid_is_same_edid (struct dc_sink *prev_sink,struct dc_sink *current_sink)
@@ -25,3 +26,8 @@ void dc_edid_copy_edid_to_dc(struct dc_sink *dc_sink,memmove (dc_sink->dc_edid.raw_edid, edid, len); dc_sink->dc_edid.length = len; } + +void dc_edid_sink_edid_free (struct dc_sink *sink) +{ +drm_edid_free (sink->drm_edid); +}
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h +1 -0
@@ -9,5 +9,6 @@ bool dc_edid_is_same_edid(struct dc_sink *prev_sink, struct dc_sink *current_sink);void dc_edid_copy_edid_to_dc (struct dc_sink *dc_sink,const void *edid,int len); +void dc_edid_sink_edid_free (struct dc_sink *sink);#endif /* __DC_EDID_H__ */
drivers/gpu/drm/amd/display/dc/core/dc_sink.c +3 -0
@@ -26,6 +26,7 @@#include "dm_services.h" #include "dm_helpers.h" #include "core_types.h" +#include "dc_edid.h" /******************************************************************************* * Private functions
@@ -65,6 +66,8 @@ void dc_sink_retain(struct dc_sink *sink)static void dc_sink_free (struct kref *kref) { struct dc_sink *sink = container_of(kref, struct dc_sink, refcount); + +dc_edid_sink_edid_free (sink);kfree (sink->dc_container_id);kfree (sink); }
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
@@ -2466,6 +2466,7 @@ struct scdc_caps {struct dc_sink {enum signal_type sink_signal;struct dc_edid dc_edid;/* raw edid */ +const struct drm_edid *drm_edid;/* Linux DRM EDID */ struct dc_edid_caps edid_caps;/* parse display caps */ struct dc_container_id *dc_container_id;uint32_t dongle_max_pix_clk;
Signature · 1 line
2.47.2
Harry Wentland
maintainerRe: [PATCH v5 13/14] drm/amd/display: add drm_edid to dc_sink
Quoted 78 lines · Melissa Wen
Add Linux opaque object to
dc_sinkfor storing EDID data cross driver,drm_edid. Also include the Linux call to free this object, thedrm_edid_free()Signed-off-by Melissa Wen <[email protected]>---
v3:
- remove uneccessary include (jani)v5:
- fix comment (Mario)--- drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c | 6 ++++++ drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h | 1 + drivers/gpu/drm/amd/display/dc/core/dc_sink.c | 3 +++ drivers/gpu/drm/amd/display/dc/dc.h | 1 + 4 files changed, 11 insertions(+)drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c +6
-0@@ -1,6 +1,7 @@// SPDX-License-Identifier: MIT #include "dc.h" #include "dc_edid.h" +#include <drm/drm_edid.h> bool dc_edid_is_same_edid (struct dc_sink *prev_sink,struct dc_sink *current_sink)@@ -25,3 +26,8 @@ void dc_edid_copy_edid_to_dc(struct dc_sink *dc_sink,memmove (dc_sink->dc_edid.raw_edid, edid, len); dc_sink->dc_edid.length = len; } + +void dc_edid_sink_edid_free (struct dc_sink *sink) +{ +drm_edid_free (sink->drm_edid); +}drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h +1
-0@@ -9,5 +9,6 @@ bool dc_edid_is_same_edid(struct dc_sink *prev_sink, struct dc_sink *current_sink);void dc_edid_copy_edid_to_dc (struct dc_sink *dc_sink,const void *edid,int len); +void dc_edid_sink_edid_free (struct dc_sink *sink);#endif /* __DC_EDID_H__ */ drivers/gpu/drm/amd/display/dc/core/dc_sink.c +3
-0@@ -26,6 +26,7 @@#include "dm_services.h" #include "dm_helpers.h" #include "core_types.h" +#include "dc_edid.h" /******************************************************************************* * Private functions @@ -65,6 +66,8 @@ void dc_sink_retain(struct dc_sink *sink)static void dc_sink_free (struct kref *kref) { struct dc_sink *sink = container_of(kref, struct dc_sink, refcount); + +dc_edid_sink_edid_free (sink);kfree (sink->dc_container_id);kfree (sink); }drivers/gpu/drm/amd/display/dc/dc.h +0
-0
drivers/gpu/drm/amd/display/dc/dc.h struct scdc_caps { · line 2469
Quoted 4 lines
drivers/gpu/drm/amd/display/dc/dc.h +1
-0@@ -2466,6 +2466,7 @@ struct scdc_caps {struct dc_sink {enum signal_type sink_signal;struct dc_edid dc_edid;/* raw edid */ +const struct drm_edid *drm_edid;/* Linux DRM EDID */
On second thought I think I can live with this. DC will only ever treat this as an opaque pointer and never look at the actual struct (or know the struct definition).
Harry
Quoted 3 lines
drivers/gpu/drm/amd/display/dc/dc.h +0
-0struct dc_edid_caps edid_caps;/* parse display caps */ struct dc_container_id *dc_container_id;uint32_t dongle_max_pix_clk;
PATCH v5 14/14 drm/amd/display: move dc_sink from dc_edid to drm_edid
In reply to Melissa WenReduce direct handling of edid data by resorting to drm helpers that deal with this info inside drm_edid infrastructure.
v3:
- use dc_edid_sink_edid_free in link_detection
v5:
- no need of drm_edid duplication (Mario)
- fix mem leak on dc_sink->drm_edid
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 26 +++++++----------- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 27 +++++++------------ .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 21 +++++---------- .../gpu/drm/amd/display/amdgpu_dm/dc_edid.c | 26 +++++++++--------- .../gpu/drm/amd/display/amdgpu_dm/dc_edid.h | 1 + .../drm/amd/display/dc/link/link_detection.c | 3 ++- 6 files changed, 42 insertions(+), 62 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +10 -16
@@ -68,6 +68,7 @@#endif #include "amdgpu_dm_psr.h" #include "amdgpu_dm_replay.h" +#include "dc_edid.h" #include "ivsrcid/ivsrcid_vislands30.h"
@@ -3708,6 +3709,8 @@ void amdgpu_dm_update_connector_after_detect(* 2. Send an event and let userspace tell us what to do */ if (sink) { +const struct drm_edid *drm_edid = sink->drm_edid; +/* * TODO: check if we still need the S3 mode update workaround. * If yes, put it here.
@@ -3719,16 +3722,15 @@ void amdgpu_dm_update_connector_after_detect( aconnector->dc_sink = sink;dc_sink_retain (aconnector->dc_sink); -if (sink->dc_edid.length ==0 ) { + +if (!drm_edid_valid (drm_edid)) { aconnector->drm_edid =NULL ;hdmi_cec_unset_edid (aconnector);if (aconnector->dc_link->aux_mode) {drm_dp_cec_unset_edid (&aconnector->dm_dp_aux.aux); } }else { -const struct edid *edid = (const struct edid *)sink->dc_edid.raw_edid; - - aconnector->drm_edid =drm_edid_alloc (edid, sink->dc_edid.length); + aconnector->drm_edid =drm_edid_dup (sink->drm_edid);drm_edid_connector_update (connector, aconnector->drm_edid);hdmi_cec_set_edid (aconnector);
@@ -7378,12 +7380,8 @@ static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector) aconnector->drm_edid = drm_edid;/* Update emulated (virtual) sink's EDID */ if (dc_em_sink && dc_link) { -// FIXME: Get rid of drm_edid_raw() -const struct edid *edid =drm_edid_raw (drm_edid); -memset (&dc_em_sink->edid_caps,0 ,sizeof (struct dc_edid_caps )); -memmove (dc_em_sink->dc_edid.raw_edid, edid, - (edid->extensions +1 ) *EDID_LENGTH ); +dc_edid_copy_edid_to_dc (dc_em_sink, drm_edid,0 );dm_helpers_parse_edid_caps (dc_link, dc_em_sink); } }
@@ -7416,7 +7414,6 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector) .sink_signal = SIGNAL_TYPE_VIRTUAL };const struct drm_edid *drm_edid; -const struct edid *edid;struct i2c_adapter *ddc;if (dc_link && dc_link->aux_mode)
@@ -7436,12 +7433,9 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector) aconnector->drm_edid = drm_edid; - edid =drm_edid_raw (drm_edid);// FIXME: Get rid of drm_edid_raw() - aconnector->dc_em_sink =dc_link_add_remote_sink ( - aconnector->dc_link, - (uint8_t *)edid, - (edid->extensions +1 ) *EDID_LENGTH , - &init_params); + aconnector->dc_em_sink =dc_link_add_remote_sink (aconnector->dc_link, + drm_edid,0 , + &init_params);if (aconnector->base.force ==DRM_FORCE_ON ) { aconnector->dc_sink = aconnector->dc_link->local_sink ?
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +9 -18
@@ -48,6 +48,7 @@#include "dm_helpers.h" #include "ddc_service_types.h" #include "clk_mgr.h" +#include "dc_edid.h" static void apply_edid_quirks(struct drm_device *dev, const struct drm_edid *drm_edid,
@@ -100,20 +101,16 @@ enum dc_edid_status dm_helpers_parse_edid_caps(struct dc_link *link,struct amdgpu_dm_connector *aconnector = link->priv;struct drm_connector *connector = &aconnector->base;struct drm_device *dev = connector->dev; -struct edid *edid_buf; -const struct drm_edid *drm_edid; +const struct drm_edid *drm_edid = sink->drm_edid;struct drm_edid_product_id product_id;struct dc_edid_caps *edid_caps = &sink->edid_caps;int sad_count;int i =0 ;enum dc_edid_status result =EDID_OK ; - edid_buf = (struct edid *) &sink->dc_edid.raw_edid; -if (!edid_caps || !edid_buf) +if (!edid_caps || !drm_edid)return EDID_BAD_INPUT ; - drm_edid =drm_edid_alloc (edid_buf,EDID_LENGTH * (edid_buf->extensions +1 )); -if (!drm_edid_valid (drm_edid)) result =EDID_BAD_CHECKSUM ;
@@ -135,10 +132,8 @@ enum dc_edid_status dm_helpers_parse_edid_caps(struct dc_link *link,apply_edid_quirks (dev, drm_edid, edid_caps); sad_count =drm_eld_sad_count (connector->eld); -if (sad_count <=0 ) { -drm_edid_free (drm_edid); +if (sad_count <=0 )return result; - } edid_caps->audio_mode_count =min (sad_count,DC_MAX_AUDIO_DESC_COUNT );for (i =0 ; i < edid_caps->audio_mode_count; ++i) {
@@ -158,8 +153,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps(struct dc_link *link,else edid_caps->speaker_flags =DEFAULT_SPEAKER_LOCATION ; -drm_edid_free (drm_edid); -return result; }
@@ -991,7 +984,6 @@ enum dc_edid_status dm_helpers_read_local_edid(int retry =3 ;enum dc_edid_status edid_status;const struct drm_edid *drm_edid; -const struct edid *edid;if (link->aux_mode) ddc = &aconnector->dm_dp_aux.aux.ddc;
@@ -1002,6 +994,8 @@ enum dc_edid_status dm_helpers_read_local_edid(* do check sum and retry to make sure read correct edid. */ do { + drm_edid_free(sink->drm_edid); + drm_edid = dm_helpers_read_acpi_edid(aconnector); if (drm_edid) drm_info(connector->dev, "Using ACPI provided EDID for %s\n", connector->name);
@@ -1021,12 +1015,7 @@ enum dc_edid_status dm_helpers_read_local_edid(if (!drm_edid)return EDID_NO_RESPONSE ; - edid =drm_edid_raw (drm_edid);// FIXME: Get rid of drm_edid_raw() - sink->dc_edid.length =EDID_LENGTH * (edid->extensions +1 ); -memmove (sink->dc_edid.raw_edid, (uint8_t *)edid, sink->dc_edid.length); - -/* We don't need the original edid anymore */ -drm_edid_free (drm_edid); + sink->drm_edid = drm_edid; edid_status =dm_helpers_parse_edid_caps (link, sink);
@@ -1051,6 +1040,8 @@ enum dc_edid_status dm_helpers_read_local_edid( test_response.bits.EDID_CHECKSUM_WRITE =1 ; +// TODO: drm_edid doesn't have a helper for dp_write_dpcd yet +dc_edid_copy_edid_to_sink (sink); dm_helpers_dp_write_dpcd(ctx, link, DP_TEST_EDID_CHECKSUM,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +7 -14
@@ -359,12 +359,10 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector) .link = aconnector->dc_link, .sink_signal = SIGNAL_TYPE_DISPLAY_PORT_MST }; - dc_sink =dc_link_add_remote_sink ( - aconnector->dc_link, -NULL , -0 , - &init_params); - + dc_sink =dc_link_add_remote_sink (aconnector->dc_link, +NULL , +0 , + &init_params);if (!dc_sink) {DRM_ERROR ("Unable to add a remote sink\n" );return 0 ;
@@ -397,15 +395,10 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)struct dc_sink_init_data init_params = { .link = aconnector->dc_link, .sink_signal =SIGNAL_TYPE_DISPLAY_PORT_MST }; -const struct edid *edid; - - edid =drm_edid_raw (aconnector->drm_edid);// FIXME: Get rid of drm_edid_raw() - dc_sink =dc_link_add_remote_sink ( - aconnector->dc_link, - (uint8_t *)edid, - (edid->extensions +1 ) *EDID_LENGTH , - &init_params); + dc_sink =dc_link_add_remote_sink (aconnector->dc_link, + aconnector->drm_edid,0 , + &init_params);if (!dc_sink) {DRM_ERROR ("Unable to add a remote sink\n" );return 0 ;
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c +13 -13
@@ -6,25 +6,25 @@bool dc_edid_is_same_edid (struct dc_sink *prev_sink,struct dc_sink *current_sink) { -struct dc_edid *old_edid = &prev_sink->dc_edid; -struct dc_edid *new_edid = ¤t_sink->dc_edid; - -if (old_edid->length != new_edid->length) -return false; - -if (new_edid->length ==0 ) -return false; - -return (memcmp (old_edid->raw_edid, - new_edid->raw_edid, new_edid->length) ==0 ); +return drm_edid_eq (prev_sink->drm_edid, current_sink->drm_edid); }void dc_edid_copy_edid_to_dc (struct dc_sink *dc_sink,const void *edid,int len) { -memmove (dc_sink->dc_edid.raw_edid, edid, len); - dc_sink->dc_edid.length = len; + dc_sink->drm_edid =drm_edid_dup ((const struct drm_edid *) edid); +} + +void dc_edid_copy_edid_to_sink (struct dc_sink *sink) +{ +const struct edid *edid; +uint32_t edid_length; + + edid =drm_edid_raw (sink->drm_edid);// FIXME: Get rid of drm_edid_raw() + edid_length =EDID_LENGTH * (edid->extensions +1 ); +memcpy (sink->dc_edid.raw_edid, (uint8_t *) edid, edid_length); + sink->dc_edid.length = edid_length; }void dc_edid_sink_edid_free (struct dc_sink *sink)
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h +1 -0
@@ -9,6 +9,7 @@ bool dc_edid_is_same_edid(struct dc_sink *prev_sink, struct dc_sink *current_sink);void dc_edid_copy_edid_to_dc (struct dc_sink *dc_sink,const void *edid,int len); +void dc_edid_copy_edid_to_sink (struct dc_sink *sink);void dc_edid_sink_edid_free (struct dc_sink *sink);#endif /* __DC_EDID_H__ */
drivers/gpu/drm/amd/display/dc/link/link_detection.c +2 -1
@@ -1133,6 +1133,7 @@ static bool detect_link_and_local_sink(struct dc_link *link,dp_trace_init (link);/* Connectivity log: detection */ +dc_edid_copy_edid_to_sink (sink);for (i =0 ; i < sink->dc_edid.length /DC_EDID_BLOCK_SIZE ; i++) { CONN_DATA_DETECT(link, &sink->dc_edid.raw_edid[i * DC_EDID_BLOCK_SIZE],
@@ -1415,7 +1416,7 @@ struct dc_sink *link_add_remote_sink(* parsing fails */ if (edid_status !=EDID_OK && edid_status !=EDID_PARTIAL_VALID ) { - dc_sink->dc_edid.length =0 ; +dc_edid_sink_edid_free (dc_sink);dm_error ("Bad EDID, status%d!\n" , edid_status); }
Signature · 1 line
2.47.2
Re: [PATCH v5 14/14] drm/amd/display: move dc_sink from dc_edid to drm_edid
Melisa,
The following NULL pointer error was reported from promotion test with this patch:
[ 31.525028] amdgpu 0000:c4:00.0: [drm] *ERROR* No EDID read. [ 31.525596] amdgpu 0000:c4:00.0: [drm:drm_dp_dpcd_read [drm_display_helper]] AMDGPU DM aux hw bus 2: 0x6921d AUX -> (ret= 3) 00 00 00 [ 31.526132] amdgpu 0000:c4:00.0: [drm:drm_dp_dpcd_read [drm_display_helper]] AMDGPU DM aux hw bus 2: 0x68028 AUX -> (ret= 1) 00 [ 31.526146] BUG: kernel NULL pointer dereference, address: 000000000000007e [ 31.526148] #PF: supervisor read access in kernel mode [ 31.526150] #PF: error_code(0x0000) - not-present page [ 31.526152] PGD 0 P4D 0 [ 31.526155] Oops: Oops: 0000 [#1] PREEMPT SMP NOPTI [ 31.526158] CPU: 13 UID: 0 PID: 291 Comm: kworker/13:1H Not tainted 6.14.0-reg-jul14-redo+ #15 [ 31.526162] Hardware name: Unnamed Product [ 31.526164] Workqueue: events_highpri dm_irq_work_func [amdgpu] [ 31.526472] RIP: 0010:dc_edid_copy_edid_to_sink+0x21/0xa0 [amdgpu] [ 31.526781] Code: 90 90 90 90 90 90 90 90 90 0f 1f 44 00 00 55 48 89 e5 41 55 41 54 49 89 fc 53 48 83 ec 08 48 8b bf 08 08 00 00 e8 cf 85 62 ff <0f> b6 58 7e 83 c3 01 c1 e3 07 4c 63 eb 81 fb 00 08 00 00 7f 24 49 [ 31.526783] RSP: 0018:ffffbd72c0623bc8 EFLAGS: 00010246 [ 31.526786] RAX: 0000000000000000 RBX: ffff9a8c8b836800 RCX: 0000000000000000 [ 31.526787] RDX: 0000000000000000 RSI: ffff9a8c8b836af3 RDI: 0000000000000000 [ 31.526788] RBP: ffffbd72c0623be8 R08: 0000000000000000 R09: 0000000000000003 [ 31.526789] R10: ffffbd72c0623778 R11: ffff9a93d07fffe8 R12: ffff9a8c8a4cd000 [ 31.526790] R13: ffff9a8c832ac200 R14: 0000000000000000 R15: ffff9a8c8a4cd000 [ 31.526792] FS: 0000000000000000(0000) GS:ffff9a93de080000(0000) knlGS:0000000000000000 [ 31.526793] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 31.526794] CR2: 000000000000007e CR3: 000000085a236000 CR4: 0000000000750ef0 [ 31.526796] PKRU: 55555554 [ 31.526797] Call Trace: [ 31.526798] <TASK> [ 31.526800] ? show_regs+0x64/0x70 [ 31.526807] ? __die+0x24/0x70 [ 31.526809] ? page_fault_oops+0x160/0x520 [ 31.526814] ? drm_dp_dpcd_read+0x6b/0xf0 [drm_display_helper] [ 31.526825] ? do_user_addr_fault+0x2e9/0x6a0 [ 31.526828] ? dm_helpers_dp_read_dpcd+0x2d/0x50 [amdgpu] [ 31.527135] ? exc_page_fault+0x7f/0x1b0 [ 31.527139] ? asm_exc_page_fault+0x27/0x30 [ 31.527145] ? dc_edid_copy_edid_to_sink+0x21/0xa0 [amdgpu] [ 31.527457] ? dc_edid_copy_edid_to_sink+0x21/0xa0 [amdgpu] [ 31.527761] detect_link_and_local_sink+0x438/0x11f0 [amdgpu] [ 31.528080] ? call_rcu+0xe/0x20 [ 31.528084] ? put_object+0x2f/0x50 [ 31.528089] ? __delete_object+0x39/0x50 [ 31.528092] ? delete_object_full+0x57/0x80 [ 31.528094] ? dal_gpio_destroy+0x49/0x70 [amdgpu] [ 31.528418] ? kmemleak_free+0x31/0x60 [ 31.528420] ? kfree+0x1a3/0x320 [ 31.528424] ? dm_read_reg_func+0x5a/0xf0 [amdgpu] [ 31.528739] link_detect+0x36/0x550 [amdgpu] [ 31.529044] ? query_hpd_status+0x6e/0xa0 [amdgpu] [ 31.529345] dc_link_detect+0x1d/0x30 [amdgpu] [ 31.529591] handle_hpd_irq_helper+0x133/0x1c0 [amdgpu] [ 31.529894] handle_hpd_irq+0xe/0x20 [amdgpu] [ 31.530193] dm_irq_work_func+0x16/0x20 [amdgpu] [ 31.530493] process_one_work+0x176/0x3b0 [ 31.530497] worker_thread+0x2ca/0x400 [ 31.530499] ? _raw_spin_unlock_irqrestore+0x27/0x50 [ 31.530501] ? __pfx_worker_thread+0x10/0x10 [ 31.530504] kthread+0x10a/0x240 [ 31.530507] ? _raw_spin_unlock_irq+0x1f/0x40 [ 31.530509] ? __pfx_kthread+0x10/0x10 [ 31.530511] ret_from_fork+0x3a/0x60 [ 31.530514] ? __pfx_kthread+0x10/0x10 [ 31.530516] ret_from_fork_asm+0x1a/0x30 [ 31.530520] </TASK> [ 31.530521] Modules linked in: snd_seq_dummy snd_hrtimer qrtr binfmt_misc intel_rapl_msr amd_atl intel_rapl_common nls_iso8859_1 snd_hda_codec_realtek snd_hda_codec_generic snd_hda_scodec_component snd_hda_codec_hdmi snd_hda_intel snd_soc_dmic edac_mce_amd snd_intel_dspcfg snd_intel_sdw_acpi snd_soc_core amdgpu snd_hda_codec snd_hda_core snd_compress ac97_bus snd_hwdep snd_pcm_dmaengine kvm_amd snd_seq_midi snd_pci_ps snd_seq_midi_event amdxcp kvm snd_soc_acpi_amd_match gpu_sched snd_rpl_pci_acp6x drm_panel_backlight_quirks snd_acp_pci snd_rawmidi drm_buddy snd_acp_legacy_common drm_ttm_helper ghash_clmulni_intel snd_pci_acp6x sha512_ssse3 ttm sha256_ssse3 drm_exec sha1_ssse3 snd_seq drm_suballoc_helper drm_client_lib snd_pcm aesni_intel snd_seq_device cec crypto_simd cryptd wmi_bmof snd_pci_acp5x snd_timer rc_core rapl snd_rn_pci_acp3x drm_display_helper snd_acp_config snd k10temp drm_kms_helper snd_soc_acpi i2c_piix4 i2c_algo_bit ccp snd_pci_acp3x joydev soundcore i2c_smbus amd_pmc input_leds serio_raw mac_hid [ 31.530565] sch_fq_codel msr parport_pc ppdev lp parport drm efi_pstore nfnetlink dmi_sysfs ip_tables x_tables autofs4 hid_generic usbhid rtsx_pci_sdmmc r8169 nvme amd_sfh thunderbolt hid video rtsx_pci nvme_core realtek wmi [ 31.530583] CR2: 000000000000007e [ 31.530585] ---[ end trace 0000000000000000 ]--- [ 31.785449] RIP: 0010:dc_edid_copy_edid_to_sink+0x21/0xa0 [amdgpu] [ 31.785817] Code: 90 90 90 90 90 90 90 90 90 0f 1f 44 00 00 55 48 89 e5 41 55 41 54 49 89 fc 53 48 83 ec 08 48 8b bf 08 08 00 00 e8 cf 85 62 ff <0f> b6 58 7e 83 c3 01 c1 e3 07 4c 63 eb 81 fb 00 08 00 00 7f 24 49 [ 31.785819] RSP: 0018:ffffbd72c0623bc8 EFLAGS: 00010246 [ 31.785822] RAX: 0000000000000000 RBX: ffff9a8c8b836800 RCX: 0000000000000000 [ 31.785824] RDX: 0000000000000000 RSI: ffff9a8c8b836af3 RDI: 0000000000000000 [ 31.785824] RBP: ffffbd72c0623be8 R08: 0000000000000000 R09: 0000000000000003 [ 31.785825] R10: ffffbd72c0623778 R11: ffff9a93d07fffe8 R12: ffff9a8c8a4cd000 [ 31.785826] R13: ffff9a8c832ac200 R14: 0000000000000000 R15: ffff9a8c8a4cd000 [ 31.785827] FS: 0000000000000000(0000) GS:ffff9a93de080000(0000) knlGS:0000000000000000 [ 31.785829] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 31.785830] CR2: 000000000000007e CR3: 0000000134804000 CR4: 0000000000750ef0 [ 31.785832] PKRU: 55555554
Quoted 311 lines · Melissa Wen
Reduce direct handling of edid data by resorting to drm helpers that deal with this info inside
drm_edidinfrastructure.v3:
- usedc_edid_sink_edid_freeinlink_detectionv5:
- no need ofdrm_edidduplication (Mario)
- fix mem leak ondc_sink->drm_edidSigned-off-by Melissa Wen <[email protected]>--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 26 +++++++----------- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 27 +++++++------------ .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 21 +++++---------- .../gpu/drm/amd/display/amdgpu_dm/dc_edid.c | 26 +++++++++--------- .../gpu/drm/amd/display/amdgpu_dm/dc_edid.h | 1 + .../drm/amd/display/dc/link/link_detection.c | 3 ++- 6 files changed, 42 insertions(+), 62 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +10
-16@@ -68,6 +68,7 @@#endif #include "amdgpu_dm_psr.h" #include "amdgpu_dm_replay.h" +#include "dc_edid.h" #include "ivsrcid/ivsrcid_vislands30.h" @@ -3708,6 +3709,8 @@ void amdgpu_dm_update_connector_after_detect(* 2. Send an event and let userspace tell us what to do */ if (sink) { +const struct drm_edid *drm_edid = sink->drm_edid; +/* * TODO: check if we still need the S3 mode update workaround. * If yes, put it here. @@ -3719,16 +3722,15 @@ void amdgpu_dm_update_connector_after_detect( aconnector->dc_sink = sink;dc_sink_retain (aconnector->dc_sink); -if (sink->dc_edid.length ==0 ) { + +if (!drm_edid_valid (drm_edid)) { aconnector->drm_edid =NULL ;hdmi_cec_unset_edid (aconnector);if (aconnector->dc_link->aux_mode) {drm_dp_cec_unset_edid (&aconnector->dm_dp_aux.aux); } }else { -const struct edid *edid = (const struct edid *)sink->dc_edid.raw_edid; - - aconnector->drm_edid =drm_edid_alloc (edid, sink->dc_edid.length); + aconnector->drm_edid =drm_edid_dup (sink->drm_edid);drm_edid_connector_update (connector, aconnector->drm_edid);hdmi_cec_set_edid (aconnector);@@ -7378,12 +7380,8 @@ static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector) aconnector->drm_edid = drm_edid;/* Update emulated (virtual) sink's EDID */ if (dc_em_sink && dc_link) { -// FIXME: Get rid of drm_edid_raw() -const struct edid *edid =drm_edid_raw (drm_edid); -memset (&dc_em_sink->edid_caps,0 ,sizeof (struct dc_edid_caps )); -memmove (dc_em_sink->dc_edid.raw_edid, edid, - (edid->extensions +1 ) *EDID_LENGTH ); +dc_edid_copy_edid_to_dc (dc_em_sink, drm_edid,0 );dm_helpers_parse_edid_caps (dc_link, dc_em_sink); } }@@ -7416,7 +7414,6 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector) .sink_signal = SIGNAL_TYPE_VIRTUAL };const struct drm_edid *drm_edid; -const struct edid *edid;struct i2c_adapter *ddc;if (dc_link && dc_link->aux_mode)@@ -7436,12 +7433,9 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector) aconnector->drm_edid = drm_edid; - edid =drm_edid_raw (drm_edid);// FIXME: Get rid of drm_edid_raw() - aconnector->dc_em_sink =dc_link_add_remote_sink ( - aconnector->dc_link, - (uint8_t *)edid, - (edid->extensions +1 ) *EDID_LENGTH , - &init_params); + aconnector->dc_em_sink =dc_link_add_remote_sink (aconnector->dc_link, + drm_edid,0 , + &init_params);if (aconnector->base.force ==DRM_FORCE_ON ) { aconnector->dc_sink = aconnector->dc_link->local_sink ?drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +9
-18@@ -48,6 +48,7 @@#include "dm_helpers.h" #include "ddc_service_types.h" #include "clk_mgr.h" +#include "dc_edid.h" static void apply_edid_quirks(struct drm_device *dev, const struct drm_edid *drm_edid,@@ -100,20 +101,16 @@ enum dc_edid_status dm_helpers_parse_edid_caps(struct dc_link *link,struct amdgpu_dm_connector *aconnector = link->priv;struct drm_connector *connector = &aconnector->base;struct drm_device *dev = connector->dev; -struct edid *edid_buf; -const struct drm_edid *drm_edid; +const struct drm_edid *drm_edid = sink->drm_edid;struct drm_edid_product_id product_id;struct dc_edid_caps *edid_caps = &sink->edid_caps;int sad_count;int i =0 ;enum dc_edid_status result =EDID_OK ; - edid_buf = (struct edid *) &sink->dc_edid.raw_edid; -if (!edid_caps || !edid_buf) +if (!edid_caps || !drm_edid)return EDID_BAD_INPUT ; - drm_edid =drm_edid_alloc (edid_buf,EDID_LENGTH * (edid_buf->extensions +1 )); -if (!drm_edid_valid (drm_edid)) result =EDID_BAD_CHECKSUM ;@@ -135,10 +132,8 @@ enum dc_edid_status dm_helpers_parse_edid_caps(struct dc_link *link,apply_edid_quirks (dev, drm_edid, edid_caps); sad_count =drm_eld_sad_count (connector->eld); -if (sad_count <=0 ) { -drm_edid_free (drm_edid); +if (sad_count <=0 )return result; - } edid_caps->audio_mode_count =min (sad_count,DC_MAX_AUDIO_DESC_COUNT );for (i =0 ; i < edid_caps->audio_mode_count; ++i) {@@ -158,8 +153,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps(struct dc_link *link,else edid_caps->speaker_flags =DEFAULT_SPEAKER_LOCATION ; -drm_edid_free (drm_edid); -return result; }@@ -991,7 +984,6 @@ enum dc_edid_status dm_helpers_read_local_edid(int retry =3 ;enum dc_edid_status edid_status;const struct drm_edid *drm_edid; -const struct edid *edid;if (link->aux_mode) ddc = &aconnector->dm_dp_aux.aux.ddc;@@ -1002,6 +994,8 @@ enum dc_edid_status dm_helpers_read_local_edid(* do check sum and retry to make sure read correct edid. */ do { + drm_edid_free(sink->drm_edid); + drm_edid = dm_helpers_read_acpi_edid(aconnector); if (drm_edid) drm_info(connector->dev, "Using ACPI provided EDID for %s\n", connector->name);@@ -1021,12 +1015,7 @@ enum dc_edid_status dm_helpers_read_local_edid(if (!drm_edid)return EDID_NO_RESPONSE ; - edid =drm_edid_raw (drm_edid);// FIXME: Get rid of drm_edid_raw() - sink->dc_edid.length =EDID_LENGTH * (edid->extensions +1 ); -memmove (sink->dc_edid.raw_edid, (uint8_t *)edid, sink->dc_edid.length); - -/* We don't need the original edid anymore */ -drm_edid_free (drm_edid); + sink->drm_edid = drm_edid; edid_status =dm_helpers_parse_edid_caps (link, sink);@@ -1051,6 +1040,8 @@ enum dc_edid_status dm_helpers_read_local_edid( test_response.bits.EDID_CHECKSUM_WRITE =1 ; +// TODO: drm_edid doesn't have a helper for dp_write_dpcd yet +dc_edid_copy_edid_to_sink (sink); dm_helpers_dp_write_dpcd(ctx, link, DP_TEST_EDID_CHECKSUM,drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +7
-14@@ -359,12 +359,10 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector) .link = aconnector->dc_link, .sink_signal = SIGNAL_TYPE_DISPLAY_PORT_MST }; - dc_sink =dc_link_add_remote_sink ( - aconnector->dc_link, -NULL , -0 , - &init_params); - + dc_sink =dc_link_add_remote_sink (aconnector->dc_link, +NULL , +0 , + &init_params);if (!dc_sink) {DRM_ERROR ("Unable to add a remote sink\n" );return 0 ;@@ -397,15 +395,10 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)struct dc_sink_init_data init_params = { .link = aconnector->dc_link, .sink_signal =SIGNAL_TYPE_DISPLAY_PORT_MST }; -const struct edid *edid; - - edid =drm_edid_raw (aconnector->drm_edid);// FIXME: Get rid of drm_edid_raw() - dc_sink =dc_link_add_remote_sink ( - aconnector->dc_link, - (uint8_t *)edid, - (edid->extensions +1 ) *EDID_LENGTH , - &init_params); + dc_sink =dc_link_add_remote_sink (aconnector->dc_link, + aconnector->drm_edid,0 , + &init_params);if (!dc_sink) {DRM_ERROR ("Unable to add a remote sink\n" );return 0 ;drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c +13
-13@@ -6,25 +6,25 @@bool dc_edid_is_same_edid (struct dc_sink *prev_sink,struct dc_sink *current_sink) { -struct dc_edid *old_edid = &prev_sink->dc_edid; -struct dc_edid *new_edid = ¤t_sink->dc_edid; - -if (old_edid->length != new_edid->length) -return false; - -if (new_edid->length ==0 ) -return false; - -return (memcmp (old_edid->raw_edid, - new_edid->raw_edid, new_edid->length) ==0 ); +return drm_edid_eq (prev_sink->drm_edid, current_sink->drm_edid); }void dc_edid_copy_edid_to_dc (struct dc_sink *dc_sink,const void *edid,int len) { -memmove (dc_sink->dc_edid.raw_edid, edid, len); - dc_sink->dc_edid.length = len; + dc_sink->drm_edid =drm_edid_dup ((const struct drm_edid *) edid); +} + +void dc_edid_copy_edid_to_sink (struct dc_sink *sink) +{ +const struct edid *edid; +uint32_t edid_length; + + edid =drm_edid_raw (sink->drm_edid);// FIXME: Get rid of drm_edid_raw() + edid_length =EDID_LENGTH * (edid->extensions +1 ); +memcpy (sink->dc_edid.raw_edid, (uint8_t *) edid, edid_length); + sink->dc_edid.length = edid_length; }void dc_edid_sink_edid_free (struct dc_sink *sink)drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h +1
-0@@ -9,6 +9,7 @@ bool dc_edid_is_same_edid(struct dc_sink *prev_sink, struct dc_sink *current_sink);void dc_edid_copy_edid_to_dc (struct dc_sink *dc_sink,const void *edid,int len); +void dc_edid_copy_edid_to_sink (struct dc_sink *sink);void dc_edid_sink_edid_free (struct dc_sink *sink);#endif /* __DC_EDID_H__ */ drivers/gpu/drm/amd/display/dc/link/link_detection.c +2
-1@@ -1133,6 +1133,7 @@ static bool detect_link_and_local_sink(struct dc_link *link,dp_trace_init (link);/* Connectivity log: detection */ +dc_edid_copy_edid_to_sink (sink);for (i =0 ; i < sink->dc_edid.length /DC_EDID_BLOCK_SIZE ; i++) { CONN_DATA_DETECT(link, &sink->dc_edid.raw_edid[i * DC_EDID_BLOCK_SIZE],@@ -1415,7 +1416,7 @@ struct dc_sink *link_add_remote_sink(* parsing fails */ if (edid_status !=EDID_OK && edid_status !=EDID_PARTIAL_VALID ) { - dc_sink->dc_edid.length =0 ; +dc_edid_sink_edid_free (dc_sink);dm_error ("Bad EDID, status%d!\n" , edid_status); }
Re: [PATCH v5 14/14] drm/amd/display: move dc_sink from dc_edid to drm_edid
Quoted 3 lines · Alex Hung
Melisa,
The following NULL pointer error was reported from promotion test with this patch:
Hi Alex,
Sorry for the delay on addressing it.
I just sent a v6. To address this NULL pointer dereference, I use the same sanity check proposed in
https://gitlab.freedesktop.org/agd5f/linux/-/commit/7c3be3ce3dfae
It seems enought to me. Let me know if you find any other issue.
Thanks for reviewing and validating this series.
Melissa
Quoted 56 lines
[ 31.525028] amdgpu 0000:c4:00.0: [drm] *ERROR* No EDID read. [ 31.525596] amdgpu 0000:c4:00.0: [drm:drm_dp_dpcd_read [drm_display_helper]] AMDGPU DM aux hw bus 2: 0x6921d AUX -> (ret= 3) 00 00 00 [ 31.526132] amdgpu 0000:c4:00.0: [drm:drm_dp_dpcd_read [drm_display_helper]] AMDGPU DM aux hw bus 2: 0x68028 AUX -> (ret= 1) 00 [ 31.526146] BUG: kernel NULL pointer dereference, address: 000000000000007e [ 31.526148] #PF: supervisor read access in kernel mode [ 31.526150] #PF: error_code(0x0000) - not-present page [ 31.526152] PGD 0 P4D 0 [ 31.526155] Oops: Oops: 0000 [#1] PREEMPT SMP NOPTI [ 31.526158] CPU: 13 UID: 0 PID: 291 Comm: kworker/13:1H Not tainted 6.14.0-reg-jul14-redo+ #15 [ 31.526162] Hardware name: Unnamed Product [ 31.526164] Workqueue: events_highpri dm_irq_work_func [amdgpu] [ 31.526472] RIP: 0010:dc_edid_copy_edid_to_sink+0x21/0xa0 [amdgpu] [ 31.526781] Code: 90 90 90 90 90 90 90 90 90 0f 1f 44 00 00 55 48 89 e5 41 55 41 54 49 89 fc 53 48 83 ec 08 48 8b bf 08 08 00 00 e8 cf 85 62 ff <0f> b6 58 7e 83 c3 01 c1 e3 07 4c 63 eb 81 fb 00 08 00 00 7f 24 49 [ 31.526783] RSP: 0018:ffffbd72c0623bc8 EFLAGS: 00010246 [ 31.526786] RAX: 0000000000000000 RBX: ffff9a8c8b836800 RCX: 0000000000000000 [ 31.526787] RDX: 0000000000000000 RSI: ffff9a8c8b836af3 RDI: 0000000000000000 [ 31.526788] RBP: ffffbd72c0623be8 R08: 0000000000000000 R09: 0000000000000003 [ 31.526789] R10: ffffbd72c0623778 R11: ffff9a93d07fffe8 R12: ffff9a8c8a4cd000 [ 31.526790] R13: ffff9a8c832ac200 R14: 0000000000000000 R15: ffff9a8c8a4cd000 [ 31.526792] FS: 0000000000000000(0000) GS:ffff9a93de080000(0000) knlGS:0000000000000000 [ 31.526793] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 31.526794] CR2: 000000000000007e CR3: 000000085a236000 CR4: 0000000000750ef0 [ 31.526796] PKRU: 55555554 [ 31.526797] Call Trace: [ 31.526798] <TASK> [ 31.526800] ? show_regs+0x64/0x70 [ 31.526807] ? __die+0x24/0x70 [ 31.526809] ? page_fault_oops+0x160/0x520 [ 31.526814] ? drm_dp_dpcd_read+0x6b/0xf0 [drm_display_helper] [ 31.526825] ? do_user_addr_fault+0x2e9/0x6a0 [ 31.526828] ? dm_helpers_dp_read_dpcd+0x2d/0x50 [amdgpu] [ 31.527135] ? exc_page_fault+0x7f/0x1b0 [ 31.527139] ? asm_exc_page_fault+0x27/0x30 [ 31.527145] ? dc_edid_copy_edid_to_sink+0x21/0xa0 [amdgpu] [ 31.527457] ? dc_edid_copy_edid_to_sink+0x21/0xa0 [amdgpu] [ 31.527761] detect_link_and_local_sink+0x438/0x11f0 [amdgpu] [ 31.528080] ? call_rcu+0xe/0x20 [ 31.528084] ? put_object+0x2f/0x50 [ 31.528089] ? __delete_object+0x39/0x50 [ 31.528092] ? delete_object_full+0x57/0x80 [ 31.528094] ? dal_gpio_destroy+0x49/0x70 [amdgpu] [ 31.528418] ? kmemleak_free+0x31/0x60 [ 31.528420] ? kfree+0x1a3/0x320 [ 31.528424] ? dm_read_reg_func+0x5a/0xf0 [amdgpu] [ 31.528739] link_detect+0x36/0x550 [amdgpu] [ 31.529044] ? query_hpd_status+0x6e/0xa0 [amdgpu] [ 31.529345] dc_link_detect+0x1d/0x30 [amdgpu] [ 31.529591] handle_hpd_irq_helper+0x133/0x1c0 [amdgpu] [ 31.529894] handle_hpd_irq+0xe/0x20 [amdgpu] [ 31.530193] dm_irq_work_func+0x16/0x20 [amdgpu] [ 31.530493] process_one_work+0x176/0x3b0 [ 31.530497] worker_thread+0x2ca/0x400 [ 31.530499] ? _raw_spin_unlock_irqrestore+0x27/0x50 [ 31.530501] ? __pfx_worker_thread+0x10/0x10
Quoted 8 lines
[ 31.530504] kthread+0x10a/0x240 [ 31.530507] ? _raw_spin_unlock_irq+0x1f/0x40 [ 31.530509] ? __pfx_kthread+0x10/0x10 [ 31.530511] ret_from_fork+0x3a/0x60 [ 31.530514] ? __pfx_kthread+0x10/0x10 [ 31.530516] ret_from_fork_asm+0x1a/0x30 [ 31.530520] </TASK> [ 31.530521] Modules linked in: snd_seq_dummy snd_hrtimer qrtr binfmt_misc intel_rapl_msr amd_atl intel_rapl_common nls_iso8859_1 snd_hda_codec_realtek snd_hda_codec_generic snd_hda_scodec_component snd_hda_codec_hdmi snd_hda_intel snd_soc_dmic edac_mce_amd snd_intel_dspcfg snd_intel_sdw_acpi snd_soc_core amdgpu snd_hda_codec snd_hda_core snd_compress ac97_bus snd_hwdep snd_pcm_dmaengine kvm_amd snd_seq_midi snd_pci_ps snd_seq_midi_event amdxcp kvm snd_soc_acpi_amd_match gpu_sched snd_rpl_pci_acp6x drm_panel_backlight_quirks snd_acp_pci snd_rawmidi drm_buddy snd_acp_legacy_common drm_ttm_helper ghash_clmulni_intel snd_pci_acp6x sha512_ssse3 ttm sha256_ssse3 drm_exec sha1_ssse3 snd_seq drm_suballoc_helper drm_client_lib snd_pcm aesni_intel snd_seq_device cec crypto_simd cryptd wmi_bmof snd_pci_acp5x snd_timer rc_core rapl snd_rn_pci_acp3x drm_display_helper snd_acp_config snd k10temp drm_kms_helper snd_soc_acpi i2c_piix4 i2c_algo_bit ccp snd_pci_acp3x joydev soundcore i2c_smbus
amd_pmc input_leds serio_raw mac_hid
Quoted 302 lines
[ 31.530565] sch_fq_codel msr parport_pc ppdev lp parport drm efi_pstore nfnetlink dmi_sysfs ip_tables x_tables autofs4 hid_generic usbhid rtsx_pci_sdmmc r8169 nvme amd_sfh thunderbolt hid video rtsx_pci nvme_core realtek wmi [ 31.530583] CR2: 000000000000007e [ 31.530585] ---[ end trace 0000000000000000 ]--- [ 31.785449] RIP: 0010:dc_edid_copy_edid_to_sink+0x21/0xa0 [amdgpu] [ 31.785817] Code: 90 90 90 90 90 90 90 90 90 0f 1f 44 00 00 55 48 89 e5 41 55 41 54 49 89 fc 53 48 83 ec 08 48 8b bf 08 08 00 00 e8 cf 85 62 ff <0f> b6 58 7e 83 c3 01 c1 e3 07 4c 63 eb 81 fb 00 08 00 00 7f 24 49 [ 31.785819] RSP: 0018:ffffbd72c0623bc8 EFLAGS: 00010246 [ 31.785822] RAX: 0000000000000000 RBX: ffff9a8c8b836800 RCX: 0000000000000000 [ 31.785824] RDX: 0000000000000000 RSI: ffff9a8c8b836af3 RDI: 0000000000000000 [ 31.785824] RBP: ffffbd72c0623be8 R08: 0000000000000000 R09: 0000000000000003 [ 31.785825] R10: ffffbd72c0623778 R11: ffff9a93d07fffe8 R12: ffff9a8c8a4cd000 [ 31.785826] R13: ffff9a8c832ac200 R14: 0000000000000000 R15: ffff9a8c8a4cd000 [ 31.785827] FS: 0000000000000000(0000) GS:ffff9a93de080000(0000) knlGS:0000000000000000 [ 31.785829] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 31.785830] CR2: 000000000000007e CR3: 0000000134804000 CR4: 0000000000750ef0 [ 31.785832] PKRU: 55555554Quoted 283 lines · Melissa Wen
Reduce direct handling of edid data by resorting to drm helpers that deal with this info inside
drm_edidinfrastructure.v3:
- usedc_edid_sink_edid_freeinlink_detectionv5:
- no need ofdrm_edidduplication (Mario)
- fix mem leak ondc_sink->drm_edidSigned-off-by Melissa Wen <[email protected]>--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 26 +++++++----------- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 27 +++++++------------ .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 21 +++++---------- .../gpu/drm/amd/display/amdgpu_dm/dc_edid.c | 26 +++++++++--------- .../gpu/drm/amd/display/amdgpu_dm/dc_edid.h | 1 + .../drm/amd/display/dc/link/link_detection.c | 3 ++- 6 files changed, 42 insertions(+), 62 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-0@@ -68,6 +68,7 @@#endif #include "amdgpu_dm_psr.h" #include "amdgpu_dm_replay.h" +#include "dc_edid.h" #include "ivsrcid/ivsrcid_vislands30.h" @@ -3708,6 +3709,8 @@ void amdgpu_dm_update_connector_after_detect( * 2. Send an event and let userspace tell us what to do*/ if (sink) {drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +9
-15+const struct drm_edid *drm_edid = sink->drm_edid; +/* * TODO: check if we still need the S3 mode update workaround. * If yes, put it here. @@ -3719,16 +3722,15 @@ void amdgpu_dm_update_connector_after_detect( aconnector->dc_sink = sink;dc_sink_retain (aconnector->dc_sink); -if (sink->dc_edid.length ==0 ) { + +if (!drm_edid_valid (drm_edid)) { aconnector->drm_edid =NULL ;hdmi_cec_unset_edid (aconnector);if (aconnector->dc_link->aux_mode) {drm_dp_cec_unset_edid (&aconnector->dm_dp_aux.aux); } }else { -const struct edid *edid = (const struct edid *)sink->dc_edid.raw_edid; - - aconnector->drm_edid =drm_edid_alloc (edid, sink->dc_edid.length); + aconnector->drm_edid =drm_edid_dup (sink->drm_edid);drm_edid_connector_update (connector, aconnector->drm_edid);hdmi_cec_set_edid (aconnector);@@ -7378,12 +7380,8 @@ static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector) aconnector->drm_edid = drm_edid;/* Update emulated (virtual) sink's EDID */ if (dc_em_sink && dc_link) { -// FIXME: Get rid of drm_edid_raw() -const struct edid *edid =drm_edid_raw (drm_edid); -memset (&dc_em_sink->edid_caps,0 ,sizeof (struct dc_edid_caps )); -memmove (dc_em_sink->dc_edid.raw_edid, edid, - (edid->extensions +1 ) *EDID_LENGTH ); +dc_edid_copy_edid_to_dc (dc_em_sink, drm_edid,0 );dm_helpers_parse_edid_caps (dc_link, dc_em_sink); } }@@ -7416,7 +7414,6 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector) .sink_signal = SIGNAL_TYPE_VIRTUAL };const struct drm_edid *drm_edid; -const struct edid *edid;struct i2c_adapter *ddc;if (dc_link && dc_link->aux_mode)@@ -7436,12 +7433,9 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector) aconnector->drm_edid = drm_edid; - edid =drm_edid_raw (drm_edid);// FIXME: Get rid of drm_edid_raw() - aconnector->dc_em_sink =dc_link_add_remote_sink ( - aconnector->dc_link, - (uint8_t *)edid, - (edid->extensions +1 ) *EDID_LENGTH , - &init_params); + aconnector->dc_em_sink =dc_link_add_remote_sink (aconnector->dc_link, + drm_edid,0 , + &init_params);if (aconnector->base.force ==DRM_FORCE_ON ) { aconnector->dc_sink = aconnector->dc_link->local_sink ?drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +8
-14@@ -48,6 +48,7 @@#include "dm_helpers.h" #include "ddc_service_types.h" #include "clk_mgr.h" +#include "dc_edid.h" static void apply_edid_quirks(struct drm_device *dev, const struct drm_edid *drm_edid,@@ -100,20 +101,16 @@ enum dc_edid_status dm_helpers_parse_edid_caps(struct dc_link *link,struct amdgpu_dm_connector *aconnector = link->priv;struct drm_connector *connector = &aconnector->base;struct drm_device *dev = connector->dev; -struct edid *edid_buf; -const struct drm_edid *drm_edid; +const struct drm_edid *drm_edid = sink->drm_edid;struct drm_edid_product_id product_id;struct dc_edid_caps *edid_caps = &sink->edid_caps;int sad_count;int i =0 ;enum dc_edid_status result =EDID_OK ; - edid_buf = (struct edid *) &sink->dc_edid.raw_edid; -if (!edid_caps || !edid_buf) +if (!edid_caps || !drm_edid)return EDID_BAD_INPUT ; - drm_edid =drm_edid_alloc (edid_buf,EDID_LENGTH * (edid_buf->extensions +1 )); -if (!drm_edid_valid (drm_edid)) result =EDID_BAD_CHECKSUM ; @@ -135,10 +132,8 @@ enum dc_edid_status dm_helpers_parse_edid_caps(struct dc_link *link, apply_edid_quirks(dev, drm_edid, edid_caps); sad_count =drm_eld_sad_count (connector->eld); -if (sad_count <=0 ) { -drm_edid_free (drm_edid); +if (sad_count <=0 )return result; - } edid_caps->audio_mode_count =min (sad_count,DC_MAX_AUDIO_DESC_COUNT );for (i =0 ; i < edid_caps->audio_mode_count; ++i) {@@ -158,8 +153,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps(struct dc_link *link,else edid_caps->speaker_flags =DEFAULT_SPEAKER_LOCATION ; -drm_edid_free (drm_edid); -return result; } @@ -991,7 +984,6 @@ enum dc_edid_status dm_helpers_read_local_edid( int retry = 3;enum dc_edid_status edid_status;const struct drm_edid *drm_edid; -const struct edid *edid;if (link->aux_mode) ddc = &aconnector->dm_dp_aux.aux.ddc;@@ -1002,6 +994,8 @@ enum dc_edid_status dm_helpers_read_local_edid(* do check sum and retry to make sure read correct edid. */ do { + drm_edid_free(sink->drm_edid); + drm_edid = dm_helpers_read_acpi_edid(aconnector); if (drm_edid) drm_info(connector->dev, "Using ACPI provided EDID for %s\n", connector->name);@@ -1021,12 +1015,7 @@ enum dc_edid_status dm_helpers_read_local_edid(if (!drm_edid)return EDID_NO_RESPONSE ; - edid =drm_edid_raw (drm_edid);// FIXME: Get rid of drm_edid_raw() - sink->dc_edid.length =EDID_LENGTH * (edid->extensions +1 ); -memmove (sink->dc_edid.raw_edid, (uint8_t *)edid, sink->dc_edid.length); - -/* We don't need the original edid anymore */ -drm_edid_free (drm_edid); + sink->drm_edid = drm_edid; edid_status =dm_helpers_parse_edid_caps (link, sink); @@ -1051,6 +1040,8 @@ enum dc_edid_status dm_helpers_read_local_edid( test_response.bits.EDID_CHECKSUM_WRITE = 1; +// TODO: drm_edid doesn't have a helper for dp_write_dpcd yet +dc_edid_copy_edid_to_sink (sink); dm_helpers_dp_write_dpcd(ctx, link, DP_TEST_EDID_CHECKSUM,drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +6
-13@@ -359,12 +359,10 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector) .link = aconnector->dc_link, .sink_signal = SIGNAL_TYPE_DISPLAY_PORT_MST }; - dc_sink =dc_link_add_remote_sink ( - aconnector->dc_link, -NULL , -0 , - &init_params); - + dc_sink =dc_link_add_remote_sink (aconnector->dc_link, +NULL , +0 , + &init_params);if (!dc_sink) {DRM_ERROR ("Unable to add a remote sink\n" );return 0 ;@@ -397,15 +395,10 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)struct dc_sink_init_data init_params = { .link = aconnector->dc_link, .sink_signal =SIGNAL_TYPE_DISPLAY_PORT_MST }; -const struct edid *edid; - - edid =drm_edid_raw (aconnector->drm_edid);// FIXME: Get rid of drm_edid_raw() - dc_sink =dc_link_add_remote_sink ( - aconnector->dc_link, - (uint8_t *)edid, - (edid->extensions +1 ) *EDID_LENGTH , - &init_params); + dc_sink =dc_link_add_remote_sink (aconnector->dc_link, + aconnector->drm_edid,0 , + &init_params);if (!dc_sink) {DRM_ERROR ("Unable to add a remote sink\n" );return 0 ;drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.c +13
-13@@ -6,25 +6,25 @@bool dc_edid_is_same_edid (struct dc_sink *prev_sink,struct dc_sink *current_sink) { -struct dc_edid *old_edid = &prev_sink->dc_edid; -struct dc_edid *new_edid = ¤t_sink->dc_edid; - -if (old_edid->length != new_edid->length) -return false; - -if (new_edid->length ==0 ) -return false; - -return (memcmp (old_edid->raw_edid, - new_edid->raw_edid, new_edid->length) ==0 ); +return drm_edid_eq (prev_sink->drm_edid, current_sink->drm_edid); }void dc_edid_copy_edid_to_dc (struct dc_sink *dc_sink,const void *edid,int len) { -memmove (dc_sink->dc_edid.raw_edid, edid, len); - dc_sink->dc_edid.length = len; + dc_sink->drm_edid =drm_edid_dup ((const struct drm_edid *) edid); +} + +void dc_edid_copy_edid_to_sink (struct dc_sink *sink) +{ +const struct edid *edid; +uint32_t edid_length; + + edid =drm_edid_raw (sink->drm_edid);// FIXME: Get rid of drm_edid_raw() + edid_length =EDID_LENGTH * (edid->extensions +1 ); +memcpy (sink->dc_edid.raw_edid, (uint8_t *) edid, edid_length); + sink->dc_edid.length = edid_length; }void dc_edid_sink_edid_free (struct dc_sink *sink)drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h +1
-0@@ -9,6 +9,7 @@ bool dc_edid_is_same_edid(struct dc_sink *prev_sink, struct dc_sink *current_sink);void dc_edid_copy_edid_to_dc (struct dc_sink *dc_sink,const void *edid,int len); +void dc_edid_copy_edid_to_sink (struct dc_sink *sink);void dc_edid_sink_edid_free (struct dc_sink *sink);#endif /* __DC_EDID_H__ */ drivers/gpu/drm/amd/display/dc/link/link_detection.c +2
-1@@ -1133,6 +1133,7 @@ static bool detect_link_and_local_sink(struct dc_link *link,dp_trace_init (link);/* Connectivity log: detection */ +dc_edid_copy_edid_to_sink (sink);for (i =0 ; i < sink->dc_edid.length /DC_EDID_BLOCK_SIZE ; i++) { CONN_DATA_DETECT(link, &sink->dc_edid.raw_edid[i * DC_EDID_BLOCK_SIZE],@@ -1415,7 +1416,7 @@ struct dc_sink *link_add_remote_sink(* parsing fails */ if (edid_status !=EDID_OK && edid_status !=EDID_PARTIAL_VALID ) { - dc_sink->dc_edid.length =0 ; +dc_edid_sink_edid_free (dc_sink);dm_error ("Bad EDID, status%d!\n" , edid_status); }
Thanks Melissa. I will send this series to promotion test and post the result by the end of next week.
Quoted 8 lines · Melissa Wen
Hi,
Siqueira and I have been working on a solution to reduce the usage of
drm_edid_rawin the AMD display driver, since the current guideline in the DRM subsystem is to stop handling raw edid data in driver-specific implementation and use opaquedrm_edidobject with common-code helpers.
Quoted 6 lines
In short, this series approaches the issue of maintaining DC as an OS-agnostic component by creating a mid layer to isolate
drm_edidhelpers that need to be called in the DC code, while allowing other OSes to implement their specific implementation. This is an extension of [1].- Patch 1 addresses a possible leak added by previous migration t drm/amd/display: more
drm_edidto AMD display driver
o
Quoted 111 lines
drm_edid.
- Patch 2 allocates a temporarydrm_edidfrom raw edid for parsing.
- Patches 3-7 use common-code,drm_edidhelpers to parse edid capabilities instead of driver-specific solutions. For this, patch 4 introduces a new helper that gets monitor name fromdrm_edid.
- Patches 8-9 are groundwork to reduce the noise of Linux/DRM specific code in the DC shared code
- Patch 10 creates a mid layer to make DC embraces different ways of handling EDID by platforms.
- Patch 11 move open-coded management of raw EDID data to the mid layer created before.
- Patch 12 introduces a helper that compares EDIDs from twodrm_edids.
- Patch 13 addsdrm_edidtodc_sinkstruct and a mid-layer helper to freedrm_edid.
- Patch 14 switchdc_edidtodrm_edidacross the driver in a way that the DC shared code is little affected by Linux specific stuff.[v1] https://lore.kernel.org/dri-devel/[email protected]/
Changes:
- fix broken approach to get monitor name from eld (Jani)
- I introduced a new helper that gets monitor name fromdrm_edid
- renamedrm_edid_eqtodrm_edid_eq_bufand doc fixes (Jani)
- add NULL edid checks (Jani)
- fix mishandling of product_id.manufacturer_name (Michel)
- I directly set it tomanufacturer_idsince sparse didn't complain.
- add Mario's r-b in the first fix patch and fix commit msg typo.[v2] https://lore.kernel.org/dri-devel/[email protected]/
Changes:
- kernel-doc and commit msg fixes (Jani)
- usedrm_edid_legacy_initinstead of open coded (Jani)
- placedrm_edidnew func into the right section (Jani)
- paramenter names fix (Jani)
- add Jani's r-b to the patch 12
- remove unnecessary include (Jani)
- calldc_edid_sink_edid_freeinlink_detection, instead ofdrm_edid_free
- rebase on top of asdn[v3] https://lore.kernel.org/dri-devel/[email protected]/
Changes:
- rebase to asdn
- some kernel-doc fixes
- move some changes to the right commit[v4] https://lore.kernel.org/amd-gfx/[email protected]/
Changes:
- fix comments and commit messages (Mario)
- remove unnecessarydrm_ediddup and fix mem leak (Mario)
- add Mario's rb to patches 5-7---
There are three specific points where we still use
drm_edid_raw()in the driver:
1. raw edid data for write EDID checksum inDP_TEST_EDID_CHECKSUMviadrm_dp_dpcd_write(), that AFAIK there is no common code solution yet; 2. open-coded connectivity log for dc link detection, that maybe can be moved to drm (?);3. open-coded parser that I suspect is a lot of duplicated code, but needs careful examining.
I suggest to address those points in a next phase for regression control.
Finally, I'm not sure amdgpu_dm/dc_edid is the right place and file name for the mid-layer. Suggestions?
[1] https://lore.kernel.org/amd-gfx/[email protected]/
Let me know yours thoughts!
Melissa
Melissa Wen (12):
drm/amd/display: make suredrm_edidstored in aconnector doesn't leak drm/amd/display: start usingdrm_edidhelpers to parse EDID caps drm/amd/display: usedrm_edid_product_idfor parsing EDID product info drm/edid: introduce a helper that gets monitor name fromdrm_ediddrm/amd/display: get panel id withdrm_edidhelper drm/amd/display: get SAD fromdrm_eldwhen parsing EDID caps drm/amd/display: get SADB fromdrm_eldwhen parsing EDID caps drm/amd/display: simplifydm_helpers_parse_edid_capssignature drm/amd/display: change DC functions to accept private types for edid drm/edid: introduce a helper that compares edid data from twodrm_ediddrm/amd/display: adddrm_edidtodc_sink
drm/amd/display: movedc_sinkfromdc_edidtodrm_edidRodrigo Siqueira (2):
drm/amd/display: add a mid-layer file to handle EDID in DC drm/amd/display: create a function to filldc_sinkwith edid data.../gpu/drm/amd/display/amdgpu_dm/Makefile | 1 + .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 33 +++--- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 105 +++++++----------- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 21 ++-- .../gpu/drm/amd/display/amdgpu_dm/dc_edid.c | 33 ++++++ .../gpu/drm/amd/display/amdgpu_dm/dc_edid.h | 15 +++ .../drm/amd/display/dc/core/dc_link_exports.c | 9 +- drivers/gpu/drm/amd/display/dc/core/dc_sink.c | 3 + drivers/gpu/drm/amd/display/dc/dc.h | 10 +- drivers/gpu/drm/amd/display/dc/dm_helpers.h | 7 +- drivers/gpu/drm/amd/display/dc/inc/link.h | 9 +- .../drm/amd/display/dc/link/link_detection.c | 30 ++--- .../drm/amd/display/dc/link/link_detection.h | 9 +- drivers/gpu/drm/bridge/sil-sii8620.c | 2 +- drivers/gpu/drm/display/drm_dp_mst_topology.c | 2 +- drivers/gpu/drm/drm_edid.c | 54 +++++++-- include/drm/drm_edid.h | 10 +- 17 files changed, 193 insertions(+), 160 deletions(-)create mode 100644
drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.ccreate mode 100644drivers/gpu/drm/amd/display/amdgpu_dm/dc_edid.h