aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0365-drm-amd-display-Make-sure-v_total_min-and-max-not-le.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0365-drm-amd-display-Make-sure-v_total_min-and-max-not-le.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0365-drm-amd-display-Make-sure-v_total_min-and-max-not-le.patch85
1 files changed, 85 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0365-drm-amd-display-Make-sure-v_total_min-and-max-not-le.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0365-drm-amd-display-Make-sure-v_total_min-and-max-not-le.patch
new file mode 100644
index 00000000..faaafcfb
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0365-drm-amd-display-Make-sure-v_total_min-and-max-not-le.patch
@@ -0,0 +1,85 @@
+From 53023d9fe906db4755d7108828c7e6846ed52d0d Mon Sep 17 00:00:00 2001
+From: Yongqiang Sun <yongqiang.sun@amd.com>
+Date: Fri, 21 Apr 2017 11:00:43 -0400
+Subject: [PATCH 0365/4131] drm/amd/display: Make sure v_total_min and max not
+ less than v_total.
+
+Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
+Acked-by: Harry Wentland <Harry.Wentland@amd.com>
+Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ .../gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c | 4 ++--
+ .../gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c | 4 ++--
+ drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 12 ++++++++++++
+ 3 files changed, 16 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c
+index 69ae3a8..7070aaf 100644
+--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c
++++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c
+@@ -393,12 +393,12 @@ void dce110_timing_generator_set_drr(
+ params->vertical_total_min > 0) {
+
+ set_reg_field_value(v_total_max,
+- params->vertical_total_max,
++ params->vertical_total_max - 1,
+ CRTC_V_TOTAL_MAX,
+ CRTC_V_TOTAL_MAX);
+
+ set_reg_field_value(v_total_min,
+- params->vertical_total_min,
++ params->vertical_total_min - 1,
+ CRTC_V_TOTAL_MIN,
+ CRTC_V_TOTAL_MIN);
+
+diff --git a/drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c b/drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c
+index 6e3e7b6..1318df7 100644
+--- a/drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c
++++ b/drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c
+@@ -540,10 +540,10 @@ void dce120_timing_generator_set_drr(
+
+ CRTC_REG_UPDATE(
+ CRTC0_CRTC_V_TOTAL_MIN,
+- CRTC_V_TOTAL_MIN, params->vertical_total_min);
++ CRTC_V_TOTAL_MIN, params->vertical_total_min - 1);
+ CRTC_REG_UPDATE(
+ CRTC0_CRTC_V_TOTAL_MAX,
+- CRTC_V_TOTAL_MAX, params->vertical_total_max);
++ CRTC_V_TOTAL_MAX, params->vertical_total_max - 1);
+ CRTC_REG_SET_N(CRTC0_CRTC_V_TOTAL_CONTROL, 6,
+ FD(CRTC0_CRTC_V_TOTAL_CONTROL__CRTC_V_TOTAL_MIN_SEL), 1,
+ FD(CRTC0_CRTC_V_TOTAL_CONTROL__CRTC_V_TOTAL_MAX_SEL), 1,
+diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+index 94566c0..5c6de72 100644
+--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
++++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+@@ -347,6 +347,7 @@ static void calc_vmin_vmax(struct core_freesync *core_freesync,
+ {
+ unsigned int min_frame_duration_in_ns = 0, max_frame_duration_in_ns = 0;
+ unsigned int index = map_index_from_stream(core_freesync, stream);
++ uint32_t vtotal = stream->timing.v_total;
+
+ min_frame_duration_in_ns = ((unsigned int) (div64_u64(
+ (1000000000ULL * 1000000),
+@@ -362,6 +363,17 @@ static void calc_vmin_vmax(struct core_freesync *core_freesync,
+ *vmin = div64_u64(div64_u64(((unsigned long long)(
+ min_frame_duration_in_ns) * stream->timing.pix_clk_khz),
+ stream->timing.h_total), 1000000);
++
++ /* In case of 4k free sync monitor, vmin or vmax cannot be less than vtotal */
++ if (*vmin < vtotal) {
++ ASSERT(false);
++ *vmin = vtotal;
++ }
++
++ if (*vmax < vtotal) {
++ ASSERT(false);
++ *vmax = vtotal;
++ }
+ }
+
+ static void calc_v_total_from_duration(const struct dc_stream *stream,
+--
+2.7.4
+