Skip to contentSkip to conversation

DC Patches June 11, 2024

PATCH In review Hamza Mahfooz 2 participants 38 messages Jun 11, 2024 – Jun 17, 2024

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover DC Patches June 11, 2024

Cc Daniel Wheeler <[email protected]>

Alex Hung (15):
drm/amd/display: Explicitly extend unsigned 16 bit to 64 bit drm/amd/display: Add null checker before passing variables drm/amd/display: Check BIOS images before it is used drm/amd/display: Skip wbscl_set_scaler_filter if filter is null drm/amd/display: Add null checker before access structs drm/amd/display: Check dc_stream_state before it is used drm/amd/display: Check pipe_ctx before it is used drm/amd/display: Covert integers to double before divisions drm/amd/display: Remove redundant checks for res_pool->dccg drm/amd/display: Remove redundant checks for ctx->dc_bios drm/amd/display: Remove redundant null checks drm/amd/display: Remove redundant checks for opp drm/amd/display: Remove redundant checks for context drm/amd/display: Check UnboundedRequestEnabled's value drm/amd/display: Remove redundant null checks

Alvin Lee (1):
drm/amd/display: Make sure to reprogram ODM when resync fifo

Anthony Koo (1):
drm/amd/display: [FW Promotion] Release 0.0.222.0

Aric Cyr (1):
drm/amd/display: 3.2.289

Chris Park (1):
drm/amd/display: On clock init, maintain DISPCLK freq

Dillon Varone (2):
drm/amd/display: Enable DCN401 idle optimizations by default drm/amd/display: Add null check to dml21_find_dc_pipes_for_plane

Ivan Lipski (3):
drm/amd/display: Remove redundant condition with DEADCODE drm/amd/display: Remove redundant condition in VBA 314 func drm/amd/display: Remove unused value set from 'min_hratio_fact' in dml

Joshua Aberback (3):
drm/amd/display: DCN401 full power down in HW init if any link enabled Revert "drm/amd/display: workaround for oled eDP not lighting up on

    DCN401"

drm/amd/display: Remove duplicate HWSS interfaces

Michael Strauss (1):
drm/amd/display: Attempt to avoid empty TUs when endpoint is DPIA

Mounika Adhuri (1):
drm/amd/display: Refactor DCN3X into component folder

Relja Vojvodic (1):
drm/amd/display: Add dcn401 DIG fifo enable/disable

Rodrigo Siqueira (3):
drm/amd/display: Fix NULL pointer dereference for DTN log in DCN401 drm/amd/display: Fix warning caused by an attempt to configure a
non-otg master
drm/amd/display: Improve warning log for get OPP for OTG master

Sridevi Arvindekar (1):
drm/amd/display: mirror case cleanup for cursors

Sung Joon Kim (1):
drm/amd/display: Send message to notify the DPIA host router bandwidth

Wenjing Liu (1):
drm/amd/display: fix minor coding errors where dml21 phase 5 uses
wrong variables

 drivers/gpu/drm/amd/display/Makefile          |   7 ++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  19 +--
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c |   2 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c |   3 -
 drivers/gpu/drm/amd/display/dc/Makefile       |   6 +-
 .../gpu/drm/amd/display/dc/bios/bios_parser.c |  14 +++
 .../amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c |   2 +-
 .../display/dc/clk_mgr/dcn301/vg_clk_mgr.c    |   2 +-
 .../display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c  |   2 +-
 .../dc/clk_mgr/dcn314/dcn314_clk_mgr.c        |   2 +-
 .../dc/clk_mgr/dcn315/dcn315_clk_mgr.c        |   2 +-
 .../dc/clk_mgr/dcn316/dcn316_clk_mgr.c        |   2 +-
 .../display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c  |   2 +-
 .../display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c  |  57 ++++++++-
 .../amd/display/dc/clk_mgr/dcn35/dcn35_smu.c  |  21 +++-
 .../amd/display/dc/clk_mgr/dcn35/dcn35_smu.h  |   2 +
 .../dc/clk_mgr/dcn401/dcn401_clk_mgr.c        |  17 +++
 drivers/gpu/drm/amd/display/dc/core/dc.c      |  21 +++-
 .../drm/amd/display/dc/core/dc_hw_sequencer.c |   2 +-
 .../gpu/drm/amd/display/dc/core/dc_resource.c |  15 ++-
 .../gpu/drm/amd/display/dc/core/dc_state.c    |  24 ++--
 drivers/gpu/drm/amd/display/dc/dc.h           |   6 +-
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c  |  20 +++-
 .../drm/amd/display/dc/dcn20/dcn20_dwb_scl.c  |   3 +
 drivers/gpu/drm/amd/display/dc/dcn32/Makefile |  19 ---
 .../gpu/drm/amd/display/dc/dcn321/Makefile    |  17 ---
 drivers/gpu/drm/amd/display/dc/dcn35/Makefile |  19 ---
 drivers/gpu/drm/amd/display/dc/dio/Makefile   |  63 ++++++++++
 .../{ => dio}/dcn32/dcn32_dio_link_encoder.c  |   0
 .../{ => dio}/dcn32/dcn32_dio_link_encoder.h  |   0
 .../dcn32/dcn32_dio_stream_encoder.c          |   0
 .../dcn32/dcn32_dio_stream_encoder.h          |   0
 .../dcn321/dcn321_dio_link_encoder.c          |   0
 .../dcn321/dcn321_dio_link_encoder.h          |   0
 .../{ => dio}/dcn35/dcn35_dio_link_encoder.c  |   0
 .../{ => dio}/dcn35/dcn35_dio_link_encoder.h  |   0
 .../dcn35/dcn35_dio_stream_encoder.c          |   4 +-
 .../dcn35/dcn35_dio_stream_encoder.h          |   6 +
 .../dcn401/dcn401_dio_link_encoder.c          |   0
 .../dcn401/dcn401_dio_link_encoder.h          |   0
 .../dcn401/dcn401_dio_stream_encoder.c        |   4 +-
 .../dcn401/dcn401_dio_stream_encoder.h        |   0
 .../drm/amd/display/dc/dml/calcs/dcn_calcs.c  |   2 +-
 .../drm/amd/display/dc/dml/dcn20/dcn20_fpu.c  |  20 ++--
 .../dc/dml/dcn20/display_mode_vba_20.c        |  16 +--
 .../dc/dml/dcn20/display_mode_vba_20v2.c      |   4 +-
 .../dc/dml/dcn20/display_rq_dlg_calc_20.c     |   5 -
 .../dc/dml/dcn20/display_rq_dlg_calc_20v2.c   |   5 -
 .../dc/dml/dcn21/display_mode_vba_21.c        |   2 +-
 .../dc/dml/dcn21/display_rq_dlg_calc_21.c     |   8 --
 .../dc/dml/dcn30/display_mode_vba_30.c        |   2 +-
 .../dc/dml/dcn30/display_rq_dlg_calc_30.c     |   5 -
 .../dc/dml/dcn31/display_mode_vba_31.c        |   4 +-
 .../dc/dml/dcn31/display_rq_dlg_calc_31.c     |   5 -
 .../dc/dml/dcn314/display_mode_vba_314.c      |  11 +-
 .../dc/dml/dcn314/display_rq_dlg_calc_314.c   |   5 -
 .../drm/amd/display/dc/dml/dcn32/dcn32_fpu.c  |  11 +-
 .../dc/dml/dcn32/display_mode_vba_util_32.c   |   8 +-
 .../display/dc/dml/dml1_display_rq_dlg_calc.c |   5 -
 .../amd/display/dc/dml2/display_mode_core.c   |  12 +-
 .../dc/dml2/dml21/dml21_translation_helper.c  |   4 +-
 .../amd/display/dc/dml2/dml21/dml21_utils.c   |  28 ++++-
 .../src/dml2_core/dml2_core_dcn4_calcs.c      |  28 ++---
 .../dml21/src/dml2_core/dml2_core_shared.c    |  24 ++--
 .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c  |   5 +
 .../dc/dml2/dml21/src/dml2_top/dml_top.c      |   4 +-
 .../display/dc/dml2/dml2_dc_resource_mgmt.c   |   9 +-
 .../drm/amd/display/dc/dml2/dml2_wrapper.c    |   5 +-
 drivers/gpu/drm/amd/display/dc/dwb/Makefile   |  37 ++++++
 .../display/dc/{ => dwb}/dcn35/dcn35_dwb.c    |   0
 .../display/dc/{ => dwb}/dcn35/dcn35_dwb.h    |   0
 drivers/gpu/drm/amd/display/dc/hpo/Makefile   |  35 ++++++
 .../dcn32/dcn32_hpo_dp_link_encoder.c         |   0
 .../dcn32/dcn32_hpo_dp_link_encoder.h         |   0
 .../amd/display/dc/hwss/dce110/dce110_hwseq.c |   9 +-
 .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c   |  61 +++++-----
 .../amd/display/dc/hwss/dcn10/dcn10_init.c    |   2 -
 .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c   |  11 +-
 .../amd/display/dc/hwss/dcn20/dcn20_init.c    |   1 -
 .../amd/display/dc/hwss/dcn201/dcn201_hwseq.c |   5 +-
 .../amd/display/dc/hwss/dcn201/dcn201_init.c  |   1 -
 .../amd/display/dc/hwss/dcn21/dcn21_init.c    |   2 -
 .../amd/display/dc/hwss/dcn30/dcn30_hwseq.c   |  10 +-
 .../amd/display/dc/hwss/dcn30/dcn30_init.c    |   1 -
 .../amd/display/dc/hwss/dcn301/dcn301_init.c  |   1 -
 .../amd/display/dc/hwss/dcn31/dcn31_hwseq.c   |   2 +-
 .../amd/display/dc/hwss/dcn31/dcn31_init.c    |   2 -
 .../amd/display/dc/hwss/dcn314/dcn314_hwseq.c |  19 ++-
 .../amd/display/dc/hwss/dcn314/dcn314_init.c  |   2 -
 .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c   | 110 ++++++++++--------
 .../amd/display/dc/hwss/dcn32/dcn32_init.c    |   1 -
 .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c   |  82 ++++++++++++-
 .../amd/display/dc/hwss/dcn35/dcn35_hwseq.h   |   2 +
 .../amd/display/dc/hwss/dcn35/dcn35_init.c    |   4 +-
 .../amd/display/dc/hwss/dcn351/dcn351_init.c  |   2 -
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |  75 ++++++------
 .../amd/display/dc/hwss/dcn401/dcn401_init.c  |   1 -
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |   1 -
 .../display/dc/hwss/hw_sequencer_private.h    |   2 -
 .../link/protocols/link_edp_panel_control.c   |   3 -
 .../gpu/drm/amd/display/dc/mmhubbub/Makefile  |  45 +++++++
 .../dc/{ => mmhubbub}/dcn32/dcn32_mmhubbub.c  |   0
 .../dc/{ => mmhubbub}/dcn32/dcn32_mmhubbub.h  |   0
 .../dc/{ => mmhubbub}/dcn35/dcn35_mmhubbub.c  |   0
 .../dc/{ => mmhubbub}/dcn35/dcn35_mmhubbub.h  |   0
 drivers/gpu/drm/amd/display/dc/mpc/Makefile   |  45 +++++++
 .../display/dc/{ => mpc}/dcn32/dcn32_mpc.c    |   0
 .../display/dc/{ => mpc}/dcn32/dcn32_mpc.h    |   0
 .../display/dc/{ => mpc}/dcn401/dcn401_mpc.c  |   0
 .../display/dc/{ => mpc}/dcn401/dcn401_mpc.h  |   0
 drivers/gpu/drm/amd/display/dc/opp/Makefile   |  35 ++++++
 .../display/dc/{ => opp}/dcn35/dcn35_opp.c    |   0
 .../display/dc/{ => opp}/dcn35/dcn35_opp.h    |   0
 drivers/gpu/drm/amd/display/dc/pg/Makefile    |  35 ++++++
 .../display/dc/{ => pg}/dcn35/dcn35_pg_cntl.c |   0
 .../display/dc/{ => pg}/dcn35/dcn35_pg_cntl.h |   0
 .../gpu/drm/amd/display/dc/resource/Makefile  |   2 +-
 .../dc/resource/dcn20/dcn20_resource.c        |   2 +-
 .../dc/resource/dcn201/dcn201_resource.c      |   4 +-
 .../dc/resource/dcn32/dcn32_resource.c        |   2 +
 .../dcn32/dcn32_resource_helpers.c            |   0
 .../dc/resource/dcn351/dcn351_resource.c      |   1 +
 .../dc/resource/dcn401/dcn401_resource.c      |   3 -
 .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h   |   9 +-
 124 files changed, 880 insertions(+), 409 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dcn32/Makefile
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dcn321/Makefile
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dcn35/Makefile
 create mode 100644 drivers/gpu/drm/amd/display/dc/dio/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn32/dcn32_dio_link_encoder.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn32/dcn32_dio_link_encoder.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn32/dcn32_dio_stream_encoder.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn32/dcn32_dio_stream_encoder.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn321/dcn321_dio_link_encoder.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn321/dcn321_dio_link_encoder.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn35/dcn35_dio_link_encoder.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn35/dcn35_dio_link_encoder.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn35/dcn35_dio_stream_encoder.c (99%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn35/dcn35_dio_stream_encoder.h (99%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn401/dcn401_dio_link_encoder.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn401/dcn401_dio_link_encoder.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn401/dcn401_dio_stream_encoder.c (99%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn401/dcn401_dio_stream_encoder.h (100%)
 create mode 100644 drivers/gpu/drm/amd/display/dc/dwb/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => dwb}/dcn35/dcn35_dwb.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dwb}/dcn35/dcn35_dwb.h (100%)
 create mode 100644 drivers/gpu/drm/amd/display/dc/hpo/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => hpo}/dcn32/dcn32_hpo_dp_link_encoder.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => hpo}/dcn32/dcn32_hpo_dp_link_encoder.h (100%)
 create mode 100644 drivers/gpu/drm/amd/display/dc/mmhubbub/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => mmhubbub}/dcn32/dcn32_mmhubbub.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => mmhubbub}/dcn32/dcn32_mmhubbub.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => mmhubbub}/dcn35/dcn35_mmhubbub.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => mmhubbub}/dcn35/dcn35_mmhubbub.h (100%)
 create mode 100644 drivers/gpu/drm/amd/display/dc/mpc/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => mpc}/dcn32/dcn32_mpc.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => mpc}/dcn32/dcn32_mpc.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => mpc}/dcn401/dcn401_mpc.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => mpc}/dcn401/dcn401_mpc.h (100%)
 create mode 100644 drivers/gpu/drm/amd/display/dc/opp/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => opp}/dcn35/dcn35_opp.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => opp}/dcn35/dcn35_opp.h (100%)
 create mode 100644 drivers/gpu/drm/amd/display/dc/pg/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => pg}/dcn35/dcn35_pg_cntl.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => pg}/dcn35/dcn35_pg_cntl.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => resource}/dcn32/dcn32_resource_helpers.c (100%)
Signature · 1 line
2.45.1
#1 lore raw

PATCH 1/36 drm/amd/display: DCN401 full power down in HW init if any link enabled

From: Joshua Aberback <[email protected]>

[Why]
During HW init, certain operations the driver performs are invalid on enabled hardware in an unknown state (for example, setting all clock values to minimum when the GPU is actively driving a display). There is already code present to call HWSS->power_down during init when any link is enabled in HW, but that function pointer is unpopulated for most asics. We want to enable this codepath for DCN401, as it resolves the issue with being unable to drive certain display configs on adapter re-enable, and we can restore boot optimizations.

[How]
- add power_down HWSS function for DCN401
- remove debug bit to disable boot optimizations for DCN401

---
 drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c         | 1 +
 drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c +1 -0
index dabad7feff03..1cf0608e1980 100644
@@ -98,6 +98,7 @@ static const struct hw_sequencer_funcs dcn401_funcs = {
 	.fams2_global_control_lock = dcn401_fams2_global_control_lock,
 	.fams2_update_config = dcn401_fams2_update_config,
 	.fams2_global_control_lock_fast = dcn401_fams2_global_control_lock_fast,
+	.power_down = dce110_power_down,
 };
 
 static const struct hwseq_private_funcs dcn401_private_funcs = {
drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c +0 -1
index ea803df8645e..7781a0342d67 100644
@@ -733,7 +733,6 @@ static const struct dc_debug_options debug_defaults_drv = {
 	.force_cositing = CHROMA_COSITING_TOPLEFT + 1,
 	.disable_idle_power_optimizations = true,
 	.edp_oled_no_backlight_enable = true,
-	.disable_boot_optimizations = true,
 };
 
 static struct dce_aux *dcn401_aux_engine_create(
Signature · 1 line
2.45.1
#2 lore raw

PATCH 2/36 drm/amd/display: Enable DCN401 idle optimizations by default

In reply to Hamza Mahfooz

From: Dillon Varone <[email protected]>

[WHY&HOW]
Re-enable idle optimizations by default.

---
 drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c +0 -1
index 7781a0342d67..d78dc63f82fd 100644
@@ -731,7 +731,6 @@ static const struct dc_debug_options debug_defaults_drv = {
 		}
 	},
 	.force_cositing = CHROMA_COSITING_TOPLEFT + 1,
-	.disable_idle_power_optimizations = true,
 	.edp_oled_no_backlight_enable = true,
 };
 
Signature · 1 line
2.45.1
#3 lore raw

PATCH 3/36 drm/amd/display: Add dcn401 DIG fifo enable/disable

In reply to Hamza Mahfooz

From: Relja Vojvodic <[email protected]>

[Why]
Found while hotplugging MST daisy chain displays. Changing dispclk during this sequence caused SMU hang due to DIG fifo not being disabled correctly (caused by missing functions).

[How]
Adding disable/enable DIG fifo functions for dcn401

---
 .../gpu/drm/amd/display/dc/dcn35/dcn35_dio_stream_encoder.c | 4 ++--
 .../gpu/drm/amd/display/dc/dcn35/dcn35_dio_stream_encoder.h | 6 ++++++
 .../drm/amd/display/dc/dcn401/dcn401_dio_stream_encoder.c   | 4 +++-
 3 files changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dio_stream_encoder.c +2 -2
index 1325db3a4ed0..6a179e5ab417 100644
@@ -392,7 +392,7 @@ static void enc35_reset_fifo(struct stream_encoder *enc, bool reset)
 		udelay(10);
 }
 
-static void enc35_disable_fifo(struct stream_encoder *enc)
+void enc35_disable_fifo(struct stream_encoder *enc)
 {
 	struct dcn10_stream_encoder *enc1 = DCN10STRENC_FROM_STRENC(enc);
 
@@ -401,7 +401,7 @@ static void enc35_disable_fifo(struct stream_encoder *enc)
 	REG_UPDATE(DIG_FE_CLK_CNTL, DIG_FE_CLK_EN, 0);
 }
 
-static void enc35_enable_fifo(struct stream_encoder *enc)
+void enc35_enable_fifo(struct stream_encoder *enc)
 {
 	struct dcn10_stream_encoder *enc1 = DCN10STRENC_FROM_STRENC(enc);
 
drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dio_stream_encoder.h +6 -0
index 1212fcee38f2..ddb33fdfb4ee 100644
@@ -322,5 +322,11 @@ void enc3_dp_set_dsc_pps_info_packet(
 	uint8_t *dsc_packed_pps,
 	bool immediate_update);
 
+void enc35_disable_fifo(
+	struct stream_encoder *enc);
+
+void enc35_enable_fifo(
+	struct stream_encoder *enc);
+
 
 #endif /* __DC_DIO_STREAM_ENCODER_DCN35_H__ */
drivers/gpu/drm/amd/display/dc/dcn401/dcn401_dio_stream_encoder.c +3 -1
index 2ebfca4769aa..0a27e0942a12 100644
@@ -27,6 +27,7 @@
 #include "dc_bios_types.h"
 #include "dcn30/dcn30_dio_stream_encoder.h"
 #include "dcn32/dcn32_dio_stream_encoder.h"
+#include "dcn35/dcn35_dio_stream_encoder.h"
 
 #include "dcn401_dio_stream_encoder.h"
 #include "reg_helper.h"
@@ -764,7 +765,8 @@ static const struct stream_encoder_funcs dcn401_str_enc_funcs = {
 	.enable_stream = enc401_stream_encoder_enable,
 
 	.set_input_mode = enc401_set_dig_input_mode,
-	.enable_fifo = enc32_enable_fifo,
+	.enable_fifo = enc35_enable_fifo,
+	.disable_fifo = enc35_disable_fifo,
 	.map_stream_to_link = enc401_stream_encoder_map_to_link,
 };
 
Signature · 1 line
2.45.1
#4 lore raw

PATCH 4/36 Revert "drm/amd/display: workaround for oled eDP not lighting up on DCN401"

In reply to Hamza Mahfooz

From: Joshua Aberback <[email protected]>

This reverts commit e296c84e7d0561ed626591e1cf9b71a7ba0133f4.

A proper fix for this issue has been implemented in DMUB FW. So, no need to keep the workaround.

---
 drivers/gpu/drm/amd/display/dc/dc.h                            | 1 -
 .../drm/amd/display/dc/link/protocols/link_edp_panel_control.c | 3 ---
 .../gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c   | 1 -
 3 files changed, 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dc.h +0 -1
index 35ca38ea2efa..b9c67bac7beb 100644
@@ -1045,7 +1045,6 @@ struct dc_debug_options {
 	unsigned int force_easf;
 	unsigned int force_sharpness;
 	unsigned int force_lls;
-	bool edp_oled_no_backlight_enable;
 };
 
 
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +0 -3
index b0e17064a960..455b85adec28 100644
@@ -248,9 +248,6 @@ bool edp_backlight_enable_aux(struct dc_link *link, bool enable)
 		link->connector_signal != SIGNAL_TYPE_DISPLAY_PORT))
 		return false;
 
-	if (link->dc->debug.edp_oled_no_backlight_enable && link->dpcd_sink_ext_caps.bits.oled)
-		return true;
-
 	if (core_link_write_dpcd(link, DP_SOURCE_BACKLIGHT_ENABLE,
 		&backlight_enable, 1) != DC_OK)
 		return false;
drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c +0 -1
index d78dc63f82fd..74fb21b88f12 100644
@@ -731,7 +731,6 @@ static const struct dc_debug_options debug_defaults_drv = {
 		}
 	},
 	.force_cositing = CHROMA_COSITING_TOPLEFT + 1,
