Hi,

We 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.

The main change of this version is that we are now adding DM helpers for
linux-specific code with drm_edid to keep DC OS-agnostic, instead of
creating a new file and new functions, as in previous versions.

This work 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-8 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 9-10 are groundwork to reduce the noise of Linux/DRM specific
  code in the DC shared code.
- Patch 11 moves open-coded management of raw EDID data to DM helpers
  with drm_edid 
- Patch 12 creates a DM helper that fills dc_sink with edid data 
- Patch 13 introduces a helper that compares EDIDs from two drm_edids.
- Patch 14 adds drm_edid to dc_sink struct and a DM helper to free
  `drm_edid`
- Patch 15 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

[v5] https://lore.kernel.org/amd-gfx/[email protected]/
Changes:
- fix NULL pointer dereference (Alex H.) with the same approach proposed
  by 7c3be3ce3dfae

[v6] https://lore.kernel.org/amd-gfx/[email protected]/
Changes:
- use AMD DM helpers instead of new file for edid-related helpers with Linux 
drm_edid (Harry)
- new patch (4/15) for AMD edid_caps parsing of analog displays with a drm_edid 
helper.
- rebase on top of asdn

---

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.

[1] https://lore.kernel.org/amd-gfx/[email protected]/

Let me know yours thoughts!

Melissa

Melissa Wen (15):
  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/amd/display: use drm_edid helper to set analog EDID caps
  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/amd/display: add DM helpers to handle EDID in DC via drm_edid
    helpers
  drm/amd/display: create a function to fill dc_sink with edid data
  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

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  32 ++--
 .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 145 ++++++++++--------
 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   |  21 +--
 .../drm/amd/display/dc/core/dc_link_exports.c |   9 +-
 drivers/gpu/drm/amd/display/dc/core/dc_sink.c |   2 +
 drivers/gpu/drm/amd/display/dc/dc.h           |  10 +-
 drivers/gpu/drm/amd/display/dc/dm_helpers.h   |  13 +-
 .../gpu/drm/amd/display/dc/inc/link_service.h |   2 +-
 .../drm/amd/display/dc/link/link_detection.c  |  28 +---
 .../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                        |   9 +-
 14 files changed, 179 insertions(+), 159 deletions(-)

-- 
2.51.0

Reply via email to