aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4350-drm-amd-display-Add-a-sanity-check-for-DSC-already-e.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4350-drm-amd-display-Add-a-sanity-check-for-DSC-already-e.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4350-drm-amd-display-Add-a-sanity-check-for-DSC-already-e.patch71
1 files changed, 71 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4350-drm-amd-display-Add-a-sanity-check-for-DSC-already-e.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4350-drm-amd-display-Add-a-sanity-check-for-DSC-already-e.patch
new file mode 100644
index 00000000..3c3c7009
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4350-drm-amd-display-Add-a-sanity-check-for-DSC-already-e.patch
@@ -0,0 +1,71 @@
+From 37d0bb62a1186bd5e2141900ad1431e93f2823d5 Mon Sep 17 00:00:00 2001
+From: Nikola Cornij <nikola.cornij@amd.com>
+Date: Wed, 16 Oct 2019 14:34:15 -0400
+Subject: [PATCH 4350/4736] drm/amd/display: Add a sanity check for DSC already
+ enabled/disabled
+
+[why]
+If acquire/release DSC resource sequence is affected by a regression,
+it can happen that the already-in-use DSC HW block is being wrongly
+re-used for a different pipe. The reverse is also possible, i.e.
+already-disabled DSC HW block could be disabled from other context.
+
+[how]
+Read back the enable state of DSC HW and report an error if duplicate
+enable or disable was attempted.
+
+Signed-off-by: Nikola Cornij <nikola.cornij@amd.com>
+Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
+Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
+---
+ .../gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c | 25 ++++++++++++++++---
+ 1 file changed, 22 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c
+index 63eb377ed9c0..dc9944427d2f 100644
+--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c
++++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c
+@@ -222,9 +222,18 @@ static bool dsc2_get_packed_pps(struct display_stream_compressor *dsc, const str
+ static void dsc2_enable(struct display_stream_compressor *dsc, int opp_pipe)
+ {
+ struct dcn20_dsc *dsc20 = TO_DCN20_DSC(dsc);
++ int dsc_clock_en;
++ int dsc_fw_config;
++ int enabled_opp_pipe;
+
+- /* TODO Check if DSC alreay in use? */
+- DC_LOG_DSC("enable DSC at opp pipe %d", opp_pipe);
++ DC_LOG_DSC("enable DSC %d at opp pipe %d", dsc->inst, opp_pipe);
++
++ REG_GET(DSC_TOP_CONTROL, DSC_CLOCK_EN, &dsc_clock_en);
++ REG_GET_2(DSCRM_DSC_FORWARD_CONFIG, DSCRM_DSC_FORWARD_EN, &dsc_fw_config, DSCRM_DSC_OPP_PIPE_SOURCE, &enabled_opp_pipe);
++ if ((dsc_clock_en || dsc_fw_config) && enabled_opp_pipe != opp_pipe) {
++ DC_LOG_DSC("ERROR: DSC %d at opp pipe %d already enabled!", dsc->inst, enabled_opp_pipe);
++ ASSERT(0);
++ }
+
+ REG_UPDATE(DSC_TOP_CONTROL,
+ DSC_CLOCK_EN, 1);
+@@ -238,8 +247,18 @@ static void dsc2_enable(struct display_stream_compressor *dsc, int opp_pipe)
+ static void dsc2_disable(struct display_stream_compressor *dsc)
+ {
+ struct dcn20_dsc *dsc20 = TO_DCN20_DSC(dsc);
++ int dsc_clock_en;
++ int dsc_fw_config;
++ int enabled_opp_pipe;
+
+- DC_LOG_DSC("disable DSC");
++ DC_LOG_DSC("disable DSC %d", dsc->inst);
++
++ REG_GET(DSC_TOP_CONTROL, DSC_CLOCK_EN, &dsc_clock_en);
++ REG_GET_2(DSCRM_DSC_FORWARD_CONFIG, DSCRM_DSC_FORWARD_EN, &dsc_fw_config, DSCRM_DSC_OPP_PIPE_SOURCE, &enabled_opp_pipe);
++ if (!dsc_clock_en || !dsc_fw_config) {
++ DC_LOG_DSC("ERROR: DSC %d at opp pipe %d already disabled!", dsc->inst, enabled_opp_pipe);
++ ASSERT(0);
++ }
+
+ REG_UPDATE(DSCRM_DSC_FORWARD_CONFIG,
+ DSCRM_DSC_FORWARD_EN, 0);
+--
+2.17.1
+