-	.edp_oled_no_backlight_enable = true,
 };
 
 static struct dce_aux *dcn401_aux_engine_create(
Signature · 1 line
2.45.1
#5 lore raw

PATCH 5/36 drm/amd/display: Remove redundant condition with DEADCODE

In reply to Hamza Mahfooz

From: Ivan Lipski <[email protected]>

[WHY]
Coverity analysis flagged this condition as DEADCODE since the variable 'req128_c' is always false, thus the condition is never true.

[HOW]
Remove the condition.

---
 .../gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c  | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c +0 -3
index 618f4b682ab1..708e1632170d 100644
@@ -297,9 +297,6 @@ static void handle_det_buf_split(
 
 		if (swath_height_c > 0)
 			log2_swath_height_c = dml_log2(swath_height_c);
-
-		if (req128_c && log2_swath_height_c > 0)
-			log2_swath_height_c -= 1;
 	}
 
 	rq_param->dlg.rq_l.swath_height = 1 << log2_swath_height_l;
Signature · 1 line
2.45.1
#6 lore raw

PATCH 6/36 drm/amd/display: Remove redundant condition in VBA 314 func

In reply to Hamza Mahfooz

From: Ivan Lipski <[email protected]>

[WHY]
Coverity analysis this conditional code as DEADCODE. The conditional statement is never true since 'MacroTileSizeBytes' is either 256 or 65536. Thus, the code inside is the conditional statement is never reached.

[HOW]
Removed the conditional statement.

---
 .../drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c | 9 ---------
 1 file changed, 9 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c +0 -9
index f52b9e3d2bee..cb50c475746b 100644
@@ -1941,15 +1941,6 @@ static unsigned int CalculateVMAndRowBytes(
 		*PixelPTEReqWidth = 32768.0 / BytePerPixel;
 		*PTERequestSize = 64;
 		FractionOfPTEReturnDrop = 0;
-	} else if (MacroTileSizeBytes == 4096) {
-		PixelPTEReqHeightPTEs = 1;
-		*PixelPTEReqHeight = MacroTileHeight;
-		*PixelPTEReqWidth = 8 * *MacroTileWidth;
-		*PTERequestSize = 64;
-		if (ScanDirection != dm_vert)
-			FractionOfPTEReturnDrop = 0;
-		else
-			FractionOfPTEReturnDrop = 7 / 8;
 	} else if (GPUVMMinPageSize == 4 && MacroTileSizeBytes > 4096) {
 		PixelPTEReqHeightPTEs = 16;
 		*PixelPTEReqHeight = 16 * BlockHeight256Bytes;
Signature · 1 line
2.45.1
#7 lore raw

PATCH 7/36 drm/amd/display: fix minor coding errors where dml21 phase 5 uses wrong variables

In reply to Hamza Mahfooz

From: Wenjing Liu <[email protected]>

There is a coding error which causes incorrect variables to be assigned in DML21 phase 5.

---
 .../gpu/drm/amd/display/dc/dml2/dml21/src/dml2_top/dml_top.c  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_top/dml_top.c +2 -2
index 1142fdade334..6f334fdc6eb8 100644
@@ -259,7 +259,7 @@ bool dml2_build_mode_programming(struct dml2_build_mode_programming_in_out *in_o
 	/*
 	* Phase 5: Optimize for Stutter
 	*/
-	memset(&l->vmin_phase, 0, sizeof(struct optimization_phase_params));
+	memset(&l->stutter_phase, 0, sizeof(struct optimization_phase_params));
 	l->stutter_phase.dml = dml;
 	l->stutter_phase.display_config = &l->base_display_config_with_meta;
 	l->stutter_phase.init_function = dml2_top_optimization_init_function_stutter;
@@ -272,7 +272,7 @@ bool dml2_build_mode_programming(struct dml2_build_mode_programming_in_out *in_o
 
 	if (stutter_success) {
 		memcpy(&l->base_display_config_with_meta, &l->optimized_display_config_with_meta, sizeof(struct display_configuation_with_meta));
-		l->base_display_config_with_meta.stage4.success = true;
+		l->base_display_config_with_meta.stage5.success = true;
 	}
 
 	/*
Signature · 1 line
2.45.1
#8 lore raw

PATCH 8/36 drm/amd/display: On clock init, maintain DISPCLK freq

In reply to Hamza Mahfooz

From: Chris Park <[email protected]>

[Why]
On init if a display is connected, we need to maintain the DISPCLK frequency Even though DPG_EN=1, the display still requires the correct timing or it could cause audio corruption (if DISPCLK freq is reduced).

[How]
Read the current DISPCLK freq and request the same value to ensure the timing is valid and unchanged.

---
 .../display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c  | 17 +++++++++++++++++
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c   | 11 ++++++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c +17 -0
index cd1c30fa783a..70f06a7c882e 100644
@@ -1459,6 +1459,22 @@ static int dcn401_get_dtb_ref_freq_khz(struct clk_mgr *clk_mgr_base)
 	return dtb_ref_clk_khz;
 }
 
+static int dcn401_get_dispclk_from_dentist(struct clk_mgr *clk_mgr_base)
+{
+	struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
+	uint32_t dispclk_wdivider;
+	int disp_divider;
+
+	REG_GET(DENTIST_DISPCLK_CNTL, DENTIST_DISPCLK_WDIVIDER, &dispclk_wdivider);
+	disp_divider = dentist_get_divider_from_did(dispclk_wdivider);
+
+	/* Return DISPCLK freq in Khz */
+	if (disp_divider)
+		return (DENTIST_DIVIDER_RANGE_SCALE_FACTOR * clk_mgr->base.dentist_vco_freq_khz) / disp_divider;
+
+	return 0;
+}
+
 static struct clk_mgr_funcs dcn401_funcs = {
 		.get_dp_ref_clk_frequency = dce12_get_dp_ref_freq_khz,
 		.get_dtb_ref_clk_frequency = dcn401_get_dtb_ref_freq_khz,
@@ -1472,6 +1488,7 @@ static struct clk_mgr_funcs dcn401_funcs = {
 		.are_clock_states_equal = dcn401_are_clock_states_equal,
 		.enable_pme_wa = dcn401_enable_pme_wa,
 		.is_smu_present = dcn401_is_smu_present,
+		.get_dispclk_from_dentist = dcn401_get_dispclk_from_dentist,
 };
 
 struct clk_mgr_internal *dcn401_clk_mgr_construct(
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +10 -1
index 4d0c01e866be..e7d6d987e3d3 100644
@@ -57,7 +57,16 @@ static void dcn401_initialize_min_clocks(struct dc *dc)
 	clocks->socclk_khz = dc->clk_mgr->bw_params->clk_table.entries[0].socclk_mhz * 1000;
 	clocks->dramclk_khz = dc->clk_mgr->bw_params->clk_table.entries[0].memclk_mhz * 1000;
 	clocks->dppclk_khz = dc->clk_mgr->bw_params->clk_table.entries[0].dppclk_mhz * 1000;
-	clocks->dispclk_khz = dc->clk_mgr->bw_params->clk_table.entries[0].dispclk_mhz * 1000;
+	if (dc->debug.disable_boot_optimizations) {
+		clocks->dispclk_khz = dc->clk_mgr->bw_params->clk_table.entries[0].dispclk_mhz * 1000;
+	} else {
+		/* Even though DPG_EN = 1 for the connected display, it still requires the
+		 * correct timing so we cannot set DISPCLK to min freq or it could cause
+		 * audio corruption. Read current DISPCLK from DENTIST and request the same
+		 * freq to ensure that the timing is valid and unchanged.
+		 */
+		clocks->dispclk_khz = dc->clk_mgr->funcs->get_dispclk_from_dentist(dc->clk_mgr);
+	}
 	clocks->ref_dtbclk_khz = dc->clk_mgr->bw_params->clk_table.entries[0].dtbclk_mhz * 1000;
 	clocks->fclk_p_state_change_support = true;
 	clocks->p_state_change_support = true;
Signature · 1 line
2.45.1
#9 lore raw

PATCH 9/36 drm/amd/display: Refactor DCN3X into component folder

In reply to Hamza Mahfooz

From: Mounika Adhuri <[email protected]>

[why]
Move DCN3X files to unique component folder.

[how]
Create respective component folder in dc, move the DCN3X files into corresponding new folders and made appropriate changes for compilation in Makefiles.

---
 drivers/gpu/drm/amd/display/Makefile          |  7 +++
 drivers/gpu/drm/amd/display/dc/Makefile       |  6 +-
 drivers/gpu/drm/amd/display/dc/dcn32/Makefile | 19 ------
 .../gpu/drm/amd/display/dc/dcn321/Makefile    | 17 -----
 drivers/gpu/drm/amd/display/dc/dcn35/Makefile | 19 ------
 drivers/gpu/drm/amd/display/dc/dio/Makefile   | 63 +++++++++++++++++++
 .../{ => dio}/dcn32/dcn32_dio_link_encoder.c  |  0
 .../{ => dio}/dcn32/dcn32_dio_link_encoder.h  |  0
 .../dcn32/dcn32_dio_stream_encoder.c          |  0
 .../dcn32/dcn32_dio_stream_encoder.h          |  0
 .../dcn321/dcn321_dio_link_encoder.c          |  0
 .../dcn321/dcn321_dio_link_encoder.h          |  0
 .../{ => dio}/dcn35/dcn35_dio_link_encoder.c  |  0
 .../{ => dio}/dcn35/dcn35_dio_link_encoder.h  |  0
 .../dcn35/dcn35_dio_stream_encoder.c          |  0
 .../dcn35/dcn35_dio_stream_encoder.h          |  0
 .../dcn401/dcn401_dio_link_encoder.c          |  0
 .../dcn401/dcn401_dio_link_encoder.h          |  0
 .../dcn401/dcn401_dio_stream_encoder.c        |  0
 .../dcn401/dcn401_dio_stream_encoder.h        |  0
 drivers/gpu/drm/amd/display/dc/dwb/Makefile   | 37 +++++++++++
 .../display/dc/{ => dwb}/dcn35/dcn35_dwb.c    |  0
 .../display/dc/{ => dwb}/dcn35/dcn35_dwb.h    |  0
 drivers/gpu/drm/amd/display/dc/hpo/Makefile   | 35 +++++++++++
 .../dcn32/dcn32_hpo_dp_link_encoder.c         |  0
 .../dcn32/dcn32_hpo_dp_link_encoder.h         |  0
 .../gpu/drm/amd/display/dc/mmhubbub/Makefile  | 45 +++++++++++++
 .../dc/{ => mmhubbub}/dcn32/dcn32_mmhubbub.c  |  0
 .../dc/{ => mmhubbub}/dcn32/dcn32_mmhubbub.h  |  0
 .../dc/{ => mmhubbub}/dcn35/dcn35_mmhubbub.c  |  0
 .../dc/{ => mmhubbub}/dcn35/dcn35_mmhubbub.h  |  0
 drivers/gpu/drm/amd/display/dc/mpc/Makefile   | 45 +++++++++++++
 .../display/dc/{ => mpc}/dcn32/dcn32_mpc.c    |  0
 .../display/dc/{ => mpc}/dcn32/dcn32_mpc.h    |  0
 .../display/dc/{ => mpc}/dcn401/dcn401_mpc.c  |  0
 .../display/dc/{ => mpc}/dcn401/dcn401_mpc.h  |  0
 drivers/gpu/drm/amd/display/dc/opp/Makefile   | 35 +++++++++++
 .../display/dc/{ => opp}/dcn35/dcn35_opp.c    |  0
 .../display/dc/{ => opp}/dcn35/dcn35_opp.h    |  0
 drivers/gpu/drm/amd/display/dc/pg/Makefile    | 35 +++++++++++
 .../display/dc/{ => pg}/dcn35/dcn35_pg_cntl.c |  0
 .../display/dc/{ => pg}/dcn35/dcn35_pg_cntl.h |  0
 .../gpu/drm/amd/display/dc/resource/Makefile  |  2 +-
 .../dcn32/dcn32_resource_helpers.c            |  0
 44 files changed, 304 insertions(+), 61 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dcn32/Makefile
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dcn321/Makefile
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dcn35/Makefile
 create mode 100644 drivers/gpu/drm/amd/display/dc/dio/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn32/dcn32_dio_link_encoder.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn32/dcn32_dio_link_encoder.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn32/dcn32_dio_stream_encoder.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn32/dcn32_dio_stream_encoder.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn321/dcn321_dio_link_encoder.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn321/dcn321_dio_link_encoder.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn35/dcn35_dio_link_encoder.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn35/dcn35_dio_link_encoder.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn35/dcn35_dio_stream_encoder.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn35/dcn35_dio_stream_encoder.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn401/dcn401_dio_link_encoder.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn401/dcn401_dio_link_encoder.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn401/dcn401_dio_stream_encoder.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn401/dcn401_dio_stream_encoder.h (100%)
 create mode 100644 drivers/gpu/drm/amd/display/dc/dwb/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => dwb}/dcn35/dcn35_dwb.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => dwb}/dcn35/dcn35_dwb.h (100%)
 create mode 100644 drivers/gpu/drm/amd/display/dc/hpo/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => hpo}/dcn32/dcn32_hpo_dp_link_encoder.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => hpo}/dcn32/dcn32_hpo_dp_link_encoder.h (100%)
 create mode 100644 drivers/gpu/drm/amd/display/dc/mmhubbub/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => mmhubbub}/dcn32/dcn32_mmhubbub.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => mmhubbub}/dcn32/dcn32_mmhubbub.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => mmhubbub}/dcn35/dcn35_mmhubbub.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => mmhubbub}/dcn35/dcn35_mmhubbub.h (100%)
 create mode 100644 drivers/gpu/drm/amd/display/dc/mpc/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => mpc}/dcn32/dcn32_mpc.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => mpc}/dcn32/dcn32_mpc.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => mpc}/dcn401/dcn401_mpc.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => mpc}/dcn401/dcn401_mpc.h (100%)
 create mode 100644 drivers/gpu/drm/amd/display/dc/opp/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => opp}/dcn35/dcn35_opp.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => opp}/dcn35/dcn35_opp.h (100%)
 create mode 100644 drivers/gpu/drm/amd/display/dc/pg/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => pg}/dcn35/dcn35_pg_cntl.c (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => pg}/dcn35/dcn35_pg_cntl.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{ => resource}/dcn32/dcn32_resource_helpers.c (100%)
drivers/gpu/drm/amd/display/Makefile +7 -0
index 8297fbce7749..89d605de0595 100644
@@ -37,6 +37,13 @@ subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dpp
 subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/hubbub
 subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dccg
 subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/hubp
+subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dio
+subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dwb
+subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/hpo
+subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/mmhubbub
+subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/mpc
+subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/opp
+subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/pg
 subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/inc
 subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/freesync
 subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/color
drivers/gpu/drm/amd/display/dc/Makefile +1 -5
index 9c2f932217e4..80069651def3 100644
@@ -22,7 +22,7 @@
 #
 # Makefile for Display Core (dc) component.
 
-DC_LIBS = basics bios dml clk_mgr dce gpio hwss irq link virtual dsc resource optc dpp hubbub dccg hubp
+DC_LIBS = basics bios dml clk_mgr dce gpio hwss irq link virtual dsc resource optc dpp hubbub dccg hubp dio dwb hpo mmhubbub mpc opp pg
 
 ifdef CONFIG_DRM_AMD_DC_FP
 
@@ -36,10 +36,6 @@ DC_LIBS += dcn30
 DC_LIBS += dcn301
 DC_LIBS += dcn31
 DC_LIBS += dcn314
-DC_LIBS += dcn32
-DC_LIBS += dcn321
-DC_LIBS += dcn35
-DC_LIBS += dcn401
 DC_LIBS += dml
 DC_LIBS += dml2
 endif
drivers/gpu/drm/amd/display/dc/dcn32/Makefile deleted +0 -19
deleted file mode 100644
index 2d0eb203ab69..000000000000
@@ -1,19 +0,0 @@
-#
-# (c) Copyright 2022 Advanced Micro Devices, Inc. All the rights reserved
-#
-#  All rights reserved.  This notice is intended as a precaution against
-#  inadvertent publication and does not imply publication or any waiver
-#  of confidentiality.  The year included in the foregoing notice is the
-#  year of creation of the work.
-#
-#  Authors: AMD
-#
-# Makefile for dcn32.
-
-DCN32 = dcn32_mmhubbub.o dcn32_mpc.o \
-		dcn32_dio_stream_encoder.o dcn32_dio_link_encoder.o dcn32_resource_helpers.o \
-		dcn32_hpo_dp_link_encoder.o
-
-AMD_DAL_DCN32 = $(addprefix $(AMDDALPATH)/dc/dcn32/,$(DCN32))
-
-AMD_DISPLAY_FILES += $(AMD_DAL_DCN32)
drivers/gpu/drm/amd/display/dc/dcn321/Makefile deleted +0 -17
deleted file mode 100644
index c195c47f58b4..000000000000
@@ -1,17 +0,0 @@
-#
-# (c) Copyright 2020 Advanced Micro Devices, Inc. All the rights reserved
-#
-#  All rights reserved.  This notice is intended as a precaution against
-#  inadvertent publication and does not imply publication or any waiver
-#  of confidentiality.  The year included in the foregoing notice is the
-#  year of creation of the work.
-#
-#  Authors: AMD
-#
-# Makefile for dcn321.
-
-DCN321 = dcn321_dio_link_encoder.o
-
-AMD_DAL_DCN321 = $(addprefix $(AMDDALPATH)/dc/dcn321/,$(DCN321))
-
-AMD_DISPLAY_FILES += $(AMD_DAL_DCN321)
drivers/gpu/drm/amd/display/dc/dcn35/Makefile deleted +0 -19
deleted file mode 100644
index d0fab60e7cd9..000000000000
@@ -1,19 +0,0 @@
-#
-# (c) Copyright 2022 Advanced Micro Devices, Inc. All the rights reserved
-#
-#  All rights reserved.  This notice is intended as a precaution against
-#  inadvertent publication and does not imply publication or any waiver
-#  of confidentiality.  The year included in the foregoing notice is the
-#  year of creation of the work.
-#
-#  Authors: AMD
-#
-# Makefile for DCN35.
-
-DCN35 = dcn35_dio_stream_encoder.o \
-	dcn35_dio_link_encoder.o \
-	dcn35_mmhubbub.o dcn35_opp.o dcn35_pg_cntl.o dcn35_dwb.o
-
-AMD_DAL_DCN35 = $(addprefix $(AMDDALPATH)/dc/dcn35/,$(DCN35))
-
-AMD_DISPLAY_FILES += $(AMD_DAL_DCN35)
drivers/gpu/drm/amd/display/dc/dio/Makefile new file +63 -0

63 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dio/dcn32/dcn32_dio_link_encoder.c renamed from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dio_link_encoder.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dio_link_encoder.c
rename to drivers/gpu/drm/amd/display/dc/dio/dcn32/dcn32_dio_link_encoder.c
drivers/gpu/drm/amd/display/dc/dio/dcn32/dcn32_dio_link_encoder.h renamed from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dio_link_encoder.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dio_link_encoder.h
rename to drivers/gpu/drm/amd/display/dc/dio/dcn32/dcn32_dio_link_encoder.h
drivers/gpu/drm/amd/display/dc/dio/dcn32/dcn32_dio_stream_encoder.c renamed from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dio_stream_encoder.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dio_stream_encoder.c
rename to drivers/gpu/drm/amd/display/dc/dio/dcn32/dcn32_dio_stream_encoder.c
drivers/gpu/drm/amd/display/dc/dio/dcn32/dcn32_dio_stream_encoder.h renamed from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dio_stream_encoder.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dio_stream_encoder.h
rename to drivers/gpu/drm/amd/display/dc/dio/dcn32/dcn32_dio_stream_encoder.h
drivers/gpu/drm/amd/display/dc/dio/dcn321/dcn321_dio_link_encoder.c renamed from drivers/gpu/drm/amd/display/dc/dcn321/dcn321_dio_link_encoder.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn321/dcn321_dio_link_encoder.c
rename to drivers/gpu/drm/amd/display/dc/dio/dcn321/dcn321_dio_link_encoder.c
drivers/gpu/drm/amd/display/dc/dio/dcn321/dcn321_dio_link_encoder.h renamed from drivers/gpu/drm/amd/display/dc/dcn321/dcn321_dio_link_encoder.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn321/dcn321_dio_link_encoder.h
rename to drivers/gpu/drm/amd/display/dc/dio/dcn321/dcn321_dio_link_encoder.h
drivers/gpu/drm/amd/display/dc/dio/dcn35/dcn35_dio_link_encoder.c renamed from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dio_link_encoder.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dio_link_encoder.c
rename to drivers/gpu/drm/amd/display/dc/dio/dcn35/dcn35_dio_link_encoder.c
drivers/gpu/drm/amd/display/dc/dio/dcn35/dcn35_dio_link_encoder.h renamed from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dio_link_encoder.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dio_link_encoder.h
rename to drivers/gpu/drm/amd/display/dc/dio/dcn35/dcn35_dio_link_encoder.h
drivers/gpu/drm/amd/display/dc/dio/dcn35/dcn35_dio_stream_encoder.c renamed from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dio_stream_encoder.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dio_stream_encoder.c
rename to drivers/gpu/drm/amd/display/dc/dio/dcn35/dcn35_dio_stream_encoder.c
drivers/gpu/drm/amd/display/dc/dio/dcn35/dcn35_dio_stream_encoder.h renamed from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dio_stream_encoder.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dio_stream_encoder.h
rename to drivers/gpu/drm/amd/display/dc/dio/dcn35/dcn35_dio_stream_encoder.h
drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_link_encoder.c renamed from drivers/gpu/drm/amd/display/dc/dcn401/dcn401_dio_link_encoder.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn401/dcn401_dio_link_encoder.c
rename to drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_link_encoder.c
drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_link_encoder.h renamed from drivers/gpu/drm/amd/display/dc/dcn401/dcn401_dio_link_encoder.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn401/dcn401_dio_link_encoder.h
rename to drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_link_encoder.h
drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_stream_encoder.c renamed from drivers/gpu/drm/amd/display/dc/dcn401/dcn401_dio_stream_encoder.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn401/dcn401_dio_stream_encoder.c
rename to drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_stream_encoder.c
drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_stream_encoder.h renamed from drivers/gpu/drm/amd/display/dc/dcn401/dcn401_dio_stream_encoder.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn401/dcn401_dio_stream_encoder.h
rename to drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_stream_encoder.h
drivers/gpu/drm/amd/display/dc/dwb/Makefile new file +37 -0
new file mode 100644
index 000000000000..16f7a454fed9
@@ -0,0 +1,37 @@
+#
+# Copyright 2020 Advanced Micro Devices, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+#
+# Authors: AMD
+#
+#
+
+ifdef CONFIG_DRM_AMD_DC_FP
+###############################################################################
+# DCN35
+###############################################################################
+DWB_DCN35 = dcn35_dwb.o
+
+AMD_DAL_DWB_DCN35 = $(addprefix $(AMDDALPATH)/dc/dwb/dcn35/,$(DWB_DCN35))
+
+AMD_DISPLAY_FILES += $(AMD_DAL_DWB_DCN35)
+
+
+endif
drivers/gpu/drm/amd/display/dc/dwb/dcn35/dcn35_dwb.c renamed from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dwb.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dwb.c
rename to drivers/gpu/drm/amd/display/dc/dwb/dcn35/dcn35_dwb.c
drivers/gpu/drm/amd/display/dc/dwb/dcn35/dcn35_dwb.h renamed from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dwb.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dwb.h
rename to drivers/gpu/drm/amd/display/dc/dwb/dcn35/dcn35_dwb.h
drivers/gpu/drm/amd/display/dc/hpo/Makefile new file +35 -0
new file mode 100644
index 000000000000..c248bd86b477
@@ -0,0 +1,35 @@
+#
+# Copyright 2020 Advanced Micro Devices, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+#
+# Authors: AMD
+#
+#
+
+ifdef CONFIG_DRM_AMD_DC_FP
+###############################################################################
+# DCN32
+###############################################################################
+HPO_DCN32 = dcn32_hpo_dp_link_encoder.o
+
+AMD_DAL_HPO_DCN32 = $(addprefix $(AMDDALPATH)/dc/hpo/dcn32/,$(HPO_DCN32))
+
+AMD_DISPLAY_FILES += $(AMD_DAL_HPO_DCN32)
+endif
drivers/gpu/drm/amd/display/dc/hpo/dcn32/dcn32_hpo_dp_link_encoder.c renamed from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hpo_dp_link_encoder.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hpo_dp_link_encoder.c
rename to drivers/gpu/drm/amd/display/dc/hpo/dcn32/dcn32_hpo_dp_link_encoder.c
drivers/gpu/drm/amd/display/dc/hpo/dcn32/dcn32_hpo_dp_link_encoder.h renamed from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hpo_dp_link_encoder.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hpo_dp_link_encoder.h
rename to drivers/gpu/drm/amd/display/dc/hpo/dcn32/dcn32_hpo_dp_link_encoder.h
drivers/gpu/drm/amd/display/dc/mmhubbub/Makefile new file +45 -0

45 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/mmhubbub/dcn32/dcn32_mmhubbub.c renamed from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_mmhubbub.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_mmhubbub.c
rename to drivers/gpu/drm/amd/display/dc/mmhubbub/dcn32/dcn32_mmhubbub.c
drivers/gpu/drm/amd/display/dc/mmhubbub/dcn32/dcn32_mmhubbub.h renamed from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_mmhubbub.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_mmhubbub.h
rename to drivers/gpu/drm/amd/display/dc/mmhubbub/dcn32/dcn32_mmhubbub.h
drivers/gpu/drm/amd/display/dc/mmhubbub/dcn35/dcn35_mmhubbub.c renamed from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_mmhubbub.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_mmhubbub.c
rename to drivers/gpu/drm/amd/display/dc/mmhubbub/dcn35/dcn35_mmhubbub.c
drivers/gpu/drm/amd/display/dc/mmhubbub/dcn35/dcn35_mmhubbub.h renamed from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_mmhubbub.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_mmhubbub.h
rename to drivers/gpu/drm/amd/display/dc/mmhubbub/dcn35/dcn35_mmhubbub.h
drivers/gpu/drm/amd/display/dc/mpc/Makefile new file +45 -0

45 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/mpc/dcn32/dcn32_mpc.c renamed from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_mpc.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_mpc.c
rename to drivers/gpu/drm/amd/display/dc/mpc/dcn32/dcn32_mpc.c
drivers/gpu/drm/amd/display/dc/mpc/dcn32/dcn32_mpc.h renamed from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_mpc.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_mpc.h
rename to drivers/gpu/drm/amd/display/dc/mpc/dcn32/dcn32_mpc.h
drivers/gpu/drm/amd/display/dc/mpc/dcn401/dcn401_mpc.c renamed from drivers/gpu/drm/amd/display/dc/dcn401/dcn401_mpc.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn401/dcn401_mpc.c
rename to drivers/gpu/drm/amd/display/dc/mpc/dcn401/dcn401_mpc.c
drivers/gpu/drm/amd/display/dc/mpc/dcn401/dcn401_mpc.h renamed from drivers/gpu/drm/amd/display/dc/dcn401/dcn401_mpc.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn401/dcn401_mpc.h
rename to drivers/gpu/drm/amd/display/dc/mpc/dcn401/dcn401_mpc.h
drivers/gpu/drm/amd/display/dc/opp/Makefile new file +35 -0
new file mode 100644
index 000000000000..fbfb3c3ad819
@@ -0,0 +1,35 @@
+#
+# Copyright 2020 Advanced Micro Devices, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+#
+# Authors: AMD
+#
+#
+
+ifdef CONFIG_DRM_AMD_DC_FP
+###############################################################################
+# DCN35
+###############################################################################
+OPP_DCN35 = dcn35_opp.o
+
+AMD_DAL_OPP_DCN35 = $(addprefix $(AMDDALPATH)/dc/opp/dcn35/,$(OPP_DCN35))
+
+AMD_DISPLAY_FILES += $(AMD_DAL_OPP_DCN35)
+endif
drivers/gpu/drm/amd/display/dc/opp/dcn35/dcn35_opp.c renamed from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_opp.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_opp.c
rename to drivers/gpu/drm/amd/display/dc/opp/dcn35/dcn35_opp.c
drivers/gpu/drm/amd/display/dc/opp/dcn35/dcn35_opp.h renamed from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_opp.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_opp.h
rename to drivers/gpu/drm/amd/display/dc/opp/dcn35/dcn35_opp.h
drivers/gpu/drm/amd/display/dc/pg/Makefile new file +35 -0
new file mode 100644
index 000000000000..ec11d3157a57
@@ -0,0 +1,35 @@
+#
+# Copyright 2020 Advanced Micro Devices, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+#
+# Authors: AMD
+#
+#
+
+ifdef CONFIG_DRM_AMD_DC_FP
+###############################################################################
+# DCN35
+###############################################################################
+PG_DCN35 = dcn35_pg_cntl.o
+
+AMD_DAL_PG_DCN35 = $(addprefix $(AMDDALPATH)/dc/pg/dcn35/,$(PG_DCN35))
+
+AMD_DISPLAY_FILES += $(AMD_DAL_PG_DCN35)
+endif
drivers/gpu/drm/amd/display/dc/pg/dcn35/dcn35_pg_cntl.c renamed from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_pg_cntl.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_pg_cntl.c
rename to drivers/gpu/drm/amd/display/dc/pg/dcn35/dcn35_pg_cntl.c
drivers/gpu/drm/amd/display/dc/pg/dcn35/dcn35_pg_cntl.h renamed from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_pg_cntl.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn35/dcn35_pg_cntl.h
rename to drivers/gpu/drm/amd/display/dc/pg/dcn35/dcn35_pg_cntl.h
drivers/gpu/drm/amd/display/dc/resource/Makefile +1 -1
index abc2405b7167..4860bb2531a1 100644
@@ -166,7 +166,7 @@ AMD_DISPLAY_FILES += $(AMD_DAL_RESOURCE_DCN316)
 
 ###############################################################################
 
-RESOURCE_DCN32 = dcn32_resource.o
+RESOURCE_DCN32 = dcn32_resource.o dcn32_resource_helpers.o
 
 AMD_DAL_RESOURCE_DCN32 = $(addprefix $(AMDDALPATH)/dc/resource/dcn32/,$(RESOURCE_DCN32))
 
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource_helpers.c renamed from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c
rename to drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource_helpers.c
Signature · 1 line
2.45.1
#10 lore raw

PATCH 10/36 drm/amd/display: Attempt to avoid empty TUs when endpoint is DPIA

In reply to Hamza Mahfooz

From: Michael Strauss <[email protected]>

[WHY]
Empty SST TUs are illegal to transmit over a USB4 DP tunnel. Current policy is to configure stream encoder to pack 2 pixels per pclk even when ODM combine is not in use, allowing seamless dynamic ODM reconfiguration. However, in extreme edge cases where average pixel count per TU is less than 2, this can lead to unexpected empty TU generation during compliance testing. For example, VIC 1 with a 1xHBR3 link configuration will average 1.98 pix/TU.

[HOW]
Calculate average pixel count per TU, and block 2 pixels per clock if endpoint is a DPIA tunnel and pixel clock is low enough that we will never require 2:1 ODM combine.

---
 .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c   | 72 +++++++++++++++++++
 .../amd/display/dc/hwss/dcn35/dcn35_hwseq.h   |  2 +
 .../amd/display/dc/hwss/dcn35/dcn35_init.c    |  2 +-
 3 files changed, 75 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +72 -0
index 4f87316e1318..0602921399cd 100644
@@ -1529,3 +1529,75 @@ void dcn35_set_long_vblank(struct pipe_ctx **pipe_ctx,
 		}
 	}
 }
