diff options
author | Jani Nikula <jani.nikula@intel.com> | 2022-05-09 15:03:03 +0300 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2022-05-13 18:12:59 +0300 |
commit | 22a27e0532d06968afc265a3b91fbdc5a773169a (patch) | |
tree | cfeb42b921b810398185d08dacab9db2d5660fb7 /drivers | |
parent | e4ccf9a777d30d60c60f729b1d5c9bc9e3ea46e3 (diff) | |
download | linux-22a27e0532d06968afc265a3b91fbdc5a773169a.tar.xz |
drm/edid: start propagating drm_edid to lower levels
We'll need to propagate drm_edid everywhere. This is a clunky start, but
a start nonetheless. We'll eventually convert all of the EDID parsing to
struct drm_edid.
Initially, we'll just create the struct drm_edid in stack. This will be
the compat layer for legacy struct edid code. In the future, we'll have
EDID read return drm_edid objects.
v2: Add legacy init helper.
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/000452fddedbaf7f473ac25d4dde2502e60b8e39.1652097712.git.jani.nikula@intel.com
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/drm_edid.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 480fd9fbe412..f48f1f1a1fa7 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1609,6 +1609,24 @@ static const void *edid_extension_block_data(const struct edid *edid, int index) } /* + * Initializer helper for legacy interfaces, where we have no choice but to + * trust edid size. Not for general purpose use. + */ +static const struct drm_edid *drm_edid_legacy_init(struct drm_edid *drm_edid, + const struct edid *edid) +{ + if (!edid) + return NULL; + + memset(drm_edid, 0, sizeof(*drm_edid)); + + drm_edid->edid = edid; + drm_edid->size = edid_size(edid); + + return drm_edid; +} + +/* * EDID base and extension block iterator. * * struct drm_edid_iter iter; @@ -5814,17 +5832,20 @@ static int add_displayid_detailed_modes(struct drm_connector *connector, } static int drm_edid_connector_update(struct drm_connector *connector, - const struct edid *edid) + const struct drm_edid *drm_edid) { + const struct edid *edid; int num_modes = 0; u32 quirks; - if (edid == NULL) { + if (!drm_edid) { drm_reset_display_info(connector); clear_eld(connector); return 0; } + edid = drm_edid->edid; + /* * CEA-861-F adds ycbcr capability map block, for HDMI 2.0 sinks. * To avoid multiple parsing of same block, lets parse that map @@ -5890,13 +5911,16 @@ static int drm_edid_connector_update(struct drm_connector *connector, */ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid) { + struct drm_edid drm_edid; + if (edid && !drm_edid_is_valid(edid)) { drm_warn(connector->dev, "%s: EDID invalid.\n", connector->name); edid = NULL; } - return drm_edid_connector_update(connector, edid); + return drm_edid_connector_update(connector, + drm_edid_legacy_init(&drm_edid, edid)); } EXPORT_SYMBOL(drm_add_edid_modes); |