OSDN Git Service

drm/edid: add struct drm_edid container
authorJani Nikula <jani.nikula@intel.com>
Mon, 9 May 2022 12:03:02 +0000 (15:03 +0300)
committerJani Nikula <jani.nikula@intel.com>
Fri, 13 May 2022 15:12:56 +0000 (18:12 +0300)
commite4ccf9a777d30d60c60f729b1d5c9bc9e3ea46e3
treea368b688b082aacf249557cbb7ddac3727752521
parentab1747ccf052976465db7c5a7e1301a50f290db0
drm/edid: add struct drm_edid container

Introduce new opaque type struct drm_edid to encapsulate the EDID data
and the size allocated for it. The contents will be private to
drm_edid.c.

There are a number of reasons for adding a container around struct edid:

* struct edid is a raw blob pointer to data that usually originates
  outside of the kernel. Its size is contained within the structure.

* There's no way to attach meta information (such as allocated memory
  size) to struct edid.

* Validation of the EDID blob and its size become crucial, and it's
  spread all over the subsystem, with varying levels of accuracy.

* HDMI Forum has introduced an HF-EEODB extension that defines an
  override EDID size within an EDID extension. The size allocated for an
  EDID depends on whether the allocator understands the HF-EEODB
  extension. Given a struct edid *, it's impossible to know how much
  memory was actually allocated for it.

There are also some reasons for making the container type struct
drm_edid opaque and private to drm_edid.c:

* Have only one place for creating and parsing the EDID, to avoid
  duplicating bugs.

* Prepare for reading a pure DisplayID 2.0 from its own DDC address, and
  adding it within the same struct drm_edid container, transparently,
  and for all drivers.

* With the idea that the drm_edid objects are immutable during their
  lifetimes, it will be possible to refcount them and reduce EDID
  copying everywhere (this is left for future work).

Initially, just add the type. In follow-up, we'll start converting the
guts of drm_edid.c to use it, and finally add interfaces around it.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/f3ecabd8a219aea678ad00f7bcdecf77b27b3c78.1652097712.git.jani.nikula@intel.com
drivers/gpu/drm/drm_edid.c