+
+static bool should_avoid_empty_tu(struct pipe_ctx *pipe_ctx)
+{
+	/* Calculate average pixel count per TU, return false if under ~2.00 to
+	 * avoid empty TUs. This is only required for DPIA tunneling as empty TUs
+	 * are legal to generate for native DP links. Assume TU size 64 as there
+	 * is currently no scenario where it's reprogrammed from HW default.
+	 * MTPs have no such limitation, so this does not affect MST use cases.
+	 */
+	unsigned int pix_clk_mhz;
+	unsigned int symclk_mhz;
+	unsigned int avg_pix_per_tu_x1000;
+	unsigned int tu_size_bytes = 64;
+	struct dc_crtc_timing *timing = &pipe_ctx->stream->timing;
+	struct dc_link_settings *link_settings = &pipe_ctx->link_config.dp_link_settings;
+	const struct dc *dc = pipe_ctx->stream->link->dc;
+
+	if (pipe_ctx->stream->link->ep_type != DISPLAY_ENDPOINT_USB4_DPIA)
+		return false;
+
+	// Not necessary for MST configurations
+	if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
+		return false;
+
+	pix_clk_mhz = timing->pix_clk_100hz / 10000;
+
+	// If this is true, can't block due to dynamic ODM
+	if (pix_clk_mhz > dc->clk_mgr->bw_params->clk_table.entries[0].dispclk_mhz)
+		return false;
+
+	switch (link_settings->link_rate) {
+	case LINK_RATE_LOW:
+		symclk_mhz = 162;
+		break;
+	case LINK_RATE_HIGH:
+		symclk_mhz = 270;
+		break;
+	case LINK_RATE_HIGH2:
+		symclk_mhz = 540;
+		break;
+	case LINK_RATE_HIGH3:
+		symclk_mhz = 810;
+		break;
+	default:
+		// We shouldn't be tunneling any other rates, something is wrong
+		ASSERT(0);
+		return false;
+	}
+
+	avg_pix_per_tu_x1000 = (1000 * pix_clk_mhz * tu_size_bytes)
+		/ (symclk_mhz * link_settings->lane_count);
+
+	// Add small empirically-decided margin to account for potential jitter
+	return (avg_pix_per_tu_x1000 < 2020);
+}
+
+bool dcn35_is_dp_dig_pixel_rate_div_policy(struct pipe_ctx *pipe_ctx)
+{
+	struct dc *dc = pipe_ctx->stream->ctx->dc;
+
+	if (!is_h_timing_divisible_by_2(pipe_ctx->stream))
+		return false;
+
+	if (should_avoid_empty_tu(pipe_ctx))
+		return false;
+
+	if (dc_is_dp_signal(pipe_ctx->stream->signal) && !dc->link_srv->dp_is_128b_132b_signal(pipe_ctx) &&
+		dc->debug.enable_dp_dig_pixel_rate_div_policy)
+		return true;
+
+	return false;
+}
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.h +2 -0
index bc05beba5f2c..e27b3609020f 100644
@@ -97,4 +97,6 @@ void dcn35_set_static_screen_control(struct pipe_ctx **pipe_ctx,
 void dcn35_set_long_vblank(struct pipe_ctx **pipe_ctx,
 		int num_pipes, uint32_t v_total_min, uint32_t v_total_max);
 
+bool dcn35_is_dp_dig_pixel_rate_div_policy(struct pipe_ctx *pipe_ctx);
+
 #endif /* __DC_HWSS_DCN35_H__ */
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_init.c +1 -1
index 30e6a6398839..428912f37129 100644
@@ -161,7 +161,7 @@ static const struct hwseq_private_funcs dcn35_private_funcs = {
 	.setup_hpo_hw_control = dcn35_setup_hpo_hw_control,
 	.calculate_dccg_k1_k2_values = dcn32_calculate_dccg_k1_k2_values,
 	.resync_fifo_dccg_dio = dcn314_resync_fifo_dccg_dio,
-	.is_dp_dig_pixel_rate_div_policy = dcn32_is_dp_dig_pixel_rate_div_policy,
+	.is_dp_dig_pixel_rate_div_policy = dcn35_is_dp_dig_pixel_rate_div_policy,
 	.dsc_pg_control = dcn35_dsc_pg_control,
 	.dsc_pg_status = dcn32_dsc_pg_status,
 	.enable_plane = dcn35_enable_plane,
Signature · 1 line
2.45.1
#11 lore raw

PATCH 11/36 drm/amd/display: Add null check to dml21_find_dc_pipes_for_plane

In reply to Hamza Mahfooz

From: Dillon Varone <[email protected]>

When a phantom stream is in the process of being deconstructed, there could be pipes with no associated planes. In that case, ignore the phantom stream entirely when searching for associated pipes.

---
 .../gpu/drm/amd/display/dc/dml2/dml21/dml21_utils.c   | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_utils.c +8 -3
index 4e12810308a4..4166332b5b89 100644
@@ -126,10 +126,15 @@ int dml21_find_dc_pipes_for_plane(const struct dc *in_dc,
 	if (dc_phantom_stream && num_pipes > 0) {
 		dc_phantom_stream_status = dml_ctx->config.callbacks.get_stream_status(context, dc_phantom_stream);
 
-		/* phantom plane will have same index as main */
-		dc_phantom_plane = dc_phantom_stream_status->plane_states[dc_plane_index];
+		if (dc_phantom_stream_status) {
+			/* phantom plane will have same index as main */
+			dc_phantom_plane = dc_phantom_stream_status->plane_states[dc_plane_index];
 
-		dml_ctx->config.callbacks.get_dpp_pipes_for_plane(dc_phantom_plane, &context->res_ctx, dc_phantom_pipes);
+			if (dc_phantom_plane) {
+				/* only care about phantom pipes if they contain the phantom plane */
+				dml_ctx->config.callbacks.get_dpp_pipes_for_plane(dc_phantom_plane, &context->res_ctx, dc_phantom_pipes);
+			}
+		}
 	}
 
 	return num_pipes;
Signature · 1 line
2.45.1
#12 lore raw

PATCH 12/36 drm/amd/display: Send message to notify the DPIA host router bandwidth

In reply to Hamza Mahfooz

From: Sung Joon Kim <[email protected]>

[why]
Tell the system about the current host router bandwidth to be used to measure and calculate the right voltage to be used.

[how]
Send SMU message of each DPIA host router bandwidth.

---
 .../display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c  | 55 +++++++++++++++++++
 .../amd/display/dc/clk_mgr/dcn35/dcn35_smu.c  | 21 ++++++-
 .../amd/display/dc/clk_mgr/dcn35/dcn35_smu.h  |  2 +
 drivers/gpu/drm/amd/display/dc/dc.h           |  3 +
 .../dc/resource/dcn351/dcn351_resource.c      |  1 +
 5 files changed, 81 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c +55 -0
index 6c9b4e6491a5..9a414f49f15a 100644
@@ -218,6 +218,57 @@ static void dcn35_update_clocks_update_dpp_dto(struct clk_mgr_internal *clk_mgr,
 		}
 }
 
+static uint8_t get_lowest_dpia_index(const struct dc_link *link)
+{
+	const struct dc *dc_struct = link->dc;
+	uint8_t idx = 0xFF;
+	int i;
+
+	for (i = 0; i < MAX_PIPES * 2; ++i) {
+		if (!dc_struct->links[i] || dc_struct->links[i]->ep_type != DISPLAY_ENDPOINT_USB4_DPIA)
+			continue;
+
+		if (idx > dc_struct->links[i]->link_index)
+			idx = dc_struct->links[i]->link_index;
+	}
+
+	return idx;
+}
+
+static void dcn35_notify_host_router_bw(struct clk_mgr *clk_mgr_base, struct dc_state *context,
+					bool safe_to_lower)
+{
+	struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk;
+	struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
+	uint32_t host_router_bw_kbps[MAX_HOST_ROUTERS_NUM] = { 0 };
+	int i;
+
+	for (i = 0; i < context->stream_count; ++i) {
+		const struct dc_stream_state *stream = context->streams[i];
+		const struct dc_link *link = stream->link;
+		uint8_t lowest_dpia_index = 0, hr_index = 0;
+
+		if (!link)
+			continue;
+
+		lowest_dpia_index = get_lowest_dpia_index(link);
+		if (link->link_index < lowest_dpia_index)
+			continue;
+
+		hr_index = (link->link_index - lowest_dpia_index) / 2;
+		host_router_bw_kbps[hr_index] += dc_bandwidth_in_kbps_from_timing(
+			&stream->timing, dc_link_get_highest_encoding_format(link));
+	}
+
+	for (i = 0; i < MAX_HOST_ROUTERS_NUM; ++i) {
+		new_clocks->host_router_bw_kbps[i] = host_router_bw_kbps[i];
+		if (should_set_clock(safe_to_lower, new_clocks->host_router_bw_kbps[i], clk_mgr_base->clks.host_router_bw_kbps[i])) {
+			clk_mgr_base->clks.host_router_bw_kbps[i] = new_clocks->host_router_bw_kbps[i];
+			dcn35_smu_notify_host_router_bw(clk_mgr, i, new_clocks->host_router_bw_kbps[i]);
+		}
+	}
+}
+
 void dcn35_update_clocks(struct clk_mgr *clk_mgr_base,
 			struct dc_state *context,
 			bool safe_to_lower)
@@ -342,6 +393,10 @@ void dcn35_update_clocks(struct clk_mgr *clk_mgr_base,
 		dcn35_update_clocks_update_dpp_dto(clk_mgr, context, safe_to_lower);
 	}
 
+	// notify PMFW of bandwidth per DPIA tunnel
+	if (dc->debug.notify_dpia_hr_bw)
+		dcn35_notify_host_router_bw(clk_mgr_base, context, safe_to_lower);
+
 	// notify DMCUB of latest clocks
 	memset(&cmd, 0, sizeof(cmd));
 	cmd.notify_clocks.header.type = DMUB_CMD__CLK_MGR;
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_smu.c +20 -1
index 1399b41dfd1c..f6f0e6a33001 100644
@@ -89,7 +89,8 @@
 #define VBIOSSMC_MSG_DisableLSdma                 0x1A ///< Disable LSDMA; only sent by VBIOS
 #define VBIOSSMC_MSG_DpControllerPhyStatus        0x1B ///< Inform PMFW about the pre conditions for turning SLDO2 on/off . bit[0]==1 precondition is met, bit[1-2] are for DPPHY number
 #define VBIOSSMC_MSG_QueryIPS2Support             0x1C ///< Return 1: support; else not supported
-#define VBIOSSMC_Message_Count                    0x1D
+#define VBIOSSMC_MSG_NotifyHostRouterBW           0x1D
+#define VBIOSSMC_Message_Count                    0x1E
 
 #define VBIOSSMC_Status_BUSY                      0x0
 #define VBIOSSMC_Result_OK                        0x1
@@ -98,6 +99,14 @@
 #define VBIOSSMC_Result_CmdRejectedPrereq         0xFD
 #define VBIOSSMC_Result_CmdRejectedBusy           0xFC
 
+union dcn35_dpia_host_router_bw {
+	struct {
+		uint32_t hr_id : 16;
+		uint32_t bw_mbps : 16;
+	} bits;
+	uint32_t all;
+};
+
 /*
  * Function to be used instead of REG_WAIT macro because the wait ends when
  * the register is NOT EQUAL to zero, and because `the translation in msg_if.h
@@ -487,3 +496,13 @@ int dcn35_smu_get_ips_supported(struct clk_mgr_internal *clk_mgr)
 	//smu_print("%s: VBIOSSMC_MSG_QueryIPS2Support return = %x\n", __func__, retv);
 	return retv;
 }
+
+void dcn35_smu_notify_host_router_bw(struct clk_mgr_internal *clk_mgr, uint32_t hr_id, uint32_t bw_kbps)
+{
+	union dcn35_dpia_host_router_bw msg_data = { 0 };
+
+	msg_data.bits.hr_id = hr_id;
+	msg_data.bits.bw_mbps = bw_kbps / 1000;
+
+	dcn35_smu_send_msg_with_param(clk_mgr, VBIOSSMC_MSG_NotifyHostRouterBW, msg_data.all);
+}
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_smu.h +2 -0
index 06cd3cc6d36e..3fae13c73934 100644
@@ -198,4 +198,6 @@ int dcn35_smu_exit_low_power_state(struct clk_mgr_internal *clk_mgr);
 int dcn35_smu_get_ips_supported(struct clk_mgr_internal *clk_mgr);
 int dcn35_smu_get_dtbclk(struct clk_mgr_internal *clk_mgr);
 int dcn35_smu_get_dprefclk(struct clk_mgr_internal *clk_mgr);
+void dcn35_smu_notify_host_router_bw(struct clk_mgr_internal *clk_mgr, uint32_t hr_id, uint32_t bw_kbps);
+
 #endif /* DAL_DC_35_SMU_H_ */
drivers/gpu/drm/amd/display/dc/dc.h +3 -0
index b9c67bac7beb..fa4e6b09409e 100644
@@ -62,6 +62,7 @@ struct dmub_notification;
 #define MAX_STREAMS 6
 #define MIN_VIEWPORT_SIZE 12
 #define MAX_NUM_EDP 2
+#define MAX_HOST_ROUTERS_NUM 2
 
 /* Display Core Interfaces */
 struct dc_versions {
@@ -594,6 +595,7 @@ struct dc_clocks {
 	bool prev_p_state_change_support;
 	bool fclk_prev_p_state_change_support;
 	int num_ways;
+	int host_router_bw_kbps[MAX_HOST_ROUTERS_NUM];
 
 	/*
 	 * @fw_based_mclk_switching
@@ -1045,6 +1047,7 @@ struct dc_debug_options {
 	unsigned int force_easf;
 	unsigned int force_sharpness;
 	unsigned int force_lls;
+	bool notify_dpia_hr_bw;
 };
 
 
drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c +1 -0
index 30b40ba0c324..4c5e722baa3a 100644
@@ -765,6 +765,7 @@ static const struct dc_debug_options debug_defaults_drv = {
 	.ips2_entry_delay_us = 800,
 	.disable_dmub_reallow_idle = false,
 	.static_screen_wait_frames = 2,
+	.notify_dpia_hr_bw = true,
 };
 
 static const struct dc_panel_config panel_config_defaults = {
Signature · 1 line
2.45.1
#13 lore raw

PATCH 13/36 drm/amd/display: Explicitly extend unsigned 16 bit to 64 bit

In reply to Hamza Mahfooz

From: Alex Hung <[email protected]>

Coverity reports sign extention defects as below:

Suspicious implicit sign extension: mode->htotal with type u16 ... to int (32 bits, signed), then sign-extended to type unsigned long (64 bits, unsigned). If mode->htotal * mode->vtotal is greater than 0x7FFFFFFF, the upper bits of the result will all be 1.

Cast it to unsigned long to avoid possible overflow.

This fixes 4 SIGN_EXTENSION issues reported by Coverity.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -2
index 0940c2facb30..4de50b297035 100644
@@ -977,8 +977,8 @@ static void amdgpu_dm_fbc_init(struct drm_connector *connector)
 
 
 	list_for_each_entry(mode, &connector->modes, head) {
-		if (max_size < mode->htotal * mode->vtotal)
-			max_size = mode->htotal * mode->vtotal;
+		if (max_size < (unsigned long) mode->htotal * mode->vtotal)
+			max_size = (unsigned long) mode->htotal * mode->vtotal;
 	}
 
 	if (max_size) {
Signature · 1 line
2.45.1
#14 lore raw

PATCH 14/36 drm/amd/display: Add null checker before passing variables

In reply to Hamza Mahfooz

From: Alex Hung <[email protected]>

Checks null pointer before passing variables to functions.

This fixes 3 NULL_RETURNS issues reported by Coverity.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +6 -3
index 4de50b297035..48a9243ada7d 100644
@@ -2875,7 +2875,8 @@ static int dm_suspend(void *handle)
 
 		dm->cached_dc_state = dc_state_create_copy(dm->dc->current_state);
 
-		dm_gpureset_toggle_interrupts(adev, dm->cached_dc_state, false);
+		if (dm->cached_dc_state)
+			dm_gpureset_toggle_interrupts(adev, dm->cached_dc_state, false);
 
 		amdgpu_dm_commit_zero_streams(dm->dc);
 
@@ -7102,7 +7103,8 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
 		aconnector->dc_sink = aconnector->dc_link->local_sink ?
 		aconnector->dc_link->local_sink :
 		aconnector->dc_em_sink;
-		dc_sink_retain(aconnector->dc_sink);
+		if (aconnector->dc_sink)
+			dc_sink_retain(aconnector->dc_sink);
 	}
 }
 
@@ -7929,7 +7931,8 @@ static int amdgpu_dm_connector_get_modes(struct drm_connector *connector)
 				drm_add_modes_noedid(connector, 1920, 1080);
 	} else {
 		amdgpu_dm_connector_ddc_get_modes(connector, edid);
-		amdgpu_dm_connector_add_common_modes(encoder, connector);
+		if (encoder)
+			amdgpu_dm_connector_add_common_modes(encoder, connector);
 		amdgpu_dm_connector_add_freesync_modes(connector, edid);
 	}
 	amdgpu_dm_fbc_init(connector);
Signature · 1 line
2.45.1
#15 lore raw

PATCH 15/36 drm/amd/display: Check BIOS images before it is used

In reply to Hamza Mahfooz

From: Alex Hung <[email protected]>

BIOS images may fail to load and null checks are added before they are used.

This fixes 6 NULL_RETURNS issues reported by Coverity.

---
 drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +14 -0
index 25fe1a124029..3bacf470f7c5 100644
@@ -665,6 +665,9 @@ static enum bp_result get_ss_info_v3_1(
 	ss_table_header_include = ((ATOM_ASIC_INTERNAL_SS_INFO_V3 *) bios_get_image(&bp->base,
 				DATA_TABLES(ASIC_InternalSS_Info),
 				struct_size(ss_table_header_include, asSpreadSpectrum, 1)));
+	if (!ss_table_header_include)
+		return BP_RESULT_UNSUPPORTED;
+
 	table_size =
 		(le16_to_cpu(ss_table_header_include->sHeader.usStructureSize)
 				- sizeof(ATOM_COMMON_TABLE_HEADER))
@@ -1034,6 +1037,8 @@ static enum bp_result get_ss_info_from_internal_ss_info_tbl_V2_1(
 				&bp->base,
 				DATA_TABLES(ASIC_InternalSS_Info),
 				struct_size(header, asSpreadSpectrum, 1)));
+	if (!header)
+		return result;
 
 	memset(info, 0, sizeof(struct spread_spectrum_info));
 
@@ -1107,6 +1112,8 @@ static enum bp_result get_ss_info_from_ss_info_table(
 	get_atom_data_table_revision(header, &revision);
 
 	tbl = GET_IMAGE(ATOM_SPREAD_SPECTRUM_INFO, DATA_TABLES(SS_Info));
+	if (!tbl)
+		return result;
 
 	if (1 != revision.major || 2 > revision.minor)
 		return result;
@@ -1634,6 +1641,8 @@ static uint32_t get_ss_entry_number_from_ss_info_tbl(
 
 	tbl = GET_IMAGE(ATOM_SPREAD_SPECTRUM_INFO,
 			DATA_TABLES(SS_Info));
+	if (!tbl)
+		return number;
 
 	if (1 != revision.major || 2 > revision.minor)
 		return number;
@@ -1716,6 +1725,8 @@ static uint32_t get_ss_entry_number_from_internal_ss_info_tbl_v2_1(
 				&bp->base,
 				DATA_TABLES(ASIC_InternalSS_Info),
 				struct_size(header_include, asSpreadSpectrum, 1)));
+	if (!header_include)
+		return 0;
 
 	size = (le16_to_cpu(header_include->sHeader.usStructureSize)
 			- sizeof(ATOM_COMMON_TABLE_HEADER))
@@ -1755,6 +1766,9 @@ static uint32_t get_ss_entry_number_from_internal_ss_info_tbl_V3_1(
 	header_include = ((ATOM_ASIC_INTERNAL_SS_INFO_V3 *) bios_get_image(&bp->base,
 				DATA_TABLES(ASIC_InternalSS_Info),
 				struct_size(header_include, asSpreadSpectrum, 1)));
+	if (!header_include)
+		return number;
+
 	size = (le16_to_cpu(header_include->sHeader.usStructureSize) -
 			sizeof(ATOM_COMMON_TABLE_HEADER)) /
 					sizeof(ATOM_ASIC_SS_ASSIGNMENT_V3);
Signature · 1 line
2.45.1
#16 lore raw

PATCH 16/36 drm/amd/display: Skip wbscl_set_scaler_filter if filter is null

In reply to Hamza Mahfooz

From: Alex Hung <[email protected]>

Callers can pass null in filter (i.e. from returned from the function wbscl_get_filter_coeffs_16p) and a null check is added to ensure that is not the case.

This fixes 4 NULL_RETURNS issues reported by Coverity.

---
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dwb_scl.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dwb_scl.c +3 -0
index 994fb732a7cb..a0d437f0ce2b 100644
@@ -690,6 +690,9 @@ static void wbscl_set_scaler_filter(
 	int pair;
 	uint16_t odd_coef, even_coef;
 
+	if (!filter)
+		return;
+
 	for (phase = 0; phase < (NUM_PHASES / 2 + 1); phase++) {
 		for (pair = 0; pair < tap_pairs; pair++) {
 			even_coef = filter[phase * taps + 2 * pair];
Signature · 1 line
2.45.1
#17 lore raw

PATCH 17/36 drm/amd/display: Add null checker before access structs

In reply to Hamza Mahfooz

From: Alex Hung <[email protected]>

Checks null pointer before accessing various structs.

This fixes 5 NULL_RETURNS issues reported by Coverity.

---
 drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_utils.c      | 2 ++
 .../display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c | 5 +++++
 .../gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c   | 2 +-
 .../gpu/drm/amd/display/dc/resource/dcn201/dcn201_resource.c | 4 +++-
 4 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_utils.c +2 -0
index 4166332b5b89..b97d9abfdbc6 100644
@@ -360,6 +360,8 @@ static struct dc_plane_state *dml21_add_phantom_plane(struct dml2_context *dml_c
 	struct dc_plane_state *phantom_plane;
 
 	phantom_plane = dml_ctx->config.svp_pstate.callbacks.create_phantom_plane(dc, context, main_plane);
+	if (!phantom_plane)
+		return NULL;
 
 	phantom_plane->format = main_plane->format;
 	phantom_plane->rotation = main_plane->rotation;
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c +5 -0
index 7272a04b9d1d..00fedc00a735 100644
@@ -1082,12 +1082,17 @@ static bool is_timing_group_schedulable(
 
 	/* init allow start and end lines for timing group */
 	stream_method_fams2_meta = get_per_method_common_meta(pmo, per_stream_pstate_strategy[base_stream_idx], base_stream_idx);
+	if (!stream_method_fams2_meta)
+		return false;
+
 	group_fams2_meta->allow_start_otg_vline = stream_method_fams2_meta->allow_start_otg_vline;
 	group_fams2_meta->allow_end_otg_vline = stream_method_fams2_meta->allow_end_otg_vline;
 	group_fams2_meta->period_us = stream_method_fams2_meta->period_us;
 	for (i = base_stream_idx + 1; i < display_cfg->display_config.num_streams; i++) {
 		if (is_bit_set_in_bitfield(pmo->scratch.pmo_dcn4.synchronized_timing_group_masks[timing_group_idx], i)) {
 			stream_method_fams2_meta = get_per_method_common_meta(pmo, per_stream_pstate_strategy[i], i);
+			if (!stream_method_fams2_meta)
+				continue;
 
 			if (group_fams2_meta->allow_start_otg_vline < stream_method_fams2_meta->allow_start_otg_vline) {
 				/* set group allow start to larger otg vline */
drivers/gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c +1 -1
index f93853d434d2..e783afbbb397 100644
@@ -2628,7 +2628,7 @@ static bool dcn20_resource_construct(
 		ranges.writer_wm_sets[0].max_drain_clk_mhz = PP_SMU_WM_SET_RANGE_CLK_UNCONSTRAINED_MAX;
 
 		/* Notify PP Lib/SMU which Watermarks to use for which clock ranges */
-		if (pool->base.pp_smu->nv_funcs.set_wm_ranges)
+		if (pool->base.pp_smu && pool->base.pp_smu->nv_funcs.set_wm_ranges)
 			pool->base.pp_smu->nv_funcs.set_wm_ranges(&pool->base.pp_smu->nv_funcs.pp_smu, &ranges);
 	}
 
drivers/gpu/drm/amd/display/dc/resource/dcn201/dcn201_resource.c +3 -1
index 070a4efb308b..131d98025bd4 100644
@@ -795,11 +795,13 @@ static struct link_encoder *dcn201_link_encoder_create(
 {
 	struct dcn20_link_encoder *enc20 =
 		kzalloc(sizeof(struct dcn20_link_encoder), GFP_ATOMIC);
-	struct dcn10_link_encoder *enc10 = &enc20->enc10;
+	struct dcn10_link_encoder *enc10;
 
 	if (!enc20)
 		return NULL;
 
+	enc10 = &enc20->enc10;
+
 	dcn201_link_encoder_construct(enc20,
 			enc_init_data,
 			&link_enc_feature,
Signature · 1 line
2.45.1
#18 lore raw

PATCH 18/36 drm/amd/display: mirror case cleanup for cursors

In reply to Hamza Mahfooz

From: Sridevi Arvindekar <[email protected]>

Mirror case unsupported for cursors. So, remove code for mirror case with cursors.

---
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 30 +------------------
 1 file changed, 1 insertion(+), 29 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +1 -29
index e7d6d987e3d3..ef0a42f2933d 100644
@@ -1209,34 +1209,7 @@ void dcn401_set_cursor_position(struct pipe_ctx *pipe_ctx)
 	if (pos_cpy.enable && dcn401_can_pipe_disable_cursor(pipe_ctx))
 		pos_cpy.enable = false;
 
-	if (param.rotation == ROTATION_ANGLE_0) {
-		int recout_width =
-			pipe_ctx->plane_res.scl_data.recout.width;
-		int recout_x =
-			pipe_ctx->plane_res.scl_data.recout.x;
-
-		if (param.mirror) {
-			if (pipe_split_on || odm_combine_on) {
-				if (pos_cpy.x >= recout_width + recout_x) {
-					pos_cpy.x = 2 * recout_width
-						- pos_cpy.x + 2 * recout_x;
-				} else {
-					uint32_t temp_x = pos_cpy.x;
-
-					pos_cpy.x = 2 * recout_x - pos_cpy.x;
-					if (temp_x >= recout_x +
-						(int)hubp->curs_attr.width || pos_cpy.x
-						<= (int)hubp->curs_attr.width +
-						pipe_ctx->plane_state->src_rect.x) {
-						pos_cpy.x = 2 * recout_width - temp_x;
-					}
-				}
-			} else {
-				pos_cpy.x = recout_width - pos_cpy.x + 2 * recout_x;
-			}
-		}
-	} else if (param.rotation == ROTATION_ANGLE_90) {
-	} else if (param.rotation == ROTATION_ANGLE_270) {
+	if (param.rotation == ROTATION_ANGLE_270) {
 		// Swap axis and mirror vertically
 		uint32_t temp_x = pos_cpy.x;
 
@@ -1285,7 +1258,6 @@ void dcn401_set_cursor_position(struct pipe_ctx *pipe_ctx)
 				pos_cpy.x = pipe_ctx->plane_res.scl_data.recout.width + next_odm_width + next_odm_offset - pos_cpy.y;
 				pos_cpy.y = temp_x;
 			}
-		} else {
 		}
 	} else if (param.rotation == ROTATION_ANGLE_180) {
 		// Mirror horizontally and vertically
Signature · 1 line
2.45.1
#19 lore raw

PATCH 19/36 drm/amd/display: Fix NULL pointer dereference for DTN log in DCN401

In reply to Hamza Mahfooz

From: Rodrigo Siqueira <[email protected]>

When users run the command:

cat /sys/kernel/debug/dri/0/amdgpu_dm_dtn_log

The following NULL pointer dereference happens:

[  +0.000003] BUG: kernel NULL pointer dereference, address: NULL
[  +0.000005] #PF: supervisor instruction fetch in kernel mode
[  +0.000002] #PF: error_code(0x0010) - not-present page
[  +0.000002] PGD 0 P4D 0
[  +0.000004] Oops: 0010 [#1] PREEMPT SMP NOPTI
[  +0.000003] RIP: 0010:0x0
[  +0.000008] Code: Unable to access opcode bytes at 0xffffffffffffffd6.
[...]
[  +0.000002] PKRU: 55555554
[  +0.000002] Call Trace:
[  +0.000002]  <TASK>
[  +0.000003]  ? show_regs+0x65/0x70
[  +0.000006]  ? __die+0x24/0x70
[  +0.000004]  ? page_fault_oops+0x160/0x470
[  +0.000006]  ? do_user_addr_fault+0x2b5/0x690
[  +0.000003]  ? prb_read_valid+0x1c/0x30
[  +0.000005]  ? exc_page_fault+0x8c/0x1a0
[  +0.000005]  ? asm_exc_page_fault+0x27/0x30
[  +0.000012]  dcn10_log_color_state+0xf9/0x510 [amdgpu]
[  +0.000306]  ? srso_alias_return_thunk+0x5/0xfbef5
[  +0.000003]  ? vsnprintf+0x2fb/0x600
[  +0.000009]  dcn10_log_hw_state+0xfd0/0xfe0 [amdgpu]
[  +0.000218]  ? __mod_memcg_lruvec_state+0xe8/0x170
[  +0.000008]  ? srso_alias_return_thunk+0x5/0xfbef5
[  +0.000002]  ? debug_smp_processor_id+0x17/0x20
[  +0.000003]  ? srso_alias_return_thunk+0x5/0xfbef5
[  +0.000002]  ? srso_alias_return_thunk+0x5/0xfbef5
[  +0.000002]  ? set_ptes.isra.0+0x2b/0x90
[  +0.000004]  ? srso_alias_return_thunk+0x5/0xfbef5
[  +0.000002]  ? _raw_spin_unlock+0x19/0x40
[  +0.000004]  ? srso_alias_return_thunk+0x5/0xfbef5
[  +0.000002]  ? do_anonymous_page+0x337/0x700
[  +0.000004]  dtn_log_read+0x82/0x120 [amdgpu]
[  +0.000207]  full_proxy_read+0x66/0x90
[  +0.000007]  vfs_read+0xb0/0x340
[  +0.000005]  ? __count_memcg_events+0x79/0xe0
[  +0.000002]  ? srso_alias_return_thunk+0x5/0xfbef5
[  +0.000003]  ? count_memcg_events.constprop.0+0x1e/0x40
[  +0.000003]  ? handle_mm_fault+0xb2/0x370
[  +0.000003]  ksys_read+0x6b/0xf0
[  +0.000004]  __x64_sys_read+0x19/0x20
[  +0.000003]  do_syscall_64+0x60/0x130
[  +0.000004]  entry_SYSCALL_64_after_hwframe+0x6e/0x76
[  +0.000003] RIP: 0033:0x7fdf32f147e2

[...]

This error happens when the color log tries to read the gamut remap information from DCN401 which is not initialized in the dcn401_dpp_funcs which leads to a null pointer dereference. This commit addresses this issue by adding a proper guard to access the gamut_remap callback in case the specific ASIC did not implement this function.

---
 .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c   | 49 ++++++++++---------
 1 file changed, 27 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +27 -22
index de6ee6bf0a88..0bfab66b8038 100644
@@ -289,6 +289,7 @@ static void dcn10_log_color_state(struct dc *dc,
 {
 	struct dc_context *dc_ctx = dc->ctx;
 	struct resource_pool *pool = dc->res_pool;
+	bool is_gamut_remap_available = false;
 	int i;
 
 	DTN_INFO("DPP:    IGAM format    IGAM mode    DGAM mode    RGAM mode"
@@ -301,16 +302,15 @@ static void dcn10_log_color_state(struct dc *dc,
 		struct dcn_dpp_state s = {0};
 
 		dpp->funcs->dpp_read_state(dpp, &s);
-		dpp->funcs->dpp_get_gamut_remap(dpp, &s.gamut_remap);
+		if (dpp->funcs->dpp_get_gamut_remap) {
+			dpp->funcs->dpp_get_gamut_remap(dpp, &s.gamut_remap);
+			is_gamut_remap_available = true;
+		}
 
 		if (!s.is_enabled)
 			continue;
 
-		DTN_INFO("[%2d]:  %11xh  %11s    %9s    %9s"
-			 "  %12s  "
-			 "%010lld %010lld %010lld %010lld "
-			 "%010lld %010lld %010lld %010lld "
-			 "%010lld %010lld %010lld %010lld",
+		DTN_INFO("[%2d]:  %11xh  %11s    %9s    %9s",
 				dpp->inst,
 				s.igam_input_format,
 				(s.igam_lut_mode == 0) ? "BypassFixed" :
@@ -329,22 +329,27 @@ static void dcn10_log_color_state(struct dc *dc,
 					((s.rgam_lut_mode == 2) ? "Ycc" :
 					((s.rgam_lut_mode == 3) ? "RAM" :
 					((s.rgam_lut_mode == 4) ? "RAM" :
-								 "Unknown")))),
-				(s.gamut_remap.gamut_adjust_type == 0) ? "Bypass" :
-					((s.gamut_remap.gamut_adjust_type == 1) ? "HW" :
-										  "SW"),
-				s.gamut_remap.temperature_matrix[0].value,
-				s.gamut_remap.temperature_matrix[1].value,
-				s.gamut_remap.temperature_matrix[2].value,
-				s.gamut_remap.temperature_matrix[3].value,
-				s.gamut_remap.temperature_matrix[4].value,
-				s.gamut_remap.temperature_matrix[5].value,
-				s.gamut_remap.temperature_matrix[6].value,
-				s.gamut_remap.temperature_matrix[7].value,
-				s.gamut_remap.temperature_matrix[8].value,
-				s.gamut_remap.temperature_matrix[9].value,
-				s.gamut_remap.temperature_matrix[10].value,
-				s.gamut_remap.temperature_matrix[11].value);
+								 "Unknown")))));
+		if (is_gamut_remap_available)
+			DTN_INFO("  %12s  "
+				 "%010lld %010lld %010lld %010lld "
+				 "%010lld %010lld %010lld %010lld "
+				 "%010lld %010lld %010lld %010lld",
+				 (s.gamut_remap.gamut_adjust_type == 0) ? "Bypass" :
+					((s.gamut_remap.gamut_adjust_type == 1) ? "HW" : "SW"),
+				 s.gamut_remap.temperature_matrix[0].value,
+				 s.gamut_remap.temperature_matrix[1].value,
+				 s.gamut_remap.temperature_matrix[2].value,
+				 s.gamut_remap.temperature_matrix[3].value,
+				 s.gamut_remap.temperature_matrix[4].value,
+				 s.gamut_remap.temperature_matrix[5].value,
+				 s.gamut_remap.temperature_matrix[6].value,
+				 s.gamut_remap.temperature_matrix[7].value,
+				 s.gamut_remap.temperature_matrix[8].value,
+				 s.gamut_remap.temperature_matrix[9].value,
+				 s.gamut_remap.temperature_matrix[10].value,
+				 s.gamut_remap.temperature_matrix[11].value);
+
 		DTN_INFO("\n");
 	}
 	DTN_INFO("\n");
Signature · 1 line
2.45.1
#20 lore raw

PATCH 20/36 drm/amd/display: Remove duplicate HWSS interfaces

In reply to Hamza Mahfooz

From: Joshua Aberback <[email protected]>

[Why]
Some interface functions are defined in both the public and private HWSS interfaces, which can lead to confusion and runtime issues, therefore the duplicates should be eliminated.

[How]
- power_down should only be private, because it's only used within HWSS
- update_plane_addr should only be public, as it's used outside HWSS

---
 .../gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c  |  1 -
 .../gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c    | 10 +++++-----
 drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_init.c |  2 --
 .../gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c    |  2 +-
 drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_init.c |  1 -
 .../gpu/drm/amd/display/dc/hwss/dcn201/dcn201_init.c   |  1 -
 drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_init.c |  2 --
 .../gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c    |  8 ++++----
 drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_init.c |  1 -
 .../gpu/drm/amd/display/dc/hwss/dcn301/dcn301_init.c   |  1 -
 drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_init.c |  2 --
 .../gpu/drm/amd/display/dc/hwss/dcn314/dcn314_init.c   |  2 --
 .../gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c    |  8 ++++----
 drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c |  1 -
 .../gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c    |  8 ++++----
 drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_init.c |  2 --
 .../gpu/drm/amd/display/dc/hwss/dcn351/dcn351_init.c   |  2 --
 .../gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c  |  8 ++++----
 .../gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c   |  2 --
 drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h     |  1 -
 .../gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h |  2 --
 21 files changed, 22 insertions(+), 45 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +0 -1
index f489371a3bc6..871f1e1ca2e0 100644
@@ -3262,7 +3262,6 @@ static const struct hw_sequencer_funcs dce110_funcs = {
 
 static const struct hwseq_private_funcs dce110_private_funcs = {
 	.init_pipes = init_pipes,
-	.update_plane_addr = update_plane_addr,
 	.set_input_transfer_func = dce110_set_input_transfer_func,
 	.set_output_transfer_func = dce110_set_output_transfer_func,
 	.power_down = dce110_power_down,
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +5 -5
index 0bfab66b8038..85f014cae6be 100644
@@ -1712,10 +1712,10 @@ void dcn10_power_down_on_boot(struct dc *dc)
 	if (edp_link && edp_link->link_enc->funcs->is_dig_enabled &&
 			edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) &&
 			dc->hwseq->funcs.edp_backlight_control &&
-			dc->hwss.power_down &&
+			dc->hwseq->funcs.power_down &&
 			dc->hwss.edp_power_control) {
 		dc->hwseq->funcs.edp_backlight_control(edp_link, false);
-		dc->hwss.power_down(dc);
+		dc->hwseq->funcs.power_down(dc);
 		dc->hwss.edp_power_control(edp_link, false);
 	} else {
 		for (i = 0; i < dc->link_count; i++) {
@@ -1723,8 +1723,8 @@ void dcn10_power_down_on_boot(struct dc *dc)
 
 			if (link->link_enc && link->link_enc->funcs->is_dig_enabled &&
 					link->link_enc->funcs->is_dig_enabled(link->link_enc) &&
-					dc->hwss.power_down) {
-				dc->hwss.power_down(dc);
+					dc->hwseq->funcs.power_down) {
+				dc->hwseq->funcs.power_down(dc);
 				break;
 			}
 
@@ -2929,7 +2929,7 @@ static void dcn10_update_dchubp_dpp(
 
 	hubp->power_gated = false;
 
-	hws->funcs.update_plane_addr(dc, pipe_ctx);
+	dc->hwss.update_plane_addr(dc, pipe_ctx);
 
 	if (is_pipe_tree_visible(pipe_ctx))
 		hubp->funcs->set_blank(hubp, false);
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_init.c +0 -2
index a5bdac79a744..5e51e1761707 100644
@@ -78,7 +78,6 @@ static const struct hw_sequencer_funcs dcn10_funcs = {
 	.get_clock = dcn10_get_clock,
 	.get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync,
 	.calc_vupdate_position = dcn10_calc_vupdate_position,
-	.power_down = dce110_power_down,
 	.set_backlight_level = dce110_set_backlight_level,
 	.set_abm_immediate_disable = dce110_set_abm_immediate_disable,
 	.set_pipe = dce110_set_pipe,
@@ -92,7 +91,6 @@ static const struct hw_sequencer_funcs dcn10_funcs = {
 
 static const struct hwseq_private_funcs dcn10_private_funcs = {
 	.init_pipes = dcn10_init_pipes,
-	.update_plane_addr = dcn10_update_plane_addr,
 	.plane_atomic_disconnect = dcn10_plane_atomic_disconnect,
 	.program_pipe = dcn10_program_pipe,
 	.update_mpcc = dcn10_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +1 -1
index d60941495fd3..09376c367c14 100644
@@ -1821,7 +1821,7 @@ static void dcn20_update_dchubp_dpp(
 			params.subvp_save_surf_addr.subvp_index = pipe_ctx->subvp_index;
 			hwss_subvp_save_surf_addr(&params);
 		}
-		hws->funcs.update_plane_addr(dc, pipe_ctx);
+		dc->hwss.update_plane_addr(dc, pipe_ctx);
 	}
 
 	if (pipe_ctx->update_flags.bits.enable)
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_init.c +0 -1
index ef6488165b8f..32707b344f0b 100644
@@ -105,7 +105,6 @@ static const struct hw_sequencer_funcs dcn20_funcs = {
 
 static const struct hwseq_private_funcs dcn20_private_funcs = {
 	.init_pipes = dcn10_init_pipes,
-	.update_plane_addr = dcn20_update_plane_addr,
 	.plane_atomic_disconnect = dcn10_plane_atomic_disconnect,
 	.update_mpcc = dcn20_update_mpcc,
 	.set_input_transfer_func = dcn20_set_input_transfer_func,
drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_init.c +0 -1
index a13bf6c9386e..78351408e864 100644
@@ -96,7 +96,6 @@ static const struct hw_sequencer_funcs dcn201_funcs = {
 
 static const struct hwseq_private_funcs dcn201_private_funcs = {
 	.init_pipes = NULL,
-	.update_plane_addr = dcn201_update_plane_addr,
 	.plane_atomic_disconnect = dcn201_plane_atomic_disconnect,
 	.program_pipe = dcn10_program_pipe,
 	.update_mpcc = dcn201_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_init.c +0 -2
index 3dfac372d165..e044e9e0a3a1 100644
@@ -93,7 +93,6 @@ static const struct hw_sequencer_funcs dcn21_funcs = {
 	.exit_optimized_pwr_state = dcn21_exit_optimized_pwr_state,
 	.get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync,
 	.calc_vupdate_position = dcn10_calc_vupdate_position,
-	.power_down = dce110_power_down,
 	.set_backlight_level = dcn21_set_backlight_level,
 	.set_abm_immediate_disable = dcn21_set_abm_immediate_disable,
 	.set_pipe = dcn21_set_pipe,
@@ -109,7 +108,6 @@ static const struct hw_sequencer_funcs dcn21_funcs = {
 
 static const struct hwseq_private_funcs dcn21_private_funcs = {
 	.init_pipes = dcn10_init_pipes,
-	.update_plane_addr = dcn20_update_plane_addr,
 	.plane_atomic_disconnect = dcn10_plane_atomic_disconnect,
 	.update_mpcc = dcn20_update_mpcc,
 	.set_input_transfer_func = dcn20_set_input_transfer_func,
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c +4 -4
index 4c4706153305..9ef38a3759b1 100644
@@ -728,10 +728,10 @@ void dcn30_init_hw(struct dc *dc)
 		if (edp_link && edp_link->link_enc->funcs->is_dig_enabled &&
 				edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) &&
 				dc->hwss.edp_backlight_control &&
-				dc->hwss.power_down &&
+				hws->funcs.power_down &&
 				dc->hwss.edp_power_control) {
 			dc->hwss.edp_backlight_control(edp_link, false);
-			dc->hwss.power_down(dc);
+			hws->funcs.power_down(dc);
 			dc->hwss.edp_power_control(edp_link, false);
 		} else {
 			for (i = 0; i < dc->link_count; i++) {
@@ -739,8 +739,8 @@ void dcn30_init_hw(struct dc *dc)
 
 				if (link->link_enc->funcs->is_dig_enabled &&
 						link->link_enc->funcs->is_dig_enabled(link->link_enc) &&
-						dc->hwss.power_down) {
-					dc->hwss.power_down(dc);
+						hws->funcs.power_down) {
+					hws->funcs.power_down(dc);
 					break;
 				}
 
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_init.c +0 -1
index 4b32497c09d0..2a8dc40d2847 100644
@@ -113,7 +113,6 @@ static const struct hw_sequencer_funcs dcn30_funcs = {
 
 static const struct hwseq_private_funcs dcn30_private_funcs = {
 	.init_pipes = dcn10_init_pipes,
-	.update_plane_addr = dcn20_update_plane_addr,
 	.plane_atomic_disconnect = dcn10_plane_atomic_disconnect,
 	.update_mpcc = dcn20_update_mpcc,
 	.set_input_transfer_func = dcn30_set_input_transfer_func,
drivers/gpu/drm/amd/display/dc/hwss/dcn301/dcn301_init.c +0 -1
index 97e33eb7ac5a..93e49d87a67c 100644
@@ -111,7 +111,6 @@ static const struct hw_sequencer_funcs dcn301_funcs = {
 
 static const struct hwseq_private_funcs dcn301_private_funcs = {
 	.init_pipes = dcn10_init_pipes,
-	.update_plane_addr = dcn20_update_plane_addr,
 	.plane_atomic_disconnect = dcn10_plane_atomic_disconnect,
 	.update_mpcc = dcn20_update_mpcc,
 	.set_input_transfer_func = dcn30_set_input_transfer_func,
drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_init.c +0 -2
index 9cb7afe0e731..b57dd45611f2 100644
@@ -98,7 +98,6 @@ static const struct hw_sequencer_funcs dcn31_funcs = {
 	.set_flip_control_gsl = dcn20_set_flip_control_gsl,
 	.get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync,
 	.calc_vupdate_position = dcn10_calc_vupdate_position,
-	.power_down = dce110_power_down,
 	.set_backlight_level = dcn21_set_backlight_level,
 	.set_abm_immediate_disable = dcn21_set_abm_immediate_disable,
 	.set_pipe = dcn21_set_pipe,
@@ -116,7 +115,6 @@ static const struct hw_sequencer_funcs dcn31_funcs = {
 
 static const struct hwseq_private_funcs dcn31_private_funcs = {
 	.init_pipes = dcn10_init_pipes,
-	.update_plane_addr = dcn20_update_plane_addr,
 	.plane_atomic_disconnect = dcn10_plane_atomic_disconnect,
 	.update_mpcc = dcn20_update_mpcc,
 	.set_input_transfer_func = dcn30_set_input_transfer_func,
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_init.c +0 -2
index 7a8db4b81471..fe5495a8e7a2 100644
@@ -100,7 +100,6 @@ static const struct hw_sequencer_funcs dcn314_funcs = {
 	.set_flip_control_gsl = dcn20_set_flip_control_gsl,
 	.get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync,
 	.calc_vupdate_position = dcn10_calc_vupdate_position,
-	.power_down = dce110_power_down,
 	.set_backlight_level = dcn21_set_backlight_level,
 	.set_abm_immediate_disable = dcn21_set_abm_immediate_disable,
 	.set_pipe = dcn21_set_pipe,
@@ -119,7 +118,6 @@ static const struct hw_sequencer_funcs dcn314_funcs = {
 
 static const struct hwseq_private_funcs dcn314_private_funcs = {
 	.init_pipes = dcn10_init_pipes,
-	.update_plane_addr = dcn20_update_plane_addr,
 	.plane_atomic_disconnect = dcn10_plane_atomic_disconnect,
 	.update_mpcc = dcn20_update_mpcc,
 	.set_input_transfer_func = dcn30_set_input_transfer_func,
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +4 -4
index 0d27eec724b4..732da5e5c1ba 100644
@@ -901,10 +901,10 @@ void dcn32_init_hw(struct dc *dc)
 				if (edp_link->link_enc->funcs->is_dig_enabled &&
 						edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) &&
 						dc->hwss.edp_backlight_control &&
-						dc->hwss.power_down &&
+						hws->funcs.power_down &&
 						dc->hwss.edp_power_control) {
 					dc->hwss.edp_backlight_control(edp_link, false);
-					dc->hwss.power_down(dc);
+					hws->funcs.power_down(dc);
 					dc->hwss.edp_power_control(edp_link, false);
 				}
 			}
@@ -914,8 +914,8 @@ void dcn32_init_hw(struct dc *dc)
 
 				if (link->link_enc->funcs->is_dig_enabled &&
 						link->link_enc->funcs->is_dig_enabled(link->link_enc) &&
-						dc->hwss.power_down) {
-					dc->hwss.power_down(dc);
+						hws->funcs.power_down) {
+					hws->funcs.power_down(dc);
 					break;
 				}
 
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c +0 -1
index 5c50458b12cb..968b010971ea 100644
@@ -124,7 +124,6 @@ static const struct hw_sequencer_funcs dcn32_funcs = {
 
 static const struct hwseq_private_funcs dcn32_private_funcs = {
 	.init_pipes = dcn10_init_pipes,
-	.update_plane_addr = dcn20_update_plane_addr,
 	.plane_atomic_disconnect = dcn10_plane_atomic_disconnect,
 	.update_mpcc = dcn20_update_mpcc,
 	.set_input_transfer_func = dcn32_set_input_transfer_func,
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +4 -4
index 0602921399cd..d894c52bfdaf 100644
@@ -629,10 +629,10 @@ void dcn35_power_down_on_boot(struct dc *dc)
 	if (edp_link && edp_link->link_enc->funcs->is_dig_enabled &&
 			edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) &&
 			dc->hwseq->funcs.edp_backlight_control &&
-			dc->hwss.power_down &&
+			dc->hwseq->funcs.power_down &&
 			dc->hwss.edp_power_control) {
 		dc->hwseq->funcs.edp_backlight_control(edp_link, false);
-		dc->hwss.power_down(dc);
+		dc->hwseq->funcs.power_down(dc);
 		dc->hwss.edp_power_control(edp_link, false);
 	} else {
 		for (i = 0; i < dc->link_count; i++) {
@@ -640,8 +640,8 @@ void dcn35_power_down_on_boot(struct dc *dc)
 
 			if (link->link_enc && link->link_enc->funcs->is_dig_enabled &&
 					link->link_enc->funcs->is_dig_enabled(link->link_enc) &&
-					dc->hwss.power_down) {
-				dc->hwss.power_down(dc);
+					dc->hwseq->funcs.power_down) {
+				dc->hwseq->funcs.power_down(dc);
 				break;
 			}
 
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_init.c +0 -2
index 428912f37129..55dc5799e725 100644
@@ -101,7 +101,6 @@ static const struct hw_sequencer_funcs dcn35_funcs = {
 	.set_flip_control_gsl = dcn20_set_flip_control_gsl,
 	.get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync,
 	.calc_vupdate_position = dcn10_calc_vupdate_position,
-	.power_down = dce110_power_down,
 	.set_backlight_level = dcn21_set_backlight_level,
 	.set_abm_immediate_disable = dcn21_set_abm_immediate_disable,
 	.set_pipe = dcn21_set_pipe,
@@ -128,7 +127,6 @@ static const struct hw_sequencer_funcs dcn35_funcs = {
 
 static const struct hwseq_private_funcs dcn35_private_funcs = {
 	.init_pipes = dcn35_init_pipes,
-	.update_plane_addr = dcn20_update_plane_addr,
 	.plane_atomic_disconnect = dcn10_plane_atomic_disconnect,
 	.update_mpcc = dcn20_update_mpcc,
 	.set_input_transfer_func = dcn32_set_input_transfer_func,
drivers/gpu/drm/amd/display/dc/hwss/dcn351/dcn351_init.c +0 -2
index 55e791552bca..b1b2a58684e7 100644
@@ -100,7 +100,6 @@ static const struct hw_sequencer_funcs dcn351_funcs = {
 	.set_flip_control_gsl = dcn20_set_flip_control_gsl,
 	.get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync,
 	.calc_vupdate_position = dcn10_calc_vupdate_position,
-	.power_down = dce110_power_down,
 	.set_backlight_level = dcn21_set_backlight_level,
 	.set_abm_immediate_disable = dcn21_set_abm_immediate_disable,
 	.set_pipe = dcn21_set_pipe,
@@ -127,7 +126,6 @@ static const struct hw_sequencer_funcs dcn351_funcs = {
 
 static const struct hwseq_private_funcs dcn351_private_funcs = {
 	.init_pipes = dcn35_init_pipes,
-	.update_plane_addr = dcn20_update_plane_addr,
 	.plane_atomic_disconnect = dcn10_plane_atomic_disconnect,
 	.update_mpcc = dcn20_update_mpcc,
 	.set_input_transfer_func = dcn32_set_input_transfer_func,
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +4 -4
index ef0a42f2933d..0fafbec442b1 100644
@@ -354,10 +354,10 @@ void dcn401_init_hw(struct dc *dc)
 				if (edp_link->link_enc->funcs->is_dig_enabled &&
 						edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) &&
 						dc->hwss.edp_backlight_control &&
-						dc->hwss.power_down &&
+						hws->funcs.power_down &&
 						dc->hwss.edp_power_control) {
 					dc->hwss.edp_backlight_control(edp_link, false);
-					dc->hwss.power_down(dc);
+					hws->funcs.power_down(dc);
 					dc->hwss.edp_power_control(edp_link, false);
 				}
 			}
@@ -367,8 +367,8 @@ void dcn401_init_hw(struct dc *dc)
 
 				if (link->link_enc->funcs->is_dig_enabled &&
 						link->link_enc->funcs->is_dig_enabled(link->link_enc) &&
-						dc->hwss.power_down) {
-					dc->hwss.power_down(dc);
+						hws->funcs.power_down) {
+					hws->funcs.power_down(dc);
 					break;
 				}
 
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c +0 -2
index 1cf0608e1980..067cdd1f5f38 100644
@@ -98,12 +98,10 @@ static const struct hw_sequencer_funcs dcn401_funcs = {
 	.fams2_global_control_lock = dcn401_fams2_global_control_lock,
 	.fams2_update_config = dcn401_fams2_update_config,
 	.fams2_global_control_lock_fast = dcn401_fams2_global_control_lock_fast,
-	.power_down = dce110_power_down,
 };
 
 static const struct hwseq_private_funcs dcn401_private_funcs = {
 	.init_pipes = dcn10_init_pipes,
-	.update_plane_addr = dcn20_update_plane_addr,
 	.plane_atomic_disconnect = dcn10_plane_atomic_disconnect,
 	.update_mpcc = dcn20_update_mpcc,
 	.set_input_transfer_func = dcn32_set_input_transfer_func,
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +0 -1
index e9b85884edce..91becbc8e862 100644
@@ -233,7 +233,6 @@ struct hw_sequencer_funcs {
 	void (*program_triplebuffer)(const struct dc *dc,
 		struct pipe_ctx *pipe_ctx, bool enableTripleBuffer);
 	void (*update_pending_status)(struct pipe_ctx *pipe_ctx);
-	void (*power_down)(struct dc *dc);
 	void (*update_dsc_pg)(struct dc *dc, struct dc_state *context, bool safe_to_disable);
 
 	/* Pipe Lock Related */
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h +0 -2
index 7ac3f2a09487..87c75db10086 100644
@@ -76,8 +76,6 @@ struct hwseq_private_funcs {
 	void (*enable_stream_gating)(struct dc *dc, struct pipe_ctx *pipe_ctx);
 	void (*init_pipes)(struct dc *dc, struct dc_state *context);
 	void (*reset_hw_ctx_wrap)(struct dc *dc, struct dc_state *context);
-	void (*update_plane_addr)(const struct dc *dc,
-			struct pipe_ctx *pipe_ctx);
 	void (*plane_atomic_disconnect)(struct dc *dc,
 			struct dc_state *state,
 			struct pipe_ctx *pipe_ctx);
Signature · 1 line
2.45.1
#21 lore raw

PATCH 21/36 drm/amd/display: Make sure to reprogram ODM when resync fifo

In reply to Hamza Mahfooz

From: Alvin Lee <[email protected]>

Need to reconfigure ODM when resyncing FIFO because on OTG disable we clear all ODM programming

---
 .../amd/display/dc/hwss/dcn314/dcn314_hwseq.c | 19 ++++++++++++++++++-
 .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c   | 19 ++++++++++++++++++-
 2 files changed, 36 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c +18 -1
index 8e68e05e3b72..388404cdeeaa 100644
@@ -379,8 +379,25 @@ void dcn314_resync_fifo_dccg_dio(struct dce_hwseq *hws, struct dc *dc, struct dc
 	for (i = 0; i < dc->res_pool->pipe_count; i++) {
 		pipe = &dc->current_state->res_ctx.pipe_ctx[i];
 
-		if (otg_disabled[i])
+		if (otg_disabled[i]) {
+			int opp_inst[MAX_PIPES] = { pipe->stream_res.opp->inst };
+			int opp_cnt = 1;
+			int last_odm_slice_width = resource_get_odm_slice_dst_width(pipe, true);
+			int odm_slice_width = resource_get_odm_slice_dst_width(pipe, false);
+			struct pipe_ctx *odm_pipe;
+
+			for (odm_pipe = pipe->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) {
+				opp_inst[opp_cnt] = odm_pipe->stream_res.opp->inst;
+				opp_cnt++;
+			}
+			if (opp_cnt > 1)
+				pipe->stream_res.tg->funcs->set_odm_combine(
+						pipe->stream_res.tg,
+						opp_inst, opp_cnt,
+						odm_slice_width,
+						last_odm_slice_width);
 			pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg);
+		}
 	}
 }
 
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +18 -1
index 732da5e5c1ba..33b8df995869 100644
@@ -1237,8 +1237,25 @@ void dcn32_resync_fifo_dccg_dio(struct dce_hwseq *hws, struct dc *dc, struct dc_
 	for (i = 0; i < dc->res_pool->pipe_count; i++) {
 		pipe = &dc->current_state->res_ctx.pipe_ctx[i];
 
-		if (otg_disabled[i])
+		if (otg_disabled[i]) {
+			int opp_inst[MAX_PIPES] = { pipe->stream_res.opp->inst };
+			int opp_cnt = 1;
+			int last_odm_slice_width = resource_get_odm_slice_dst_width(pipe, true);
+			int odm_slice_width = resource_get_odm_slice_dst_width(pipe, false);
+			struct pipe_ctx *odm_pipe;
+
+			for (odm_pipe = pipe->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) {
+				opp_inst[opp_cnt] = odm_pipe->stream_res.opp->inst;
+				opp_cnt++;
+			}
+			if (opp_cnt > 1)
+				pipe->stream_res.tg->funcs->set_odm_combine(
+						pipe->stream_res.tg,
+						opp_inst, opp_cnt,
+						odm_slice_width,
+						last_odm_slice_width);
 			pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg);
+		}
 	}
 }
 
Signature · 1 line
2.45.1
#22 lore raw

PATCH 22/36 drm/amd/display: Check dc_stream_state before it is used

In reply to Hamza Mahfooz

From: Alex Hung <[email protected]>

dc_state_get_stream_status dc_state_get_paired_subvp_stream and other functions can return null, and therefore null must be checked before status can be used.

This fixes 21 NULL_RETURNS issues reported by Coverity.

---
 drivers/gpu/drm/amd/display/dc/core/dc.c      | 17 +++++++++----
 .../gpu/drm/amd/display/dc/core/dc_state.c    | 24 ++++++++++++-------
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c  | 20 ++++++++++++++--
 .../drm/amd/display/dc/dml/dcn32/dcn32_fpu.c  |  8 +++----
 .../amd/display/dc/dml2/dml21/dml21_utils.c   | 12 +++++++++-
 .../display/dc/dml2/dml2_dc_resource_mgmt.c   |  6 +++--
 .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c   |  9 ++++---
 .../dc/resource/dcn32/dcn32_resource.c        |  2 ++
 8 files changed, 74 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +13 -4
index 25a498f65c1c..fce1c3e03094 100644
@@ -1233,11 +1233,14 @@ static void disable_dangling_plane(struct dc *dc, struct dc_state *context)
 			 */
 			if (is_phantom) {
 				if (tg->funcs->enable_crtc) {
-					int main_pipe_width, main_pipe_height;
+					int main_pipe_width = 0, main_pipe_height = 0;
 					struct dc_stream_state *old_paired_stream = dc_state_get_paired_subvp_stream(dc->current_state, old_stream);
 
-					main_pipe_width = old_paired_stream->dst.width;
-					main_pipe_height = old_paired_stream->dst.height;
+					if (old_paired_stream) {
+						main_pipe_width = old_paired_stream->dst.width;
+						main_pipe_height = old_paired_stream->dst.height;
+					}
+
 					if (dc->hwss.blank_phantom)
 						dc->hwss.blank_phantom(dc, tg, main_pipe_width, main_pipe_height);
 					tg->funcs->enable_crtc(tg);
@@ -1628,6 +1631,9 @@ static void program_timing_sync(
 		for (k = 0; k < group_size; k++) {
 			struct dc_stream_status *status = dc_state_get_stream_status(ctx, pipe_set[k]->stream);
 
+			if (!status)
+				continue;
+
 			status->timing_sync_info.group_id = num_group;
 			status->timing_sync_info.group_size = group_size;
 			if (k == 0)
@@ -2225,6 +2231,9 @@ enum dc_status dc_commit_streams(struct dc *dc, struct dc_commit_streams_params
 			if (dc_is_embedded_signal(params->streams[i]->signal)) {
 				struct dc_stream_status *status = dc_state_get_stream_status(context, params->streams[i]);
 
+				if (!status)
+					continue;
+
 				if (dc->hwss.is_abm_supported)
 					status->is_abm_supported = dc->hwss.is_abm_supported(dc, context, params->streams[i]);
 				else
@@ -4023,7 +4032,7 @@ static void commit_planes_for_stream(struct dc *dc,
 			stream_status =
 				stream_get_status(context, pipe_ctx->stream);
 
-			if (dc->hwss.apply_ctx_for_surface)
+			if (dc->hwss.apply_ctx_for_surface && stream_status)
 				dc->hwss.apply_ctx_for_surface(
 					dc, pipe_ctx->stream, stream_status->plane_count, context);
 		}
drivers/gpu/drm/amd/display/dc/core/dc_state.c +16 -8
index c75dcdc20428..e990346e51f6 100644
@@ -794,11 +794,16 @@ enum dc_status dc_state_add_phantom_stream(const struct dc *dc,
 
 	/* setup subvp meta */
 	main_stream_status = dc_state_get_stream_status(state, main_stream);
+	if (main_stream_status) {
+		main_stream_status->mall_stream_config.type = SUBVP_MAIN;
+		main_stream_status->mall_stream_config.paired_stream = phantom_stream;
+	}
+
 	phantom_stream_status = dc_state_get_stream_status(state, phantom_stream);
-	phantom_stream_status->mall_stream_config.type = SUBVP_PHANTOM;
-	phantom_stream_status->mall_stream_config.paired_stream = main_stream;
-	main_stream_status->mall_stream_config.type = SUBVP_MAIN;
-	main_stream_status->mall_stream_config.paired_stream = phantom_stream;
+	if (phantom_stream_status) {
+		phantom_stream_status->mall_stream_config.type = SUBVP_PHANTOM;
+		phantom_stream_status->mall_stream_config.paired_stream = main_stream;
+	}
 
 	return res;
 }
@@ -807,14 +812,17 @@ enum dc_status dc_state_remove_phantom_stream(const struct dc *dc,
 		struct dc_state *state,
 		struct dc_stream_state *phantom_stream)
 {
-	struct dc_stream_status *main_stream_status;
+	struct dc_stream_status *main_stream_status = NULL;
 	struct dc_stream_status *phantom_stream_status;
 
 	/* reset subvp meta */
 	phantom_stream_status = dc_state_get_stream_status(state, phantom_stream);
-	main_stream_status = dc_state_get_stream_status(state, phantom_stream_status->mall_stream_config.paired_stream);
-	phantom_stream_status->mall_stream_config.type = SUBVP_NONE;
-	phantom_stream_status->mall_stream_config.paired_stream = NULL;
+	if (phantom_stream_status) {
+		main_stream_status = dc_state_get_stream_status(state, phantom_stream_status->mall_stream_config.paired_stream);
+		phantom_stream_status->mall_stream_config.type = SUBVP_NONE;
+		phantom_stream_status->mall_stream_config.paired_stream = NULL;
+	}
+
 	if (main_stream_status) {
 		main_stream_status->mall_stream_config.type = SUBVP_NONE;
 		main_stream_status->mall_stream_config.paired_stream = NULL;
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +18 -2
index 6ff87b023081..b2051c4dd7b6 100644
@@ -562,7 +562,7 @@ static void populate_subvp_cmd_drr_info(struct dc *dc,
 {
 	struct dc_stream_state *phantom_stream = dc_state_get_paired_subvp_stream(context, subvp_pipe->stream);
 	struct dc_crtc_timing *main_timing = &subvp_pipe->stream->timing;
-	struct dc_crtc_timing *phantom_timing = &phantom_stream->timing;
+	struct dc_crtc_timing *phantom_timing;
 	struct dc_crtc_timing *drr_timing = &vblank_pipe->stream->timing;
 	uint16_t drr_frame_us = 0;
 	uint16_t min_drr_supported_us = 0;
@@ -576,6 +576,11 @@ static void populate_subvp_cmd_drr_info(struct dc *dc,
 	uint16_t min_vtotal_supported = 0;
 	uint16_t max_vtotal_supported = 0;
 
+	if (!phantom_stream)
+		return;
+
+	phantom_timing = &phantom_stream->timing;
+
 	pipe_data->pipe_config.vblank_data.drr_info.drr_in_use = true;
 	pipe_data->pipe_config.vblank_data.drr_info.use_ramping = false; // for now don't use ramping
 	pipe_data->pipe_config.vblank_data.drr_info.drr_window_size_ms = 4; // hardcode 4ms DRR window for now
@@ -699,7 +704,13 @@ static void update_subvp_prefetch_end_to_mall_start(struct dc *dc,
 	struct dmub_cmd_fw_assisted_mclk_switch_pipe_data_v2 *pipe_data = NULL;
 
 	phantom_stream0 = dc_state_get_paired_subvp_stream(context, subvp_pipes[0]->stream);
+	if (!phantom_stream0)
+		return;
+
 	phantom_stream1 = dc_state_get_paired_subvp_stream(context, subvp_pipes[1]->stream);
+	if (!phantom_stream1)
+		return;
+
 	phantom_timing0 = &phantom_stream0->timing;
 	phantom_timing1 = &phantom_stream1->timing;
 
@@ -754,9 +765,14 @@ static void populate_subvp_cmd_pipe_info(struct dc *dc,
 			&cmd->fw_assisted_mclk_switch_v2.config_data.pipe_data[cmd_pipe_index];
 	struct dc_stream_state *phantom_stream = dc_state_get_paired_subvp_stream(context, subvp_pipe->stream);
 	struct dc_crtc_timing *main_timing = &subvp_pipe->stream->timing;
-	struct dc_crtc_timing *phantom_timing = &phantom_stream->timing;
+	struct dc_crtc_timing *phantom_timing;
 	uint32_t out_num_stream, out_den_stream, out_num_plane, out_den_plane, out_num, out_den;
 
+	if (!phantom_stream)
+		return;
+
+	phantom_timing = &phantom_stream->timing;
+
 	pipe_data->mode = SUBVP;
 	pipe_data->pipe_config.subvp_data.pix_clk_100hz = subvp_pipe->stream->timing.pix_clk_100hz;
 	pipe_data->pipe_config.subvp_data.htotal = subvp_pipe->stream->timing.h_total;
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c +4 -4
index 5ef10e2b9443..a63b5dcba3f5 100644
@@ -738,9 +738,9 @@ static bool subvp_subvp_schedulable(struct dc *dc, struct dc_state *context)
 		/* Loop to calculate the maximum microschedule time between the two SubVP pipes,
 		 * and also to store the two main SubVP pipe pointers in subvp_pipes[2].
 		 */
-		if (pipe->stream && pipe->plane_state && !pipe->top_pipe &&
+		phantom = dc_state_get_paired_subvp_stream(context, pipe->stream);
+		if (phantom && pipe->stream && pipe->plane_state && !pipe->top_pipe &&
 			dc_state_get_pipe_subvp_type(context, pipe) == SUBVP_MAIN) {
-			phantom = dc_state_get_paired_subvp_stream(context, pipe->stream);
 			microschedule_lines = (phantom->timing.v_total - phantom->timing.v_front_porch) +
 					phantom->timing.v_addressable;
 
@@ -845,8 +845,8 @@ static bool subvp_drr_schedulable(struct dc *dc, struct dc_state *context)
 		}
 	}
 
-	if (subvp_found && drr_found) {
-		phantom_stream = dc_state_get_paired_subvp_stream(context, pipe->stream);
+	phantom_stream = dc_state_get_paired_subvp_stream(context, pipe->stream);
+	if (phantom_stream && subvp_found && drr_found) {
 		main_timing = &pipe->stream->timing;
 		phantom_timing = &phantom_stream->timing;
 		drr_timing = &drr_pipe->stream->timing;
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_utils.c +11 -1
index b97d9abfdbc6..87c7b13391bc 100644
@@ -108,6 +108,8 @@ int dml21_find_dc_pipes_for_plane(const struct dc *in_dc,
 
 	dc_main_stream = dml_ctx->config.callbacks.get_stream_from_id(context, main_stream_id);
 	dc_main_stream_status = dml_ctx->config.callbacks.get_stream_status(context, dc_main_stream);
+	if (!dc_main_stream_status)
+		return num_pipes;
 
 	/* find main plane based on id */
 	dc_plane_index = dml21_get_dc_plane_idx_from_plane_id(dml_ctx->v21.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_id[dml_plane_idx]);
@@ -325,6 +327,8 @@ static struct dc_stream_state *dml21_add_phantom_stream(struct dml2_context *dml
 	struct dml2_stream_parameters *phantom_stream_descriptor = &stream_programming->phantom_stream.descriptor;
 
 	phantom_stream = dml_ctx->config.svp_pstate.callbacks.create_phantom_stream(dc, context, main_stream);
+	if (!phantom_stream)
+		return NULL;
 
 	/* copy details of phantom stream from main */
 	memcpy(&phantom_stream->timing, &main_stream->timing, sizeof(phantom_stream->timing));
@@ -411,7 +415,7 @@ void dml21_handle_phantom_streams_planes(const struct dc *dc, struct dc_state *c
 
 			main_stream_status = dml_ctx->config.callbacks.get_stream_status(context, main_stream);
 
-			if (main_stream_status->plane_count == 0)
+			if (!main_stream_status || main_stream_status->plane_count == 0)
 				continue;
 
 			/* create phantom stream for subvp enabled stream */
@@ -421,6 +425,9 @@ void dml21_handle_phantom_streams_planes(const struct dc *dc, struct dc_state *c
 					main_stream,
 					&dml_ctx->v21.mode_programming.programming->stream_programming[dml_stream_index]);
 
+			if (!phantom_stream)
+				continue;
+
 			/* iterate through DML planes associated with this stream */
 			for (dml_plane_index = 0; dml_plane_index < dml_ctx->v21.mode_programming.programming->display_config.num_planes; dml_plane_index++) {
 				if (dml_ctx->v21.mode_programming.programming->plane_programming[dml_plane_index].plane_descriptor->stream_index == dml_stream_index) {
@@ -509,6 +516,9 @@ void dml21_build_fams2_programming(const struct dc *dc,
 			break;
 		case FAMS2_STREAM_TYPE_SUBVP:
 			phantom_stream = dml_ctx->config.svp_pstate.callbacks.get_paired_subvp_stream(context, stream);
+			if (!phantom_stream)
+				break;
+
 			phantom_status = dml_ctx->config.callbacks.get_stream_status(context, phantom_stream);
 
 			/* phantom status should always be present */
drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c +4 -2
index 23ffecfd70eb..486b222083e0 100644
@@ -874,13 +874,14 @@ static unsigned int get_target_odm_factor(
 		default:
 			break;
 		}
-	}
-	else if (ctx->architecture == dml2_architecture_21) {
+	} else if (ctx->architecture == dml2_architecture_21) {
 		if (ctx->config.svp_pstate.callbacks.get_stream_subvp_type(state, stream) == SUBVP_PHANTOM) {
 			struct dc_stream_state *main_stream;
 
 			/* get stream id of main stream */
 			main_stream = ctx->config.svp_pstate.callbacks.get_paired_subvp_stream(state, stream);
+			if (!main_stream)
+				goto failed;
 
 			/* get cfg idx for associated main stream */
 			cfg_idx = find_disp_cfg_idx_by_stream_id(
@@ -893,6 +894,7 @@ static unsigned int get_target_odm_factor(
 		return ctx->v21.mode_programming.programming->stream_programming[cfg_idx].num_odms_required;
 	}
 
+failed:
 	ASSERT(false);
 	return 1;
 }
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +6 -3
index 09376c367c14..1b71cb365aa9 100644
@@ -2051,11 +2051,14 @@ void dcn20_program_front_end_for_ctx(
 
 			if (tg->funcs->enable_crtc) {
 				if (dc->hwss.blank_phantom) {
-					int main_pipe_width, main_pipe_height;
+					int main_pipe_width = 0, main_pipe_height = 0;
 					struct dc_stream_state *phantom_stream = dc_state_get_paired_subvp_stream(dc->current_state, dc->current_state->res_ctx.pipe_ctx[i].stream);
 
-					main_pipe_width = phantom_stream->dst.width;
-					main_pipe_height = phantom_stream->dst.height;
+					if (phantom_stream) {
+						main_pipe_width = phantom_stream->dst.width;
+						main_pipe_height = phantom_stream->dst.height;
+					}
+
 					dc->hwss.blank_phantom(dc, tg, main_pipe_width, main_pipe_height);
 				}
 				tg->funcs->enable_crtc(tg);
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c +2 -0
index 2e1b30a33ea9..969658313fd6 100644
@@ -1687,6 +1687,8 @@ static struct dc_stream_state *dcn32_enable_phantom_stream(struct dc *dc,
 	struct pipe_ctx *ref_pipe = &context->res_ctx.pipe_ctx[dc_pipe_idx];
 
 	phantom_stream = dc_state_create_phantom_stream(dc, context, ref_pipe->stream);
+	if (!phantom_stream)
+		return phantom_stream;
 
 	/* stream has limited viewport and small timing */
 	memcpy(&phantom_stream->timing, &ref_pipe->stream->timing, sizeof(phantom_stream->timing));
Signature · 1 line
2.45.1
#23 lore raw

PATCH 23/36 drm/amd/display: Check pipe_ctx before it is used

In reply to Hamza Mahfooz

From: Alex Hung <[email protected]>

resource_get_odm_slice_count and resource_get_otg_master_for_stream can return null, and their returns must be checked before used.

This fixes 4 NULL_RETURNS issues reported by Coverity.

---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c          | 7 ++++++-
 drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c       | 3 +++
 drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_utils.c    | 3 ++-
 .../gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c    | 3 +++
 4 files changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +6 -1
index 76b849bdd914..87e84b0a3d48 100644
@@ -3127,9 +3127,14 @@ bool resource_update_pipes_for_stream_with_slice_count(
 	int i;
 	struct pipe_ctx *otg_master = resource_get_otg_master_for_stream(
 			&new_ctx->res_ctx, stream);
-	int cur_slice_count = resource_get_odm_slice_count(otg_master);
+	int cur_slice_count;
 	bool result = true;
 
+	if (!otg_master)
+		return false;
+
+	cur_slice_count = resource_get_odm_slice_count(otg_master);
+
 	if (new_slice_count == cur_slice_count)
 		return result;
 
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c +3 -0
index a63b5dcba3f5..7abf8b88ca91 100644
@@ -1177,6 +1177,9 @@ static void init_pipe_slice_table_from_context(
 		stream = context->streams[i];
 		otg_master = resource_get_otg_master_for_stream(
 				&context->res_ctx, stream);
+		if (!otg_master)
+			continue;
+
 		count = resource_get_odm_slice_count(otg_master);
 		update_slice_table_for_stream(table, stream, count);
 
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_utils.c +2 -1
index 87c7b13391bc..d276458e50fd 100644
@@ -120,7 +120,8 @@ int dml21_find_dc_pipes_for_plane(const struct dc *in_dc,
 	} else {
 		/* stream was configured with dummy plane, so get pipes from opp head */
 		struct pipe_ctx *otg_master_pipe = dml_ctx->config.callbacks.get_otg_master_for_stream(&context->res_ctx, dc_main_stream);
-		num_pipes = dml_ctx->config.callbacks.get_opp_heads_for_otg_master(otg_master_pipe, &context->res_ctx, dc_main_pipes);
+		if (otg_master_pipe != NULL)
+			num_pipes = dml_ctx->config.callbacks.get_opp_heads_for_otg_master(otg_master_pipe, &context->res_ctx, dc_main_pipes);
 	}
 
 	/* if phantom exists, find associated pipes */
drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c +3 -0
index 486b222083e0..6eccf0241d85 100644
@@ -905,6 +905,9 @@ static unsigned int get_source_odm_factor(const struct dml2_context *ctx,
 {
 	struct pipe_ctx *otg_master = ctx->config.callbacks.get_otg_master_for_stream(&state->res_ctx, stream);
 
+	if (!otg_master)
+		return 0;
+
 	return ctx->config.callbacks.get_odm_slice_count(otg_master);
 }
 
Signature · 1 line
2.45.1
#24 lore raw

PATCH 24/36 drm/amd/display: Covert integers to double before divisions

In reply to Hamza Mahfooz

From: Alex Hung <[email protected]>

Integer divisions result in loss of fractional and accuracy is lost when assigned or compared with double. It is necessary to perform double/integer instead or explicitly cast them to double.

This fixes 54 UNINTENDED_INTEGER_DIVISION issues reported by Coverity.

---
 .../drm/amd/display/dc/dml/calcs/dcn_calcs.c  |  2 +-
 .../drm/amd/display/dc/dml/dcn20/dcn20_fpu.c  | 20 ++++++-------
 .../dc/dml/dcn20/display_mode_vba_20.c        | 16 +++++------
 .../dc/dml/dcn20/display_mode_vba_20v2.c      |  4 +--
 .../dc/dml/dcn21/display_mode_vba_21.c        |  2 +-
 .../dc/dml/dcn30/display_mode_vba_30.c        |  2 +-
 .../dc/dml/dcn31/display_mode_vba_31.c        |  4 +--
 .../dc/dml/dcn314/display_mode_vba_314.c      |  2 +-
 .../dc/dml/dcn32/display_mode_vba_util_32.c   |  8 +++---
 .../amd/display/dc/dml2/display_mode_core.c   | 10 +++----
 .../src/dml2_core/dml2_core_dcn4_calcs.c      | 28 +++++++++----------
 .../dml21/src/dml2_core/dml2_core_shared.c    | 24 ++++++++--------
 12 files changed, 61 insertions(+), 61 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calcs.c +1 -1
index f1cde1e4265f..39525721c976 100644
@@ -690,7 +690,7 @@ static void hack_disable_optional_pipe_split(struct dcn_bw_internal_vars *v)
 static void hack_force_pipe_split(struct dcn_bw_internal_vars *v,
 		unsigned int pixel_rate_100hz)
 {
-	float pixel_rate_mhz = pixel_rate_100hz / 10000;
+	float pixel_rate_mhz = pixel_rate_100hz / 10000.0;
 
 	/*
 	 * force enabling pipe split by lower dpp clock for DPM0 to just
drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c +10 -10
index 74da9ebda016..54dd7e164635 100644
@@ -1882,10 +1882,10 @@ void dcn20_update_bounding_box(struct dc *dc,
 		bb->clock_limits[i].fabricclk_mhz = (min_fclk_required_by_uclk < min_dcfclk) ?
 				min_dcfclk : min_fclk_required_by_uclk;
 
-		bb->clock_limits[i].socclk_mhz = (bb->clock_limits[i].fabricclk_mhz > max_clocks->socClockInKhz / 1000) ?
+		bb->clock_limits[i].socclk_mhz = (bb->clock_limits[i].fabricclk_mhz > max_clocks->socClockInKhz / 1000.0) ?
 				max_clocks->socClockInKhz / 1000 : bb->clock_limits[i].fabricclk_mhz;
 
-		bb->clock_limits[i].dcfclk_mhz = (bb->clock_limits[i].fabricclk_mhz > max_clocks->dcfClockInKhz / 1000) ?
+		bb->clock_limits[i].dcfclk_mhz = (bb->clock_limits[i].fabricclk_mhz > max_clocks->dcfClockInKhz / 1000.0) ?
 				max_clocks->dcfClockInKhz / 1000 : bb->clock_limits[i].fabricclk_mhz;
 
 		bb->clock_limits[i].dispclk_mhz = max_clocks->displayClockInKhz / 1000;
@@ -1917,35 +1917,35 @@ void dcn20_cap_soc_clocks(struct _vcs_dpi_soc_bounding_box_st *bb,
 
 	// First pass - cap all clocks higher than the reported max
 	for (i = 0; i < bb->num_states; i++) {
-		if ((bb->clock_limits[i].dcfclk_mhz > (max_clocks.dcfClockInKhz / 1000))
+		if ((bb->clock_limits[i].dcfclk_mhz > (max_clocks.dcfClockInKhz / 1000.0))
 				&& max_clocks.dcfClockInKhz != 0)
 			bb->clock_limits[i].dcfclk_mhz = (max_clocks.dcfClockInKhz / 1000);
 
-		if ((bb->clock_limits[i].dram_speed_mts > (max_clocks.uClockInKhz / 1000) * 16)
+		if ((bb->clock_limits[i].dram_speed_mts > (max_clocks.uClockInKhz / 1000.0) * 16)
 						&& max_clocks.uClockInKhz != 0)
 			bb->clock_limits[i].dram_speed_mts = (max_clocks.uClockInKhz / 1000) * 16;
 
-		if ((bb->clock_limits[i].fabricclk_mhz > (max_clocks.fabricClockInKhz / 1000))
+		if ((bb->clock_limits[i].fabricclk_mhz > (max_clocks.fabricClockInKhz / 1000.0))
 						&& max_clocks.fabricClockInKhz != 0)
 			bb->clock_limits[i].fabricclk_mhz = (max_clocks.fabricClockInKhz / 1000);
 
-		if ((bb->clock_limits[i].dispclk_mhz > (max_clocks.displayClockInKhz / 1000))
+		if ((bb->clock_limits[i].dispclk_mhz > (max_clocks.displayClockInKhz / 1000.0))
 						&& max_clocks.displayClockInKhz != 0)
 			bb->clock_limits[i].dispclk_mhz = (max_clocks.displayClockInKhz / 1000);
 
-		if ((bb->clock_limits[i].dppclk_mhz > (max_clocks.dppClockInKhz / 1000))
+		if ((bb->clock_limits[i].dppclk_mhz > (max_clocks.dppClockInKhz / 1000.0))
 						&& max_clocks.dppClockInKhz != 0)
 			bb->clock_limits[i].dppclk_mhz = (max_clocks.dppClockInKhz / 1000);
 
-		if ((bb->clock_limits[i].phyclk_mhz > (max_clocks.phyClockInKhz / 1000))
+		if ((bb->clock_limits[i].phyclk_mhz > (max_clocks.phyClockInKhz / 1000.0))
 						&& max_clocks.phyClockInKhz != 0)
 			bb->clock_limits[i].phyclk_mhz = (max_clocks.phyClockInKhz / 1000);
 
-		if ((bb->clock_limits[i].socclk_mhz > (max_clocks.socClockInKhz / 1000))
+		if ((bb->clock_limits[i].socclk_mhz > (max_clocks.socClockInKhz / 1000.0))
 						&& max_clocks.socClockInKhz != 0)
 			bb->clock_limits[i].socclk_mhz = (max_clocks.socClockInKhz / 1000);
 
-		if ((bb->clock_limits[i].dscclk_mhz > (max_clocks.dscClockInKhz / 1000))
+		if ((bb->clock_limits[i].dscclk_mhz > (max_clocks.dscClockInKhz / 1000.0))
 						&& max_clocks.dscClockInKhz != 0)
 			bb->clock_limits[i].dscclk_mhz = (max_clocks.dscClockInKhz / 1000);
 	}
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20.c +8 -8
index 7bf4bb7ad044..565f3c492477 100644
@@ -1017,7 +1017,7 @@ static unsigned int CalculateVMAndRowBytes(
 			if (ScanDirection == dm_horz)
 				FractionOfPTEReturnDrop = 0;
 			else
-				FractionOfPTEReturnDrop = 7 / 8;
+				FractionOfPTEReturnDrop = 7.0 / 8;
 		} else if (VMMPageSize == 4096 && MacroTileSizeBytes > 4096) {
 			PixelPTEReqHeight = 16 * BlockHeight256Bytes;
 			PixelPTEReqWidth = 16 * BlockWidth256Bytes;
@@ -3231,22 +3231,22 @@ static unsigned int TruncToValidBPP(
 			if (Format == dm_420) {
 				if (DecimalBPP < 6)
 					return BPP_INVALID;
-				else if (DecimalBPP >= 1.5 * DSCInputBitPerComponent - 1 / 16)
-					return 1.5 * DSCInputBitPerComponent - 1 / 16;
+				else if (DecimalBPP >= 1.5 * DSCInputBitPerComponent - 1.0 / 16)
+					return 1.5 * DSCInputBitPerComponent - 1.0 / 16;
 				else
 					return dml_floor(16 * DecimalBPP, 1) / 16;
 			} else if (Format == dm_n422) {
 				if (DecimalBPP < 7)
 					return BPP_INVALID;
-				else if (DecimalBPP >= 2 * DSCInputBitPerComponent - 1 / 16)
-					return 2 * DSCInputBitPerComponent - 1 / 16;
+				else if (DecimalBPP >= 2 * DSCInputBitPerComponent - 1.0 / 16)
+					return 2 * DSCInputBitPerComponent - 1.0 / 16;
 				else
 					return dml_floor(16 * DecimalBPP, 1) / 16;
 			} else {
 				if (DecimalBPP < 8)
 					return BPP_INVALID;
-				else if (DecimalBPP >= 3 * DSCInputBitPerComponent - 1 / 16)
-					return 3 * DSCInputBitPerComponent - 1 / 16;
+				else if (DecimalBPP >= 3 * DSCInputBitPerComponent - 1.0 / 16)
+					return 3 * DSCInputBitPerComponent - 1.0 / 16;
 				else
 					return dml_floor(16 * DecimalBPP, 1) / 16;
 			}
@@ -4322,7 +4322,7 @@ void dml20_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 					locals->RoundedUpMaxSwathSizeBytesC = 0;
 				}
 
-				if (locals->RoundedUpMaxSwathSizeBytesY + locals->RoundedUpMaxSwathSizeBytesC <= locals->DETBufferSizeInKByte[0] * 1024 / 2) {
+				if (locals->RoundedUpMaxSwathSizeBytesY + locals->RoundedUpMaxSwathSizeBytesC <= locals->DETBufferSizeInKByte[0] * 1024.0 / 2) {
 					locals->SwathHeightYPerState[i][j][k] = locals->MaxSwathHeightY[k];
 					locals->SwathHeightCPerState[i][j][k] = locals->MaxSwathHeightC[k];
 				} else {
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c +2 -2
index 989d83ee3842..9d6675ecc5f1 100644
@@ -1077,7 +1077,7 @@ static unsigned int CalculateVMAndRowBytes(
 			if (ScanDirection == dm_horz)
 				FractionOfPTEReturnDrop = 0;
 			else
-				FractionOfPTEReturnDrop = 7 / 8;
+				FractionOfPTEReturnDrop = 7.0 / 8;
 		} else if (VMMPageSize == 4096 && MacroTileSizeBytes > 4096) {
 			PixelPTEReqHeight = 16 * BlockHeight256Bytes;
 			PixelPTEReqWidth = 16 * BlockWidth256Bytes;
@@ -4443,7 +4443,7 @@ void dml20v2_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode
 					locals->RoundedUpMaxSwathSizeBytesC = 0;
 				}
 
-				if (locals->RoundedUpMaxSwathSizeBytesY + locals->RoundedUpMaxSwathSizeBytesC <= locals->DETBufferSizeInKByte[0] * 1024 / 2) {
+				if (locals->RoundedUpMaxSwathSizeBytesY + locals->RoundedUpMaxSwathSizeBytesC <= locals->DETBufferSizeInKByte[0] * 1024.0 / 2) {
 					locals->SwathHeightYPerState[i][j][k] = locals->MaxSwathHeightY[k];
 					locals->SwathHeightCPerState[i][j][k] = locals->MaxSwathHeightC[k];
 				} else {
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_mode_vba_21.c +1 -1
index 57cf0358cc43..eb3ed965e48b 100644
@@ -1399,7 +1399,7 @@ static unsigned int CalculateVMAndRowBytes(
 			if (ScanDirection == dm_horz)
 				FractionOfPTEReturnDrop = 0;
 			else
-				FractionOfPTEReturnDrop = 7 / 8;
+				FractionOfPTEReturnDrop = 7.0 / 8;
 		} else if (VMMPageSize == 4096 && MacroTileSizeBytes > 4096) {
 			PixelPTEReqHeightPTEs = 16;
 			*PixelPTEReqHeight = 16 * BlockHeight256Bytes;
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c +1 -1
index e0b52db2c210..1c10ba4dcdde 100644
@@ -1783,7 +1783,7 @@ static unsigned int CalculateVMAndRowBytes(
 		if (ScanDirection != dm_vert)
 			FractionOfPTEReturnDrop = 0;
 		else
-			FractionOfPTEReturnDrop = 7 / 8;
+			FractionOfPTEReturnDrop = 7.0 / 8;
 	} else if (GPUVMMinPageSize == 4 && MacroTileSizeBytes > 4096) {
 		PixelPTEReqHeightPTEs = 16;
 		*PixelPTEReqHeight = 16 * BlockHeight256Bytes;
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c +2 -2
index 33cf824c5da1..0b132ce1d2cd 100644
@@ -1932,7 +1932,7 @@ static unsigned int CalculateVMAndRowBytes(
 		if (ScanDirection != dm_vert)
 			FractionOfPTEReturnDrop = 0;
 		else
-			FractionOfPTEReturnDrop = 7 / 8;
+			FractionOfPTEReturnDrop = 7.0 / 8;
 	} else if (GPUVMMinPageSize == 4 && MacroTileSizeBytes > 4096) {
 		PixelPTEReqHeightPTEs = 16;
 		*PixelPTEReqHeight = 16 * BlockHeight256Bytes;
@@ -3617,7 +3617,7 @@ static double TruncToValidBPP(
 		NonDSCBPP1 = 15;
 		NonDSCBPP2 = 18;
 		MinDSCBPP = 6;
-		MaxDSCBPP = 1.5 * DSCInputBitPerComponent - 1 / 16;
+		MaxDSCBPP = 1.5 * DSCInputBitPerComponent - 1.0 / 16;
 	} else if (Format == dm_444) {
 		NonDSCBPP0 = 24;
 		NonDSCBPP1 = 30;
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c +1 -1
index cb50c475746b..debfa31583a6 100644
@@ -3714,7 +3714,7 @@ static double TruncToValidBPP(
 		NonDSCBPP1 = 15;
 		NonDSCBPP2 = 18;
 		MinDSCBPP = 6;
-		MaxDSCBPP = 1.5 * DSCInputBitPerComponent - 1 / 16;
+		MaxDSCBPP = 1.5 * DSCInputBitPerComponent - 1.0 / 16;
 	} else if (Format == dm_444) {
 		NonDSCBPP0 = 24;
 		NonDSCBPP1 = 30;
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c +4 -4
index ba1310c8fd77..d92fb428ee96 100644
@@ -1401,13 +1401,13 @@ void dml32_CalculateOutputLink(
 			if (Output == dm_dp2p0) {
 				*OutBpp = 0;
 				if ((OutputLinkDPRate == dm_dp_rate_na || OutputLinkDPRate == dm_dp_rate_uhbr10) &&
-						PHYCLKD32PerState >= 10000 / 32) {
+						PHYCLKD32PerState >= 10000.0 / 32) {
 					*OutBpp = dml32_TruncToValidBPP((1 - Downspreading / 100) * 10000,
 							OutputLinkDPLanes, HTotal, HActive, PixelClockBackEnd,
 							ForcedOutputLinkBPP, LinkDSCEnable, Output, OutputFormat,
 							DSCInputBitPerComponent, NumberOfDSCSlices, AudioSampleRate,
 							AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, RequiredSlots);
-					if (*OutBpp == 0 && PHYCLKD32PerState < 13500 / 32 && DSCEnable == true &&
+					if (*OutBpp == 0 && PHYCLKD32PerState < 13500.0 / 32 && DSCEnable == true &&
 							ForcedOutputLinkBPP == 0) {
 						*RequiresDSC = true;
 						LinkDSCEnable = true;
@@ -1423,7 +1423,7 @@ void dml32_CalculateOutputLink(
 					*OutputRate = dm_output_rate_dp_rate_uhbr10;
 				}
 				if ((OutputLinkDPRate == dm_dp_rate_na || OutputLinkDPRate == dm_dp_rate_uhbr13p5) &&
-						*OutBpp == 0 && PHYCLKD32PerState >= 13500 / 32) {
+						*OutBpp == 0 && PHYCLKD32PerState >= 13500.0 / 32) {
 					*OutBpp = dml32_TruncToValidBPP((1 - Downspreading / 100) * 13500,
 							OutputLinkDPLanes, HTotal, HActive, PixelClockBackEnd,
 							ForcedOutputLinkBPP, LinkDSCEnable, Output, OutputFormat,
@@ -1601,7 +1601,7 @@ double dml32_TruncToValidBPP(
 		NonDSCBPP1 = 15;
 		NonDSCBPP2 = 18;
 		MinDSCBPP = 6;
-		MaxDSCBPP = 1.5 * DSCInputBitPerComponent - 1 / 16;
+		MaxDSCBPP = 1.5 * DSCInputBitPerComponent - 1.0 / 16;
 	} else if (Format == dm_444) {
 		NonDSCBPP0 = 24;
 		NonDSCBPP1 = 30;
drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c +5 -5
index a08ae7b7d39a..791f1725b62b 100644
@@ -2733,7 +2733,7 @@ static dml_float_t TruncToValidBPP(
 		NonDSCBPP1 = 15;
 		NonDSCBPP2 = 18;
 		MinDSCBPP = 6;
-		MaxDSCBPP = 1.5 * DSCInputBitPerComponent - 1 / 16;
+		MaxDSCBPP = 1.5 * DSCInputBitPerComponent - 1.0 / 16;
 	} else if (Format == dml_444) {
 		NonDSCBPP0 = 24;
 		NonDSCBPP1 = 30;
@@ -5404,10 +5404,10 @@ static void CalculateOutputLink(
 			}
 			if (Output == dml_dp2p0) {
 				*OutBpp = 0;
-				if ((OutputLinkDPRate == dml_dp_rate_na || OutputLinkDPRate == dml_dp_rate_uhbr10) && PHYCLKD32PerState >= 10000 / 32) {
+				if ((OutputLinkDPRate == dml_dp_rate_na || OutputLinkDPRate == dml_dp_rate_uhbr10) && PHYCLKD32PerState >= 10000 / 32.0) {
 					*OutBpp = TruncToValidBPP((1 - Downspreading / 100) * 10000, OutputLinkDPLanes, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output,
 												OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (dml_uint_t)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, RequiredSlots);
-					if (*OutBpp == 0 && PHYCLKD32PerState < 13500 / 32 && DSCEnable == dml_dsc_enable_if_necessary && ForcedOutputLinkBPP == 0) {
+					if (*OutBpp == 0 && PHYCLKD32PerState < 13500 / 32.0 && DSCEnable == dml_dsc_enable_if_necessary && ForcedOutputLinkBPP == 0) {
 						*RequiresDSC = true;
 						LinkDSCEnable = true;
 						*OutBpp = TruncToValidBPP((1 - Downspreading / 100) * 10000, OutputLinkDPLanes, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output,
@@ -5417,7 +5417,7 @@ static void CalculateOutputLink(
 					*OutputType = dml_output_type_dp2p0;
 					*OutputRate = dml_output_rate_dp_rate_uhbr10;
 				}
-				if ((OutputLinkDPRate == dml_dp_rate_na || OutputLinkDPRate == dml_dp_rate_uhbr13p5) && *OutBpp == 0 && PHYCLKD32PerState >= 13500 / 32) {
+				if ((OutputLinkDPRate == dml_dp_rate_na || OutputLinkDPRate == dml_dp_rate_uhbr13p5) && *OutBpp == 0 && PHYCLKD32PerState >= 13500 / 32.0) {
 					*OutBpp = TruncToValidBPP((1 - Downspreading / 100) * 13500, OutputLinkDPLanes, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output,
 												OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (dml_uint_t)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, RequiredSlots);
 
@@ -9701,7 +9701,7 @@ void dml_core_mode_programming(struct display_mode_lib_st *mode_lib, const struc
 											+ dml_max(1.0, dml_ceil((dml_float_t) locals->WritebackDelay[k] / ((dml_float_t) mode_lib->ms.cache_display_cfg.timing.HTotal[k] / mode_lib->ms.cache_display_cfg.timing.PixelClock[k]), 1.0))
 											+ dml_floor(4.0 * locals->TSetup[k] / ((dml_float_t) mode_lib->ms.cache_display_cfg.timing.HTotal[k] / mode_lib->ms.cache_display_cfg.timing.PixelClock[k]), 1.0) / 4.0;
 
-		if (((locals->VUpdateOffsetPix[k] + locals->VUpdateWidthPix[k] + locals->VReadyOffsetPix[k]) / mode_lib->ms.cache_display_cfg.timing.HTotal[k]) <=
+		if (((locals->VUpdateOffsetPix[k] + locals->VUpdateWidthPix[k] + locals->VReadyOffsetPix[k]) / (double) mode_lib->ms.cache_display_cfg.timing.HTotal[k]) <=
 			(isInterlaceTiming ?
 				dml_floor((mode_lib->ms.cache_display_cfg.timing.VTotal[k] - mode_lib->ms.cache_display_cfg.timing.VActive[k] - mode_lib->ms.cache_display_cfg.timing.VFrontPorch[k] - locals->VStartup[k]) / 2.0, 1.0) :
 				(int) (mode_lib->ms.cache_display_cfg.timing.VTotal[k] - mode_lib->ms.cache_display_cfg.timing.VActive[k] - mode_lib->ms.cache_display_cfg.timing.VFrontPorch[k] - locals->VStartup[k]))) {
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c +14 -14
index eceef0fcb316..be73784e21eb 100644
@@ -4202,10 +4202,10 @@ static void CalculateOutputLink(
 			}
 			if (Output == dml2_dp2p0) {
 				*OutBpp = 0;
-				if ((OutputLinkDPRate == dml2_dp_rate_na || OutputLinkDPRate == dml2_dp_rate_uhbr10) && PHYCLKD32 >= 10000 / 32) {
+				if ((OutputLinkDPRate == dml2_dp_rate_na || OutputLinkDPRate == dml2_dp_rate_uhbr10) && PHYCLKD32 >= 10000.0 / 32) {
 					*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, (1 - Downspreading / 100) * 10000, OutputLinkDPLanes, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output,
 						OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, RequiredSlots);
-					if (*OutBpp == 0 && PHYCLKD32 < 13500 / 32 && DSCEnable == dml2_dsc_enable_if_necessary && ForcedOutputLinkBPP == 0) {
+					if (*OutBpp == 0 && PHYCLKD32 < 13500.0 / 32 && DSCEnable == dml2_dsc_enable_if_necessary && ForcedOutputLinkBPP == 0) {
 						*RequiresDSC = true;
 						LinkDSCEnable = true;
 						*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, (1 - Downspreading / 100) * 10000, OutputLinkDPLanes, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output,
@@ -4215,11 +4215,11 @@ static void CalculateOutputLink(
 					*OutputType = dml2_core_internal_output_type_dp2p0;
 					*OutputRate = dml2_core_internal_output_rate_dp_rate_uhbr10;
 				}
-				if ((OutputLinkDPRate == dml2_dp_rate_na || OutputLinkDPRate == dml2_dp_rate_uhbr13p5) && *OutBpp == 0 && PHYCLKD32 >= 13500 / 32) {
+				if ((OutputLinkDPRate == dml2_dp_rate_na || OutputLinkDPRate == dml2_dp_rate_uhbr13p5) && *OutBpp == 0 && PHYCLKD32 >= 13500.0 / 32) {
 					*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, (1 - Downspreading / 100) * 13500, OutputLinkDPLanes, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output,
 						OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, RequiredSlots);
 
-					if (*OutBpp == 0 && PHYCLKD32 < 20000 / 32 && DSCEnable == dml2_dsc_enable_if_necessary && ForcedOutputLinkBPP == 0) {
+					if (*OutBpp == 0 && PHYCLKD32 < 20000.0 / 32 && DSCEnable == dml2_dsc_enable_if_necessary && ForcedOutputLinkBPP == 0) {
 						*RequiresDSC = true;
 						LinkDSCEnable = true;
 						*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, (1 - Downspreading / 100) * 13500, OutputLinkDPLanes, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output,
@@ -4229,7 +4229,7 @@ static void CalculateOutputLink(
 					*OutputType = dml2_core_internal_output_type_dp2p0;
 					*OutputRate = dml2_core_internal_output_rate_dp_rate_uhbr13p5;
 				}
-				if ((OutputLinkDPRate == dml2_dp_rate_na || OutputLinkDPRate == dml2_dp_rate_uhbr20) && *OutBpp == 0 && PHYCLKD32 >= 20000 / 32) {
+				if ((OutputLinkDPRate == dml2_dp_rate_na || OutputLinkDPRate == dml2_dp_rate_uhbr20) && *OutBpp == 0 && PHYCLKD32 >= 20000.0 / 32) {
 					*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, (1 - Downspreading / 100) * 20000, OutputLinkDPLanes, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output,
 						OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, RequiredSlots);
 					if (*OutBpp == 0 && DSCEnable == dml2_dsc_enable_if_necessary && ForcedOutputLinkBPP == 0) {
@@ -4306,33 +4306,33 @@ static void CalculateOutputLink(
 				*RequiresFEC = false;
 			}
 			*OutBpp = 0;
-			if (PHYCLKD18 >= 3000 / 18) {
+			if (PHYCLKD18 >= 3000.0 / 18) {
 				*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, 3000, 3, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output, OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, &dummy);
 				//OutputTypeAndRate = Output & "3x3";
 				*OutputType = dml2_core_internal_output_type_hdmifrl;
 				*OutputRate = dml2_core_internal_output_rate_hdmi_rate_3x3;
 			}
-			if (*OutBpp == 0 && PHYCLKD18 >= 6000 / 18) {
+			if (*OutBpp == 0 && PHYCLKD18 >= 6000.0 / 18) {
 				*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, 6000, 3, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output, OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, &dummy);
 				//OutputTypeAndRate = Output & "6x3";
 				*OutputType = dml2_core_internal_output_type_hdmifrl;
 				*OutputRate = dml2_core_internal_output_rate_hdmi_rate_6x3;
 			}
-			if (*OutBpp == 0 && PHYCLKD18 >= 6000 / 18) {
+			if (*OutBpp == 0 && PHYCLKD18 >= 6000.0 / 18) {
 				*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, 6000, 4, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output, OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, &dummy);
 				//OutputTypeAndRate = Output & "6x4";
 				*OutputType = dml2_core_internal_output_type_hdmifrl;
 				*OutputRate = dml2_core_internal_output_rate_hdmi_rate_6x4;
 			}
-			if (*OutBpp == 0 && PHYCLKD18 >= 8000 / 18) {
+			if (*OutBpp == 0 && PHYCLKD18 >= 8000.0 / 18) {
 				*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, 8000, 4, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output, OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, &dummy);
 				//OutputTypeAndRate = Output & "8x4";
 				*OutputType = dml2_core_internal_output_type_hdmifrl;
 				*OutputRate = dml2_core_internal_output_rate_hdmi_rate_8x4;
 			}
-			if (*OutBpp == 0 && PHYCLKD18 >= 10000 / 18) {
+			if (*OutBpp == 0 && PHYCLKD18 >= 10000.0 / 18) {
 				*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, 10000, 4, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output, OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, &dummy);
-				if (*OutBpp == 0 && DSCEnable == dml2_dsc_enable_if_necessary && ForcedOutputLinkBPP == 0 && PHYCLKD18 < 12000 / 18) {
+				if (*OutBpp == 0 && DSCEnable == dml2_dsc_enable_if_necessary && ForcedOutputLinkBPP == 0 && PHYCLKD18 < 12000.0 / 18) {
 					*RequiresDSC = true;
 					LinkDSCEnable = true;
 					*RequiresFEC = true;
@@ -4342,7 +4342,7 @@ static void CalculateOutputLink(
 				*OutputType = dml2_core_internal_output_type_hdmifrl;
 				*OutputRate = dml2_core_internal_output_rate_hdmi_rate_10x4;
 			}
-			if (*OutBpp == 0 && PHYCLKD18 >= 12000 / 18) {
+			if (*OutBpp == 0 && PHYCLKD18 >= 12000.0 / 18) {
 				*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, 12000, 4, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output, OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, &dummy);
 				if (*OutBpp == 0 && DSCEnable == dml2_dsc_enable_if_necessary && ForcedOutputLinkBPP == 0) {
 					*RequiresDSC = true;
@@ -7126,7 +7126,7 @@ static bool dml_core_mode_support(struct dml2_core_calcs_mode_support_ex *in_out
 	mode_lib->ms.support.WritebackLatencySupport = true;
 	for (k = 0; k <= mode_lib->ms.num_active_planes - 1; k++) {
 		if (display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].writeback.enable == true &&
-			(mode_lib->ms.WriteBandwidth[k] > mode_lib->ip.writeback_interface_buffer_size_kbytes * 1024 / mode_lib->soc.qos_parameters.writeback.base_latency_us)) {
+			(mode_lib->ms.WriteBandwidth[k] > mode_lib->ip.writeback_interface_buffer_size_kbytes * 1024.0 / mode_lib->soc.qos_parameters.writeback.base_latency_us)) {
 			mode_lib->ms.support.WritebackLatencySupport = false;
 		}
 	}
@@ -11350,7 +11350,7 @@ static bool dml_core_mode_programming(struct dml2_core_calcs_mode_programming_ex
 			mode_lib->mp.MIN_DST_Y_NEXT_START[k] = s->dlg_vblank_start + s->blank_lines_remaining + s->LSetup;
 
 			// debug only
-			if (((mode_lib->mp.VUpdateOffsetPix[k] + mode_lib->mp.VUpdateWidthPix[k] + mode_lib->mp.VReadyOffsetPix[k]) / display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.h_total) <=
+			if (((mode_lib->mp.VUpdateOffsetPix[k] + mode_lib->mp.VUpdateWidthPix[k] + mode_lib->mp.VReadyOffsetPix[k]) / (double) display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.h_total) <=
 				(isInterlaceTiming ?
 					math_floor2((display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.v_total - display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.v_active - display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.v_front_porch - mode_lib->mp.VStartup[k]) / 2.0, 1.0) :
 					(int)(display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.v_total - display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.v_active - display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.v_front_porch - mode_lib->mp.VStartup[k]))) {
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_shared.c +12 -12
index cfa4c4475821..0099e58e0b1a 100644
@@ -942,7 +942,7 @@ bool dml2_core_shared_mode_support(struct dml2_core_calcs_mode_support_ex *in_ou
 	mode_lib->ms.support.WritebackLatencySupport = true;
 	for (k = 0; k <= mode_lib->ms.num_active_planes - 1; k++) {
 		if (display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].writeback.enable == true &&
-			(mode_lib->ms.WriteBandwidth[k] > mode_lib->ip.writeback_interface_buffer_size_kbytes * 1024 / mode_lib->soc.qos_parameters.writeback.base_latency_us)) {
+			(mode_lib->ms.WriteBandwidth[k] > mode_lib->ip.writeback_interface_buffer_size_kbytes * 1024.0 / mode_lib->soc.qos_parameters.writeback.base_latency_us)) {
 			mode_lib->ms.support.WritebackLatencySupport = false;
 		}
 	}
@@ -6731,10 +6731,10 @@ static void CalculateOutputLink(
 			}
 			if (Output == dml2_dp2p0) {
 				*OutBpp = 0;
-				if ((OutputLinkDPRate == dml2_dp_rate_na || OutputLinkDPRate == dml2_dp_rate_uhbr10) && PHYCLKD32 >= 10000 / 32) {
+				if ((OutputLinkDPRate == dml2_dp_rate_na || OutputLinkDPRate == dml2_dp_rate_uhbr10) && PHYCLKD32 >= 10000.0 / 32) {
 					*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, (1 - Downspreading / 100) * 10000, OutputLinkDPLanes, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output,
 						OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, RequiredSlots);
-					if (*OutBpp == 0 && PHYCLKD32 < 13500 / 32 && DSCEnable == dml2_dsc_enable_if_necessary && ForcedOutputLinkBPP == 0) {
+					if (*OutBpp == 0 && PHYCLKD32 < 13500.0 / 32 && DSCEnable == dml2_dsc_enable_if_necessary && ForcedOutputLinkBPP == 0) {
 						*RequiresDSC = true;
 						LinkDSCEnable = true;
 						*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, (1 - Downspreading / 100) * 10000, OutputLinkDPLanes, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output,
@@ -6744,7 +6744,7 @@ static void CalculateOutputLink(
 					*OutputType = dml2_core_internal_output_type_dp2p0;
 					*OutputRate = dml2_core_internal_output_rate_dp_rate_uhbr10;
 				}
-				if ((OutputLinkDPRate == dml2_dp_rate_na || OutputLinkDPRate == dml2_dp_rate_uhbr13p5) && *OutBpp == 0 && PHYCLKD32 >= 13500 / 32) {
+				if ((OutputLinkDPRate == dml2_dp_rate_na || OutputLinkDPRate == dml2_dp_rate_uhbr13p5) && *OutBpp == 0 && PHYCLKD32 >= 13500.0 / 32) {
 					*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, (1 - Downspreading / 100) * 13500, OutputLinkDPLanes, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output,
 						OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, RequiredSlots);
 
@@ -6835,33 +6835,33 @@ static void CalculateOutputLink(
 				*RequiresFEC = false;
 			}
 			*OutBpp = 0;
-			if (PHYCLKD18 >= 3000 / 18) {
+			if (PHYCLKD18 >= 3000.0 / 18) {
 				*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, 3000, 3, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output, OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, &dummy);
 				//OutputTypeAndRate = Output & "3x3";
 				*OutputType = dml2_core_internal_output_type_hdmifrl;
 				*OutputRate = dml2_core_internal_output_rate_hdmi_rate_3x3;
 			}
-			if (*OutBpp == 0 && PHYCLKD18 >= 6000 / 18) {
+			if (*OutBpp == 0 && PHYCLKD18 >= 6000.0 / 18) {
 				*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, 6000, 3, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output, OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, &dummy);
 				//OutputTypeAndRate = Output & "6x3";
 				*OutputType = dml2_core_internal_output_type_hdmifrl;
 				*OutputRate = dml2_core_internal_output_rate_hdmi_rate_6x3;
 			}
-			if (*OutBpp == 0 && PHYCLKD18 >= 6000 / 18) {
+			if (*OutBpp == 0 && PHYCLKD18 >= 6000.0 / 18) {
 				*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, 6000, 4, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output, OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, &dummy);
 				//OutputTypeAndRate = Output & "6x4";
 				*OutputType = dml2_core_internal_output_type_hdmifrl;
 				*OutputRate = dml2_core_internal_output_rate_hdmi_rate_6x4;
 			}
-			if (*OutBpp == 0 && PHYCLKD18 >= 8000 / 18) {
+			if (*OutBpp == 0 && PHYCLKD18 >= 8000.0 / 18) {
 				*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, 8000, 4, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output, OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, &dummy);
 				//OutputTypeAndRate = Output & "8x4";
 				*OutputType = dml2_core_internal_output_type_hdmifrl;
 				*OutputRate = dml2_core_internal_output_rate_hdmi_rate_8x4;
 			}
-			if (*OutBpp == 0 && PHYCLKD18 >= 10000 / 18) {
+			if (*OutBpp == 0 && PHYCLKD18 >= 10000.0 / 18) {
 				*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, 10000, 4, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output, OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, &dummy);
-				if (*OutBpp == 0 && DSCEnable == dml2_dsc_enable_if_necessary && ForcedOutputLinkBPP == 0 && PHYCLKD18 < 12000 / 18) {
+				if (*OutBpp == 0 && DSCEnable == dml2_dsc_enable_if_necessary && ForcedOutputLinkBPP == 0 && PHYCLKD18 < 12000.0 / 18) {
 					*RequiresDSC = true;
 					LinkDSCEnable = true;
 					*RequiresFEC = true;
@@ -6871,7 +6871,7 @@ static void CalculateOutputLink(
 				*OutputType = dml2_core_internal_output_type_hdmifrl;
 				*OutputRate = dml2_core_internal_output_rate_hdmi_rate_10x4;
 			}
-			if (*OutBpp == 0 && PHYCLKD18 >= 12000 / 18) {
+			if (*OutBpp == 0 && PHYCLKD18 >= 12000.0 / 18) {
 				*OutBpp = TruncToValidBPP(&s->TruncToValidBPP_locals, 12000, 4, HTotal, HActive, PixelClockBackEnd, ForcedOutputLinkBPP, LinkDSCEnable, Output, OutputFormat, DSCInputBitPerComponent, NumberOfDSCSlices, (unsigned int)AudioSampleRate, AudioSampleLayout, ODMModeNoDSC, ODMModeDSC, &dummy);
 				if (*OutBpp == 0 && DSCEnable == dml2_dsc_enable_if_necessary && ForcedOutputLinkBPP == 0) {
 					*RequiresDSC = true;
@@ -11236,7 +11236,7 @@ bool dml2_core_shared_mode_programming(struct dml2_core_calcs_mode_programming_e
 			mode_lib->mp.MIN_DST_Y_NEXT_START[k] = s->dlg_vblank_start + s->blank_lines_remaining + s->LSetup;
 
 			// debug only
-			if (((mode_lib->mp.VUpdateOffsetPix[k] + mode_lib->mp.VUpdateWidthPix[k] + mode_lib->mp.VReadyOffsetPix[k]) / display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.h_total) <=
+			if (((mode_lib->mp.VUpdateOffsetPix[k] + mode_lib->mp.VUpdateWidthPix[k] + (double) mode_lib->mp.VReadyOffsetPix[k]) / display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.h_total) <=
 				(isInterlaceTiming ?
 					math_floor2((display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.v_total - display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.v_active - display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.v_front_porch - mode_lib->mp.VStartup[k]) / 2.0, 1.0) :
 					(int)(display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.v_total - display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.v_active - display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.v_front_porch - mode_lib->mp.VStartup[k]))) {
Signature · 1 line
2.45.1
#25 lore raw

PATCH 25/36 drm/amd/display: Fix warning caused by an attempt to configure a non-otg master

In reply to Hamza Mahfooz

From: Rodrigo Siqueira <[email protected]>

When booting the system with DCN401, the driver adds the following dmesg warning:

WARNING: CPU: 8 PID: 175 at
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_resource.c:1923
resource_get_opp_heads_for_otg_master+0x13/0x70 [amdgpu]

Modules linked in: amdgpu(+) hid_generic amdxcp i2c_algo_bit

drm_ttm_helper ttm drm_exec gpu_sched drm_suballoc_helper drm_buddy drm_display_helper drm_kms_helper usbhid hid drm i2c_piix4 ahci igc libahci video wmi

CPU: 8 PID: 175 Comm: systemd-udevd Not tainted 6.8.0-EXTRA-PROMO-MAY-29+ #66
Hardware name: ASUS System Product Name/TUF GAMING X570-PRO (WI-FI),

BIOS 4021 08/10/2021

RIP: 0010:resource_get_opp_heads_for_otg_master+0x13/0x70 [amdgpu]
Code: 8b 66 0f 1f 44 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90

90 0f 1f 44 00 00 55 48 83 bf f8 07 00 00 00 48 89 e5 74 0c <0f> 0b 31 f6 89 f0 5d e9 0c 65 01 e5 48 83 bf e0 07 00 00 00 75 ea

RSP: 0018:ffffa5f000816ed8 EFLAGS: 00010246
[...]
PKRU: 55555554

Call Trace:
 <TASK>
 ? show_regs+0x65/0x70
 ? __warn+0x85/0x160
 ? resource_get_opp_heads_for_otg_master+0x13/0x70 [amdgpu]
 ? report_bug+0x192/0x1c0
 ? handle_bug+0x44/0x90
 ? exc_invalid_op+0x18/0x70

[...]

This warning is triggered by a check in the function resource_get_opp_heads_for_otg_master that validates if the request operation is in a master OTG pipe; if not, the warning above is displayed. In other words, another part of the code might be calling this function in a non-OTG master pipe context, resulting in the log message.

The reason the ASSERT was triggered is that the current state wasn't updated after applying the context to the hardware. This means that the update_dsc_for_odm_change might be called from a non-OTG-MASTER. To prevent this, it's crucial to check if the current reference is pointing to an OTG master before operate in the old OTG master reference. If it's not, the function must set the old OTG reference to NULL and avoid calling resource_get_opp_heads_for_otg_master before the context is updated.

---
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 24 ++++++++++++++-----
 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +18 -6
index 0fafbec442b1..cb8e417fb032 100644
@@ -1561,16 +1561,28 @@ static void update_dsc_for_odm_change(struct dc *dc, struct dc_state *context,
 	struct pipe_ctx *new_pipe;
 	struct pipe_ctx *old_opp_heads[MAX_PIPES];
 	struct dccg *dccg = dc->res_pool->dccg;
-	struct pipe_ctx *old_otg_master =
-			&dc->current_state->res_ctx.pipe_ctx[otg_master->pipe_idx];
-	int old_opp_head_count = resource_get_opp_heads_for_otg_master(
-			old_otg_master, &dc->current_state->res_ctx,
-			old_opp_heads);
+	struct pipe_ctx *old_otg_master;
+	int old_opp_head_count = 0;
+
+	old_otg_master = &dc->current_state->res_ctx.pipe_ctx[otg_master->pipe_idx];
+
+	if (resource_is_pipe_type(old_otg_master, OTG_MASTER)) {
+		old_opp_head_count = resource_get_opp_heads_for_otg_master(old_otg_master,
+									   &dc->current_state->res_ctx,
+									   old_opp_heads);
+	} else {
+		// DC cannot assume that the current state and the new state
+		// share the same OTG pipe since this is not true when called
+		// in the context of a commit stream not checked. Hence, set
+		// old_otg_master to NULL to skip the DSC configuration.
+		old_otg_master = NULL;
+	}
+
 
 	if (otg_master->stream_res.dsc)
 		dcn32_update_dsc_on_stream(otg_master,
 				otg_master->stream->timing.flags.DSC);
-	if (old_otg_master->stream_res.dsc) {
+	if (old_otg_master && old_otg_master->stream_res.dsc) {
 		for (i = 0; i < old_opp_head_count; i++) {
 			old_pipe = old_opp_heads[i];
 			new_pipe = &context->res_ctx.pipe_ctx[old_pipe->pipe_idx];
Signature · 1 line
2.45.1
#26 lore raw

PATCH 26/36 drm/amd/display: Improve warning log for get OPP for OTG master

In reply to Hamza Mahfooz

From: Rodrigo Siqueira <[email protected]>

If some part of the driver tries to call resource_get_opp_heads_for_otg_master in a non-OTG master context, DC will trigger a dmesg warning since this situation indicates that some configuration associated with ODM slices might be wrong. This commit adds an extra log to describe why the warning was triggered to make the debugging more straightforward.

---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +6 -0
index 87e84b0a3d48..1cba8f58f1e6 100644
@@ -1917,9 +1917,15 @@ int resource_get_opp_heads_for_otg_master(const struct pipe_ctx *otg_master,
 		struct pipe_ctx *opp_heads[MAX_PIPES])
 {
 	struct pipe_ctx *opp_head = &res_ctx->pipe_ctx[otg_master->pipe_idx];
+	struct dc *dc = otg_master->stream->ctx->dc;
 	int i = 0;
 
+	DC_LOGGER_INIT(dc->ctx->logger);
+
 	if (!resource_is_pipe_type(otg_master, OTG_MASTER)) {
+		DC_LOG_WARNING("%s called from a non OTG master, something "
+			       "is wrong in the pipe configuration",
+			       __func__);
 		ASSERT(0);
 		return 0;
 	}
Signature · 1 line
2.45.1
#27 lore raw

PATCH 27/36 drm/amd/display: Remove redundant checks for res_pool->dccg

In reply to Hamza Mahfooz

From: Alex Hung <[email protected]>

The null checks for res_pool->dccg are redundant as it was already dereferenced previously, as reported by Coverity; therefore the null checks are removed.

This fixes 6 REVERSE_INULL issues reported by Coverity.

---
 drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_hwseq.c | 2 +-
 drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c   | 2 +-
 drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c   | 2 +-
 drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c   | 2 +-
 drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c   | 2 +-
 drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_hwseq.c +1 -1
index 86d871cc74c7..f96adc689055 100644
@@ -240,7 +240,7 @@ void dcn201_init_hw(struct dc *dc)
 		res_pool->ref_clocks.xtalin_clock_inKhz =
 			dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency;
 
-		if (res_pool->dccg && res_pool->hubbub) {
+		if (res_pool->hubbub) {
 			(res_pool->dccg->funcs->get_dccg_ref_freq)(res_pool->dccg,
 					dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency,
 					&res_pool->ref_clocks.dccg_ref_clock_inKhz);
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c +1 -1
index 9ef38a3759b1..567300c3acaa 100644
@@ -656,7 +656,7 @@ void dcn30_init_hw(struct dc *dc)
 		res_pool->ref_clocks.xtalin_clock_inKhz =
 				dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency;
 
-		if (res_pool->dccg && res_pool->hubbub) {
+		if (res_pool->hubbub) {
 
 			(res_pool->dccg->funcs->get_dccg_ref_freq)(res_pool->dccg,
 					dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency,
drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c +1 -1
index 1c8abb417b6e..746c522adf84 100644
@@ -132,7 +132,7 @@ void dcn31_init_hw(struct dc *dc)
 		res_pool->ref_clocks.xtalin_clock_inKhz =
 				dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency;
 
-		if (res_pool->dccg && res_pool->hubbub) {
+		if (res_pool->hubbub) {
 
 			(res_pool->dccg->funcs->get_dccg_ref_freq)(res_pool->dccg,
 					dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency,
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +1 -1
index 33b8df995869..a597b2342472 100644
@@ -806,7 +806,7 @@ void dcn32_init_hw(struct dc *dc)
 		res_pool->ref_clocks.xtalin_clock_inKhz =
 				dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency;
 
-		if (res_pool->dccg && res_pool->hubbub) {
+		if (res_pool->hubbub) {
 			(res_pool->dccg->funcs->get_dccg_ref_freq)(res_pool->dccg,
 					dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency,
 					&res_pool->ref_clocks.dccg_ref_clock_inKhz);
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +1 -1
index d894c52bfdaf..a1e1f76bfde7 100644
@@ -188,7 +188,7 @@ void dcn35_init_hw(struct dc *dc)
 		res_pool->ref_clocks.xtalin_clock_inKhz =
 				dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency;
 
-		if (res_pool->dccg && res_pool->hubbub) {
+		if (res_pool->hubbub) {
 
 			(res_pool->dccg->funcs->get_dccg_ref_freq)(res_pool->dccg,
 				dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency,
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +1 -1
index cb8e417fb032..6ba2e1cd20c7 100644
@@ -259,7 +259,7 @@ void dcn401_init_hw(struct dc *dc)
 		res_pool->ref_clocks.xtalin_clock_inKhz =
 				dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency;
 
-		if (res_pool->dccg && res_pool->hubbub) {
+		if (res_pool->hubbub) {
 			(res_pool->dccg->funcs->get_dccg_ref_freq)(res_pool->dccg,
 					dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency,
 					&res_pool->ref_clocks.dccg_ref_clock_inKhz);
Signature · 1 line
2.45.1
#28 lore raw

PATCH 28/36 drm/amd/display: Remove redundant checks for ctx->dc_bios

In reply to Hamza Mahfooz

From: Alex Hung <[email protected]>

The null checks for ctx->dc_bios are redundant as it was already dereferenced previously, as reported by Coverity; therefore the null checks are removed.

This fixes 7 REVERSE_INULL issues reported by Coverity.

---
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c      | 2 +-
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c     | 2 +-
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c   | 2 +-
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c | 2 +-
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c | 2 +-
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c | 2 +-
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c   | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +1 -1
index a650a9877097..e18097f82091 100644
@@ -772,7 +772,7 @@ void rn_clk_mgr_construct(
 		status = pp_smu->rn_funcs.get_dpm_clock_table(&pp_smu->rn_funcs.pp_smu, &clock_table);
 
 		if (status == PP_SMU_RESULT_OK &&
-		    ctx->dc_bios && ctx->dc_bios->integrated_info) {
+		    ctx->dc_bios->integrated_info) {
 			rn_clk_mgr_helper_populate_bw_params (clk_mgr->base.bw_params, &clock_table, ctx->dc_bios->integrated_info);
 			/* treat memory config as single channel if memory is asymmetrics. */
 			if (ctx->dc->config.is_asymmetric_memory)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c +1 -1
index 148a0e4cdea2..9e2ef0e724fc 100644
@@ -731,7 +731,7 @@ void vg_clk_mgr_construct(
 	clk_mgr->base.base.bw_params = &vg_bw_params;
 
 	vg_get_dpm_table_from_smu(&clk_mgr->base, &smu_dpm_clks);
-	if (ctx->dc_bios && ctx->dc_bios->integrated_info) {
+	if (ctx->dc_bios->integrated_info) {
 		vg_clk_mgr_helper_populate_bw_params(
 				&clk_mgr->base,
 				ctx->dc_bios->integrated_info,
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c +1 -1
index 12a7752758b8..e93df3d6222e 100644
@@ -785,7 +785,7 @@ void dcn31_clk_mgr_construct(
 					   i, smu_dpm_clks.dpm_clks->DfPstateTable[i].MemClk,
 					   i, smu_dpm_clks.dpm_clks->DfPstateTable[i].Voltage);
 		}
-		if (ctx->dc_bios && ctx->dc_bios->integrated_info) {
+		if (ctx->dc_bios->integrated_info) {
 			dcn31_clk_mgr_helper_populate_bw_params(
 					&clk_mgr->base,
 					ctx->dc_bios->integrated_info,
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c +1 -1
index a84f1e376dee..29eff386505a 100644
@@ -896,7 +896,7 @@ void dcn314_clk_mgr_construct(
 					   i, smu_dpm_clks.dpm_clks->DfPstateTable[i].Voltage);
 		}
 
-		if (ctx->dc_bios && ctx->dc_bios->integrated_info && ctx->dc->config.use_default_clock_table == false) {
+		if (ctx->dc_bios->integrated_info && ctx->dc->config.use_default_clock_table == false) {
 			dcn314_clk_mgr_helper_populate_bw_params(
 					&clk_mgr->base,
 					ctx->dc_bios->integrated_info,
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c +1 -1
index 5506cf9b3672..a0fb4481d2f1 100644
@@ -712,7 +712,7 @@ void dcn315_clk_mgr_construct(
 					   i, smu_dpm_clks.dpm_clks->DfPstateTable[i].Voltage);
 		}
 
-		if (ctx->dc_bios && ctx->dc_bios->integrated_info) {
+		if (ctx->dc_bios->integrated_info) {
 			dcn315_clk_mgr_helper_populate_bw_params(
 					&clk_mgr->base,
 					ctx->dc_bios->integrated_info,
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c +1 -1
index 20ca7afa9cb4..c3e50c3aaa60 100644
@@ -652,7 +652,7 @@ void dcn316_clk_mgr_construct(
 	if (clk_mgr->base.base.ctx->dc->debug.pstate_enabled) {
 		dcn316_get_dpm_table_from_smu(&clk_mgr->base, &smu_dpm_clks);
 
-		if (ctx->dc_bios && ctx->dc_bios->integrated_info) {
+		if (ctx->dc_bios->integrated_info) {
 			dcn316_clk_mgr_helper_populate_bw_params(
 					&clk_mgr->base,
 					ctx->dc_bios->integrated_info,
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c +1 -1
index 9a414f49f15a..5691714f738d 100644
@@ -1182,7 +1182,7 @@ void dcn35_clk_mgr_construct(
 					   i, smu_dpm_clks.dpm_clks->MemPstateTable[i].Voltage);
 		}
 
-		if (ctx->dc_bios && ctx->dc_bios->integrated_info && ctx->dc->config.use_default_clock_table == false) {
+		if (ctx->dc_bios->integrated_info && ctx->dc->config.use_default_clock_table == false) {
 			dcn35_clk_mgr_helper_populate_bw_params(
 					&clk_mgr->base,
 					ctx->dc_bios->integrated_info,
Signature · 1 line
2.45.1
#29 lore raw

PATCH 29/36 drm/amd/display: Remove unused value set from 'min_hratio_fact' in dml

In reply to Hamza Mahfooz

From: Ivan Lipski <[email protected]>

These portions of code are flagged as 'UNUSED_VALUE' by the Coverity analysis since the assigned values of these vars are never used in the code.

---
 .../drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.c    | 5 -----
 .../drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.c  | 5 -----
 .../drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c    | 5 -----
 .../drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c    | 5 -----
 .../drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c    | 5 -----
 .../drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.c  | 5 -----
 .../gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.c    | 5 -----
 7 files changed, 35 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.c +0 -5
index 548cdef8a8ad..07146569e335 100644
@@ -1156,11 +1156,6 @@ static void dml20_rq_dlg_get_dlg_params(struct display_mode_lib *mode_lib,
 		swath_width_pixels_ub_c = swath_width_ub_c * 1;
 	}
 
-	hscale_pixel_rate_l = 0.;
-	hscale_pixel_rate_c = 0.;
-	min_hratio_fact_l = 1.0;
-	min_hratio_fact_c = 1.0;
-
 	if (htaps_l <= 1)
 		min_hratio_fact_l = 2.0;
 	else if (htaps_l <= 6) {
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.c +0 -5
index 0fc9f3e3ffae..f4bba1f2aeb6 100644
@@ -1157,11 +1157,6 @@ static void dml20v2_rq_dlg_get_dlg_params(struct display_mode_lib *mode_lib,
 		swath_width_pixels_ub_c = swath_width_ub_c * 1;
 	}
 
-	hscale_pixel_rate_l = 0.;
-	hscale_pixel_rate_c = 0.;
-	min_hratio_fact_l = 1.0;
-	min_hratio_fact_c = 1.0;
-
 	if (htaps_l <= 1)
 		min_hratio_fact_l = 2.0;
 	else if (htaps_l <= 6) {
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c +0 -5
index 708e1632170d..c229a9edf82a 100644
@@ -1205,11 +1205,6 @@ static void dml_rq_dlg_get_dlg_params(
 		swath_width_pixels_ub_c = swath_width_ub_c * 1;
 	}
 
-	hscale_pixel_rate_l = 0.;
-	hscale_pixel_rate_c = 0.;
-	min_hratio_fact_l = 1.0;
-	min_hratio_fact_c = 1.0;
-
 	if (hratio_l <= 1)
 		min_hratio_fact_l = 2.0;
 	else if (htaps_l <= 6) {
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c +0 -5
index 0497a5d74a62..f3ee7baac786 100644
@@ -1309,11 +1309,6 @@ static void dml_rq_dlg_get_dlg_params(struct display_mode_lib *mode_lib,
 		swath_width_pixels_ub_c = swath_width_ub_c * 1;
 	}
 
-	hscale_pixel_rate_l = 0.;
-	hscale_pixel_rate_c = 0.;
-	min_hratio_fact_l = 1.0;
-	min_hratio_fact_c = 1.0;
-
 	if (hratio_l <= 1)
 		min_hratio_fact_l = 2.0;
 	else if (htaps_l <= 6) {
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c +0 -5
index 4113ce79c4af..b6d954d9aa00 100644
@@ -1150,11 +1150,6 @@ static void dml_rq_dlg_get_dlg_params(
 		swath_width_pixels_ub_c = swath_width_ub_c * 1;
 	}
 
-	hscale_pixel_rate_l = 0.;
-	hscale_pixel_rate_c = 0.;
-	min_hratio_fact_l = 1.0;
-	min_hratio_fact_c = 1.0;
-
 	if (hratio_l <= 1)
 		min_hratio_fact_l = 2.0;
 	else if (htaps_l <= 6) {
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.c +0 -5
index b3e8dc08030c..94975b0fa398 100644
@@ -1238,11 +1238,6 @@ static void dml_rq_dlg_get_dlg_params(
 		swath_width_pixels_ub_c = swath_width_ub_c * 1;
 	}
 
-	hscale_pixel_rate_l = 0.;
-	hscale_pixel_rate_c = 0.;
-	min_hratio_fact_l = 1.0;
-	min_hratio_fact_c = 1.0;
-
 	if (hratio_l <= 1)
 		min_hratio_fact_l = 2.0;
 	else if (htaps_l <= 6) {
drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.c +0 -5
index 3df559c591f8..dae13f202220 100644
@@ -1596,11 +1596,6 @@ void dml1_rq_dlg_get_dlg_params(
 		swath_width_pixels_ub_c = swath_width_ub_c * 1;
 	}
 
-	hscale_pixel_rate_l = 0.;
-	hscale_pixel_rate_c = 0.;
-	min_hratio_fact_l = 1.0;
-	min_hratio_fact_c = 1.0;
-
 	if (htaps_l <= 1)
 		min_hratio_fact_l = 2.0;
 	else if (htaps_l <= 6) {
Signature · 1 line
2.45.1
#30 lore raw

PATCH 30/36 drm/amd/display: Remove redundant null checks

In reply to Hamza Mahfooz

From: Alex Hung <[email protected]>

The null checks are redundant as they were already dereferenced previously, as reported by Coverity; therefore the null checks are removed.

This fixes 7 REVERSE_INULL issues reported by Coverity.

---
 .../display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c  |  2 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c      |  4 +-
 .../gpu/drm/amd/display/dc/core/dc_resource.c |  2 +-
 .../dc/dml2/dml21/dml21_translation_helper.c  |  4 +-
 .../amd/display/dc/hwss/dce110/dce110_hwseq.c |  8 +-
 .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c   | 81 +++++++++----------
 6 files changed, 47 insertions(+), 54 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c +1 -1
index ee4b02c8c807..06f0c41ad6f1 100644
@@ -553,7 +553,7 @@ static void dcn32_auto_dpm_test_log(
 	//
 	//				AutoDPMTest: clk1:%d - clk2:%d - clk3:%d - clk4:%d\n"
 	////////////////////////////////////////////////////////////////////////////
-	if (new_clocks && active_pipe_count > 0 &&
+	if (active_pipe_count > 0 &&
 		new_clocks->dramclk_khz > 0 &&
 		new_clocks->fclk_khz > 0 &&
 		new_clocks->dcfclk_khz > 0 &&
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -2
index fce1c3e03094..a4ba6f99cd34 100644
@@ -2640,7 +2640,7 @@ static enum surface_update_type det_surface_update(const struct dc *dc,
 
 		if (u->plane_info)
 			format = u->plane_info->format;
-		else if (u->surface)
+		else
 			format = u->surface->format;
 
 		if (dce_use_lut(format))
@@ -2741,7 +2741,7 @@ static enum surface_update_type check_update_surfaces_for_stream(
 		if (stream_update->mst_bw_update)
 			su_flags->bits.mst_bw = 1;
 
-		if (stream_update->stream && stream_update->stream->freesync_on_desktop &&
+		if (stream_update->stream->freesync_on_desktop &&
 			(stream_update->vrr_infopacket || stream_update->allow_freesync ||
 				stream_update->vrr_active_variable || stream_update->vrr_active_fixed))
 			su_flags->bits.fams_changed = 1;
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
index 1cba8f58f1e6..eb053e1791c0 100644
@@ -2099,7 +2099,7 @@ int resource_get_odm_slice_dst_width(struct pipe_ctx *otg_master,
 			timing->h_border_right;
 	width = h_active / count;
 
-	if (otg_master->stream_res.tg && otg_master->stream)
+	if (otg_master->stream_res.tg)
 		two_pixel_alignment_required =
 				otg_master->stream_res.tg->funcs->is_two_pixels_per_container(timing) ||
 				/*
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_translation_helper.c +1 -3
index a7d02da16bb5..d5ead0205053 100644
@@ -102,9 +102,7 @@ void dml21_apply_soc_bb_overrides(struct dml2_initialize_instance_in_out *dml_in
 	struct dml2_soc_state_table *dml_clk_table = &dml_soc_bb->clk_table;
 
 	/* override clocks if smu is present */
-	if (in_dc->clk_mgr &&
-			in_dc->clk_mgr->funcs->is_smu_present &&
-			in_dc->clk_mgr->funcs->is_smu_present(in_dc->clk_mgr)) {
+	if (in_dc->clk_mgr->funcs->is_smu_present && in_dc->clk_mgr->funcs->is_smu_present(in_dc->clk_mgr)) {
 		/* dcfclk */
 		if (dc_clk_table->num_entries_per_clk.num_dcfclk_levels) {
 			dml_clk_table->dcfclk.num_clk_values = dc_clk_table->num_entries_per_clk.num_dcfclk_levels;
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +3 -5
index 871f1e1ca2e0..307af11b4bb6 100644
@@ -742,12 +742,10 @@ void dce110_edp_wait_for_hpd_ready(
 		return;
 	}
 
-	if (link != NULL) {
-		if (link->panel_config.pps.extra_t3_ms > 0) {
-			int extra_t3_in_ms = link->panel_config.pps.extra_t3_ms;
+	if (link->panel_config.pps.extra_t3_ms > 0) {
+		int extra_t3_in_ms = link->panel_config.pps.extra_t3_ms;
 
-			msleep(extra_t3_in_ms);
-		}
+		msleep(extra_t3_in_ms);
 	}
 
 	dal_gpio_open(hpd, GPIO_MODE_INTERRUPT);
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +39 -42

97 lines not on this page · raw message

Signature · 1 line
2.45.1
#31 lore raw

PATCH 31/36 drm/amd/display: Remove redundant checks for opp

In reply to Hamza Mahfooz

From: Alex Hung <[email protected]>

The null checks for opp are redundant as they were already dereferenced previously, as reported by Coverity; therefore the null checks are removed.

This fixes 2 REVERSE_INULL issues reported by Coverity.

---
 drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c   | 2 +-
 drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_hwseq.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +1 -1
index 85f014cae6be..841b6423952c 100644
@@ -1260,7 +1260,7 @@ void dcn10_plane_atomic_disconnect(struct dc *dc,
 	mpc->funcs->remove_mpcc(mpc, mpc_tree_params, mpcc_to_remove);
 	// Phantom pipes have OTG disabled by default, so MPCC_STATUS will never assert idle,
 	// so don't wait for MPCC_IDLE in the programming sequence
-	if (opp != NULL && dc_state_get_pipe_subvp_type(state, pipe_ctx) != SUBVP_PHANTOM)
+	if (dc_state_get_pipe_subvp_type(state, pipe_ctx) != SUBVP_PHANTOM)
 		opp->mpcc_disconnect_pending[pipe_ctx->plane_res.mpcc_inst] = true;
 
 	dc->optimized_required = true;
drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_hwseq.c +1 -2
index f96adc689055..1635e5a552ad 100644
@@ -408,8 +408,7 @@ void dcn201_plane_atomic_disconnect(struct dc *dc,
 	if (mpcc_removed == false)
 		return;
 
-	if (opp != NULL)
-		opp->mpcc_disconnect_pending[pipe_ctx->plane_res.mpcc_inst] = true;
+	opp->mpcc_disconnect_pending[pipe_ctx->plane_res.mpcc_inst] = true;
 
 	dc->optimized_required = true;
 
Signature · 1 line
2.45.1
#32 lore raw

PATCH 32/36 drm/amd/display: Remove redundant checks for context

In reply to Hamza Mahfooz

From: Alex Hung <[email protected]>

The null checks for context are redundant as it was already dereferenced previously, as reported by Coverity; therefore the null checks are removed.

This fixes 2 REVERSE_INULL issues reported by Coverity.

---
 drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 2 +-
 drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c    | 5 +----
 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +1 -1
index 33318a112282..5037474bf95c 100644
@@ -505,7 +505,7 @@ void set_p_state_switch_method(
 	struct vba_vars_st *vba = &context->bw_ctx.dml.vba;
 	bool enable_subvp;
 
-	if (!dc->ctx || !dc->ctx->dmub_srv || !pipe_ctx || !vba || !context)
+	if (!dc->ctx || !dc->ctx->dmub_srv || !pipe_ctx || !vba)
 		return;
 
 	if (vba->DRAMClockChangeSupport[vba->VoltageLevel][vba->maxMpcComb] !=
drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c +1 -4
index 17ea15682d3a..19b61290ef9e 100644
@@ -573,10 +573,7 @@ static bool dml2_validate_and_build_resource(const struct dc *in_dc, struct dc_s
 	bool need_recalculation = false;
 	uint32_t cstate_enter_plus_exit_z8_ns;
 
-	if (!context)
-		return true;
-
-	else if (context->stream_count == 0) {
+	if (context->stream_count == 0) {
 		unsigned int lowest_state_idx = 0;
 
 		out_clks.p_state_supported = true;
Signature · 1 line
2.45.1
#33 lore raw

PATCH 33/36 drm/amd/display: Check UnboundedRequestEnabled's value

In reply to Hamza Mahfooz

From: Alex Hung <[email protected]>

CalculateSwathAndDETConfiguration_params_st's UnboundedRequestEnabled is a pointer (i.e. dml_bool_t *UnboundedRequestEnabled), and thus if (p->UnboundedRequestEnabled) checks its address, not bool value.

This fixes 1 REVERSE_INULL issue reported by Coverity.

---
 drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c +1 -1
index 791f1725b62b..547dfcc80fde 100644
@@ -4283,7 +4283,7 @@ static void CalculateSwathAndDETConfiguration(struct display_mode_lib_scratch_st
 	}
 
 	*p->compbuf_reserved_space_64b = 2 * p->PixelChunkSizeInKByte * 1024 / 64;
-	if (p->UnboundedRequestEnabled) {
+	if (*p->UnboundedRequestEnabled) {
 		*p->compbuf_reserved_space_64b = dml_max(*p->compbuf_reserved_space_64b,
 				(dml_float_t)(p->ROBBufferSizeInKByte * 1024/64)
 				- (dml_float_t)(RoundedUpSwathSizeBytesY[SurfaceDoingUnboundedRequest] * TTUFIFODEPTH / MAXIMUMCOMPRESSION/64));
Signature · 1 line
2.45.1
#34 lore raw

PATCH 34/36 drm/amd/display: Remove redundant null checks

In reply to Hamza Mahfooz

From: Alex Hung <[email protected]>

The null checks for aconnector and aconnector->dc_link and stream redundant as they were already dereferenced previously as reported by Coverity; therefore the null checks are removed.

This fixes 4 REVERSE_INULL issues reported by Coverity.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c         | 6 +++---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 3 ---
 3 files changed, 4 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -3
index 48a9243ada7d..1fd851b93d40 100644
@@ -3180,7 +3180,7 @@ static int dm_resume(void *handle)
 		 * this is the case when traversing through already created end sink
 		 * MST connectors, should be skipped
 		 */
-		if (aconnector && aconnector->mst_root)
+		if (aconnector->mst_root)
 			continue;
 
 		mutex_lock(&aconnector->hpd_lock);
@@ -6422,13 +6422,13 @@ static void apply_dsc_policy_for_stream(struct amdgpu_dm_connector *aconnector,
 	dc_dsc_policy_set_enable_dsc_when_not_needed(
 		aconnector->dsc_settings.dsc_force_enable == DSC_CLK_FORCE_ENABLE);
 
-	if (aconnector->dc_link && sink->sink_signal == SIGNAL_TYPE_EDP &&
+	if (sink->sink_signal == SIGNAL_TYPE_EDP &&
 	    !aconnector->dc_link->panel_config.dsc.disable_dsc_edp &&
 	    dc->caps.edp_dsc_support && aconnector->dsc_settings.dsc_force_enable != DSC_CLK_FORCE_DISABLE) {
 
 		apply_dsc_policy_for_edp(aconnector, sink, stream, dsc_caps, max_dsc_target_bpp_limit_override);
 
-	} else if (aconnector->dc_link && sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT) {
+	} else if (sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT) {
 		if (sink->link->dpcd_caps.dongle_type == DISPLAY_DONGLE_NONE) {
 			if (dc_dsc_compute_config(aconnector->dc_link->ctx->dc->res_pool->dscs[0],
 						dsc_caps,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +1 -1
index 7cfa240a3cea..717d97191dda 100644
@@ -1420,7 +1420,7 @@ static ssize_t trigger_hotplug(struct file *f, const char __user *buf,
 	uint8_t param_nums = 0;
 	bool ret = false;
 
-	if (!aconnector || !aconnector->dc_link)
+	if (!aconnector->dc_link)
 		return -EINVAL;
 
 	if (size == 0)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +0 -3
index 8eb2f10f2c38..659dd67be1ba 100644
@@ -807,9 +807,6 @@ bool dm_helpers_dp_write_dsc_enable(
 	uint8_t enable_passthrough = enable ? DSC_PASSTHROUGH : DSC_DISABLE;
 	uint8_t ret = 0;
 
-	if (!stream)
-		return false;
-
 	if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
 		if (!aconnector->dsc_aux)
 			return false;
Signature · 1 line
2.45.1
#35 lore raw

PATCH 35/36 drm/amd/display: [FW Promotion] Release 0.0.222.0

In reply to Hamza Mahfooz

From: Anthony Koo <[email protected]>

- Add new condition for PSR exit due to ESD recovery
- Add new VB scaling feature for ABM by interpolating between existing VB parameters, allowing driver to have fine grain scaled VB levels between 0 - 250

---
 drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +7 -2
index b75653faf40e..78e8698fe378 100644
@@ -208,6 +208,11 @@ union abm_flags {
 		 * @abm_new_frame: Indicates if a new frame update needed for ABM to ramp up into steady
 		 */
 		unsigned int abm_new_frame : 1;
+
+		/**
+		 * @vb_scaling_enabled: Indicates variBright Scaling Enable
+		 */
+		unsigned int vb_scaling_enabled : 1;
 	} bitfields;
 
 	unsigned int u32All;
@@ -2796,9 +2801,9 @@ struct dmub_cmd_psr_copy_settings_data {
 	 */
 	uint8_t relock_delay_frame_cnt;
 	/**
-	 * Explicit padding to 4 byte boundary.
+	 * esd recovery indicate.
 	 */
-	uint8_t pad3;
+	uint8_t esd_recovery;
 	/**
 	 * DSC Slice height.
 	 */
Signature · 1 line
2.45.1
#36 lore raw

PATCH 36/36 drm/amd/display: 3.2.289

In reply to Hamza Mahfooz

From: Aric Cyr <[email protected]>

This version brings along the following:

- DCN401 fixes
- DPIA fixes
- DML21 fixes
- Misc Coverity fixes

---
 drivers/gpu/drm/amd/display/dc/dc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
index fa4e6b09409e..d0d1af451b64 100644
@@ -55,7 +55,7 @@ struct aux_payload;
 struct set_config_cmd_payload;
 struct dmub_notification;
 
-#define DC_VER "3.2.288"
+#define DC_VER "3.2.289"
 
 #define MAX_SURFACES 3
 #define MAX_PLANES 6
Signature · 1 line
2.45.1
Tested-by on the v1 series
#37 lore raw
In reply to Hamza Mahfooz

[Public]

Hi all,

This week this patchset was tested on the following systems:
* Lenovo ThinkBook T13s Gen4 with AMD Ryzen 5 6600U
* MSI Gaming X Trio RX 6800
* Gigabyte Gaming OC RX 7900 XTX

These systems were tested on the following display/connection types:
* eDP, (1080p 60hz [5650U]) (1920x1200 60hz [6600U]) (2560x1600 120hz[6600U])
* VGA and DVI (1680x1050 60hz [DP to VGA/DVI, USB-C to VGA/DVI])
* DP/HDMI/USB-C (1440p 170hz, 4k 60hz, 4k 144hz, 4k 240hz [Includes USB-C to DP/HDMI adapters])
* Thunderbolt (LG Ultrafine 5k)
* MST (Startech MST14DP123DP [DP to 3x DP] and 2x 4k 60Hz displays)
* DSC (with Cable Matters 101075 [DP to 3x DP] with 3x 4k60 displays, and HP Hook G2 with 1 4k60 display)
* USB 4 (Kensington SD5700T and 1x 4k 60Hz display)
* PCON (Club3D CAC-1085 and 1x 4k 144Hz display [at 4k 120HZ, as that is the max the adapter supports])

The testing is a mix of automated and manual tests. Manual testing includes (but is not limited to):
* Changing display configurations and settings
* Benchmark testing
* Feature testing (Freesync, etc.)

Automated testing includes (but is not limited to):
* Script testing (scripts to automate some of the manual checks)
* IGT testing

The patchset consists of the amd-staging-drm-next branch (Head commit - 0a64705ad8b13bb27909ec47bd6b3a4209eb37bd -> drm/amd/display: Disable PHYSYMCLK RCO) with new patches added on top of it.

Tested on Ubuntu 22.04.3, on Wayland and X11, using KDE Plasma and Gnome.

Thank you,

Dan Wheeler
Sr. Technologist | AMD
SW Display
------------------------------------------------------------------------------------------------------------------
1 Commerce Valley Dr E, Thornhill, ON L3T 7X6
amd.com

-----Original Message-----
From: Mahfooz, Hamza <[email protected]>
Sent: Tuesday, June 11, 2024 12:51 PM
To: [email protected]
Cc: Wheeler, Daniel <[email protected]>; Wentland, Harry <[email protected]>; Li, Sun peng (Leo) <[email protected]>; Lakha, Bhawanpreet <[email protected]>; Siqueira, Rodrigo <[email protected]>; Pillai, Aurabindo <[email protected]>; Zhuo, Lillian <[email protected]>; Li, Roman <[email protected]>; Lin, Wayne <[email protected]>; Chiu, Solomon <[email protected]>; Gutierrez, Agustin <[email protected]>; Zuo, Jerry <[email protected]>; Mahfooz, Hamza <[email protected]>
Subject: [PATCH 00/36] DC Patches June 11, 2024

Cc Daniel Wheeler <[email protected]>

Alex Hung (15):
drm/amd/display: Explicitly extend unsigned 16 bit to 64 bit drm/amd/display: Add null checker before passing variables drm/amd/display: Check BIOS images before it is used drm/amd/display: Skip wbscl_set_scaler_filter if filter is null drm/amd/display: Add null checker before access structs drm/amd/display: Check dc_stream_state before it is used drm/amd/display: Check pipe_ctx before it is used drm/amd/display: Covert integers to double before divisions drm/amd/display: Remove redundant checks for res_pool->dccg drm/amd/display: Remove redundant checks for ctx->dc_bios drm/amd/display: Remove redundant null checks drm/amd/display: Remove redundant checks for opp drm/amd/display: Remove redundant checks for context drm/amd/display: Check UnboundedRequestEnabled's value drm/amd/display: Remove redundant null checks

Alvin Lee (1):
drm/amd/display: Make sure to reprogram ODM when resync fifo

Anthony Koo (1):
drm/amd/display: [FW Promotion] Release 0.0.222.0

Aric Cyr (1):
drm/amd/display: 3.2.289

Chris Park (1):
drm/amd/display: On clock init, maintain DISPCLK freq

Dillon Varone (2):
drm/amd/display: Enable DCN401 idle optimizations by default drm/amd/display: Add null check to dml21_find_dc_pipes_for_plane

Ivan Lipski (3):
drm/amd/display: Remove redundant condition with DEADCODE drm/amd/display: Remove redundant condition in VBA 314 func drm/amd/display: Remove unused value set from 'min_hratio_fact' in dml

Joshua Aberback (3):
drm/amd/display: DCN401 full power down in HW init if any link enabled Revert "drm/amd/display: workaround for oled eDP not lighting up on

    DCN401"

drm/amd/display: Remove duplicate HWSS interfaces

Michael Strauss (1):
drm/amd/display: Attempt to avoid empty TUs when endpoint is DPIA

Mounika Adhuri (1):
drm/amd/display: Refactor DCN3X into component folder

Relja Vojvodic (1):
drm/amd/display: Add dcn401 DIG fifo enable/disable

Rodrigo Siqueira (3):
drm/amd/display: Fix NULL pointer dereference for DTN log in DCN401 drm/amd/display: Fix warning caused by an attempt to configure a
non-otg master
drm/amd/display: Improve warning log for get OPP for OTG master

Sridevi Arvindekar (1):
drm/amd/display: mirror case cleanup for cursors

Sung Joon Kim (1):
drm/amd/display: Send message to notify the DPIA host router bandwidth

Wenjing Liu (1):
drm/amd/display: fix minor coding errors where dml21 phase 5 uses
wrong variables

 drivers/gpu/drm/amd/display/Makefile          |   7 ++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  19 +--
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c |   2 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c |   3 -
 drivers/gpu/drm/amd/display/dc/Makefile       |   6 +-
 .../gpu/drm/amd/display/dc/bios/bios_parser.c |  14 +++
 .../amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c |   2 +-
 .../display/dc/clk_mgr/dcn301/vg_clk_mgr.c    |   2 +-
 .../display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c  |   2 +-
 .../dc/clk_mgr/dcn314/dcn314_clk_mgr.c        |   2 +-
 .../dc/clk_mgr/dcn315/dcn315_clk_mgr.c        |   2 +-
 .../dc/clk_mgr/dcn316/dcn316_clk_mgr.c        |   2 +-
 .../display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c  |   2 +-
 .../display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c  |  57 ++++++++-  .../amd/display/dc/clk_mgr/dcn35/dcn35_smu.c  |  21 +++-
 .../amd/display/dc/clk_mgr/dcn35/dcn35_smu.h  |   2 +
 .../dc/clk_mgr/dcn401/dcn401_clk_mgr.c        |  17 +++
 drivers/gpu/drm/amd/display/dc/core/dc.c      |  21 +++-
 .../drm/amd/display/dc/core/dc_hw_sequencer.c |   2 +-
 .../gpu/drm/amd/display/dc/core/dc_resource.c |  15 ++-
 .../gpu/drm/amd/display/dc/core/dc_state.c    |  24 ++--
 drivers/gpu/drm/amd/display/dc/dc.h           |   6 +-
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c  |  20 +++-
 .../drm/amd/display/dc/dcn20/dcn20_dwb_scl.c  |   3 +
 drivers/gpu/drm/amd/display/dc/dcn32/Makefile |  19 ---
 .../gpu/drm/amd/display/dc/dcn321/Makefile    |  17 ---
 drivers/gpu/drm/amd/display/dc/dcn35/Makefile |  19 ---
 drivers/gpu/drm/amd/display/dc/dio/Makefile   |  63 ++++++++++
 .../{ => dio}/dcn32/dcn32_dio_link_encoder.c  |   0
 .../{ => dio}/dcn32/dcn32_dio_link_encoder.h  |   0
 .../dcn32/dcn32_dio_stream_encoder.c          |   0
 .../dcn32/dcn32_dio_stream_encoder.h          |   0
 .../dcn321/dcn321_dio_link_encoder.c          |   0
 .../dcn321/dcn321_dio_link_encoder.h          |   0
 .../{ => dio}/dcn35/dcn35_dio_link_encoder.c  |   0
 .../{ => dio}/dcn35/dcn35_dio_link_encoder.h  |   0
 .../dcn35/dcn35_dio_stream_encoder.c          |   4 +-
 .../dcn35/dcn35_dio_stream_encoder.h          |   6 +
 .../dcn401/dcn401_dio_link_encoder.c          |   0
 .../dcn401/dcn401_dio_link_encoder.h          |   0
 .../dcn401/dcn401_dio_stream_encoder.c        |   4 +-
 .../dcn401/dcn401_dio_stream_encoder.h        |   0
 .../drm/amd/display/dc/dml/calcs/dcn_calcs.c  |   2 +-
 .../drm/amd/display/dc/dml/dcn20/dcn20_fpu.c  |  20 ++--
 .../dc/dml/dcn20/display_mode_vba_20.c        |  16 +--
 .../dc/dml/dcn20/display_mode_vba_20v2.c      |   4 +-
 .../dc/dml/dcn20/display_rq_dlg_calc_20.c     |   5 -
 .../dc/dml/dcn20/display_rq_dlg_calc_20v2.c   |   5 -
 .../dc/dml/dcn21/display_mode_vba_21.c        |   2 +-
 .../dc/dml/dcn21/display_rq_dlg_calc_21.c     |   8 --
 .../dc/dml/dcn30/display_mode_vba_30.c        |   2 +-
 .../dc/dml/dcn30/display_rq_dlg_calc_30.c     |   5 -
 .../dc/dml/dcn31/display_mode_vba_31.c        |   4 +-
 .../dc/dml/dcn31/display_rq_dlg_calc_31.c     |   5 -
 .../dc/dml/dcn314/display_mode_vba_314.c      |  11 +-
 .../dc/dml/dcn314/display_rq_dlg_calc_314.c   |   5 -
 .../drm/amd/display/dc/dml/dcn32/dcn32_fpu.c  |  11 +-
 .../dc/dml/dcn32/display_mode_vba_util_32.c   |   8 +-
 .../display/dc/dml/dml1_display_rq_dlg_calc.c |   5 -
 .../amd/display/dc/dml2/display_mode_core.c   |  12 +-
 .../dc/dml2/dml21/dml21_translation_helper.c  |   4 +-
 .../amd/display/dc/dml2/dml21/dml21_utils.c   |  28 ++++-
 .../src/dml2_core/dml2_core_dcn4_calcs.c      |  28 ++---
 .../dml21/src/dml2_core/dml2_core_shared.c    |  24 ++--
 .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c  |   5 +
 .../dc/dml2/dml21/src/dml2_top/dml_top.c      |   4 +-
 .../display/dc/dml2/dml2_dc_resource_mgmt.c   |   9 +-
 .../drm/amd/display/dc/dml2/dml2_wrapper.c    |   5 +-
 drivers/gpu/drm/amd/display/dc/dwb/Makefile   |  37 ++++++
 .../display/dc/{ => dwb}/dcn35/dcn35_dwb.c    |   0
 .../display/dc/{ => dwb}/dcn35/dcn35_dwb.h    |   0
 drivers/gpu/drm/amd/display/dc/hpo/Makefile   |  35 ++++++
 .../dcn32/dcn32_hpo_dp_link_encoder.c         |   0
 .../dcn32/dcn32_hpo_dp_link_encoder.h         |   0
 .../amd/display/dc/hwss/dce110/dce110_hwseq.c |   9 +-
 .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c   |  61 +++++-----
 .../amd/display/dc/hwss/dcn10/dcn10_init.c    |   2 -
 .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c   |  11 +-
 .../amd/display/dc/hwss/dcn20/dcn20_init.c    |   1 -
 .../amd/display/dc/hwss/dcn201/dcn201_hwseq.c |   5 +-
 .../amd/display/dc/hwss/dcn201/dcn201_init.c  |   1 -
 .../amd/display/dc/hwss/dcn21/dcn21_init.c    |   2 -
 .../amd/display/dc/hwss/dcn30/dcn30_hwseq.c   |  10 +-
 .../amd/display/dc/hwss/dcn30/dcn30_init.c    |   1 -
 .../amd/display/dc/hwss/dcn301/dcn301_init.c  |   1 -
 .../amd/display/dc/hwss/dcn31/dcn31_hwseq.c   |   2 +-
 .../amd/display/dc/hwss/dcn31/dcn31_init.c    |   2 -
 .../amd/display/dc/hwss/dcn314/dcn314_hwseq.c |  19 ++-
 .../amd/display/dc/hwss/dcn314/dcn314_init.c  |   2 -
 .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c   | 110 ++++++++++--------
 .../amd/display/dc/hwss/dcn32/dcn32_init.c    |   1 -
 .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c   |  82 ++++++++++++-
 .../amd/display/dc/hwss/dcn35/dcn35_hwseq.h   |   2 +
 .../amd/display/dc/hwss/dcn35/dcn35_init.c    |   4 +-
 .../amd/display/dc/hwss/dcn351/dcn351_init.c  |   2 -
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |  75 ++++++------
 .../amd/display/dc/hwss/dcn401/dcn401_init.c  |   1 -
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |   1 -
 .../display/dc/hwss/hw_sequencer_private.h    |   2 -
 .../link/protocols/link_edp_panel_control.c   |   3 -
 .../gpu/drm/amd/display/dc/mmhubbub/Makefile  |  45 +++++++
 .../dc/{ => mmhubbub}/dcn32/dcn32_mmhubbub.c  |   0
 .../dc/{ => mmhubbub}/dcn32/dcn32_mmhubbub.h  |   0
 .../dc/{ => mmhubbub}/dcn35/dcn35_mmhubbub.c  |   0
 .../dc/{ => mmhubbub}/dcn35/dcn35_mmhubbub.h  |   0
 drivers/gpu/drm/amd/display/dc/mpc/Makefile   |  45 +++++++
 .../display/dc/{ => mpc}/dcn32/dcn32_mpc.c    |   0
 .../display/dc/{ => mpc}/dcn32/dcn32_mpc.h    |   0
 .../display/dc/{ => mpc}/dcn401/dcn401_mpc.c  |   0
 .../display/dc/{ => mpc}/dcn401/dcn401_mpc.h  |   0
 drivers/gpu/drm/amd/display/dc/opp/Makefile   |  35 ++++++
 .../display/dc/{ => opp}/dcn35/dcn35_opp.c    |   0
 .../display/dc/{ => opp}/dcn35/dcn35_opp.h    |   0
 drivers/gpu/drm/amd/display/dc/pg/Makefile    |  35 ++++++
 .../display/dc/{ => pg}/dcn35/dcn35_pg_cntl.c |   0
 .../display/dc/{ => pg}/dcn35/dcn35_pg_cntl.h |   0
 .../gpu/drm/amd/display/dc/resource/Makefile  |   2 +-
 .../dc/resource/dcn20/dcn20_resource.c        |   2 +-
 .../dc/resource/dcn201/dcn201_resource.c      |   4 +-
 .../dc/resource/dcn32/dcn32_resource.c        |   2 +
 .../dcn32/dcn32_resource_helpers.c            |   0
 .../dc/resource/dcn351/dcn351_resource.c      |   1 +
 .../dc/resource/dcn401/dcn401_resource.c      |   3 -
 .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h   |   9 +-
 124 files changed, 880 insertions(+), 409 deletions(-)  delete mode 100644 drivers/gpu/drm/amd/display/dc/dcn32/Makefile
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dcn321/Makefile
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dcn35/Makefile
 create mode 100644 drivers/gpu/drm/amd/display/dc/dio/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn32/dcn32_dio_link_encoder.c (100%)  rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn32/dcn32_dio_link_encoder.h (100%)  rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn32/dcn32_dio_stream_encoder.c (100%)  rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn32/dcn32_dio_stream_encoder.h (100%)  rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn321/dcn321_dio_link_encoder.c (100%)  rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn321/dcn321_dio_link_encoder.h (100%)  rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn35/dcn35_dio_link_encoder.c (100%)  rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn35/dcn35_dio_link_encoder.h (100%)  rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn35/dcn35_dio_stream_encoder.c (99%)  rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn35/dcn35_dio_stream_encoder.h (99%)  rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn401/dcn401_dio_link_encoder.c (100%)  rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn401/dcn401_dio_link_encoder.h (100%)  rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn401/dcn401_dio_stream_encoder.c (99%)  rename drivers/gpu/drm/amd/display/dc/{ => dio}/dcn401/dcn401_dio_stream_encoder.h (100%)  create mode 100644 drivers/gpu/drm/amd/display/dc/dwb/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => dwb}/dcn35/dcn35_dwb.c (100%)  rename drivers/gpu/drm/amd/display/dc/{ => dwb}/dcn35/dcn35_dwb.h (100%)  create mode 100644 drivers/gpu/drm/amd/display/dc/hpo/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => hpo}/dcn32/dcn32_hpo_dp_link_encoder.c (100%)  rename drivers/gpu/drm/amd/display/dc/{ => hpo}/dcn32/dcn32_hpo_dp_link_encoder.h (100%)  create mode 100644 drivers/gpu/drm/amd/display/dc/mmhubbub/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => mmhubbub}/dcn32/dcn32_mmhubbub.c (100%)  rename drivers/gpu/drm/amd/display/dc/{ => mmhubbub}/dcn32/dcn32_mmhubbub.h (100%)  rename drivers/gpu/drm/amd/display/dc/{ => mmhubbub}/dcn35/dcn35_mmhubbub.c (100%)  rename drivers/gpu/drm/amd/display/dc/{ => mmhubbub}/dcn35/dcn35_mmhubbub.h (100%)  create mode 100644 drivers/gpu/drm/amd/display/dc/mpc/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => mpc}/dcn32/dcn32_mpc.c (100%)  rename drivers/gpu/drm/amd/display/dc/{ => mpc}/dcn32/dcn32_mpc.h (100%)  rename drivers/gpu/drm/amd/display/dc/{ => mpc}/dcn401/dcn401_mpc.c (100%)  rename drivers/gpu/drm/amd/display/dc/{ => mpc}/dcn401/dcn401_mpc.h (100%)  create mode 100644 drivers/gpu/drm/amd/display/dc/opp/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => opp}/dcn35/dcn35_opp.c (100%)  rename drivers/gpu/drm/amd/display/dc/{ => opp}/dcn35/dcn35_opp.h (100%)  create mode 100644 drivers/gpu/drm/amd/display/dc/pg/Makefile
 rename drivers/gpu/drm/amd/display/dc/{ => pg}/dcn35/dcn35_pg_cntl.c (100%)  rename drivers/gpu/drm/amd/display/dc/{ => pg}/dcn35/dcn35_pg_cntl.h (100%)  rename drivers/gpu/drm/amd/display/dc/{ => resource}/dcn32/dcn32_resource_helpers.c (100%)

--
2.45.1