| From 7344bad7fb6daa4877a1c064b52c7d5f9182c41b Mon Sep 17 00:00:00 2001 |
| From: Jani Nikula <jani.nikula@intel.com> |
| Date: Wed, 23 Mar 2022 12:04:38 +0200 |
| Subject: drm/edid: fix CEA extension byte #3 parsing |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| Git-commit: 7344bad7fb6daa4877a1c064b52c7d5f9182c41b |
| Patch-mainline: v5.18-rc1 |
| References: bsc#1190786 |
| |
| Only an EDID CEA extension has byte #3, while the CTA DisplayID Data |
| Block does not. Don't interpret bogus data for color formats. |
| |
| For most displays it's probably an unlikely scenario you'd have a CTA |
| DisplayID Data Block without a CEA extension, but they do exist. |
| |
| Fixes: e28ad544f462 ("drm/edid: parse CEA blocks embedded in DisplayID") |
| Cc: <stable@vger.kernel.org> |
| Cc: Shawn C Lee <shawn.c.lee@intel.com> |
| Cc: Ville Syrj채l채 <ville.syrjala@linux.intel.com> |
| Signed-off-by: Jani Nikula <jani.nikula@intel.com> |
| Reviewed-by: Ville Syrj채l채 <ville.syrjala@linux.intel.com> |
| Link: https://patchwork.freedesktop.org/patch/msgid/20220323100438.1757295-1-jani.nikula@intel.com |
| Acked-by: Thomas Zimmermann <tzimmermann@suse.de> |
| |
| drivers/gpu/drm/drm_edid.c | 12 ++++++++---- |
| 1 file changed, 8 insertions(+), 4 deletions(-) |
| |
| |
| |
| @@ -5086,10 +5086,14 @@ static void drm_parse_cea_ext(struct drm |
| |
| /* The existence of a CEA block should imply RGB support */ |
| info->color_formats = DRM_COLOR_FORMAT_RGB444; |
| - if (edid_ext[3] & EDID_CEA_YCRCB444) |
| - info->color_formats |= DRM_COLOR_FORMAT_YCBCR444; |
| - if (edid_ext[3] & EDID_CEA_YCRCB422) |
| - info->color_formats |= DRM_COLOR_FORMAT_YCBCR422; |
| + |
| + /* CTA DisplayID Data Block does not have byte #3 */ |
| + if (edid_ext[0] == CEA_EXT) { |
| + if (edid_ext[3] & EDID_CEA_YCRCB444) |
| + info->color_formats |= DRM_COLOR_FORMAT_YCBCR444; |
| + if (edid_ext[3] & EDID_CEA_YCRCB422) |
| + info->color_formats |= DRM_COLOR_FORMAT_YCBCR422; |
| + } |
| |
| if (cea_db_offsets(edid_ext, &start, &end)) |
| return; |