+++ /dev/null
-From 66bafaa0a6491d056b102bf4dad574203995755f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 18 Nov 2019 18:18:31 +0800
-Subject: drm/edid: Add aspect ratios to HDMI 4K modes
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Wayne Lin <Wayne.Lin@amd.com>
-
-[ Upstream commit d2b434730f301a7ad74473eb66422f0008186306 ]
-
-[Why]
-HDMI 2.0 adds aspect ratio attribute to distinguish different
-4k modes. According to Appendix E of HDMI 2.0 spec, source should
-use VSIF to indicate video mode only when the mode is one defined
-in HDMI 1.4b 4K modes. Otherwise, use AVI infoframes to convey VIC.
-
-Current code doesn't take aspect ratio into consideration while
-constructing avi infoframe. Should modify that.
-
-[How]
-Inherit Ville Syrjälä's work
-"drm/edid: Prep for HDMI VIC aspect ratio" at
-https://patchwork.kernel.org/patch/11174639/
-
-Add picture_aspect_ratio attributes to edid_4k_modes[] and
-construct VIC and HDMI_VIC by taking aspect ratio into
-consideration.
-
-v2: Correct missing initializer error at adding aspect ratio of
-SMPTE mode.
-
-Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
-Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
-Link: https://patchwork.freedesktop.org/patch/msgid/20191118101832.15487-1-Wayne.Lin@amd.com
-Stable-dep-of: 1cbc1f0d324b ("drm/edid: fix AVI infoframe aspect ratio handling")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/drm_edid.c | 45 +++++++++++++++++++++++++++++---------
- 1 file changed, 35 insertions(+), 10 deletions(-)
-
-diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
-index 245e495f57c93..f9735861741c1 100644
---- a/drivers/gpu/drm/drm_edid.c
-+++ b/drivers/gpu/drm/drm_edid.c
-@@ -1292,25 +1292,25 @@ static const struct drm_display_mode edid_4k_modes[] = {
- 3840, 4016, 4104, 4400, 0,
- 2160, 2168, 2178, 2250, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
-- .vrefresh = 30, },
-+ .vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, },
- /* 2 - 3840x2160@25Hz */
- { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000,
- 3840, 4896, 4984, 5280, 0,
- 2160, 2168, 2178, 2250, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
-- .vrefresh = 25, },
-+ .vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, },
- /* 3 - 3840x2160@24Hz */
- { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 297000,
- 3840, 5116, 5204, 5500, 0,
- 2160, 2168, 2178, 2250, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
-- .vrefresh = 24, },
-+ .vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, },
- /* 4 - 4096x2160@24Hz (SMPTE) */
- { DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 297000,
- 4096, 5116, 5204, 5500, 0,
- 2160, 2168, 2178, 2250, 0,
- DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC),
-- .vrefresh = 24, },
-+ .vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135, },
- };
-
- /*** DDC fetch and block validation ***/
-@@ -3122,6 +3122,11 @@ enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
- }
- EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
-
-+static enum hdmi_picture_aspect drm_get_hdmi_aspect_ratio(const u8 video_code)
-+{
-+ return edid_4k_modes[video_code].picture_aspect_ratio;
-+}
-+
- /*
- * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
- * specific block).
-@@ -3148,6 +3153,9 @@ static u8 drm_match_hdmi_mode_clock_tolerance(const struct drm_display_mode *to_
- if (!to_match->clock)
- return 0;
-
-+ if (to_match->picture_aspect_ratio)
-+ match_flags |= DRM_MODE_MATCH_ASPECT_RATIO;
-+
- for (vic = 1; vic < ARRAY_SIZE(edid_4k_modes); vic++) {
- const struct drm_display_mode *hdmi_mode = &edid_4k_modes[vic];
- unsigned int clock1, clock2;
-@@ -3183,6 +3191,9 @@ static u8 drm_match_hdmi_mode(const struct drm_display_mode *to_match)
- if (!to_match->clock)
- return 0;
-
-+ if (to_match->picture_aspect_ratio)
-+ match_flags |= DRM_MODE_MATCH_ASPECT_RATIO;
-+
- for (vic = 1; vic < ARRAY_SIZE(edid_4k_modes); vic++) {
- const struct drm_display_mode *hdmi_mode = &edid_4k_modes[vic];
- unsigned int clock1, clock2;
-@@ -5123,6 +5134,7 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
- const struct drm_display_mode *mode)
- {
- enum hdmi_picture_aspect picture_aspect;
-+ u8 vic, hdmi_vic;
- int err;
-
- if (!frame || !mode)
-@@ -5135,7 +5147,8 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
- if (mode->flags & DRM_MODE_FLAG_DBLCLK)
- frame->pixel_repeat = 1;
-
-- frame->video_code = drm_mode_cea_vic(connector, mode);
-+ vic = drm_mode_cea_vic(connector, mode);
-+ hdmi_vic = drm_mode_hdmi_vic(connector, mode);
-
- frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
-
-@@ -5149,11 +5162,15 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
-
- /*
- * Populate picture aspect ratio from either
-- * user input (if specified) or from the CEA mode list.
-+ * user input (if specified) or from the CEA/HDMI mode lists.
- */
- picture_aspect = mode->picture_aspect_ratio;
-- if (picture_aspect == HDMI_PICTURE_ASPECT_NONE)
-- picture_aspect = drm_get_cea_aspect_ratio(frame->video_code);
-+ if (picture_aspect == HDMI_PICTURE_ASPECT_NONE) {
-+ if (vic)
-+ picture_aspect = drm_get_cea_aspect_ratio(vic);
-+ else if (hdmi_vic)
-+ picture_aspect = drm_get_hdmi_aspect_ratio(hdmi_vic);
-+ }
-
- /*
- * The infoframe can't convey anything but none, 4:3
-@@ -5161,12 +5178,20 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
- * we can only satisfy it by specifying the right VIC.
- */
- if (picture_aspect > HDMI_PICTURE_ASPECT_16_9) {
-- if (picture_aspect !=
-- drm_get_cea_aspect_ratio(frame->video_code))
-+ if (vic) {
-+ if (picture_aspect != drm_get_cea_aspect_ratio(vic))
-+ return -EINVAL;
-+ } else if (hdmi_vic) {
-+ if (picture_aspect != drm_get_hdmi_aspect_ratio(hdmi_vic))
-+ return -EINVAL;
-+ } else {
- return -EINVAL;
-+ }
-+
- picture_aspect = HDMI_PICTURE_ASPECT_NONE;
- }
-
-+ frame->video_code = vic;
- frame->picture_aspect = picture_aspect;
- frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
- frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
---
-2.39.2
-
+++ /dev/null
-From ee13bd559ce240afa08ec469a70dd0587cc39f1f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 4 Oct 2019 17:19:12 +0300
-Subject: drm/edid: Extract drm_mode_cea_vic()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Ville Syrjälä <ville.syrjala@linux.intel.com>
-
-[ Upstream commit cfd6f8c3a94a96c003a8929b66d6d54181b9420d ]
-
-Extract the logic to compute the final CEA VIC to a small helper.
-We'll reorder it a bit to make future modifications more
-straightforward. No function changes.
-
-Cc: Wayne Lin <waynelin@amd.com>
-Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
-Link: https://patchwork.freedesktop.org/patch/msgid/20191004141914.20600-2-ville.syrjala@linux.intel.com
-Reviewed-by: Uma Shankar <uma.shankar@intel.com>
-Stable-dep-of: 1cbc1f0d324b ("drm/edid: fix AVI infoframe aspect ratio handling")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/drm_edid.c | 53 +++++++++++++++++++++-----------------
- 1 file changed, 30 insertions(+), 23 deletions(-)
-
-diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
-index 2dc6dd6230d76..10eb78b9347e1 100644
---- a/drivers/gpu/drm/drm_edid.c
-+++ b/drivers/gpu/drm/drm_edid.c
-@@ -5065,6 +5065,35 @@ drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
- }
- EXPORT_SYMBOL(drm_hdmi_infoframe_set_hdr_metadata);
-
-+static u8 drm_mode_cea_vic(struct drm_connector *connector,
-+ const struct drm_display_mode *mode)
-+{
-+ u8 vendor_if_vic = drm_match_hdmi_mode(mode);
-+ bool is_s3d = mode->flags & DRM_MODE_FLAG_3D_MASK;
-+ u8 vic;
-+
-+ /*
-+ * HDMI spec says if a mode is found in HDMI 1.4b 4K modes
-+ * we should send its VIC in vendor infoframes, else send the
-+ * VIC in AVI infoframes. Lets check if this mode is present in
-+ * HDMI 1.4b 4K modes
-+ */
-+ if (drm_valid_hdmi_vic(vendor_if_vic) && !is_s3d)
-+ return 0;
-+
-+ vic = drm_match_cea_mode(mode);
-+
-+ /*
-+ * HDMI 1.4 VIC range: 1 <= VIC <= 64 (CEA-861-D) but
-+ * HDMI 2.0 VIC range: 1 <= VIC <= 107 (CEA-861-F). So we
-+ * have to make sure we dont break HDMI 1.4 sinks.
-+ */
-+ if (!is_hdmi2_sink(connector) && vic > 64)
-+ return 0;
-+
-+ return vic;
-+}
-+
- /**
- * drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe with
- * data from a DRM display mode
-@@ -5092,29 +5121,7 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
- if (mode->flags & DRM_MODE_FLAG_DBLCLK)
- frame->pixel_repeat = 1;
-
-- frame->video_code = drm_match_cea_mode(mode);
--
-- /*
-- * HDMI 1.4 VIC range: 1 <= VIC <= 64 (CEA-861-D) but
-- * HDMI 2.0 VIC range: 1 <= VIC <= 107 (CEA-861-F). So we
-- * have to make sure we dont break HDMI 1.4 sinks.
-- */
-- if (!is_hdmi2_sink(connector) && frame->video_code > 64)
-- frame->video_code = 0;
--
-- /*
-- * HDMI spec says if a mode is found in HDMI 1.4b 4K modes
-- * we should send its VIC in vendor infoframes, else send the
-- * VIC in AVI infoframes. Lets check if this mode is present in
-- * HDMI 1.4b 4K modes
-- */
-- if (frame->video_code) {
-- u8 vendor_if_vic = drm_match_hdmi_mode(mode);
-- bool is_s3d = mode->flags & DRM_MODE_FLAG_3D_MASK;
--
-- if (drm_valid_hdmi_vic(vendor_if_vic) && !is_s3d)
-- frame->video_code = 0;
-- }
-+ frame->video_code = drm_mode_cea_vic(connector, mode);
-
- frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
-
---
-2.39.2
-
+++ /dev/null
-From 0b862dc6ccc7dfe316c77eea18fad34f9ddda600 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 4 Jan 2023 12:05:16 +0200
-Subject: drm/edid: fix AVI infoframe aspect ratio handling
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Jani Nikula <jani.nikula@intel.com>
-
-[ Upstream commit 1cbc1f0d324ba6c4d1b10ac6362b5e0b029f63d5 ]
-
-We try to avoid sending VICs defined in the later specs in AVI
-infoframes to sinks that conform to the earlier specs, to not upset
-them, and use 0 for the VIC instead. However, we do this detection and
-conversion to 0 too early, as we'll need the actual VIC to figure out
-the aspect ratio.
-
-In particular, for a mode with 64:27 aspect ratio, 0 for VIC fails the
-AVI infoframe generation altogether with -EINVAL.
-
-Separate the VIC lookup from the "filtering", and postpone the
-filtering, to use the proper VIC for aspect ratio handling, and the 0
-VIC for the infoframe video code as needed.
-
-Reported-by: William Tseng <william.tseng@intel.com>
-Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6153
-References: https://lore.kernel.org/r/20220920062316.43162-1-william.tseng@intel.com
-Cc: <stable@vger.kernel.org>
-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/c3e78cc6d01ed237f71ad0038826b08d83d75eef.1672826282.git.jani.nikula@intel.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/drm_edid.c | 21 ++++++++++++---------
- 1 file changed, 12 insertions(+), 9 deletions(-)
-
-diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
-index f9735861741c1..2e73042e5d070 100644
---- a/drivers/gpu/drm/drm_edid.c
-+++ b/drivers/gpu/drm/drm_edid.c
-@@ -5095,8 +5095,6 @@ static u8 drm_mode_hdmi_vic(struct drm_connector *connector,
- static u8 drm_mode_cea_vic(struct drm_connector *connector,
- const struct drm_display_mode *mode)
- {
-- u8 vic;
--
- /*
- * HDMI spec says if a mode is found in HDMI 1.4b 4K modes
- * we should send its VIC in vendor infoframes, else send the
-@@ -5106,13 +5104,18 @@ static u8 drm_mode_cea_vic(struct drm_connector *connector,
- if (drm_mode_hdmi_vic(connector, mode))
- return 0;
-
-- vic = drm_match_cea_mode(mode);
-+ return drm_match_cea_mode(mode);
-+}
-
-- /*
-- * HDMI 1.4 VIC range: 1 <= VIC <= 64 (CEA-861-D) but
-- * HDMI 2.0 VIC range: 1 <= VIC <= 107 (CEA-861-F). So we
-- * have to make sure we dont break HDMI 1.4 sinks.
-- */
-+/*
-+ * Avoid sending VICs defined in HDMI 2.0 in AVI infoframes to sinks that
-+ * conform to HDMI 1.4.
-+ *
-+ * HDMI 1.4 (CTA-861-D) VIC range: [1..64]
-+ * HDMI 2.0 (CTA-861-F) VIC range: [1..107]
-+ */
-+static u8 vic_for_avi_infoframe(const struct drm_connector *connector, u8 vic)
-+{
- if (!is_hdmi2_sink(connector) && vic > 64)
- return 0;
-
-@@ -5191,7 +5194,7 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
- picture_aspect = HDMI_PICTURE_ASPECT_NONE;
- }
-
-- frame->video_code = vic;
-+ frame->video_code = vic_for_avi_infoframe(connector, vic);
- frame->picture_aspect = picture_aspect;
- frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
- frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
---
-2.39.2
-
+++ /dev/null
-From 099c0f75cc95cf4026dfa0b9087c949040171324 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 4 Oct 2019 17:19:13 +0300
-Subject: drm/edid: Fix HDMI VIC handling
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Ville Syrjälä <ville.syrjala@linux.intel.com>
-
-[ Upstream commit 949561eb85bcee10248e7da51d44a0325d5e0d1b ]
-
-Extract drm_mode_hdmi_vic() to correctly calculate the final HDMI
-VIC for us. Currently this is being done a bit differently between
-the AVI and HDMI infoframes. Let's get both to agree on this.
-
-We need to allow the case where a mode is both 3D and has a HDMI
-VIC. Currently we'll just refuse to generate the HDMI infoframe when
-we really should be setting HDMI VIC to 0 and instead enabling 3D
-stereo signalling.
-
-If the sink doesn't even support the HDMI infoframe we should
-not be picking the HDMI VIC in favor of the CEA VIC, because then
-we'll end up not sending either VIC in the end.
-
-Cc: Wayne Lin <waynelin@amd.com>
-Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
-Link: https://patchwork.freedesktop.org/patch/msgid/20191004141914.20600-3-ville.syrjala@linux.intel.com
-Reviewed-by: Uma Shankar <uma.shankar@intel.com>
-Stable-dep-of: 1cbc1f0d324b ("drm/edid: fix AVI infoframe aspect ratio handling")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/drm_edid.c | 37 +++++++++++++++++++++----------------
- 1 file changed, 21 insertions(+), 16 deletions(-)
-
-diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
-index 10eb78b9347e1..245e495f57c93 100644
---- a/drivers/gpu/drm/drm_edid.c
-+++ b/drivers/gpu/drm/drm_edid.c
-@@ -5065,11 +5065,25 @@ drm_hdmi_infoframe_set_hdr_metadata(struct hdmi_drm_infoframe *frame,
- }
- EXPORT_SYMBOL(drm_hdmi_infoframe_set_hdr_metadata);
-
-+static u8 drm_mode_hdmi_vic(struct drm_connector *connector,
-+ const struct drm_display_mode *mode)
-+{
-+ bool has_hdmi_infoframe = connector ?
-+ connector->display_info.has_hdmi_infoframe : false;
-+
-+ if (!has_hdmi_infoframe)
-+ return 0;
-+
-+ /* No HDMI VIC when signalling 3D video format */
-+ if (mode->flags & DRM_MODE_FLAG_3D_MASK)
-+ return 0;
-+
-+ return drm_match_hdmi_mode(mode);
-+}
-+
- static u8 drm_mode_cea_vic(struct drm_connector *connector,
- const struct drm_display_mode *mode)
- {
-- u8 vendor_if_vic = drm_match_hdmi_mode(mode);
-- bool is_s3d = mode->flags & DRM_MODE_FLAG_3D_MASK;
- u8 vic;
-
- /*
-@@ -5078,7 +5092,7 @@ static u8 drm_mode_cea_vic(struct drm_connector *connector,
- * VIC in AVI infoframes. Lets check if this mode is present in
- * HDMI 1.4b 4K modes
- */
-- if (drm_valid_hdmi_vic(vendor_if_vic) && !is_s3d)
-+ if (drm_mode_hdmi_vic(connector, mode))
- return 0;
-
- vic = drm_match_cea_mode(mode);
-@@ -5338,8 +5352,6 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
- bool has_hdmi_infoframe = connector ?
- connector->display_info.has_hdmi_infoframe : false;
- int err;
-- u32 s3d_flags;
-- u8 vic;
-
- if (!frame || !mode)
- return -EINVAL;
-@@ -5347,8 +5359,9 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
- if (!has_hdmi_infoframe)
- return -EINVAL;
-
-- vic = drm_match_hdmi_mode(mode);
-- s3d_flags = mode->flags & DRM_MODE_FLAG_3D_MASK;
-+ err = hdmi_vendor_infoframe_init(frame);
-+ if (err < 0)
-+ return err;
-
- /*
- * Even if it's not absolutely necessary to send the infoframe
-@@ -5359,15 +5372,7 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
- * mode if the source simply stops sending the infoframe when
- * it wants to switch from 3D to 2D.
- */
--
-- if (vic && s3d_flags)
-- return -EINVAL;
--
-- err = hdmi_vendor_infoframe_init(frame);
-- if (err < 0)
-- return err;
--
-- frame->vic = vic;
-+ frame->vic = drm_mode_hdmi_vic(connector, mode);
- frame->s3d_struct = s3d_structure_from_display_mode(mode);
-
- return 0;
---
-2.39.2
-
ext4-fix-warning-in-ext4_update_inline_data.patch
ext4-zero-i_disksize-when-initializing-the-bootloader-inode.patch
nfc-change-order-inside-nfc_se_io-error-path.patch
-drm-edid-extract-drm_mode_cea_vic.patch
-drm-edid-fix-hdmi-vic-handling.patch
-drm-edid-add-aspect-ratios-to-hdmi-4k-modes.patch
-drm-edid-fix-avi-infoframe-aspect-ratio-handling.patch
iommu-amd-add-pci-segment-support-for-ivrs_-ioapic-h.patch
iommu-amd-fix-ill-formed-ivrs_ioapic-ivrs_hpet-and-i.patch
iommu-amd-add-a-length-limitation-for-the-ivrs_acpih.patch