Skip to contentSkip to conversation

DC Patches November 23, 2026

PATCH In review James Lin 3 participants 36 messages Nov 17 – Nov 23

Subsystems (5)
lore
Share & tools
lore

James Lin

author
#0 lore raw

cover DC Patches November 23, 2026

This DC patchset brings improvements in multiple areas. In summary, we have:
- Rename DPMS to DPMS_v1
- Power up eDP when detect link
- Add DPMS-v2 files
- Refactor DP retrain link HW sequence
- Add extra 0.25 line reserved for TSetup/TCalc inefficiency
- Use panel luminance range for AUX backlight in power module
- Read PWM back linearly with the linear backlight curve
- Add API to set brightness percent
- Pass linear brightness percent to power module
- Add DPMS-v2 types
- Always apply 0ppm pixel clock adjustment
- Add otg versions of get_vblank_counter/scanoutpos
- Queue vblank control work to sleepable context
- Fix KUnit tests for vblank control rework
- Add urgent request and assertion probes
- Fix G7 P-state aperture addresses
- Set stream min/max refresh from VRR config
- Add DC2 wrapped initialization for DCN401
- Honor the Replay stream regeneration wait event
- Disable Replay when link off frame count is below 2
- Skip DSC padding borrow estimate for zero padding
- Drop unused DC interfaces
- Let the DC2 commit replace or keep a stream
- Support two streams in the dcn401 DC2 builders
- Add a plane beside a kept plane in DC2 update
- Keep an unchanged stream in the DC2 commit
- Change the ODM and MPC layout in DC2 update
- Give the DC2 builders State pipe facts
- Add RGBA8888 surface pixel format support
- Fix DCE crossbar for RGBA8888 surface format

Cc Dan Wheeler <[email protected]>

Allen Pan (1):
drm/amd/display: Always apply 0ppm pixel clock adjustment

Dominik Kowalski (3):
drm/amd/display: Rename DPMS to DPMS_v1
drm/amd/display: Add DPMS-v2 files
drm/amd/display: Add DPMS-v2 types

George Shen (1):
drm/amd/display: Refactor DP retrain link HW sequence

George Zhang (3):
drm/amd/display: Add otg versions of get_vblank_counter/scanoutpos drm/amd/display: Queue vblank control work to sleepable context drm/amd/display: Fix KUnit tests for vblank control rework

Harry VanZyllDeJong (1):
drm/amd/display: Honor the Replay stream regeneration wait event

Harry Wentland (2):
drm/amd/display: Add RGBA8888 surface pixel format support drm/amd/display: Fix DCE crossbar for RGBA8888 surface format

Ivan Lipski (2):
drm/amd/display: Fix G7 P-state aperture addresses drm/amd/display: Set stream min/max refresh from VRR config

Michael Strauss (1):
drm/amd/display: Clear OTG_AUTO_FORCE_VSYNC_MODE on OTG disable

Nicholas Kazlauskas (2):
drm/amd/display: Skip DSC padding borrow estimate for zero padding drm/amd/display: Drop unused DC interfaces

Ray Wu (5):
drm/amd/display: Use panel luminance range for AUX backlight in power
module
drm/amd/display: Read PWM back linearly with the linear backlight
curve
drm/amd/display: Add API to set brightness percent drm/amd/display: Pass linear brightness percent to power module drm/amd/display: Disable Replay when link off frame count is below 2

Samson Tam (1):
drm/amd/display: add extra 0.25 line reserved for TSetup/TCalc
inefficiency

Taimur Hassan (2):
drm/amd/display: [FW Promotion] Release 0.1.85.0 drm/amd/display: Promote DC to 3.2.408

Tomasz Siemek (1):
drm/amd/display: Add DC2 wrapped initialization for DCN401

Tony Cheng (6):
drm/amd/display: Let the DC2 commit replace or keep a stream drm/amd/display: Support two streams in the dcn401 DC2 builders drm/amd/display: Add a plane beside a kept plane in DC2 update drm/amd/display: Keep an unchanged stream in the DC2 commit drm/amd/display: Change the ODM and MPC layout in DC2 update drm/amd/display: Give the DC2 builders State pipe facts

Wenjing Liu (1):
drm/amd/display: Add urgent request and assertion probes

Zhikai Zhai (1):
drm/amd/display: Power up eDP when detect link

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  116 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   52 +
 .../display/amdgpu_dm/amdgpu_dm_backlight.c   |  208 +---
 .../display/amdgpu_dm/amdgpu_dm_backlight.h   |    9 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c    |  225 ++--
 .../amd/display/amdgpu_dm/amdgpu_dm_dmub.c    |    2 +-
 .../display/amdgpu_dm/amdgpu_dm_freesync.c    |    3 +
 .../display/amdgpu_dm/amdgpu_dm_irq_params.h  |    2 +
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c |   20 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_replay.c  |   23 +-
 .../tests/amdgpu_dm_backlight_test.c          |  552 ++-------
 .../amdgpu_dm/tests/amdgpu_dm_crtc_test.c     |  219 +++-
 .../amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c |    2 +
 .../amdgpu_dm/tests/amdgpu_dm_replay_test.c   |  129 ++
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  |   78 ++
 drivers/gpu/drm/amd/display/dc/Makefile       |    3 +
 .../gpu/drm/amd/display/dc/basics/dce_calcs.c |    2 +
 .../amd/display/dc/bls_builder/bls_builder.c  |   19 +
 .../amd/display/dc/bls_builder/bls_builder.h  |   86 +-
 .../dc/bls_builder/bls_builder_internal.h     |    3 +
 .../bls_builder/bls_builder_private_types.h   |   28 +-
 .../dc/bls_builder/dcn401_builder_internal.h  |   87 +-
 .../dc/bls_builder/dcn401_init_builder.c      |  812 ++++++------
 .../dc/bls_builder/dcn401_init_builder.h      |   16 -
 .../bls_builder/dcn401_init_builder_legacy.c  |   77 ++
 .../bls_builder/dcn401_non_seamless_builder.c |  243 ++--
 .../dc/bls_builder/dcn401_query_builder.c     |   41 +
 .../dc/bls_builder/dcn401_seamless_builder.c  | 1091 +++++++++++------
 .../display/dc/bls_executor/bls_executor.c    |   79 +-
 .../display/dc/bls_executor/bls_executor.h    |    2 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c      |    6 +-
 .../drm/amd/display/dc/core/dc_hw_sequencer.c |  267 +++-
 .../gpu/drm/amd/display/dc/core/dc_resource.c |   48 +-
 .../gpu/drm/amd/display/dc/core/dc_state.c    |   28 +
 .../gpu/drm/amd/display/dc/core/dc_stream.c   |   38 +
 .../gpu/drm/amd/display/dc/core2/dc_core2.c   |  142 ++-
 .../drm/amd/display/dc/core2/dc_core2_init.c  |  298 ++++-
 drivers/gpu/drm/amd/display/dc/dc.h           |   60 +-
 .../amd/display/dc/dc_api_dispatch/api_shim.c |    1 +
 .../amd/display/dc/dc_api_dispatch/api_shim.h |    3 +
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h  |    8 +-
 drivers/gpu/drm/amd/display/dc/dc_probe.h     |   61 +-
 .../gpu/drm/amd/display/dc/dc_state_priv.h    |   23 +
 drivers/gpu/drm/amd/display/dc/dc_stream.h    |    6 +
 .../drm/amd/display/dc/dce/dce_clock_source.c |   25 +
 .../drm/amd/display/dc/dce/dce_mem_input.c    |   42 +-
 .../drm/amd/display/dc/dce/dce_mem_input.h    |    6 +
 .../display/dc/dce110/dce110_mem_input_v.c    |    1 +
 .../drm/amd/display/dc/dml/calcs/dcn_calcs.c  |    1 +
 .../dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c |   13 +-
 .../drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c  |    3 +
 .../drm/amd/display/dc/dpp/dcn20/dcn20_dpp.c  |    3 +
 .../amd/display/dc/dpp/dcn201/dcn201_dpp.c    |    3 +
 .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c  |    3 +
 .../amd/display/dc/dpp/dcn401/dcn401_dpp.c    |    3 +
 .../drm/amd/display/dc/dpp/dcn42/dcn42_dpp.c  |    3 +
 .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.c  |    3 +
 .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.c  |    3 +
 .../display/dc/hubbub/dcn10/dcn10_hubbub.c    |    1 +
 .../display/dc/hubbub/dcn20/dcn20_hubbub.c    |    1 +
 .../display/dc/hubbub/dcn401/dcn401_hubbub.c  |    1 +
 .../display/dc/hubbub/dcn60/dcn60_hubbub.c    |   80 ++
 .../amd/display/dc/hubp/dcn10/dcn10_hubp.c    |    4 +
 .../amd/display/dc/hubp/dcn20/dcn20_hubp.c    |    4 +
 .../amd/display/dc/hubp/dcn20/dcn20_hubp.h    |    3 +-
 .../amd/display/dc/hubp/dcn35/dcn35_hubp.c    |    4 +
 .../amd/display/dc/hubp/dcn42/dcn42_hubp.c    |    4 +
 .../amd/display/dc/hubp/dcn50/dcn50_hubp.c    |    4 +
 .../amd/display/dc/hubp/dcn60/dcn60_hubp.c    |   35 +
 .../amd/display/dc/hubp/dcn60/dcn60_hubp.h    |    1 +
 .../drm/amd/display/dc/hwss/dce/dce_hwseq.c   |    1 +
 .../amd/display/dc/hwss/dce110/dce110_hwseq.c |    1 +
 .../amd/display/dc/hwss/dcn30/dcn30_hwseq.h   |    8 -
 .../amd/display/dc/hwss/dcn60/dcn60_hwseq.c   |  243 +++-
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |   80 +-
 .../gpu/drm/amd/display/dc/inc/core_types.h   |   61 +
 .../amd/display/dc/inc/dc_core_interface.h    |    6 +
 .../gpu/drm/amd/display/dc/inc/hw/dchubbub.h  |    3 +
 drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h  |   12 +
 .../amd/display/dc/inc/hw/timing_generator.h  |    4 -
 .../gpu/drm/amd/display/dc/inc/link_service.h |    6 +-
 drivers/gpu/drm/amd/display/dc/inc/link_tx.h  |   59 +
 drivers/gpu/drm/amd/display/dc/link/Makefile  |    9 +-
 .../display/dc/link/accessories/link_dp_cts.c |   43 +-
 .../drm/amd/display/dc/link/link_detection.c  |   17 +-
 .../dc/link/{link_dpms.c => link_dpms_v1.c}   |    6 +-
 .../dc/link/{link_dpms.h => link_dpms_v1.h}   |   10 +-
 .../drm/amd/display/dc/link/link_dpms_v2.c    |   44 +
 .../drm/amd/display/dc/link/link_dpms_v2.h    |   38 +
 .../drm/amd/display/dc/link/link_factory.c    |   23 +-
 .../dc/link/protocols/link_dp_irq_handler.c   |    6 +-
 .../display/dc/link/protocols/link_hdmi_frl.c |    8 +-
 .../amd/display/dc/optc/dcn31/dcn31_optc.c    |    4 +
 .../amd/display/dc/optc/dcn314/dcn314_optc.c  |    4 +
 .../amd/display/dc/optc/dcn35/dcn35_optc.c    |    4 +
 .../dc/pmfw_messenger/dcn401_pmfw_messenger.c |  211 ++++
 .../dc/pmfw_messenger/pmfw_messenger.c        |   62 +
 .../dc/pmfw_messenger/pmfw_messenger.h        |  118 ++
 .../amd/display/dc/state_facts/state_facts.h  |    3 +
 .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h   |   48 +
 .../drm/amd/display/modules/inc/mod_power.h   |    7 +
 .../drm/amd/display/modules/power/power_abm.c |   83 +-
 .../amd/display/modules/power/power_replay.c  |    1 +
 103 files changed, 4807 insertions(+), 1898 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_query_builder.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/inc/link_tx.h
 rename drivers/gpu/drm/amd/display/dc/link/{link_dpms.c => link_dpms_v1.c} (99%)
 rename drivers/gpu/drm/amd/display/dc/link/{link_dpms.h => link_dpms_v1.h} (92%)
 create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_dpms_v2.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_dpms_v2.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/pmfw_messenger/dcn401_pmfw_messenger.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/pmfw_messenger/pmfw_messenger.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/pmfw_messenger/pmfw_messenger.h
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 1/33 drm/amd/display: Clear OTG_AUTO_FORCE_VSYNC_MODE on OTG disable

From: Michael Strauss <[email protected]>

[WHY]
A frame-lock reset trigger sets OTG_AUTO_FORCE_VSYNC_MODE. If the bit is not cleared when the OTG is released, the OTG keeps forcing vsync on every trigger event.

When a display stream later reuses that OTG with DRR enabled, each DRR manual trigger forces an early vsync and cuts the frame short. The display then runs above its programmed refresh rate and underflows, leaving the external monitor with no signal.

[HOW]
Clear OTG_AUTO_FORCE_VSYNC_MODE in the DCN31/314/35 disable_crtc so a released OTG is left clean.

---
 drivers/gpu/drm/amd/display/dc/optc/dcn31/dcn31_optc.c   | 4 ++++
 drivers/gpu/drm/amd/display/dc/optc/dcn314/dcn314_optc.c | 4 ++++
 drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.c   | 4 ++++
 3 files changed, 12 insertions(+)
drivers/gpu/drm/amd/display/dc/optc/dcn31/dcn31_optc.c +4 -0
index ce9cd32b807a..7706f5f16a68 100644
@@ -143,6 +143,10 @@ static bool optc31_disable_crtc(struct timing_generator *optc)
 			1, 100000);
 	optc1_clear_optc_underflow(optc);
 
+	/* a stale frame-lock force-vsync would cut every DRR-triggered frame short on reuse */
+	REG_UPDATE(OTG_VERT_SYNC_CONTROL,
+			OTG_AUTO_FORCE_VSYNC_MODE, 0);
+
 	return true;
 }
 /*
drivers/gpu/drm/amd/display/dc/optc/dcn314/dcn314_optc.c +4 -0
index f5faa49680ef..5ec70e849cce 100644
@@ -142,6 +142,10 @@ static bool optc314_disable_crtc(struct timing_generator *optc)
 			OTG_BUSY, 0,
 			1, 100000);
 
+	/* a stale frame-lock force-vsync would cut every DRR-triggered frame short on reuse */
+	REG_UPDATE(OTG_VERT_SYNC_CONTROL,
+			OTG_AUTO_FORCE_VSYNC_MODE, 0);
+
 	return true;
 }
 
drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.c +4 -0
index 406446e5eae5..b4b4792167dd 100644
@@ -162,6 +162,10 @@ static bool optc35_disable_crtc(struct timing_generator *optc)
 
 	optc1_clear_optc_underflow(optc);
 
+	/* a stale frame-lock force-vsync would cut every DRR-triggered frame short on reuse */
+	REG_UPDATE(OTG_VERT_SYNC_CONTROL,
+			OTG_AUTO_FORCE_VSYNC_MODE, 0);
+
 	return true;
 }
 
Signature · 1 line
2.43.0
author
#2 lore raw

PATCH 2/33 drm/amd/display: Rename DPMS to DPMS_v1

In reply to James Lin

From: Dominik Kowalski <[email protected]>

[Why]
Working on v2 of DPMS link protocol implementation, renaming existing version to v1 for consistency.

[How]
* Rename files link_dpms.{c,h} to link_dpms_v1.{c,h}
* Rename functions link_dpms_set_{on,off} accordingly
* Replace direct calls to those functions with link_srv vtable

---
 drivers/gpu/drm/amd/display/dc/link/Makefile           |  2 +-
 .../drm/amd/display/dc/link/accessories/link_dp_cts.c  |  4 ++--
 drivers/gpu/drm/amd/display/dc/link/link_detection.c   |  2 +-
 .../display/dc/link/{link_dpms.c => link_dpms_v1.c}    |  6 +++---
 .../display/dc/link/{link_dpms.h => link_dpms_v1.h}    | 10 +++++-----
 drivers/gpu/drm/amd/display/dc/link/link_factory.c     |  6 +++---
 .../display/dc/link/protocols/link_dp_irq_handler.c    |  6 +++---
 .../drm/amd/display/dc/link/protocols/link_hdmi_frl.c  |  4 ++--
 8 files changed, 20 insertions(+), 20 deletions(-)
 rename drivers/gpu/drm/amd/display/dc/link/{link_dpms.c => link_dpms_v1.c} (99%)
 rename drivers/gpu/drm/amd/display/dc/link/{link_dpms.h => link_dpms_v1.h} (92%)
drivers/gpu/drm/amd/display/dc/link/Makefile +1 -1
index f558a20eceaa..0eb433b5d822 100644
@@ -23,7 +23,7 @@
 # It abstracts the control and status of back end pipe such as DIO, HPO, DPIA,
 # PHY, HPD, DDC and etc).
 
-LINK = link_detection.o link_dpms.o link_factory.o link_resource.o \
+LINK = link_detection.o link_dpms_v1.o link_factory.o link_resource.o \
 link_validation.o
 
 AMD_DAL_LINK = $(addprefix $(AMDDALPATH)/dc/link/, \
drivers/gpu/drm/amd/display/dc/link/accessories/link_dp_cts.c +2 -2
index 83f676a49fd1..f316337cee1b 100644
@@ -29,7 +29,7 @@
 #include "link/protocols/link_dp_phy.h"
 #include "link/protocols/link_dp_training_fixed_vs_pe_retimer.h"
 #include "link/protocols/link_dp_capability.h"
-#include "link/link_dpms.h"
+#include "link/link_dpms_v1.h"
 #include "resource.h"
 #include "dm_helpers.h"
 #include "dc_dmub_srv.h"
@@ -91,7 +91,7 @@ static void dp_retrain_link_dp_test(struct dc_link *link,
 	link_get_master_pipes_with_dpms_on(link, state, &count, pipes);
 
 	for (i = 0; i < count; i++) {
-		link_set_dpms_off(pipes[i]);
+		link->dc->link_srv->set_dpms_off(pipes[i]);
 		pipes[i]->link_config.dp_link_settings = *link_setting;
 		update_dp_encoder_resources_for_test_harness(
 				link->dc,
drivers/gpu/drm/amd/display/dc/link/link_detection.c +1 -1
index 5b257f003f13..9bd24b3e4291 100644
@@ -30,7 +30,7 @@
  * directly from connected receivers.
  */
 
-#include "link_dpms.h"
+#include "link_dpms_v1.h"
 #include "link_detection.h"
 #include "link_hwss.h"
 #include "protocols/link_edp_panel_control.h"
drivers/gpu/drm/amd/display/dc/link/link_dpms_v1.c renamed from drivers/gpu/drm/amd/display/dc/link/link_dpms.c +3 -3
similarity index 99%
rename from drivers/gpu/drm/amd/display/dc/link/link_dpms.c
rename to drivers/gpu/drm/amd/display/dc/link/link_dpms_v1.c
index 75e232ebffe8..ae94a0a2b9da 100644
@@ -35,7 +35,7 @@
  * boundary between link and stream is not clearly defined.
  */
 
-#include "link_dpms.h"
+#include "link_dpms_v1.h"
 #include "link_hwss.h"
 #include "link_validation.h"
 #include "accessories/link_dp_trace.h"
@@ -2403,7 +2403,7 @@ static struct vpg *get_vpg(struct pipe_ctx *pipe_ctx)
 		return pipe_ctx->stream_res.stream_enc->vpg;
 }
 
-enum dc_status link_set_dpms_off(struct pipe_ctx *pipe_ctx)
+enum dc_status link_set_dpms_off_v1(struct pipe_ctx *pipe_ctx)
 {
 	DC_LOGGER_INIT(pipe_ctx->stream->ctx->logger);
 	struct dc_stream_state *stream = pipe_ctx->stream;
@@ -2794,7 +2794,7 @@ static enum dc_status link_set_dpms_on_post_enable_link(
 	return DC_DPMS_SUCCESS;
 }
 
-enum dc_status link_set_dpms_on(
+enum dc_status link_set_dpms_on_v1(
 		struct dc_state *state,
 		struct pipe_ctx *pipe_ctx
 )
drivers/gpu/drm/amd/display/dc/link/link_dpms_v1.h renamed from drivers/gpu/drm/amd/display/dc/link/link_dpms.h +5 -5
similarity index 92%
rename from drivers/gpu/drm/amd/display/dc/link/link_dpms.h
rename to drivers/gpu/drm/amd/display/dc/link/link_dpms_v1.h
index 6559bc04d90e..b170c9a8622d 100644
@@ -23,14 +23,14 @@
  *
  */
 
-#ifndef __DC_LINK_DPMS_H__
-#define __DC_LINK_DPMS_H__
+#ifndef DC_LINK_DPMS_V1_H
+#define DC_LINK_DPMS_V1_H
 
 #include "link_service.h"
-enum dc_status link_set_dpms_on(
+enum dc_status link_set_dpms_on_v1(
 		struct dc_state *state,
 		struct pipe_ctx *pipe_ctx);
-enum dc_status link_set_dpms_off(struct pipe_ctx *pipe_ctx);
+enum dc_status link_set_dpms_off_v1(struct pipe_ctx *pipe_ctx);
 void link_resume(struct dc_link *link);
 void link_blank_all_dp_displays(struct dc *dc);
 void link_blank_all_edp_displays(struct dc *dc);
@@ -51,4 +51,4 @@ void link_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable);
 bool link_set_dsc_enable(struct pipe_ctx *pipe_ctx, bool enable);
 bool link_update_dsc_config(struct pipe_ctx *pipe_ctx);
 void link_wait_for_unlocked(struct dc_link *link);
-#endif /* __DC_LINK_DPMS_H__ */
+#endif
drivers/gpu/drm/amd/display/dc/link/link_factory.c +3 -3
index 3b192c539f8b..7bf1364659ea 100644
@@ -30,7 +30,7 @@
 #include "link_detection.h"
 #include "link_resource.h"
 #include "link_validation.h"
-#include "link_dpms.h"
+#include "link_dpms_v1.h"
 #include "accessories/link_dp_cts.h"
 #include "accessories/link_dp_trace.h"
 #include "protocols/link_ddc.h"
@@ -113,8 +113,8 @@ static void construct_link_service_validation(struct link_service *link_srv)
  */
 static void construct_link_service_dpms(struct link_service *link_srv)
 {
-	link_srv->set_dpms_on = link_set_dpms_on;
-	link_srv->set_dpms_off = link_set_dpms_off;
+	link_srv->set_dpms_on = link_set_dpms_on_v1;
+	link_srv->set_dpms_off = link_set_dpms_off_v1;
 	link_srv->resume = link_resume;
 	link_srv->blank_all_dp_displays = link_blank_all_dp_displays;
 	link_srv->blank_all_edp_displays = link_blank_all_edp_displays;
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c +3 -3
index 59f9150edf30..154595dcb618 100644
@@ -36,7 +36,7 @@
 #include "link_edp_panel_control.h"
 #include "link_dp_panel_replay.h"
 #include "link/accessories/link_dp_trace.h"
-#include "link/link_dpms.h"
+#include "link/link_dpms_v1.h"
 #include "dm_helpers.h"
 #include "link_dp_dpia_bw.h"
 
@@ -332,7 +332,7 @@ void dp_handle_link_loss(struct dc_link *link)
 	link_get_master_pipes_with_dpms_on(link, state, &count, pipes);
 
 	for (i = 0; i < count; i++)
-		link_set_dpms_off(pipes[i]);
+		link->dc->link_srv->set_dpms_off(pipes[i]);
 
 	for (i = count - 1; i >= 0; i--) {
 		// Always use max settings here for DP 1.4a LL Compliance CTS
@@ -344,7 +344,7 @@ void dp_handle_link_loss(struct dc_link *link)
 			pipes[i]->link_config.dp_link_settings.link_spread =
 					link->verified_link_cap.link_spread;
 		}
-		link_set_dpms_on(link->dc->current_state, pipes[i]);
+		link->dc->link_srv->set_dpms_on(link->dc->current_state, pipes[i]);
 	}
 }
 
drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.c +2 -2
index 3f687603a70c..2eaa830662b0 100644
@@ -36,7 +36,7 @@
  */
 #include "link_hdmi_frl.h"
 #include "link_ddc.h"
-#include "link/link_dpms.h"
+#include "link/link_dpms_v1.h"
 #include "link/link_validation.h"
 #include "resource.h"
 #include "dccg.h"
@@ -1040,7 +1040,7 @@ void hdmi_frl_set_preferred_link_settings(struct dc *dc,
 	link_stream->link->frl_verified_link_cap = *link_setting;
 
 	while (link_stat != LINK_RESULT_SUCCESS && link_stat != LINK_RESULT_NO_TIMEOUT) {
-		link_set_dpms_off(pipe);
+		link->dc->link_srv->set_dpms_off(pipe);
 		/* For DCN3.0, can also have 4:1 combine mode.
 		 * TODO: Add function get_odm_combine_mode that has different
 		 *       implementation for DCN2/DCN3AG and DCN3.0
Signature · 1 line
2.43.0
author
#3 lore raw

PATCH 3/33 drm/amd/display: Power up eDP when detect link

In reply to James Lin

From: Zhikai Zhai <[email protected]>

[WHY]
Previously we would start the asynchronous detection timer after resuming from S0i3, the sequence for eDP power up when resume from S0i3 is:
1. eDP power up when link enable
2. Timer trigger async detect for eDP
3. The AUPI could read successfully in display detect Currently
1. eDP detection runs from the display detect path
2. AUPI read fail as HPD low when eDP link detect
3. Link enable to power up eDP

[HOW]
Power up eDP when detect link for aux read.

---
 .../gpu/drm/amd/display/dc/link/link_detection.c  | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/link/link_detection.c +10 -5
index 9bd24b3e4291..dae9e6840272 100644
@@ -1153,11 +1153,16 @@ static bool detect_link_and_local_sink(struct dc_link *link,
 		(!link->dc->config.allow_edp_hotplug_detection)) &&
 		link->local_sink) {
 		// need to re-write OUI and brightness in resume case
-		if (link->connector_signal == SIGNAL_TYPE_EDP &&
-			(link->dpcd_sink_ext_caps.bits.oled == 1)) {
-			dpcd_set_source_specific_data(link);
-			msleep(post_oui_delay);
-			set_default_brightness_aux(link);
+		if (link->connector_signal == SIGNAL_TYPE_EDP) {
+			if (!link->dc->config.edp_no_power_sequencing)
+				link->dc->hwss.edp_power_control(link, true);
+			link->dc->hwss.edp_wait_for_hpd_ready(link, true);
+
+			if (link->dpcd_sink_ext_caps.bits.oled == 1) {
+				dpcd_set_source_specific_data(link);
+				msleep(post_oui_delay);
+				set_default_brightness_aux(link);
+			}
 		}
 
 		return true;
Signature · 1 line
2.43.0
author
#4 lore raw

PATCH 4/33 drm/amd/display: Add DPMS-v2 files

In reply to James Lin

From: Dominik Kowalski <[email protected]>

[Why]
Split into smallest possible increment to allow for parallel review of different aspects of DPMS-v2 design.

[How]
* Add DPMS-v2 files with empty DPMS-on/off functions
* Add flag to dc_config to choose between v1 and v2
* Use flag in link_create_link_service to update vtable

---
 drivers/gpu/drm/amd/display/dc/core/dc.c      |  6 ++-
 drivers/gpu/drm/amd/display/dc/dc.h           |  1 +
 .../gpu/drm/amd/display/dc/inc/link_service.h |  6 ++-
 drivers/gpu/drm/amd/display/dc/link/Makefile  |  9 +++-
 .../drm/amd/display/dc/link/link_dpms_v2.c    | 44 +++++++++++++++++++
 .../drm/amd/display/dc/link/link_dpms_v2.h    | 38 ++++++++++++++++
 .../drm/amd/display/dc/link/link_factory.c    | 21 ++++++---
 7 files changed, 114 insertions(+), 11 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_dpms_v2.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_dpms_v2.h
drivers/gpu/drm/amd/display/dc/core/dc.c +5 -1
index 463a3fc2d8c2..3ca650461cb6 100644
@@ -1070,7 +1070,11 @@ static bool dc_construct_ctx(struct dc *dc,
 
 	dc->ctx = dc_ctx;
 
-	dc->link_srv = link_create_link_service();
+	const struct link_service_options link_service_options = {
+		.enable_dpms_v2 = dc->config.enable_dpms_v2,
+	};
+
+	dc->link_srv = link_create_link_service(link_service_options);
 	if (!dc->link_srv)
 		return false;
 
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index b71a9a5cd424..01f549010d07 100644
@@ -645,6 +645,7 @@ struct dc_config {
 	// Set by the DM around a commit that runs where allocation is not
 	// permitted; requires preallocate_scratch_state.
 	bool use_preallocated_state;
+	bool enable_dpms_v2;
 };
 
 enum visual_confirm {
drivers/gpu/drm/amd/display/dc/inc/link_service.h +5 -1
index b2f86c51d470..d9a9d5f9f61c 100644
@@ -77,7 +77,11 @@
  */
 #include "core_types.h"
 
-struct link_service *link_create_link_service(void);
+struct link_service_options {
+	bool enable_dpms_v2;
+};
+
+struct link_service *link_create_link_service(struct link_service_options options);
 void link_destroy_link_service(struct link_service **link_srv);
 
 struct link_init_data {
drivers/gpu/drm/amd/display/dc/link/Makefile +7 -2
index 0eb433b5d822..ea08f1b1e60e 100644
@@ -23,8 +23,13 @@
 # It abstracts the control and status of back end pipe such as DIO, HPO, DPIA,
 # PHY, HPD, DDC and etc).
 
-LINK = link_detection.o link_dpms_v1.o link_factory.o link_resource.o \
-link_validation.o
+LINK = \
+	link_detection.o \
+	link_dpms_v1.o \
+	link_dpms_v2.o \
+	link_factory.o \
+	link_resource.o \
+	link_validation.o
 
 AMD_DAL_LINK = $(addprefix $(AMDDALPATH)/dc/link/, \
 $(LINK))
drivers/gpu/drm/amd/display/dc/link/link_dpms_v2.c new file +44 -0

44 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/link/link_dpms_v2.h new file +38 -0
new file mode 100644
index 000000000000..c6728932691a
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2026 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
+ *
+ */
+#ifndef LINK_DPMS_V2_H
+#define LINK_DPMS_V2_H
+
+#include "dc/inc/core_status.h"
+
+struct dc_state;
+struct pipe_ctx;
+
+// TODO: Add RESOURCED state
+enum dc_status link_set_dpms_off_v2(struct pipe_ctx *pipe_ctx);
+enum dc_status link_set_dpms_on_v2(struct dc_state *state,
+				   struct pipe_ctx *pipe_ctx);
+
+#endif
drivers/gpu/drm/amd/display/dc/link/link_factory.c +14 -7
index 7bf1364659ea..919f67b76f91 100644
@@ -31,6 +31,7 @@
 #include "link_resource.h"
 #include "link_validation.h"
 #include "link_dpms_v1.h"
+#include "link_dpms_v2.h"
 #include "accessories/link_dp_cts.h"
 #include "accessories/link_dp_trace.h"
 #include "protocols/link_ddc.h"
@@ -111,10 +112,16 @@ static void construct_link_service_validation(struct link_service *link_srv)
  * with the link and link's enable/disable sequences as result of the stream's
  * dpms state change.
  */
-static void construct_link_service_dpms(struct link_service *link_srv)
+static void construct_link_service_dpms(struct link_service *link_srv, struct link_service_options options)
 {
-	link_srv->set_dpms_on = link_set_dpms_on_v1;
-	link_srv->set_dpms_off = link_set_dpms_off_v1;
+	if (options.enable_dpms_v2) {
+		link_srv->set_dpms_on = link_set_dpms_on_v2;
+		link_srv->set_dpms_off = link_set_dpms_off_v2;
+	} else {
+		link_srv->set_dpms_on = link_set_dpms_on_v1;
+		link_srv->set_dpms_off = link_set_dpms_off_v1;
+	}
+
 	link_srv->resume = link_resume;
 	link_srv->blank_all_dp_displays = link_blank_all_dp_displays;
 	link_srv->blank_all_edp_displays = link_blank_all_edp_displays;
@@ -305,7 +312,7 @@ static void construct_link_service_dp_trace(struct link_service *link_srv)
 	link_srv->dp_trace_source_sequence = dp_trace_source_sequence;
 }
 
-static void construct_link_service(struct link_service *link_srv)
+static void construct_link_service(struct link_service *link_srv, struct link_service_options options)
 {
 	/* All link service functions should fall under some sub categories.
 	 * If a new function doesn't perfectly fall under an existing sub
@@ -318,7 +325,7 @@ static void construct_link_service(struct link_service *link_srv)
 	construct_link_service_detection(link_srv);
 	construct_link_service_resource(link_srv);
 	construct_link_service_validation(link_srv);
-	construct_link_service_dpms(link_srv);
+	construct_link_service_dpms(link_srv, options);
 	construct_link_service_ddc(link_srv);
 	construct_link_service_dp_capability(link_srv);
 	construct_link_service_dp_phy_or_dpia(link_srv);
@@ -330,14 +337,14 @@ static void construct_link_service(struct link_service *link_srv)
 	construct_link_service_dp_trace(link_srv);
 }
 
-struct link_service *link_create_link_service(void)
+struct link_service *link_create_link_service(struct link_service_options options)
 {
 	struct link_service *link_srv = kzalloc_obj(*link_srv);
 
 	if (link_srv == NULL)
 		goto fail;
 
-	construct_link_service(link_srv);
+	construct_link_service(link_srv, options);
 
 	return link_srv;
 fail:
Signature · 1 line
2.43.0
author
#5 lore raw

PATCH 5/33 drm/amd/display: Refactor DP retrain link HW sequence

In reply to James Lin

From: George Shen <[email protected]>

[Why]
Current implementation of DP retrain link test function contains an issue where ODM combine is cleared and not reconfigured when we toggle off/on OTG.

The function is also rigid and difficult to maintain when all the HW programming logic is done directly within it.

[How]
Move HW programming calls to a hwss function and call it from the DP retrain link function.

Additionaly, add a call to reprogram the ODM combine register that is cleared when disabling OTG in the hwss function call.

---
 .../drm/amd/display/dc/core/dc_hw_sequencer.c | 84 +++++++++++++++++++
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |  8 ++
 .../display/dc/link/accessories/link_dp_cts.c | 39 ++-------
 3 files changed, 98 insertions(+), 33 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +84 -0
index ecf90e3a770c..061ea11cef0e 100644
@@ -3195,6 +3195,90 @@ void hwss_wait_for_odm_update_pending_complete(struct dc *dc, struct dc_state *c
 	hwss_wait_for_all_blank_complete(dc, context);
 }
 
+/**
+ * hwss_restart_otg_for_dp_test_link_retrain - restart the OTGs of a link retrained
+ * by a DP test request, with the stream's planes left attached
+ *
+ * Disables the OTGs, programs the pixel clock and audio if requested, restores
+ * the ODM combine configuration cleared by disable_crtc, then re-enables the
+ * OTGs. The caller must have already turned DPMS off and updated the stream and
+ * link resources in @context for the new link settings.
+ *
+ * @dc: [in] dc reference
+ * @context: [in] hardware context in use
+ * @otg_masters: [in] OTG master pipes of the streams being retrained
+ * @otg_master_count: [in] number of entries in @otg_masters
+ * @program_pix_clk: [in] program pixel clock and audio, needed when the link encoding changes
+ * @audio_output: [in] audio output per OTG master, used if @program_pix_clk
+ */
+void hwss_restart_otg_for_dp_test_link_retrain(struct dc *dc,
+		struct dc_state *context,
+		struct pipe_ctx **otg_masters,
+		uint8_t otg_master_count,
+		bool program_pix_clk,
+		struct audio_output *audio_output)
+{
+	int i;
+
+	// TODO: Confirm with HW docs if disable/re-enable is actually required here
+	for (i = 0; i < otg_master_count; i++)
+		otg_masters[i]->stream_res.tg->funcs->disable_crtc(otg_masters[i]->stream_res.tg);
+
+	if (program_pix_clk) {
+		for (i = 0; i < otg_master_count; i++) {
+			struct pipe_ctx *pipe = otg_masters[i];
+			struct audio *audio = pipe->stream_res.audio;
+
+			if (pipe->stream_res.pix_clk_params.controller_id != CONTROLLER_ID_UNDEFINED)
+				pipe->clock_source->funcs->program_pix_clk(
+						pipe->clock_source,
+						&pipe->stream_res.pix_clk_params,
+						dc->link_srv->dp_get_encoding_format(&pipe->link_config.dp_link_settings),
+						&pipe->pll_settings);
+
+			if (audio != NULL) {
+				const struct link_hwss *link_hwss = get_link_hwss(
+						pipe->stream->link, &pipe->link_res);
+
+				link_hwss->setup_audio_output(pipe, &audio_output[i], audio->inst);
+
+				audio->funcs->az_configure(
+						audio,
+						pipe->stream->signal,
+						&audio_output[i].crtc_info,
+						&pipe->stream->audio_info,
+						&audio_output[i].dp_link_info);
+
+				if (dc->config.disable_hbr_audio_dp2 &&
+						audio->funcs->az_disable_hbr_audio &&
+						dc->link_srv->dp_is_128b_132b_signal(pipe))
+					audio->funcs->az_disable_hbr_audio(audio);
+			}
+		}
+	}
+
+	for (i = 0; i < otg_master_count; i++) {
+		struct pipe_ctx *pipe = otg_masters[i];
+
+		/* disable_crtc cleared the ODM segment config */
+		if (pipe->next_odm_pipe) {
+			struct pipe_ctx *opp_heads[MAX_PIPES];
+			int opp_inst[MAX_PIPES] = {0};
+			int opp_head_count = resource_get_opp_heads_for_otg_master(pipe, &context->res_ctx, opp_heads);
+			int j;
+
+			for (j = 0; j < opp_head_count; j++)
+				opp_inst[j] = opp_heads[j]->stream_res.opp->inst;
+
+			pipe->stream_res.tg->funcs->set_odm_combine(pipe->stream_res.tg, opp_inst, opp_head_count,
+					resource_get_odm_slice_dst_width(pipe, false),
+					resource_get_odm_slice_dst_width(pipe, true));
+		}
+
+		pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg);
+	}
+}
+
 void hwss_reset_unused_det(struct dc *dc, struct dc_state *context)
 {
 	struct hubbub *hubbub = dc->res_pool->hubbub;
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +8 -0
index bfe9afb434af..c2e256a40128 100644
@@ -66,6 +66,7 @@ struct link_training_settings;
 struct dc_link;
 struct dc_crtc_timing;
 struct dmub_srv_hw_params;
+struct audio_output;
 
 struct tg_lock_params {
 	struct dc *dc;
@@ -2316,6 +2317,13 @@ void hwss_wait_for_all_blank_complete(struct dc *dc,
 void hwss_wait_for_odm_update_pending_complete(struct dc *dc,
 		struct dc_state *context);
 
+void hwss_restart_otg_for_dp_test_link_retrain(struct dc *dc,
+		struct dc_state *context,
+		struct pipe_ctx **otg_masters,
+		uint8_t otg_master_count,
+		bool program_pix_clk,
+		struct audio_output *audio_output);
+
 void hwss_wait_for_no_pipes_pending(struct dc *dc,
 		struct dc_state *context);
 
drivers/gpu/drm/amd/display/dc/link/accessories/link_dp_cts.c +6 -33
index f316337cee1b..2fe7ceff1f50 100644
@@ -72,6 +72,7 @@ static void dp_retrain_link_dp_test(struct dc_link *link,
 	struct dc_stream_update stream_update = { 0 };
 	bool dpms_off = false;
 	bool needs_divider_update = false;
+	bool program_pix_clk = false;
 	bool was_hpo_acquired = resource_is_hpo_acquired(link->dc->current_state);
 	bool is_hpo_acquired;
 	uint8_t count;
@@ -97,52 +98,24 @@ static void dp_retrain_link_dp_test(struct dc_link *link,
 				link->dc,
 				state,
 				pipes[i]);
-
-		// Disable OTG and re-enable after updating clocks
-		pipes[i]->stream_res.tg->funcs->disable_crtc(pipes[i]->stream_res.tg);
 	}
 
 	if (needs_divider_update && link->dc->res_pool->funcs->update_dc_state_for_encoder_switch) {
 		link->dc->res_pool->funcs->update_dc_state_for_encoder_switch(link,
 				link_setting, count,
 				*pipes, &audio_output[0]);
-		for (i = 0; i < count; i++) {
-			pipes[i]->clock_source->funcs->program_pix_clk(
-					pipes[i]->clock_source,
-					&pipes[i]->stream_res.pix_clk_params,
-					link->dc->link_srv->dp_get_encoding_format(&pipes[i]->link_config.dp_link_settings),
-					&pipes[i]->pll_settings);
-
-			if (pipes[i]->stream_res.audio != NULL) {
-				const struct link_hwss *link_hwss = get_link_hwss(
-					link, &pipes[i]->link_res);
-
-				link_hwss->setup_audio_output(pipes[i], &audio_output[i],
-						pipes[i]->stream_res.audio->inst);
-
-				pipes[i]->stream_res.audio->funcs->az_configure(
-						pipes[i]->stream_res.audio,
-						pipes[i]->stream->signal,
-						&audio_output[i].crtc_info,
-						&pipes[i]->stream->audio_info,
-						&audio_output[i].dp_link_info);
-
-				if (link->dc->config.disable_hbr_audio_dp2 &&
-						pipes[i]->stream_res.audio->funcs->az_disable_hbr_audio &&
-						link->dc->link_srv->dp_is_128b_132b_signal(pipes[i]))
-					pipes[i]->stream_res.audio->funcs->az_disable_hbr_audio(pipes[i]->stream_res.audio);
-			}
-		}
+		program_pix_clk = true;
 	}
 
+	// Disable OTG, update clocks and re-enable OTG with its ODM configuration restored
+	hwss_restart_otg_for_dp_test_link_retrain(dc, state, pipes, count,
+			program_pix_clk, audio_output);
+
 	// Toggle on HPO I/O if necessary
 	is_hpo_acquired = resource_is_hpo_acquired(state);
 	if (was_hpo_acquired != is_hpo_acquired && link->dc->hwss.setup_hpo_hw_control)
 		link->dc->hwss.setup_hpo_hw_control(link->dc->hwseq, is_hpo_acquired);
 
-	for (i = 0; i < count; i++)
-		pipes[i]->stream_res.tg->funcs->enable_crtc(pipes[i]->stream_res.tg);
-
 	// Set DPMS on with stream update
 	// Cache all streams on current link since dc_update_planes_and_stream might kill current_state
 	for (i = 0; i < MAX_PIPES; i++) {
Signature · 1 line
2.43.0
author
#6 lore raw

PATCH 6/33 drm/amd/display: add extra 0.25 line reserved for TSetup/TCalc inefficiency

In reply to James Lin

From: Samson Tam <[email protected]>

[Why]
Some four display configurations fail to light up all displays,
failing during prefetch validation.

[How]
Add extra 0.25 lines for min_vblank_unreserve_otg_vlines to account
for inefficiency from TSetup/TCalc

Also fix nom_vtotal and allow_end_otg_vline calculations. Not related
to display config issue.

---
 .../src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c   | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c +8 -5
index c4db8ff3ee30..71407eec2d83 100644
@@ -409,8 +409,8 @@ static bool dcn6_update_worksheet_for_pstate_admissibility(struct dml2_optimizat
 	const double vblank_ratio = 0.8;
 	const double min_vblank_unreserved_ratio = 0.15;
 	const double min_vblank_unreserved_time_us = 50.0;
-	// min reserved for prefetch + 1 line lost for max vstartup
-	const unsigned int min_vblank_unreserved_otg_vlines = 4 + 1;
+	// min reserved for prefetch + 1 line lost for max vstartup, and +1/4 for inefficiency from TSetup/TCalc, in quarter OTG vlines
+	const unsigned int min_vblank_unreserved_otg_vlines_x4 = (4 + 1) * 4 + 1; // 5.25
 
 	unsigned int plane_index, stream_index, stream_index1;
 	double ideal_disallow_time_us, disallow_time_us;
@@ -464,7 +464,7 @@ static bool dcn6_update_worksheet_for_pstate_admissibility(struct dml2_optimizat
 				vblank_time_us = display_config->stream_descriptors[stream_index].timing.vblank_nom *
 					per_stream_pstate_meta[stream_index].otg_vline_time_us;
 				min_unreserved_vblank_time_us = math_max2(
-					per_stream_pstate_meta[stream_index].otg_vline_time_us * min_vblank_unreserved_otg_vlines,
+					per_stream_pstate_meta[stream_index].otg_vline_time_us * min_vblank_unreserved_otg_vlines_x4 / 4.0,
 					math_min2(vblank_time_us * min_vblank_unreserved_ratio,
 						min_vblank_unreserved_time_us));
 
@@ -718,7 +718,7 @@ static void dcn6_build_pstate_meta_per_stream(const struct dml2_display_cfg *dis
 
 	/* common */
 	stream_pstate_meta->valid               = true;
-	stream_pstate_meta->nom_vtotal          = stream_descriptor->timing.vblank_nom + stream_descriptor->timing.v_active;
+	stream_pstate_meta->nom_vtotal          = stream_descriptor->timing.v_total;
 	stream_pstate_meta->otg_vline_time_us   = (double)timing->h_total / timing->pixel_clock_khz * 1000.0;
 	stream_pstate_meta->vblank_start        = timing->v_blank_end + timing->v_active;
 	stream_pstate_meta->nom_refresh_rate_hz = timing->pixel_clock_khz * 1000.0 /
@@ -837,7 +837,10 @@ static void dcn6_build_pstate_meta_per_stream(const struct dml2_display_cfg *dis
 		stream_pstate_meta->method_vactive.common.allow_start_otg_vline =
 				timing->v_blank_end + stream_pstate_meta->method_vactive.max_vactive_det_fill_delay_otg_vlines;
 		stream_pstate_meta->method_vactive.common.allow_end_otg_vline =
-				stream_pstate_meta->vblank_start -
+				stream_pstate_meta->vblank_start +
+				stream_pstate_meta->nom_vtotal -
+				stream_descriptor->timing.v_active -
+				stream_descriptor->timing.vblank_nom -
 				stream_pstate_meta->blackout_otg_vlines +
 				stream_pstate_meta->method_vactive.reserved_blank_required_vlines;
 	} else {
Signature · 1 line
2.43.0
author
#7 lore raw

PATCH 7/33 drm/amd/display: Use panel luminance range for AUX backlight in power module

In reply to James Lin

From: Ray Wu <[email protected]>

[Why & How]
The power module always gets the default 1..270 nits range, so VESA AUX panels with DMUB aux_backlight_support are capped at 270 nits. For AUX backlight panels, pass the EDID derived aux_min/max_input_signal to the power module, and add KUnit cases for it.

---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 20 ++++-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  3 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 73 +++++++++++++++++++
 3 files changed, 93 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +17 -3
index a7c2b0094944..2f4c6a2dd4ec 100644
@@ -417,6 +417,22 @@ STATIC_IFN_KUNIT void mmhub_read_system_context(struct amdgpu_device *adev,
 }
 EXPORT_IF_KUNIT(mmhub_read_system_context);
 
+STATIC_IFN_KUNIT void
+amdgpu_dm_fill_power_nits_range(const struct amdgpu_dm_backlight_caps *caps,
+				struct mod_power_init_params *init_data)
+{
+	init_data->use_nits_based_brightness = false;
+	init_data->panel_max_millinits = 0;
+	init_data->panel_min_millinits = 0;
+	if (caps->aux_support &&
+	    caps->aux_max_input_signal > caps->aux_min_input_signal) {
+		init_data->use_nits_based_brightness = true;
+		init_data->panel_max_millinits = caps->aux_max_input_signal * 1000;
+		init_data->panel_min_millinits = caps->aux_min_input_signal * 1000;
+	}
+}
+EXPORT_IF_KUNIT(amdgpu_dm_fill_power_nits_range);
+
 STATIC_IFN_KUNIT int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm)
 {
 	struct mod_power_init_params init_data[MAX_NUM_EDP];
@@ -441,9 +457,7 @@ STATIC_IFN_KUNIT int amdgpu_dm_init_power_module(struct amdgpu_display_manager *
 		init_data[i].def_varibright_level = 0;
 		init_data[i].abm_config_setting = 0;
 		init_data[i].num_backlight_levels = 101;
-		init_data[i].use_nits_based_brightness = false;
-		init_data[i].panel_max_millinits = 0;
-		init_data[i].panel_min_millinits = 0;
+		amdgpu_dm_fill_power_nits_range(&dm->backlight_caps[i], &init_data[i]);
 		init_data[i].disable_fractional_pwm =
 			!(amdgpu_dc_feature_mask & DC_DISABLE_FRACTIONAL_PWM_MASK);
 		init_data[i].use_custom_backlight_caps = false;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +3 -0
index f8503ebf28f4..761d2b40aece 100644
@@ -1346,9 +1346,12 @@ struct dc_plane_address;
 struct dc_plane_cap;
 struct dc_plane_info;
 struct dsc_mst_fairness_vars;
+struct mod_power_init_params;
 
 void mmhub_read_system_context(struct amdgpu_device *adev,
 			       struct dc_phy_addr_space_config *pa_config);
+void amdgpu_dm_fill_power_nits_range(const struct amdgpu_dm_backlight_caps *caps,
+				     struct mod_power_init_params *init_data);
 int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm);
 void dm_gpureset_toggle_interrupts(struct amdgpu_device *adev, struct dc_state *state, bool enable);
 enum dc_status amdgpu_dm_commit_zero_streams(struct dc *dc);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +73 -0

91 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#8 lore raw

PATCH 8/33 drm/amd/display: Read PWM back linearly with the linear backlight curve

In reply to James Lin

From: Ray Wu <[email protected]>

[Why]
use_linear_backlight_curve makes the power module bypass its LUT when setting PWM, but reading PWM back still searched the LUT, so the percentage read back did not match the one set.

[How]
Map PWM back linearly over the same range instead. Also read the flag for the panel being converted, not the first one.

---
 .../drm/amd/display/modules/power/power_abm.c  | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/modules/power/power_abm.c +17 -1
index 5e86889eaa84..60930d969b9b 100644
@@ -374,6 +374,22 @@ static unsigned int backlight_pwm_to_millipercent_legacy(
 	if (core_power == NULL)
 		return 0;
 
+	/* Inverse of the LUT bypass in backlight_millipercent_to_pwm_legacy() */
+	if (core_power->bl_prop[inst].use_linear_backlight_curve) {
+		const struct pwr_backlight_properties *bl_prop = &core_power->bl_prop[inst];
+
+		if (pwm <= bl_prop->min_backlight_pwm)
+			return 0;
+
+		if (pwm >= bl_prop->max_backlight_pwm)
+			return BACKLIGHT_MILLIPERCENT_MAX;
+
+		return (unsigned int)div_u64(
+				(unsigned long long)(pwm - bl_prop->min_backlight_pwm) *
+				BACKLIGHT_MILLIPERCENT_MAX + bl_prop->backlight_range / 2,
+				bl_prop->backlight_range);
+	}
+
 	if (!core_power->bl_prop[inst].backlight_caps_valid)
 		return 0;
 
@@ -529,7 +545,7 @@ static unsigned int backlight_millipercent_to_pwm_legacy(
 		return 0;
 
 	// Bypass the brightness mapping LUT
-	if (core_power->bl_prop->use_linear_backlight_curve) {
+	if (core_power->bl_prop[inst].use_linear_backlight_curve) {
 		pwm = core_power->bl_prop[inst].min_backlight_pwm +
 			(unsigned int) div_u64((unsigned long long) millipercent *
 			core_power->bl_prop[inst].backlight_range,
Signature · 1 line
2.43.0
author
#9 lore raw

PATCH 9/33 drm/amd/display: Add API to set brightness percent

In reply to James Lin

From: Ray Wu <[email protected]>

[Why & How]
Add mod_power_set_brightness() so DM can pass a percentage for every panel type and let the power module pick the unit:

- VESA AUX takes nits, mapped linearly over the panel range.
- AMD AUX takes nits on OLED and in HDR, and follows PWM otherwise.
- PWM goes through the backlight LUT built from ATIF.

The AUX brightness mask is ORed into the nits.

---
 .../drm/amd/display/modules/inc/mod_power.h   |  7 ++
 .../drm/amd/display/modules/power/power_abm.c | 65 +++++++++++++++++++
 2 files changed, 72 insertions(+)
drivers/gpu/drm/amd/display/modules/inc/mod_power.h +7 -0
index 25a0c96ac754..3b6eb2116636 100644
@@ -221,6 +221,13 @@ bool mod_power_set_backlight_percent(struct mod_power *mod_power,
 		unsigned int transition_time_millisec,
 		bool is_hdr);
 
+bool mod_power_set_brightness(struct mod_power *mod_power,
+		struct dc_stream_state *stream,
+		unsigned int backlight_millipercent,
+		unsigned int transition_time_millisec,
+		unsigned int aux_brightness_mask,
+		bool is_hdr);
+
 void mod_power_update_backlight(struct mod_power *mod_power,
 		struct dc_stream_state *stream,
 		unsigned int backlight_millipercent);
drivers/gpu/drm/amd/display/modules/power/power_abm.c +65 -0

71 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#10 lore raw

PATCH 10/33 drm/amd/display: Pass linear brightness percent to power module

In reply to James Lin

From: Ray Wu <[email protected]>

[Why & How]
Pass the user level to mod_power_set_brightness() as a linear percentage and let the power module choose nits or PWM. The ATIF curve now applies only to PWM, through the power module's LUT. Read PWM back through the same LUT.

---
 .../display/amdgpu_dm/amdgpu_dm_backlight.c   | 208 ++-----
 .../display/amdgpu_dm/amdgpu_dm_backlight.h   |   9 +-
 .../tests/amdgpu_dm_backlight_test.c          | 552 ++++--------------
 3 files changed, 150 insertions(+), 619 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c +43 -165
index 27546febf90d..af0047c65cf2 100644
@@ -116,163 +116,35 @@ int get_brightness_range(const struct amdgpu_dm_backlight_caps *caps,
 }
 EXPORT_IF_KUNIT(get_brightness_range);
 
-/* Rescale userspace [0..max] to the firmware curve's [0..255]. */
-static inline u32 scale_input_to_fw(int max, u64 input)
-{
-	return DIV_ROUND_CLOSEST_ULL(input * AMDGPU_MAX_BL_LEVEL, max);
-}
-
-/* Rescale from [0..AMDGPU_MAX_BL_LEVEL] to [min..max] */
-static inline u32 scale_fw_to_input(int min, int max, u64 input)
-{
-	return min + DIV_ROUND_CLOSEST_ULL(input * (max - min), AMDGPU_MAX_BL_LEVEL);
-}
-
-static u32 backlight_signal_to_luminance(const struct amdgpu_dm_backlight_caps *caps,
-					 u32 signal)
-{
-	u32 lower_signal, upper_signal;
-	u32 lower_lum, upper_lum;
-	int i;
-
-	if (!caps->data_points)
-		return DIV_ROUND_CLOSEST(signal * 100, AMDGPU_MAX_BL_LEVEL);
-
-	if (signal < caps->luminance_data[0].input_signal) {
-		lower_signal = 0;
-		lower_lum = 0;
-		upper_signal = caps->luminance_data[0].input_signal;
-		upper_lum = caps->luminance_data[0].luminance;
-	} else if (signal >=
-		   caps->luminance_data[caps->data_points - 1].input_signal) {
-		lower_signal = caps->luminance_data[caps->data_points - 1].input_signal;
-		lower_lum = caps->luminance_data[caps->data_points - 1].luminance;
-		upper_signal = caps->max_input_signal;
-		upper_lum = 100;
-	} else {
-		for (i = 1;
-		     i < caps->data_points &&
-		     signal > caps->luminance_data[i].input_signal;
-		     i++)
-			;
-
-		lower_signal = caps->luminance_data[i - 1].input_signal;
-		upper_signal = caps->luminance_data[i].input_signal;
-		lower_lum = caps->luminance_data[i - 1].luminance;
-		upper_lum = caps->luminance_data[i].luminance;
-	}
-
-	if (upper_signal == lower_signal)
-		return upper_lum;
-
-	return lower_lum + DIV_ROUND_CLOSEST((upper_lum - lower_lum) *
-					     (signal - lower_signal),
-					     upper_signal - lower_signal);
-}
-
-static u32 convert_brightness_to_millipercent(const struct amdgpu_dm_backlight_caps *caps,
-					      u32 user_brightness)
+/*
+ * The power module maps the percentage to nits or, through its LUT built from
+ * the ATIF curve, to PWM, so pass userspace's [0..max] through linearly.
+ */
+STATIC_IFN_KUNIT
+u32 convert_brightness_to_millipercent(const struct amdgpu_dm_backlight_caps *caps,
+				       u32 user_brightness)
 {
 	unsigned int min, max;
-	u32 signal, luminance;
 
 	if (!get_brightness_range(caps, &min, &max))
-		return DIV_ROUND_CLOSEST_ULL((u64)user_brightness * 100000,
-					     MAX_BACKLIGHT_LEVEL);
-
-	user_brightness = clamp(user_brightness, min, max);
-	if (amdgpu_dc_debug_mask & DC_DISABLE_CUSTOM_BRIGHTNESS_CURVE)
-		return DIV_ROUND_CLOSEST_ULL((u64)user_brightness * 100000, max);
+		max = MAX_BACKLIGHT_LEVEL;
 
-	signal = scale_input_to_fw(max, user_brightness);
-	luminance = backlight_signal_to_luminance(caps, signal);
-
-	return min_t(u32, luminance * 1000, 100000);
+	return DIV_ROUND_CLOSEST_ULL((u64)min(user_brightness, max) * 100000, max);
 }
+EXPORT_IF_KUNIT(convert_brightness_to_millipercent);
 
 STATIC_IFN_KUNIT
-void convert_custom_brightness(const struct amdgpu_dm_backlight_caps *caps,
-			       unsigned int min, unsigned int max,
-			       uint32_t *user_brightness)
-{
-	u32 brightness = scale_input_to_fw(max, *user_brightness);
-	u8 lower_signal, upper_signal, upper_lum, lower_lum, lum;
-	int left, right;
-
-	if (amdgpu_dc_debug_mask & DC_DISABLE_CUSTOM_BRIGHTNESS_CURVE)
-		return;
-
-	if (!caps->data_points)
-		return;
-
-	/*
-	 * Handle the case where brightness is below the first data point
-	 * Interpolate between (0,0) and (first_signal, first_lum)
-	 */
-	if (brightness < caps->luminance_data[0].input_signal) {
-		lum = DIV_ROUND_CLOSEST(caps->luminance_data[0].luminance * brightness,
-					caps->luminance_data[0].input_signal);
-		goto scale;
-	}
-
-	left = 0;
-	right = caps->data_points - 1;
-	while (left <= right) {
-		int mid = left + (right - left) / 2;
-		u8 signal = caps->luminance_data[mid].input_signal;
-
-		/* Exact match found */
-		if (signal == brightness) {
-			lum = caps->luminance_data[mid].luminance;
-			goto scale;
-		}
-
-		if (signal < brightness)
-			left = mid + 1;
-		else
-			right = mid - 1;
-	}
-
-	/* verify bound */
-	if (left >= caps->data_points)
-		left = caps->data_points - 1;
-
-	/* At this point, left > right */
-	lower_signal = caps->luminance_data[right].input_signal;
-	upper_signal = caps->luminance_data[left].input_signal;
-	lower_lum = caps->luminance_data[right].luminance;
-	upper_lum = caps->luminance_data[left].luminance;
-
-	/* interpolate */
-	if (right == left || !lower_lum)
-		lum = upper_lum;
-	else
-		lum = lower_lum + DIV_ROUND_CLOSEST((upper_lum - lower_lum) *
-						    (brightness - lower_signal),
-						    upper_signal - lower_signal);
-scale:
-	*user_brightness = scale_fw_to_input(min, max,
-					     DIV_ROUND_CLOSEST(lum * brightness, 101));
-}
-
-EXPORT_IF_KUNIT(convert_custom_brightness);
-
-STATIC_IFN_KUNIT
-u32 convert_brightness_from_user(const struct amdgpu_dm_backlight_caps *caps,
-				uint32_t brightness)
+u32 convert_millipercent_to_user(const struct amdgpu_dm_backlight_caps *caps,
+				 u32 millipercent)
 {
 	unsigned int min, max;
 
 	if (!get_brightness_range(caps, &min, &max))
-		return brightness;
-
-	convert_custom_brightness(caps, min, max, &brightness);
+		max = MAX_BACKLIGHT_LEVEL;
 
-	/* Rescale 0..max to min..max */
-	return min + DIV_ROUND_CLOSEST_ULL((u64)(max - min) * brightness, max);
+	return DIV_ROUND_CLOSEST_ULL((u64)min(millipercent, 100000U) * max, 100000);
 }
-
-EXPORT_IF_KUNIT(convert_brightness_from_user);
+EXPORT_IF_KUNIT(convert_millipercent_to_user);
 
 STATIC_IFN_KUNIT
 u32 convert_brightness_to_user(const struct amdgpu_dm_backlight_caps *caps,
@@ -310,6 +182,19 @@ struct dc_stream_state *dm_find_stream_with_link(
 }
 EXPORT_IF_KUNIT(dm_find_stream_with_link);
 
+/* Must match the panels mod_power_set_brightness() sends nits to in SDR */
+static bool dm_backlight_takes_nits(const struct dc_link *link)
+{
+	switch (link->backlight_control_type) {
+	case BACKLIGHT_CONTROL_VESA_AUX:
+		return true;
+	case BACKLIGHT_CONTROL_AMD_AUX:
+		return link->dpcd_sink_ext_caps.bits.oled;
+	default:
+		return false;
+	}
+}
+
 STATIC_IFN_KUNIT
 int amdgpu_dm_backlight_get_device_index(struct amdgpu_display_manager *dm,
 					 struct backlight_device *bd)
@@ -331,8 +216,7 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm,
 {
 	struct amdgpu_dm_backlight_caps *caps;
 	struct dc_link *link;
-	u32 brightness = 0;
-	u32 millipercent = 0;
+	u32 millipercent;
 	bool rc = false, reallow_idle = false;
 	struct drm_connector *connector;
 	struct dc_stream_state *stream;
@@ -364,20 +248,12 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm,
 	if (!stream)
 		return;
 
-	if (caps->aux_support) {
-		brightness = convert_brightness_from_user(caps, dm->brightness[bl_idx]);
-		/* Apply brightness quirk */
-		if (caps->brightness_mask)
-			brightness |= caps->brightness_mask;
-	} else {
-		millipercent = convert_brightness_to_millipercent(caps,
-								  user_brightness);
-	}
+	millipercent = convert_brightness_to_millipercent(caps, user_brightness);
 
 	if (trace_amdgpu_dm_brightness_enabled()) {
 		trace_amdgpu_dm_brightness(__builtin_return_address(0),
 					   user_brightness,
-					   brightness,
+					   millipercent,
 					   caps->aux_support,
 					   power_supply_is_system_supplied() > 0);
 	}
@@ -388,14 +264,10 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm,
 		reallow_idle = true;
 	}
 
-	if (caps->aux_support) {
-		rc = mod_power_set_backlight_nits(dm->power_module, stream, brightness,
-			AUX_BL_DEFAULT_TRANSITION_TIME_MS, false, true);
-	} else {
-		/* power module uses millipercent */
-		rc = mod_power_set_backlight_percent(dm->power_module, stream,
-						     millipercent, 0, false);
-	}
+	rc = mod_power_set_brightness(dm->power_module, stream, millipercent,
+				      dm_backlight_takes_nits(link) ?
+				      AUX_BL_DEFAULT_TRANSITION_TIME_MS : 0,
+				      caps->brightness_mask, false);
 
 	/*
 	 * Some kms clients create a ramped backlight transition effect
@@ -443,11 +315,12 @@ u32 amdgpu_dm_backlight_get_level(struct amdgpu_display_manager *dm, int bl_idx)
 	int ret;
 	struct amdgpu_dm_backlight_caps caps;
 	struct dc_link *link = (struct dc_link *)dm->backlight_link[bl_idx];
+	unsigned int panel_inst, millipercent;
 
 	amdgpu_dm_update_backlight_caps(dm, bl_idx);
 	caps = dm->backlight_caps[bl_idx];
 
-	if (caps.aux_support) {
+	if (dm_backlight_takes_nits(link)) {
 		u32 avg, peak;
 
 		if (!dc_link_get_backlight_level_nits(link, &avg, &peak))
@@ -460,7 +333,12 @@ u32 amdgpu_dm_backlight_get_level(struct amdgpu_display_manager *dm, int bl_idx)
 	if (ret == DC_ERROR_UNEXPECTED)
 		return dm->brightness[bl_idx];
 
-	return convert_brightness_to_user(&caps, ret);
+	if (!dc_get_edp_link_panel_inst(dm->dc, link, &panel_inst) ||
+	    !mod_power_get_hw_backlight_pwm_percent(dm->power_module, link,
+						    &millipercent, panel_inst))
+		return dm->brightness[bl_idx];
+
+	return convert_millipercent_to_user(&caps, millipercent);
 }
 EXPORT_IF_KUNIT(amdgpu_dm_backlight_get_level);
 
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.h +4 -5
index 9ad888d3ae7b..1807209e90e7 100644
@@ -67,13 +67,12 @@ ssize_t panel_power_savings_store(struct device *device,
 				 const char *buf, size_t count);
 int get_brightness_range(const struct amdgpu_dm_backlight_caps *caps,
 			 unsigned int *min, unsigned int *max);
-void convert_custom_brightness(const struct amdgpu_dm_backlight_caps *caps,
-			       unsigned int min, unsigned int max,
-			       uint32_t *user_brightness);
-u32 convert_brightness_from_user(const struct amdgpu_dm_backlight_caps *caps,
-				 uint32_t brightness);
 u32 convert_brightness_to_user(const struct amdgpu_dm_backlight_caps *caps,
 			       uint32_t brightness);
+u32 convert_brightness_to_millipercent(const struct amdgpu_dm_backlight_caps *caps,
+				       u32 user_brightness);
+u32 convert_millipercent_to_user(const struct amdgpu_dm_backlight_caps *caps,
+				 u32 millipercent);
 int amdgpu_dm_backlight_get_device_index(struct amdgpu_display_manager *dm,
 					 struct backlight_device *bd);
 void amdgpu_dm_backlight_fill_props(const struct amdgpu_dm_backlight_caps *caps,
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_backlight_test.c +103 -449

690 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#11 lore raw

PATCH 11/33 drm/amd/display: Add DPMS-v2 types

In reply to James Lin

From: Dominik Kowalski <[email protected]>

[Why]
DPMS-v2 replaces pipe_ctx with link_dpms_ctx, aiming to narrow its reach and responsibilities, enabling more precise and safe design.

[How]
* Add link_tx in dedicated file as new vtable for DPMS-v2 to call
* Add link_dpms_ctx in core_types
* Place link_dpms_ctx in dc_link
* No initialization or other use logic yet, TBD

---
 drivers/gpu/drm/amd/display/dc/dc.h           |  2 +
 .../gpu/drm/amd/display/dc/inc/core_types.h   | 58 ++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/inc/link_tx.h  | 59 +++++++++++++++++++
 3 files changed, 119 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/display/dc/inc/link_tx.h
drivers/gpu/drm/amd/display/dc/dc.h +2 -0
index 01f549010d07..c9bdfba11a01 100644
@@ -556,6 +556,7 @@ struct dc_update_descriptor {
 struct dc;
 struct dc_plane_state;
 struct dc_state;
+struct link_dpms_ctx;
 
 struct dc_cap_funcs {
 	bool (*get_dcc_compression_cap)(const struct dc *dc,
@@ -1931,6 +1932,7 @@ struct dc_scratch_space {
 	void *priv;
 
 	struct ddc_service *ddc;
+	struct link_dpms_ctx *dpms_ctx;
 
 	enum dp_panel_mode panel_mode;
 	bool panel_mode_initialized;
drivers/gpu/drm/amd/display/dc/inc/core_types.h +58 -0

68 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/inc/link_tx.h new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#12 lore raw

PATCH 12/33 drm/amd/display: Always apply 0ppm pixel clock adjustment

In reply to James Lin

From: Allen Pan <[email protected]>

[Why]
program_pix_clk() pairs with dcn3_get_pix_clk_dividers(), which did not apply the video optimized pixel rate table. pll_settings and requested_pix_clk_100hz then kept the rounded pixel clock, so audio was set up for a different clock than the one the hardware runs.

[How]
program_pix_clk() pairs with dcn3_get_pix_clk_dividers(), which did not apply the video optimized pixel rate table. pll_settings and requested_pix_clk_100hz then kept the rounded pixel clock, so audio was set up for a different clock than the one the hardware runs.

---
 .../drm/amd/display/dc/dce/dce_clock_source.c | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +25 -0
index 145c993342bd..298e28befdd6 100644
@@ -1444,6 +1444,7 @@ static uint32_t dcn3_get_pix_clk_dividers(
 		struct pll_settings *pll_settings)
 {
 	unsigned long long actual_pix_clk_100Hz = pix_clk_params ? pix_clk_params->requested_pix_clk_100hz : 0;
+	const struct pixel_rate_range_table_entry *e;
 	struct dce110_clk_src *clk_src = TO_DCE110_CLK_SRC(cs);
 
 	if (pix_clk_params == NULL || pll_settings == NULL
@@ -1454,6 +1455,30 @@ static uint32_t dcn3_get_pix_clk_dividers(
 	}
 
 	memset(pll_settings, 0, sizeof(*pll_settings));
+	e = look_up_in_video_optimized_rate_tlb(pix_clk_params->requested_pix_clk_100hz / 10);
+
+	if (e) {
+		switch (e->target_pixel_rate_khz) {
+		//Do not modify (no need) for *1.001 rates
+		case 27000:
+		case 54000:
+		case 108000:
+			break;
+
+		default:
+			//Should override pll_settings->actual_pix_clk_100hz here when entry found in table to
+			//increase Pixel clock precision for one digit (in KHz units -> 100Hz unit that VBIOS
+			//accepts) for refresh rates like 59.94 / 29.97 Hz etc.
+			actual_pix_clk_100Hz = e->target_pixel_rate_khz;
+			actual_pix_clk_100Hz *= 10;
+			actual_pix_clk_100Hz *= e->mult_factor;
+			actual_pix_clk_100Hz = div_u64(actual_pix_clk_100Hz, e->div_factor);
+			pll_settings->actual_pix_clk_100hz = (unsigned int) actual_pix_clk_100Hz;
+			//Loop back so Audio will get same precisison for Audio DTO for Audio Wall clock
+			pix_clk_params->requested_pix_clk_100hz = (unsigned int) actual_pix_clk_100Hz;
+			break;
+		}
+	}
 	/* Adjust for HDMI Type A deep color */
 	if (pix_clk_params->signal_type == SIGNAL_TYPE_HDMI_TYPE_A) {
 		switch (pix_clk_params->color_depth) {
Signature · 1 line
2.43.0
author
#13 lore raw

PATCH 13/33 drm/amd/display: Add otg versions of get_vblank_counter/scanoutpos

In reply to James Lin

From: George Zhang <[email protected]>

[why & how]
Add functions to access the vblank_counter and scanoutpos of OTGs by instance number.

---
 .../gpu/drm/amd/display/dc/core/dc_stream.c   | 38 +++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/dc_stream.h    |  6 +++
 2 files changed, 44 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +38 -0
index 56c7d97733a6..01b5ddd87289 100644
@@ -862,6 +862,20 @@ uint32_t dc_stream_get_vblank_counter(const struct dc_stream_state *stream)
 	return 0;
 }
 
+uint32_t dc_otg_get_vblank_counter(struct dc *dc, int otg_inst)
+{
+	struct resource_context *res_ctx = &dc->current_state->res_ctx;
+
+	dc_exit_ips_for_hw_access(dc);
+
+	struct timing_generator *tg = res_ctx->pipe_ctx[otg_inst].stream_res.tg;
+
+	if (!tg)
+		return 0;
+
+	return tg->funcs->get_frame_count(tg);
+}
+
 bool dc_stream_send_dp_sdp(const struct dc_stream_state *stream,
 		const uint8_t *custom_sdp_message,
 		unsigned int sdp_message_size)
@@ -937,6 +951,30 @@ bool dc_stream_get_scanoutpos(const struct dc_stream_state *stream,
 	return ret;
 }
 
+bool dc_otg_get_scanoutpos(struct dc *dc, int otg_inst,
+				  uint32_t *v_blank_start,
+				  uint32_t *v_blank_end,
+				  uint32_t *h_position,
+				  uint32_t *v_position)
+{
+	struct resource_context *res_ctx = &dc->current_state->res_ctx;
+
+	dc_exit_ips_for_hw_access(dc);
+
+	struct timing_generator *tg = res_ctx->pipe_ctx[otg_inst].stream_res.tg;
+
+	if (!tg)
+		return false;
+
+	tg->funcs->get_scanoutpos(tg,
+				  v_blank_start,
+				  v_blank_end,
+				  h_position,
+				  v_position);
+
+	return true;
+}
+
 bool dc_stream_dmdata_status_done(struct dc *dc, struct dc_stream_state *stream)
 {
 	struct pipe_ctx *pipe = NULL;
drivers/gpu/drm/amd/display/dc/dc_stream.h +6 -0
index 94eccb87cbde..e507d334d598 100644
@@ -452,6 +452,7 @@ struct dc_stream_state *dc_get_stream_at_index(struct dc *dc, uint8_t i);
  * Return the current frame counter.
  */
 uint32_t dc_stream_get_vblank_counter(const struct dc_stream_state *stream);
+uint32_t dc_otg_get_vblank_counter(struct dc *dc, int otg_inst);
 
 /*
  * Send dp sdp message.
@@ -469,6 +470,11 @@ bool dc_stream_get_scanoutpos(const struct dc_stream_state *stream,
 				  uint32_t *v_blank_end,
 				  uint32_t *h_position,
 				  uint32_t *v_position);
+bool dc_otg_get_scanoutpos(struct dc *dc, int otg_inst,
+				  uint32_t *v_blank_start,
+				  uint32_t *v_blank_end,
+				  uint32_t *h_position,
+				  uint32_t *v_position);
 
 bool dc_stream_add_writeback(struct dc *dc,
 		struct dc_stream_state *stream,
Signature · 1 line
2.43.0
author
#14 lore raw

PATCH 14/33 drm/amd/display: Queue vblank control work to sleepable context

In reply to James Lin

From: George Zhang <[email protected]>

[why & how]
Currently, vblank control exits idle to program HW, but it does not (and cannot) hold dc_lock to prevent another thread from entering device-wide idle.

Add a flag to check if we are able to use the HW vblank counter or not. If not, assume that we are in idle, and queue a worker to enable/disable vblank in a sleepable context. Update the value of the flag accordingly in the ISM.

In the gap between returning from vblank_control and the worker enabling HW, use the flag to determine if we should output a virtual vblank counter or not.

Finally, lock DM internal callers of dm_vblank_get_counter.

---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  93 +++++++-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  49 ++++
 .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c    | 225 ++++++++++++------
 .../display/amdgpu_dm/amdgpu_dm_irq_params.h  |   2 +
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c |  20 +-
 5 files changed, 302 insertions(+), 87 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +88 -5
index 2f4c6a2dd4ec..29d7c87a94ef 100644
@@ -172,6 +172,7 @@ static inline void amdgpu_dm_exit_ips_for_hw_access(struct dc *dc)
 STATIC_IFN_KUNIT u32 dm_vblank_get_counter(struct amdgpu_device *adev, int crtc)
 {
 	struct amdgpu_crtc *acrtc = NULL;
+	struct amdgpu_display_manager *dm = &adev->dm;
 
 	if (crtc >= adev->mode_info.num_crtc)
 		return 0;
@@ -184,7 +185,19 @@ STATIC_IFN_KUNIT u32 dm_vblank_get_counter(struct amdgpu_device *adev, int crtc)
 		return 0;
 	}
 
-	return dc_stream_get_vblank_counter(acrtc->dm_irq_params.stream);
+	guard(spinlock_irqsave)(&adev->dm.sw_counter_lock);
+
+	if (acrtc->otg_inst < 0) {
+		drm_err(adev_to_drm(adev), "dm_vblank_get_counter: no otg_inst for crtc '%d'!\n",
+			crtc);
+		return 0;
+	}
+
+	if (dm->use_sw_vblank_counter)
+		return dm->otg_sw_counter[acrtc->otg_inst].frozen;
+
+	return (dc_stream_get_vblank_counter(acrtc->dm_irq_params.stream) +
+		dm->otg_sw_counter[acrtc->otg_inst].offset) & 0xffffff;
 }
 EXPORT_IF_KUNIT(dm_vblank_get_counter);
 
@@ -192,8 +205,8 @@ STATIC_IFN_KUNIT int dm_crtc_get_scanoutpos(struct amdgpu_device *adev, int crtc
 					    u32 *vbl, u32 *position)
 {
 	u32 v_blank_start = 0, v_blank_end = 0, h_position = 0, v_position = 0;
+	struct amdgpu_display_manager *dm = &adev->dm;
 	struct amdgpu_crtc *acrtc = NULL;
-	struct dc *dc = adev->dm.dc;
 
 	if ((crtc < 0) || (crtc >= adev->mode_info.num_crtc))
 		return -EINVAL;
@@ -206,8 +219,20 @@ STATIC_IFN_KUNIT int dm_crtc_get_scanoutpos(struct amdgpu_device *adev, int crtc
 		return 0;
 	}
 
-	if (dc && dc->caps.ips_support && dc->idle_optimizations_allowed)
-		dc_allow_idle_optimizations(dc, false);
+	guard(spinlock_irqsave)(&adev->dm.sw_counter_lock);
+
+	if (acrtc->otg_inst < 0) {
+		drm_err(adev_to_drm(adev), "dm_crtc_get_scanoutpos: no otg_inst for crtc '%d'!\n",
+			crtc);
+		return 0;
+	}
+
+	if (dm->use_sw_vblank_counter) {
+		*vbl = dm->otg_sw_counter[acrtc->otg_inst].vblank_start |
+		       (dm->otg_sw_counter[acrtc->otg_inst].vblank_end << 16);
+		*position = dm->otg_sw_counter[acrtc->otg_inst].vblank_end;
+		return 0;
+	}
 
 	/*
 	 * TODO rework base driver to use values directly.
@@ -226,6 +251,61 @@ STATIC_IFN_KUNIT int dm_crtc_get_scanoutpos(struct amdgpu_device *adev, int crtc
 }
 EXPORT_IF_KUNIT(dm_crtc_get_scanoutpos);
 
+/* active_vblank_irq_count must be 0 before calling this function */
+void amdgpu_dm_sw_counter_freeze(struct amdgpu_display_manager *dm)
+{
+	struct dc *dc = dm->dc;
+
+	lockdep_assert_held(&dm->dc_lock);
+
+	if (!dc->caps.ips_support || dc->config.disable_ips == DMUB_IPS_DISABLE_ALL)
+		return;
+
+	guard(spinlock_irqsave)(&dm->sw_counter_lock);
+
+	if (dm->use_sw_vblank_counter)
+		return;
+
+	for (int i = 0; i < MAX_PIPES; i++) {
+		u32 hw, h_position, v_position;
+
+		hw = dc_otg_get_vblank_counter(dc, i);
+		dm->otg_sw_counter[i].frozen = (hw + dm->otg_sw_counter[i].offset + 1) & 0xffffff;
+		dc_otg_get_scanoutpos(dc, i,
+				      &dm->otg_sw_counter[i].vblank_start,
+				      &dm->otg_sw_counter[i].vblank_end,
+				      &h_position, &v_position);
+	}
+
+	dm->use_sw_vblank_counter = true;
+
+}
+
+/* should only be called after IPS exit */
+void amdgpu_dm_sw_counter_resume(struct amdgpu_display_manager *dm)
+{
+	struct dc *dc = dm->dc;
+
+	lockdep_assert_held(&dm->dc_lock);
+
+	if (!dc->caps.ips_support || dc->config.disable_ips == DMUB_IPS_DISABLE_ALL)
+		return;
+
+	guard(spinlock_irqsave)(&dm->sw_counter_lock);
+
+	if (!dm->use_sw_vblank_counter)
+		return;
+
+	for (int i = 0; i < MAX_PIPES; i++) {
+		u32 hw;
+
+		hw = dc_otg_get_vblank_counter(dc, i);
+		dm->otg_sw_counter[i].offset = (dm->otg_sw_counter[i].frozen - hw) & 0xffffff;
+	}
+
+	dm->use_sw_vblank_counter = false;
+}
+
 STATIC_IFN_KUNIT int dm_wait_for_idle(struct amdgpu_ip_block *ip_block)
 {
 	/* XXX todo */
@@ -516,6 +596,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 	mutex_init(&adev->dm.audio_lock);
 
 	spin_lock_init(&adev->dm.dmub_lock);
+	spin_lock_init(&adev->dm.sw_counter_lock);
 
 	if (amdgpu_dm_irq_init(adev)) {
 		drm_err(adev_to_drm(adev), "failed to initialize DM IRQ support.\n");
@@ -768,8 +849,10 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 	if (adev->dm.dc->caps.max_links > 0) {
 		adev->dm.vblank_control_workqueue =
 			create_singlethread_workqueue("dm_vblank_control_workqueue");
-		if (!adev->dm.vblank_control_workqueue)
+		if (!adev->dm.vblank_control_workqueue) {
 			drm_err(adev_to_drm(adev), "failed to initialize vblank_workqueue.\n");
+			goto error;
+		}
 	}
 
 	if (adev->dm.dc->caps.ips_support &&
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +49 -0

67 lines not on this page · raw message

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +147 -78

258 lines not on this page · raw message

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq_params.h +2 -0
index f0c1b0c1faa9..94a3e2f4161c 100644
@@ -36,6 +36,8 @@ struct dm_irq_params {
 	int active_planes;
 	bool allow_sr_entry;
 	struct mod_freesync_config freesync_config;
+	bool vblank_irq_desired;
+	bool vblank_irq_programmed;
 
 #ifdef CONFIG_DEBUG_FS
 	enum amdgpu_dm_pipe_crc_source crc_src;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c +16 -4
index 127eaba4de60..74b33d9d8833 100644
@@ -293,8 +293,10 @@ static void dm_ism_commit_idle_optimization_state(struct amdgpu_dm_ism *ism,
 	 * If there is an active vblank requestor, or if SSO is being engaged,
 	 * then disallow idle optimizations.
 	 */
-	if (vblank_enabled || allow_panel_sso)
+	if (vblank_enabled || allow_panel_sso) {
 		dc_allow_idle_optimizations(dm->dc, false);
+		amdgpu_dm_sw_counter_resume(dm);
+	}
 
 	/*
 	 * Control PSR based on vblank requirements from OS
@@ -326,9 +328,19 @@ static void dm_ism_commit_idle_optimization_state(struct amdgpu_dm_ism *ism,
 	 * optimizations at the start of this func -- we should disallow
 	 * whenever there's *an* active CRTC.
 	 */
-	if (!vblank_enabled && dm->active_vblank_irq_count == 0) {
-		dc_post_update_surfaces_to_stream(dm->dc);
-		dc_allow_idle_optimizations(dm->dc, true);
+	if (!vblank_enabled) {
+		bool allow;
+
+		scoped_guard(spinlock_irqsave, &dm->ddev->vbl_lock) {
+			allow = !dm->active_vblank_irq_count;
+			if (allow)
+				amdgpu_dm_sw_counter_freeze(dm);
+		}
+
+		if (allow) {
+			dc_post_update_surfaces_to_stream(dm->dc);
+			dc_allow_idle_optimizations(dm->dc, true);
+		}
 	}
 }
 
Signature · 1 line
2.43.0
author
#15 lore raw

PATCH 15/33 drm/amd/display: Fix KUnit tests for vblank control rework

In reply to James Lin

From: George Zhang <[email protected]>

[why & how]
The per-CRTC vblank_toggle_lock was replaced by a device-wide sw_counter_lock, and the vblank-control-worker no longer touches active_vblank_irq_count on disable (that now happens synchronously in amdgpu_dm_crtc_set_vblank() before the worker is queued) -- seed the new lock across the affected fixtures and rework the worker tests accordingly, also seeding reset_domain where amdgpu_dm_crtc_set_vblank() now calls amdgpu_in_reset() unconditionally.

---
 .../amdgpu_dm/tests/amdgpu_dm_crtc_test.c     | 219 +++++++++++++-----
 .../amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c |   2 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  |   5 +
 3 files changed, 171 insertions(+), 55 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c +164 -55
index 20ad887979f7..ff73931a8c4d 100644
@@ -909,6 +909,38 @@ static void dm_test_crtc_cleanup(void *data)
 	list_del_init(&acrtc->base.head);
 }
 
+static void dm_test_crtc_destroy_vblank_wq(void *data)
+{
+	struct amdgpu_device *adev = data;
+
+	destroy_workqueue(adev->dm.vblank_control_workqueue);
+	adev->dm.vblank_control_workqueue = NULL;
+}
+
+/*
+ * dm_test_crtc_init_vblank_wq - Give @adev a live vblank control workqueue.
+ * @test: The KUnit test context
+ * @adev: The device to equip
+ *
+ * amdgpu_dm_crtc_set_vblank() queues unconditionally, as amdgpu_dm_init()
+ * fails driver init when the workqueue cannot be created. The worker takes
+ * dc_lock, so initialize that too. The workqueue is drained and destroyed at
+ * teardown; tests that assert on state the worker touches must flush it
+ * first.
+ */
+static void dm_test_crtc_init_vblank_wq(struct kunit *test,
+					struct amdgpu_device *adev)
+{
+	mutex_init(&adev->dm.dc_lock);
+	adev->dm.vblank_control_workqueue =
+		create_singlethread_workqueue("dm_test_vblank");
+	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev->dm.vblank_control_workqueue);
+	KUNIT_ASSERT_EQ(test,
+			kunit_add_action_or_reset(test,
+						  dm_test_crtc_destroy_vblank_wq,
+						  adev), 0);
+}
+
 /*
  * dm_test_crtc_arm_irq_src - Prime an IRQ source so get()/put() short-circuit.
  * @test: The KUnit test context
@@ -978,6 +1010,9 @@ dm_test_crtc_setup_enable(struct kunit *test, struct amdgpu_device **adev_out,
 	acrtc->base.funcs = &dm_test_crtc_funcs;
 	acrtc->base.enabled = true;
 	acrtc->crtc_id = 0;
+	/* amdgpu_dm_crtc_set_vblank() takes this; amdgpu_dm_crtc_init() is bypassed. */
+	spin_lock_init(&adev->dm.sw_counter_lock);
+	dm_test_crtc_init_vblank_wq(test, adev);
 	INIT_LIST_HEAD(&acrtc->base.head);
 	list_add_tail(&acrtc->base.head, &adev->ddev.mode_config.crtc_list);
 	KUNIT_ASSERT_EQ(test,
@@ -1148,22 +1183,56 @@ static void dm_test_crtc_enable_vblank_queues_work(struct kunit *test)
 	dm_test_crtc_arm_irq_src(test, &adev->crtc_irq, 1);
 	dm_test_crtc_arm_irq_src(test, &adev->pageflip_irq, 1);
 
-	/* Real workqueue so the queue_work() branch runs the control worker. */
-	mutex_init(&adev->dm.dc_lock);
-	adev->dm.vblank_control_workqueue =
-		create_singlethread_workqueue("dm_test_vblank");
-	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev->dm.vblank_control_workqueue);
-
 	KUNIT_EXPECT_EQ(test, amdgpu_dm_crtc_enable_vblank(&acrtc->base), 0);
 
-	/* Drain the queued worker before the fixture is torn down, then tidy up. */
-	destroy_workqueue(adev->dm.vblank_control_workqueue);
-	adev->dm.vblank_control_workqueue = NULL;
+	/* Drain the queued worker so the count below is observed deterministically. */
+	flush_workqueue(adev->dm.vblank_control_workqueue);
 
 	/* The queued worker ran and accounted the active vblank IRQ. */
 	KUNIT_EXPECT_EQ(test, adev->dm.active_vblank_irq_count, 1);
 }
 
+/**
+ * dm_test_crtc_enable_vblank_idempotent - Test a redundant enable programs nothing
+ * @test: The KUnit test context
+ *
+ * amdgpu_dm_sync_vblank_irq() short-circuits when the request already matches
+ * vblank_irq_programmed, so a second enable must leave the crtc and pageflip
+ * IRQ references untouched rather than taking a second one.
+ */
+static void dm_test_crtc_enable_vblank_idempotent(struct kunit *test)
+{
+	struct dm_crtc_state *acrtc_state;
+	struct amdgpu_device *adev;
+	struct amdgpu_crtc *acrtc;
+	int crtc_refs, pflip_refs;
+
+	/* DCE_VERSION_8_0 supports VRR -> the vupdate-irq branch is walked. */
+	acrtc = dm_test_crtc_setup_enable(test, &adev, DCE_VERSION_8_0);
+
+	/* OTG unassigned -> amdgpu_dm_crtc_set_vupdate_irq() returns 0 early. */
+	acrtc->otg_inst = -1;
+	acrtc_state = to_dm_crtc_state(acrtc->base.state);
+	acrtc_state->freesync_config.state = VRR_STATE_ACTIVE_VARIABLE;
+
+	adev->irq.installed = true;
+	dm_test_crtc_arm_irq_src(test, &adev->crtc_irq, 1);
+	dm_test_crtc_arm_irq_src(test, &adev->pageflip_irq, 1);
+
+	KUNIT_EXPECT_EQ(test, amdgpu_dm_crtc_enable_vblank(&acrtc->base), 0);
+	KUNIT_EXPECT_TRUE(test, acrtc->dm_irq_params.vblank_irq_programmed);
+
+	crtc_refs = atomic_read(&adev->crtc_irq.enabled_types[0]);
+	pflip_refs = atomic_read(&adev->pageflip_irq.enabled_types[0]);
+
+	KUNIT_EXPECT_EQ(test, amdgpu_dm_crtc_enable_vblank(&acrtc->base), 0);
+
+	KUNIT_EXPECT_EQ(test, atomic_read(&adev->crtc_irq.enabled_types[0]),
+			crtc_refs);
+	KUNIT_EXPECT_EQ(test, atomic_read(&adev->pageflip_irq.enabled_types[0]),
+			pflip_refs);
+}
+
 /**
  * dm_test_crtc_enable_vblank_ips_restore - Test IPS/self-refresh vblank restore
  * @test: The KUnit test context
@@ -1881,12 +1950,15 @@ static void dm_test_crtc_handle_vblank_completes_cursor_only(struct kunit *test)
 /**
  * dm_test_vblank_control_worker_setup - Build a vblank_control_work for the worker
  * @test: The KUnit test context
- * @enable: Value for vblank_work->enable
+ * @enable: Value for vblank_work->enable; also seeds vblank_irq_desired so the
+ *          worker's own program-decision ("desired && !programmed") matches it
  * @count: Initial dm->active_vblank_irq_count
  *
- * Returns a work item wired to a freshly allocated adev/crtc/stream. The CRTC is
- * left without an atomic state so amdgpu_dm_ism_commit_event() short-circuits and
- * only the vblank IRQ accounting in the worker runs.
+ * Returns a work item wired to a freshly allocated adev/crtc/stream, with the
+ * crtc/pageflip IRQ sources armed so amdgpu_dm_sync_vblank_irq() can actually
+ * program on the enable path. The CRTC is left without an atomic state so
+ * amdgpu_dm_ism_commit_event() short-circuits and only the vblank IRQ
+ * programming in the worker runs.
  */
 static struct vblank_control_work *
 dm_test_vblank_control_worker_setup(struct kunit *test, bool enable,
@@ -1901,14 +1973,24 @@ dm_test_vblank_control_worker_setup(struct kunit *test, bool enable,
 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev);
 
 	mutex_init(&adev->dm.dc_lock);
+	spin_lock_init(&adev->dm.sw_counter_lock);
 	adev->dm.dc = dm_kunit_alloc_dc_with_ctx(test);
 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev->dm.dc);
 	adev->dm.active_vblank_irq_count = count;
 
+	adev->mode_info.num_crtc = 1;
+	adev->irq.installed = true;
+
 	acrtc = kunit_kzalloc(test, sizeof(*acrtc), GFP_KERNEL);
 	KUNIT_ASSERT_NOT_NULL(test, acrtc);
 	acrtc->base.dev = &adev->ddev;
 	acrtc->base.state = NULL;
+	acrtc->crtc_id = 0;
+	/* OTG unassigned -> amdgpu_dm_crtc_set_vupdate_irq() returns 0 early. */
+	acrtc->otg_inst = -1;
+	acrtc->dm_irq_params.vblank_irq_desired = enable;
+	dm_test_crtc_arm_irq_src(test, &adev->crtc_irq, 1);
+	dm_test_crtc_arm_irq_src(test, &adev->pageflip_irq, 1);
 
 	stream = dm_kunit_alloc_stream(test, NULL);
 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, stream);
@@ -1930,7 +2012,9 @@ dm_test_vblank_control_worker_setup(struct kunit *test, bool enable,
  * dm_test_vblank_control_worker_enable_increments - Test enable bumps IRQ count
  * @test: The KUnit test context
  *
- * Running the worker with enable set must increment the active vblank IRQ count.
+ * With vblank_irq_desired seeded true and nothing yet programmed, the worker's
+ * program decision is true, so it calls amdgpu_dm_sync_vblank_irq(), which
+ * programs the IRQ and increments the active vblank IRQ count.
  */
 static void dm_test_vblank_control_worker_enable_increments(struct kunit *test)
 {
@@ -1943,16 +2027,22 @@ static void dm_test_vblank_control_worker_enable_increments(struct kunit *test)
 	amdgpu_dm_crtc_vblank_control_worker(&work->work);
 
 	KUNIT_EXPECT_EQ(test, dm->active_vblank_irq_count, 1);
+	KUNIT_EXPECT_TRUE(test, work->acrtc->dm_irq_params.vblank_irq_programmed);
 }
 
 /**
- * dm_test_vblank_control_worker_disable_decrements - Test disable drops IRQ count
+ * dm_test_vblank_control_worker_disable_leaves_count_unchanged - Test disable is a no-op here
  * @test: The KUnit test context
  *
- * Running the worker with enable clear must decrement a non-zero active vblank
- * IRQ count.
+ * amdgpu_dm_crtc_set_vblank()'s disable branch calls amdgpu_dm_sync_vblank_irq()
+ * synchronously, inline, before ever queuing this worker -- so by the time the
+ * worker runs, the real decrement has already happened elsewhere. With
+ * vblank_irq_desired seeded false and vblank_irq_programmed defaulting false,
+ * the worker's own program decision is false, so it must leave the count
+ * untouched; its only remaining job on disable is the (short-circuited) ISM
+ * ENTER_IDLE_REQUESTED dispatch.
  */
-static void dm_test_vblank_control_worker_disable_decrements(struct kunit *test)
+static void dm_test_vblank_control_worker_disable_leaves_count_unchanged(struct kunit *test)
 {
 	struct vblank_control_work *work;
 	struct amdgpu_display_manager *dm;
@@ -1962,26 +2052,7 @@ static void dm_test_vblank_control_worker_disable_decrements(struct kunit *test)
 
 	amdgpu_dm_crtc_vblank_control_worker(&work->work);
 
-	KUNIT_EXPECT_EQ(test, dm->active_vblank_irq_count, 1);
-}
-
-/**
- * dm_test_vblank_control_worker_disable_clamps_zero - Test disable clamps at zero
- * @test: The KUnit test context
- *
- * Disabling when the active vblank IRQ count is already zero must not underflow.
- */
-static void dm_test_vblank_control_worker_disable_clamps_zero(struct kunit *test)
-{
-	struct vblank_control_work *work;
-	struct amdgpu_display_manager *dm;
-
-	work = dm_test_vblank_control_worker_setup(test, false, 0);
-	dm = work->dm;
-
-	amdgpu_dm_crtc_vblank_control_worker(&work->work);
-
-	KUNIT_EXPECT_EQ(test, dm->active_vblank_irq_count, 0);
+	KUNIT_EXPECT_EQ(test, dm->active_vblank_irq_count, 2);
 }
 
 /**
@@ -1990,10 +2061,12 @@ static void dm_test_vblank_control_worker_disable_clamps_zero(struct kunit *test
  *
  * Disabling vblank walks amdgpu_dm_crtc_set_vblank()'s disable path. With the
  * IRQ subsystem not installed, amdgpu_irq_put() returns early so the routine
- * completes without touching the vblank workqueue or the active IRQ count.
+ * completes without changing the active IRQ count.
  */
 static void dm_test_crtc_disable_vblank_no_irq_installed(struct kunit *test)
 {
+	struct amdgpu_reset_domain *reset_domain;
+	struct dm_crtc_state *dm_state;
 	struct amdgpu_device *adev;
 	struct amdgpu_crtc *acrtc;
 
@@ -2006,6 +2079,11 @@ static void dm_test_crtc_disable_vblank_no_irq_installed(struct kunit *test)
 	adev->dm.dc->ctx->dce_version = DCE_VERSION_6_0;
 	adev->dm.active_vblank_irq_count = 0;
 
+	/* amdgpu_dm_crtc_set_vblank() calls amdgpu_in_reset(adev) unconditionally. */
+	reset_domain = kunit_kzalloc(test, sizeof(*reset_domain), GFP_KERNEL);
+	KUNIT_ASSERT_NOT_NULL(test, reset_domain);
+	adev->reset_domain = reset_domain;
+
 	/* No CRTCs registered and IRQs not installed -> irq_put returns early. */
 	adev->mode_info.num_crtc = 0;
 	adev->irq.installed = false;
@@ -2014,8 +2092,23 @@ static void dm_test_crtc_disable_vblank_no_irq_installed(struct kunit *test)
 	KUNIT_ASSERT_NOT_NULL(test, acrtc);
 	acrtc->base.dev = &adev->ddev;
 	acrtc->crtc_id = 0;
+	spin_lock_init(&adev->dm.sw_counter_lock);
+	dm_test_crtc_init_vblank_wq(test, adev);
+	/* Without this the disable is a no-op: the IRQ is already not programmed. */
+	acrtc->dm_irq_params.vblank_irq_programmed = true;
+	/*
+	 * Seed the ISM in a state where ENTER_IDLE_REQUESTED does not transition
+	 * so the worker skips the ISM power-state dispatch and its timers.
+	 */
+	acrtc->ism.current_state = DM_ISM_STATE_HYSTERESIS_WAITING;
+
+	/* CRTC state with no stream -> the stream-retain branch is skipped. */
+	dm_state = kunit_kzalloc(test, sizeof(*dm_state), GFP_KERNEL);
+	KUNIT_ASSERT_NOT_NULL(test, dm_state);
+	acrtc->base.state = &dm_state->base;
 
 	amdgpu_dm_crtc_disable_vblank(&acrtc->base);
+	flush_workqueue(adev->dm.vblank_control_workqueue);
 
 	KUNIT_EXPECT_EQ(test, adev->dm.active_vblank_irq_count, 0);
 }
@@ -2025,12 +2118,13 @@ static void dm_test_crtc_disable_vblank_no_irq_installed(struct kunit *test)
  * @test: The KUnit test context
  *
  * On a VRR-capable DC the disable path turns the vupdate IRQ off (OTG
- * unassigned so it returns early), releases the armed crtc and pageflip IRQ
- * references and completes without queuing vblank control work.
+ * unassigned so it returns early) and releases the armed crtc and pageflip
+ * IRQ references.
  */
 static void dm_test_crtc_disable_vblank_vrr(struct kunit *test)
 {
 	struct amdgpu_reset_domain *reset_domain;
+	struct dm_crtc_state *dm_state;
 	struct amdgpu_device *adev;
 	struct amdgpu_crtc *acrtc;
 
@@ -2059,8 +2153,23 @@ static void dm_test_crtc_disable_vblank_vrr(struct kunit *test)
 	acrtc->crtc_id = 0;
 	/* OTG unassigned -> amdgpu_dm_crtc_set_vupdate_irq() returns 0 early. */
 	acrtc->otg_inst = -1;
+	spin_lock_init(&adev->dm.sw_counter_lock);
+	dm_test_crtc_init_vblank_wq(test, adev);
+	/* Without this the disable is a no-op: the IRQ is already not programmed. */
+	acrtc->dm_irq_params.vblank_irq_programmed = true;
+	/*
+	 * Seed the ISM in a state where ENTER_IDLE_REQUESTED does not transition
+	 * so the worker skips the ISM power-state dispatch and its timers.
+	 */
+	acrtc->ism.current_state = DM_ISM_STATE_HYSTERESIS_WAITING;
+
+	/* CRTC state with no stream -> the stream-retain branch is skipped. */
+	dm_state = kunit_kzalloc(test, sizeof(*dm_state), GFP_KERNEL);
+	KUNIT_ASSERT_NOT_NULL(test, dm_state);
+	acrtc->base.state = &dm_state->base;
 
 	amdgpu_dm_crtc_disable_vblank(&acrtc->base);
+	flush_workqueue(adev->dm.vblank_control_workqueue);
 
 	/* Both IRQ references were released without underflow. */
 	KUNIT_EXPECT_EQ(test, atomic_read(&adev->crtc_irq.enabled_types[0]), 1);
@@ -2073,9 +2182,12 @@ static void dm_test_crtc_disable_vblank_vrr(struct kunit *test)
  *
  * With a vblank control workqueue installed and a CRTC state carrying no
  * stream, the disable path queues the control worker without retaining a
- * stream. Draining the queue runs the worker, which drops the active vblank IRQ
- * count. The ISM is seeded in a state with no ENTER_IDLE_REQUESTED transition
- * so the worker only exercises the vblank accounting.
+ * stream. amdgpu_dm_crtc_set_vblank()'s disable branch calls
+ * amdgpu_dm_sync_vblank_irq() synchronously (not via the worker), so the
+ * active vblank IRQ count has already dropped by the time this call returns.
+ * The ISM is seeded in a state with no ENTER_IDLE_REQUESTED transition so
+ * draining the queued worker only exercises its (short-circuited) ISM
+ * dispatch, leaving the count as this call already left it.
  */
 static void dm_test_crtc_disable_vblank_queues_work(struct kunit *test)
 {
@@ -2109,28 +2221,25 @@ static void dm_test_crtc_disable_vblank_queues_work(struct kunit *test)
 	acrtc->base.dev = &adev->ddev;
 	acrtc->crtc_id = 0;
 	acrtc->otg_inst = -1;
+	spin_lock_init(&adev->dm.sw_counter_lock);
+	/* Without this the disable is a no-op: the IRQ is already not programmed. */
+	acrtc->dm_irq_params.vblank_irq_programmed = true;
 	/*
 	 * Seed the ISM in a state where ENTER_IDLE_REQUESTED does not transition
 	 * so the worker skips the ISM power-state dispatch and its timers.
 	 */
 	acrtc->ism.current_state = DM_ISM_STATE_HYSTERESIS_WAITING;
+	dm_test_crtc_init_vblank_wq(test, adev);
 
 	/* CRTC state with no stream -> the stream-retain branch is skipped. */
 	dm_state = kunit_kzalloc(test, sizeof(*dm_state), GFP_KERNEL);
 	KUNIT_ASSERT_NOT_NULL(test, dm_state);
 	acrtc->base.state = &dm_state->base;
 
-	/* Real workqueue so the queue_work() branch runs the control worker. */
-	mutex_init(&adev->dm.dc_lock);
-	adev->dm.vblank_control_workqueue =
-		create_singlethread_workqueue("dm_test_vblank");
-	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev->dm.vblank_control_workqueue);
-
 	amdgpu_dm_crtc_disable_vblank(&acrtc->base);
 
-	/* Drain the queued worker before the fixture is torn down, then tidy up. */
-	destroy_workqueue(adev->dm.vblank_control_workqueue);
-	adev->dm.vblank_control_workqueue = NULL;
+	/* Drain the queued worker so the count below is observed deterministically. */
+	flush_workqueue(adev->dm.vblank_control_workqueue);
 
 	/* The queued worker ran and decremented the active vblank IRQ count. */
 	KUNIT_EXPECT_EQ(test, adev->dm.active_vblank_irq_count, 1);
@@ -2667,6 +2776,7 @@ static struct kunit_case amdgpu_dm_crtc_tests[] = {
 	KUNIT_CASE(dm_test_crtc_enable_vblank_crtc_irq_error),
 	KUNIT_CASE(dm_test_crtc_enable_vblank_in_reset),
 	KUNIT_CASE(dm_test_crtc_enable_vblank_queues_work),
+	KUNIT_CASE(dm_test_crtc_enable_vblank_idempotent),
 	KUNIT_CASE(dm_test_crtc_enable_vblank_ips_restore),
 	KUNIT_CASE(dm_test_crtc_enable_vblank_ips_restore_replay),
 	/* amdgpu_dm_crtc_set_vline0_irq */
@@ -2696,8 +2806,7 @@ static struct kunit_case amdgpu_dm_crtc_tests[] = {
 	KUNIT_CASE(dm_test_crtc_handle_vblank_completes_cursor_only),
 	/* amdgpu_dm_crtc_vblank_control_worker */
 	KUNIT_CASE(dm_test_vblank_control_worker_enable_increments),
-	KUNIT_CASE(dm_test_vblank_control_worker_disable_decrements),
-	KUNIT_CASE(dm_test_vblank_control_worker_disable_clamps_zero),
+	KUNIT_CASE(dm_test_vblank_control_worker_disable_leaves_count_unchanged),
 	/* amdgpu_dm_crtc_disable_vblank */
 	KUNIT_CASE(dm_test_crtc_disable_vblank_no_irq_installed),
 	KUNIT_CASE(dm_test_crtc_disable_vblank_vrr),
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c +2 -0
index f844b644bb77..6031d9c9c29f 100644
@@ -95,6 +95,8 @@ struct amdgpu_display_manager *dm_kunit_alloc_dm(struct kunit *test)
 
 	dm->dc = dc;
 	dc->current_state = state;
+	/* Guards otg_sw_counter[]; amdgpu_dm_init() is bypassed here. */
+	spin_lock_init(&dm->sw_counter_lock);
 
 	return dm;
 }
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +5 -0
index a7618473e207..85f2e78c54af 100644
@@ -1292,6 +1292,11 @@ static void dm_test_crtc_with_stream(struct kunit *test,
 	adev->mode_info.num_crtc = 1;
 	adev->mode_info.crtcs[0] = acrtc;
 	acrtc->dm_irq_params.stream = stream;
+
+	/* dm_vblank_get_counter()/dm_crtc_get_scanoutpos() take this unconditionally
+	 * once a stream is set.
+	 */
+	spin_lock_init(&adev->dm.sw_counter_lock);
 }
 
 /**
Signature · 1 line
2.43.0
author
#16 lore raw

PATCH 16/33 drm/amd/display: Add urgent request and assertion probes

In reply to James Lin

From: Wenjing Liu <[email protected]>

[Why]
Display debug needs to count urgent signals and data requests over a selectable part of a frame. The existing probes can only measure a whole frame.

[How]
Add a stream scope to the probe model, with the stream id and a start and end line in a union keyed on the scope type. The urgent assertion count and the new urgent request count poll with MEASURING, which has no window, or run as a one shot with MEASURED. A one shot measures one frame of the stream, or a window when the lines are set. A zero start line is the vblank start, derived from the stream timing.
Switching to a different polled probe type resets and programs the new counter first.
The one shot assertion count in a window also reports the deassertion count and the HUBP requests outstanding, sampled once after the counter was read. Make the urgent assertion result a struct to carry them.
A window the position already left when the counter is armed is missed, and its result is not valid.
Add a wrap-aware, bounded block sequence step to wait for an OTG line, the hubbub request count start and get steps, and a step to get the HUBP outstanding requests. Read the outstanding requests through the register fields.

---
 .../drm/amd/display/dc/core/dc_hw_sequencer.c | 183 ++++++++++++-
 .../gpu/drm/amd/display/dc/core/dc_resource.c |  44 +++-
 drivers/gpu/drm/amd/display/dc/dc.h           |  46 +++-
 drivers/gpu/drm/amd/display/dc/dc_probe.h     |  61 ++++-
 .../display/dc/hubbub/dcn60/dcn60_hubbub.c    |  80 ++++++
 .../amd/display/dc/hubp/dcn20/dcn20_hubp.h    |   3 +-
 .../amd/display/dc/hubp/dcn60/dcn60_hubp.c    |  35 +++
 .../amd/display/dc/hubp/dcn60/dcn60_hubp.h    |   1 +
 .../amd/display/dc/hwss/dcn60/dcn60_hwseq.c   | 243 ++++++++++++++++--
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |  53 +++-
 .../gpu/drm/amd/display/dc/inc/hw/dchubbub.h  |   3 +
 drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h  |  12 +
 12 files changed, 721 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +181 -2
index 061ea11cef0e..241cbe19056d 100644
@@ -1895,6 +1895,12 @@ void hwss_execute_sequence(struct dc *dc,
 		case TG_WAIT_FOR_STATE:
 			hwss_tg_wait_for_state(params);
 			break;
+		case TG_WAIT_FOR_POSITION:
+			hwss_tg_wait_for_position(params);
+			break;
+		case HUBP_GET_OUTSTANDING_REQ:
+			hwss_hubp_get_outstanding_req(params);
+			break;
 		case TG_SET_VTG_PARAMS:
 			hwss_tg_set_vtg_params(params);
 			break;
@@ -2025,6 +2031,9 @@ void hwss_execute_sequence(struct dc *dc,
 		case HUBBUB_PERFMON_START_URGENT_ASSERTION_COUNT:
 			hwss_hubbub_perfmon_start_urgent_assertion_count(params);
 			break;
+		case HUBBUB_PERFMON_START_URGENT_REQUEST_COUNT:
+			hwss_hubbub_perfmon_start_urgent_request_count(params);
+			break;
 		case HUBBUB_PERFMON_START_URGENT_RAMP_LATENCY:
 			hwss_hubbub_perfmon_start_urgent_ramp_latency(params);
 			break;
@@ -2043,6 +2052,9 @@ void hwss_execute_sequence(struct dc *dc,
 		case HUBBUB_PERFMON_GET_URGENT_ASSERTION_COUNT:
 			hwss_hubbub_perfmon_get_urgent_assertion_count(params);
 			break;
+		case HUBBUB_PERFMON_GET_URGENT_REQUEST_COUNT:
+			hwss_hubbub_perfmon_get_urgent_request_count(params);
+			break;
 		case HUBBUB_PERFMON_GET_PREFETCH_DATA_SIZE:
 			hwss_hubbub_perfmon_get_prefetch_data_size(params);
 			break;
@@ -2726,6 +2738,46 @@ void hwss_add_tg_wait_for_state(struct block_sequence_state *seq_state,
 	}
 }
 
+/*
+ * Helper function to add TG wait for a vertical position (OTG line) to block sequence
+ */
+/*
+ * Helper function to add a wait for an OTG line to block sequence. When
+ * window_valid is set, line is the end of the window that starts at window_start,
+ * and if the position has already left the window when the step runs, the window
+ * is missed: *window_valid is cleared and the step does not wait out a whole frame.
+ */
+void hwss_add_tg_wait_for_position(struct block_sequence_state *seq_state,
+		struct timing_generator *tg,
+		unsigned int line,
+		unsigned int window_start,
+		bool *window_valid)
+{
+	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
+		seq_state->steps[*seq_state->num_steps].params.tg_wait_for_position_params.tg = tg;
+		seq_state->steps[*seq_state->num_steps].params.tg_wait_for_position_params.line = line;
+		seq_state->steps[*seq_state->num_steps].params.tg_wait_for_position_params.window_start = window_start;
+		seq_state->steps[*seq_state->num_steps].params.tg_wait_for_position_params.window_valid = window_valid;
+		seq_state->steps[*seq_state->num_steps].func = TG_WAIT_FOR_POSITION;
+		(*seq_state->num_steps)++;
+	}
+}
+
+/*
+ * Helper function to add a HUBP outstanding request sample to block sequence
+ */
+void hwss_add_hubp_get_outstanding_req(struct block_sequence_state *seq_state,
+		struct hubp *hubp,
+		uint32_t *status)
+{
+	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
+		seq_state->steps[*seq_state->num_steps].params.hubp_get_outstanding_req_params.hubp = hubp;
+		seq_state->steps[*seq_state->num_steps].params.hubp_get_outstanding_req_params.status = status;
+		seq_state->steps[*seq_state->num_steps].func = HUBP_GET_OUTSTANDING_REQ;
+		(*seq_state->num_steps)++;
+	}
+}
+
 /*
  * Helper function to add TG set VTG params to block sequence
  */
@@ -3529,6 +3581,93 @@ void hwss_tg_wait_for_state(union block_sequence_params *params)
 		tg->funcs->wait_for_state(tg, state);
 }
 
+/*
+ * Poll the TG vertical position until it reaches the target OTG line, at its
+ * next occurrence approached from below. The OTG vertical counter is 0-based
+ * and wraps at v_total, with active starting at OTG_V_BLANK_END (not 0), so the
+ * vblank region can straddle the wrap. The initial position decides the phases,
+ * and is not sampled again to change that decision:
+ *   below target_line - skip phase 1, only phase 2 is needed,
+ *   at or above it    - phase 1 first, which waits out the wrap.
+ * and then the phases:
+ *   phase 1 - advance until the counter is below target_line,
+ *   phase 2 - advance until the counter reaches target_line.
+ * With a window, the initial position must be inside the window, so being at or
+ * above the end line is only valid for a window that crosses the wrap.
+ * target_line must be in [1, v_total-1], 0 and v_total are degenerate and will
+ * simply run out the guard. Each phase is bounded so a stalled or non-moving TG
+ * can never hang the block sequence.
+ */
+void hwss_tg_wait_for_position(union block_sequence_params *params)
+{
+	struct timing_generator *tg = params->tg_wait_for_position_params.tg;
+	unsigned int target_line = params->tg_wait_for_position_params.line;
+	struct crtc_position position = {0};
+	unsigned int initial_line;
+	unsigned int guard;
+
+	if (!tg->funcs->get_position)
+		return;
+
+	tg->funcs->get_position(tg, &position);
+	initial_line = position.vertical_count;
+
+	/*
+	 * Arming takes longer than a line. If the position already left the window,
+	 * the end line would only be reached a whole frame later, so report the window
+	 * as missed instead. A window with start at or after end crosses the wrap.
+	 */
+	if (params->tg_wait_for_position_params.window_valid) {
+		unsigned int start_line = params->tg_wait_for_position_params.window_start;
+		bool in_window;
+
+		if (start_line < target_line)
+			in_window = initial_line >= start_line
+					&& initial_line < target_line;
+		else
+			in_window = initial_line >= start_line
+					|| initial_line < target_line;
+
+		if (!in_window) {
+			*params->tg_wait_for_position_params.window_valid = false;
+			return;
+		}
+	}
+
+	/* phase 1: only if the initial position is at or above the target, wait out the wrap */
+	if (initial_line >= target_line) {
+		guard = 100000; /* 100000 * 1us = 100ms cap */
+		do {
+			tg->funcs->get_position(tg, &position);
+			if (position.vertical_count < target_line)
+				break;
+			udelay(1);
+		} while (--guard);
+	}
+
+	/* phase 2: climb to the target */
+	guard = 100000;
+	do {
+		tg->funcs->get_position(tg, &position);
+		if (position.vertical_count >= target_line)
+			break;
+		udelay(1);
+	} while (--guard);
+}
+
+/*
+ * Get the HUBP outstanding request status once and OR it into the caller's
+ * sink, so a sink cleared before a window accumulates everything seen in it.
+ */
+void hwss_hubp_get_outstanding_req(union block_sequence_params *params)
+{
+	struct hubp *hubp = params->hubp_get_outstanding_req_params.hubp;
+	uint32_t *status = params->hubp_get_outstanding_req_params.status;
+
+	if (hubp && status && hubp->funcs->hubp_get_outstanding_req_status)
+		*status |= hubp->funcs->hubp_get_outstanding_req_status(hubp);
+}
+
 void hwss_tg_set_vtg_params(union block_sequence_params *params)
 {
 	struct timing_generator *tg = params->tg_set_vtg_params_params.tg;
@@ -3974,6 +4113,14 @@ void hwss_hubbub_perfmon_start_urgent_assertion_count(union block_sequence_param
 		hubbub->funcs->perfmon.start_measuring_urgent_assertion_count(hubbub);
 }
 
+void hwss_hubbub_perfmon_start_urgent_request_count(union block_sequence_params *params)
+{
+	struct hubbub *hubbub = params->hubbub_perfmon_start_urgent_request_count_params.hubbub;
+
+	if (hubbub && hubbub->funcs->perfmon.start_measuring_urgent_request_count)
+		hubbub->funcs->perfmon.start_measuring_urgent_request_count(hubbub);
+}
+
 void hwss_hubbub_perfmon_start_urgent_ramp_latency(union block_sequence_params *params)
 {
 	struct hubbub *hubbub = params->hubbub_perfmon_start_urgent_ramp_latency_params.hubbub;
@@ -4033,10 +4180,20 @@ void hwss_hubbub_perfmon_get_urgent_assertion_count(union block_sequence_params
 	struct hubbub *hubbub   = params->hubbub_perfmon_get_urgent_assertion_count_params.hubbub;
 	uint32_t refclk_mhz    = params->hubbub_perfmon_get_urgent_assertion_count_params.refclk_mhz;
 	uint32_t *count         = params->hubbub_perfmon_get_urgent_assertion_count_params.assertion_count;
+	uint32_t *deassertion_count = params->hubbub_perfmon_get_urgent_assertion_count_params.deassertion_count;
 
 	if (hubbub && hubbub->funcs->perfmon.get_urgent_assertion_count)
 		hubbub->funcs->perfmon.get_urgent_assertion_count(
-				hubbub, refclk_mhz, count, NULL, NULL);
+				hubbub, refclk_mhz, count, deassertion_count, NULL);
+}
+
+void hwss_hubbub_perfmon_get_urgent_request_count(union block_sequence_params *params)
+{
+	struct hubbub *hubbub = params->hubbub_perfmon_get_urgent_request_count_params.hubbub;
+	uint32_t *count       = params->hubbub_perfmon_get_urgent_request_count_params.request_count;
+
+	if (hubbub && count && hubbub->funcs->perfmon.get_urgent_request_count)
+		*count = hubbub->funcs->perfmon.get_urgent_request_count(hubbub);
 }
 
 void hwss_hubbub_perfmon_get_prefetch_data_size(union block_sequence_params *params)
@@ -5415,6 +5572,16 @@ void hwss_add_hubbub_perfmon_start_urgent_assertion_count(struct block_sequence_
 	}
 }
 
+void hwss_add_hubbub_perfmon_start_urgent_request_count(struct block_sequence_state *seq_state,
+		struct hubbub *hubbub)
+{
+	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
+		seq_state->steps[*seq_state->num_steps].func = HUBBUB_PERFMON_START_URGENT_REQUEST_COUNT;
+		seq_state->steps[*seq_state->num_steps].params.hubbub_perfmon_start_urgent_request_count_params.hubbub = hubbub;
+		(*seq_state->num_steps)++;
+	}
+}
+
 void hwss_add_hubbub_perfmon_start_urgent_ramp_latency(struct block_sequence_state *seq_state,
 		struct hubbub *hubbub,
 		const struct hubbub_urgent_latency_params *latency_params)
@@ -5482,13 +5649,25 @@ void hwss_add_hubbub_perfmon_get_memory_latencies(struct block_sequence_state *s
 
 void hwss_add_hubbub_perfmon_get_urgent_assertion_count(struct block_sequence_state *seq_state,
 		struct hubbub *hubbub, uint32_t refclk_mhz,
-		uint32_t *assertion_count)
+		uint32_t *assertion_count, uint32_t *deassertion_count)
 {
 	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
 		seq_state->steps[*seq_state->num_steps].func = HUBBUB_PERFMON_GET_URGENT_ASSERTION_COUNT;
 		seq_state->steps[*seq_state->num_steps].params.hubbub_perfmon_get_urgent_assertion_count_params.hubbub = hubbub;
 		seq_state->steps[*seq_state->num_steps].params.hubbub_perfmon_get_urgent_assertion_count_params.refclk_mhz = refclk_mhz;
 		seq_state->steps[*seq_state->num_steps].params.hubbub_perfmon_get_urgent_assertion_count_params.assertion_count = assertion_count;
+		seq_state->steps[*seq_state->num_steps].params.hubbub_perfmon_get_urgent_assertion_count_params.deassertion_count = deassertion_count;
+		(*seq_state->num_steps)++;
+	}
+}
+
+void hwss_add_hubbub_perfmon_get_urgent_request_count(struct block_sequence_state *seq_state,
+		struct hubbub *hubbub, uint32_t *request_count)
+{
+	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
+		seq_state->steps[*seq_state->num_steps].func = HUBBUB_PERFMON_GET_URGENT_REQUEST_COUNT;
+		seq_state->steps[*seq_state->num_steps].params.hubbub_perfmon_get_urgent_request_count_params.hubbub = hubbub;
+		seq_state->steps[*seq_state->num_steps].params.hubbub_perfmon_get_urgent_request_count_params.request_count = request_count;
 		(*seq_state->num_steps)++;
 	}
 }
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +32 -12

65 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dc.h +44 -2

64 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dc_probe.h +56 -5

98 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c +80 -0

92 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/hubp/dcn20/dcn20_hubp.h +2 -1
index 3ae06bf89f79..a0bd134c37b3 100644
@@ -313,7 +313,8 @@
 	type URGENT_FORCE_EN;\
 	type FORCE_DISP_PREF_TO_VBLANK;\
 	type DST_Y_ALT_CH_DRQ_LIMIT;\
-	type FORCE_CURSOR_TO_DISP_PREF
+	type FORCE_CURSOR_TO_DISP_PREF;\
+	type HUBP_XRQ_NO_OUTSTANDING_REQ
 /*
 	type HUBP_3DLUT_CROSSBAR_SEL_B;\
 	type HUBP_3DLUT_CROSSBAR_SEL_G;\
drivers/gpu/drm/amd/display/dc/hubp/dcn60/dcn60_hubp.c +35 -0
index 7c2ff310ea99..6604fb880341 100644
@@ -409,6 +409,40 @@ void hubp60_read_state(struct hubp *hubp)
 	s->flip_control = REG_READ(DCSURF_FLIP_CONTROL);
 }
 
+/**
+ * hubp60_get_outstanding_req_status() - Sample the outstanding request status of HUBP.
+ * @hubp: hubp instance
+ *
+ * Reads DCHUBP_CNTL once. The no-outstanding fields read 1 when idle, so they are inverted
+ * into HUBP_OUTSTANDING_* bits that are set when something is outstanding.
+ *
+ * Return: HUBP_OUTSTANDING_* and HUBP_NOT_IN_BLANK bits
+ */
+static uint32_t hubp60_get_outstanding_req_status(struct hubp *hubp)
+{
+       struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
+       uint32_t no_outstanding_req = 0;
+       uint32_t xrq_no_outstanding_req = 0;
+       uint32_t in_blank = 0;
+       uint32_t status = 0;
+
+       REG_GET_3(DCHUBP_CNTL,
+		HUBP_NO_OUTSTANDING_REQ, &no_outstanding_req,
+		HUBP_XRQ_NO_OUTSTANDING_REQ, &xrq_no_outstanding_req,
+		HUBP_IN_BLANK, &in_blank);
+
+       if (!no_outstanding_req)
+		status |= HUBP_OUTSTANDING_ANY;
+       if (!(xrq_no_outstanding_req & HUBP_XRQ_NO_OUTSTANDING_DRQ))
+		status |= HUBP_OUTSTANDING_DRQ;
+       if (!(xrq_no_outstanding_req & HUBP_XRQ_NO_OUTSTANDING_CRQ_TRQ))
+		status |= HUBP_OUTSTANDING_CRQ_TRQ;
+       if (!in_blank)
+		status |= HUBP_NOT_IN_BLANK;
+
+       return status;
+}
+
 static struct hubp_funcs dcn60_hubp_funcs = {
 	.hubp_enable_tripleBuffer = hubp2_enable_triplebuffer,
 	.hubp_is_triplebuffer_enabled = hubp2_is_triplebuffer_enabled,
@@ -438,6 +472,7 @@ static struct hubp_funcs dcn60_hubp_funcs = {
 	.hubp_soft_reset = hubp31_soft_reset,
 	.hubp_set_flip_int = hubp401_set_flip_int,
 	.hubp_in_blank = hubp401_in_blank,
+	.hubp_get_outstanding_req_status = hubp60_get_outstanding_req_status,
 	.phantom_hubp_post_enable = hubp32_phantom_hubp_post_enable,
 	.hubp_update_mall_sel = NULL,
 	.hubp_prepare_subvp_buffering = hubp32_prepare_subvp_buffering,
drivers/gpu/drm/amd/display/dc/hubp/dcn60/dcn60_hubp.h +1 -0
index e502c9330cef..dac20ed6bb0c 100644
@@ -34,6 +34,7 @@
 	HUBP_SF(HUBP0_DCHUBP_CNTL, HUBP_UNBOUNDED_REQ_MODE, mask_sh),\
 	HUBP_SF(HUBP0_DCHUBP_CNTL, HUBP_IN_BLANK, mask_sh),\
 	HUBP_SF(HUBP0_DCHUBP_CNTL, HUBP_SOFT_RESET, mask_sh),\
+	HUBP_SF(HUBP0_DCHUBP_CNTL, HUBP_XRQ_NO_OUTSTANDING_REQ, mask_sh),\
 	HUBP_SF(HUBP0_DCSURF_ADDR_CONFIG, NUM_PIPES, mask_sh),\
 	HUBP_SF(HUBP0_DCSURF_ADDR_CONFIG, PIPE_INTERLEAVE, mask_sh),\
 	HUBP_SF(HUBP0_DCSURF_ADDR_CONFIG, MAX_COMPRESSED_FRAGS, mask_sh),\
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c +223 -20

344 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +52 -1

143 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h +3 -0
index 7280f57f75bf..0b5fe1ca04e0 100644
@@ -294,6 +294,9 @@ struct hubbub_funcs {
 				uint32_t *assertion_count,
 				uint32_t *deassertion_count,
 				uint32_t *timestamp_us);
+		void (*start_measuring_urgent_request_count)(
+				struct hubbub *hubbub);
+		uint32_t (*get_urgent_request_count)(struct hubbub *hubbub);
 		void (*start_measuring_urgent_ramp_latency)(
 				struct hubbub *hubbub,
 				const struct hubbub_urgent_latency_params *params);
drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h +12 -0
index d1cbcb87d271..d6b23bd3cdce 100644
@@ -100,6 +100,16 @@ enum hubp_3dlut_fl_crossbar_bit_slice {
 	hubp_3dlut_fl_crossbar_bit_slice_48_63 = 3
 };
 
+/* Bits returned by hubp_get_outstanding_req_status(), decoded from DCHUBP_CNTL. */
+#define HUBP_OUTSTANDING_ANY		0x1	/* a request is outstanding in HUBP */
+#define HUBP_OUTSTANDING_DRQ		0x2	/* a data request is outstanding */
+#define HUBP_OUTSTANDING_CRQ_TRQ	0x4	/* a chunk/meta or translation request is outstanding */
+#define HUBP_NOT_IN_BLANK		0x8	/* HUBP has not finished requesting for the frame */
+
+/* Request types in the HUBP_XRQ_NO_OUTSTANDING_REQ field of DCHUBP_CNTL, a bit reads 1 when idle. */
+#define HUBP_XRQ_NO_OUTSTANDING_DRQ	0x1
+#define HUBP_XRQ_NO_OUTSTANDING_CRQ_TRQ	0x8
+
 struct hubp {
 	const struct hubp_funcs *funcs;
 	struct dc_context *ctx;
@@ -261,6 +271,8 @@ struct hubp_funcs {
 		struct hubp *hubp,
 		bool enable);
 	bool (*hubp_in_blank)(struct hubp *hubp);
+	/* Decoded outstanding request and blank status, see HUBP_OUTSTANDING_*. */
+	uint32_t (*hubp_get_outstanding_req_status)(struct hubp *hubp);
 	void (*hubp_soft_reset)(struct hubp *hubp, bool reset);
 
 	void (*hubp_set_flip_int)(struct hubp *hubp);
Signature · 1 line
2.43.0
author
#17 lore raw

PATCH 17/33 drm/amd/display: Fix G7 P-state aperture addresses

In reply to James Lin

From: Ivan Lipski <[email protected]>

[Why&How]
On GMC v13, fb_start can differ from vram_start. Use vram_start when translating firmware aperture addresses to MC addresses.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c +1 -1
index ebd8130cb04d..b251351fdfec 100644
@@ -213,7 +213,7 @@ dm_get_alt_channel_pstate_switch_aperture(struct amdgpu_device *adev,
 
 		/* DML2 requires the reserved-region base in MC address space. */
 		aperture_mc_bases[i] = apertures[i].reserved_region_start +
-			adev->gmc.fb_start - adev->vm_manager.vram_base_offset;
+			adev->gmc.vram_start - adev->vm_manager.vram_base_offset;
 	}
 
 	for (i = 0; i < ARRAY_SIZE(region_ids); i++) {
Signature · 1 line
2.43.0
author
#18 lore raw

PATCH 18/33 drm/amd/display: Set stream min/max refresh from VRR config

In reply to James Lin

From: Ivan Lipski <[email protected]>

[Why]
FAMS2 on DCN6 uses the stream's max_vtotal to estimate the DRR prepare time against the remaining PPT window before allowing a UCLK switch. amdgpu_dm never set stream->timing.min/max_refresh_in_uhz, so DML derived max_vtotal from the HW vtotal limit (~0x7FFF), causing DMUB to incorrectly reject P-state switches.

[How]
Populate stream timing min/max refresh from the freesync config when VRR is supported.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c +3 -0
index 40f1dd8af21c..78dbdbce8c04 100644
@@ -187,6 +187,9 @@ void amdgpu_dm_get_freesync_config_for_crtc(
 		config.vsif_supported = true;
 		config.btr = true;
 
+		new_crtc_state->stream->timing.min_refresh_in_uhz = config.min_refresh_in_uhz;
+		new_crtc_state->stream->timing.max_refresh_in_uhz = config.max_refresh_in_uhz;
+
 		if (fs_vid_mode) {
 			config.state = VRR_STATE_ACTIVE_FIXED;
 			config.fixed_refresh_in_uhz = new_crtc_state->freesync_config.fixed_refresh_in_uhz;
Signature · 1 line
2.43.0
author
#19 lore raw

PATCH 19/33 drm/amd/display: Add DC2 wrapped initialization for DCN401

In reply to James Lin

From: Tomasz Siemek <[email protected]>

[why]
DC2 needs a wrapped hardware initialization path with software state management separated from hardware sequencing.

[how]
- Add staged DCN401 initialization with builder postprocessing and workaround application before each sequence is executed.
- Add a PMFW messenger for firmware communication and DPM clock queries.
- Resolve DMUB capabilities, reference clocks, DPM limits, bandwidth parameters and watermark ranges in core2 instead of clk_mgr.
- Add wrapped initialization selection through DAL_DC2_INIT while retaining legacy initialization as the default.

---
 drivers/gpu/drm/amd/display/dc/Makefile       |   3 +
 .../amd/display/dc/bls_builder/bls_builder.c  |  19 +
 .../amd/display/dc/bls_builder/bls_builder.h  |  68 +-
 .../dc/bls_builder/bls_builder_internal.h     |   3 +
 .../dc/bls_builder/dcn401_init_builder.c      | 812 ++++++++++--------
 .../dc/bls_builder/dcn401_init_builder.h      |  16 -
 .../bls_builder/dcn401_init_builder_legacy.c  |  77 ++
 .../dc/bls_builder/dcn401_query_builder.c     |  41 +
 .../display/dc/bls_executor/bls_executor.c    |  79 +-
 .../display/dc/bls_executor/bls_executor.h    |   2 +-
 .../gpu/drm/amd/display/dc/core2/dc_core2.c   |   2 +
 .../drm/amd/display/dc/core2/dc_core2_init.c  | 298 ++++++-
 drivers/gpu/drm/amd/display/dc/dc.h           |   1 +
 .../amd/display/dc/dc_api_dispatch/api_shim.c |   1 +
 .../amd/display/dc/dc_api_dispatch/api_shim.h |   3 +
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |  19 +-
 .../gpu/drm/amd/display/dc/inc/core_types.h   |   3 +
 .../amd/display/dc/inc/dc_core_interface.h    |   6 +
 .../dc/pmfw_messenger/dcn401_pmfw_messenger.c | 211 +++++
 .../dc/pmfw_messenger/pmfw_messenger.c        |  62 ++
 .../dc/pmfw_messenger/pmfw_messenger.h        | 118 +++
 21 files changed, 1395 insertions(+), 449 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_query_builder.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/pmfw_messenger/dcn401_pmfw_messenger.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/pmfw_messenger/pmfw_messenger.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/pmfw_messenger/pmfw_messenger.h
drivers/gpu/drm/amd/display/dc/Makefile +3 -0
index a7dd6a7ba492..4dac84158822 100644
@@ -91,9 +91,12 @@ FILES += bls_builder/dcn401_init_builder.o
 FILES += bls_builder/dcn401_init_builder_legacy.o
 FILES += bls_builder/dcn401_non_seamless_builder.o
 FILES += state_facts/state_facts.o
+FILES += bls_builder/dcn401_query_builder.o
 FILES += bls_executor/bls_executor.o
 FILES += workaround_manager/workaround_manager.o
 FILES += dmub_messenger/dmub_messenger.o
+FILES += pmfw_messenger/pmfw_messenger.o
+FILES += pmfw_messenger/dcn401_pmfw_messenger.o
 
 AMD_DISPLAY_FILES += $(addprefix $(AMDDALPATH)/dc/, $(FILES))
 
drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder.c +19 -0
index 8ac202487189..80771e7751bb 100644
@@ -6,6 +6,25 @@
 #include "dm_services.h"
 #include "bls_builder/bls_builder_internal.h"
 
+const struct bls_builder *dcn401_bls_builder_create(
+		enum bls_builder_name name)
+{
+	switch (name) {
+	case DCN_DECL_INITIALIZATION:
+		return dcn401_initialization_builder();
+	case DCN_DECL_INITIALIZATION_LEGACY:
+		return dcn401_legacy_initialization_builder();
+	case DCN_DECL_NON_SEAMLESS_COMMIT:
+		return dcn401_non_seamless_commit_builder();
+	case DCN_DECL_SEAMLESS_UPDATE:
+		return dcn401_seamless_update_builder();
+	case DCN_DECL_QUERY_ACCELERATED_MODE:
+		return dcn401_accelerated_mode_query_builder();
+	default:
+		return NULL;
+	}
+}
+
 const struct bls_builder *bls_builder_create(struct dc *dc,
 		enum bls_builder_name name)
 {
drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder.h +49 -19

112 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_internal.h +3 -0
index ebf315e31ad8..265c4c2b4b9e 100644
@@ -9,5 +9,8 @@
 
 const struct bls_builder *dcn401_bls_builder_create(
 		enum bls_builder_name name);
+const struct bls_builder *dcn401_initialization_builder(void);
+const struct bls_builder *dcn401_legacy_initialization_builder(void);
+const struct bls_builder *dcn401_accelerated_mode_query_builder(void);
 const struct bls_builder *dcn401_non_seamless_commit_builder(void);
 const struct bls_builder *dcn401_seamless_update_builder(void);
drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_init_builder.c +446 -366

887 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_init_builder.h +0 -16
index fe70971cb8a5..714990f1fd9a 100644
@@ -7,10 +7,6 @@
 
 #include "bls_builder/bls_builder.h"
 
-struct clk_mgr;
-struct dccg;
-struct dc_context;
-
 static inline bool bls_append(struct block_sequence_state *sequence,
 		enum block_sequence_func func,
 		const union block_sequence_params *params)
@@ -28,15 +24,3 @@ static inline bool bls_append(struct block_sequence_state *sequence,
 	(*sequence->num_steps)++;
 	return true;
 }
-
-enum bls_builder_result dcn401_build_clk_mgr_init(
-		struct clk_mgr *clk_mgr, struct block_sequence_state *sequence);
-enum bls_builder_result dcn401_build_dc_mode_read(
-		struct clk_mgr *clk_mgr, bool *out_dcmode_power_limits_present,
-		struct block_sequence_state *sequence);
-enum bls_builder_result dcn401_build_dccg_init(
-		struct dccg *dccg, struct block_sequence_state *sequence);
-bool dcn401_add_dmub_cmd(struct block_sequence_state *sequence,
-		struct dc_context *ctx, union dmub_rb_cmd *cmd,
-		enum dm_dmub_wait_type wait_type, bool continue_on_error);
-void dcn401_fill_query_feature_caps_cmd(union dmub_rb_cmd *cmd);
drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_init_builder_legacy.c +77 -0

92 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_query_builder.c new file +41 -0

41 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/bls_executor/bls_executor.c +58 -21

147 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/bls_executor/bls_executor.h +1 -1
index d686f03c34c2..88a2ca8b3694 100644
@@ -17,5 +17,5 @@ enum dc2_bls_exec_result {
 
 enum dc2_bls_exec_result dc2_bls_execute(
 		struct dc2 *dc2,
-		const struct block_sequence *steps,
+		struct block_sequence *steps,
 		unsigned int num_steps);
drivers/gpu/drm/amd/display/dc/core2/dc_core2.c +2 -0
index 0e92c2e7a4e6..d05d74595829 100644
@@ -46,6 +46,8 @@ void core2_construct(struct dc *dc)
 
 	for (name = 0; name < BLS_BUILDER_NAME_COUNT; name++)
 		dc2->builders[name] = bls_builder_create(dc, name);
+
+	pmfw_messenger_construct(&dc2->pmfw_messenger, dc->ctx);
 }
 
 void core2_destruct(struct dc *dc)
drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c +273 -25

335 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index 4c235520b908..775259e5e478 100644
@@ -1414,6 +1414,7 @@ struct dc_init_data {
 	uint32_t *clk_reg_offsets;
 	void *bb_from_dmub;
 	enum dc2_selection dc2_selection;
+	enum dc2_init_method dc2_init_method;
 };
 
 struct dc_callback_init {
drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.c +1 -0
index 5d7117501428..ec3b14ba8509 100644
@@ -14,6 +14,7 @@ void api_shim_construct(struct dc *dc, const struct dc_init_data *init_params)
 {
 	/* DM override today; ASIC allow-list later. Owned only by this shim. */
 	TO_DC2(dc)->selection = init_params->dc2_selection;
+	TO_DC2(dc)->init_method = init_params->dc2_init_method;
 }
 
 void dc_hardware_init(struct dc *dc)
drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h +3 -0
index 93dd2d47c8dc..297d2920f733 100644
@@ -8,16 +8,19 @@
 #include "dc.h"
 #include "inc/dc_core_interface.h"
 #include "bls_builder/bls_builder.h"
+#include "pmfw_messenger/pmfw_messenger.h"
 
 struct dc2 {
 	/* First member: TO_DC2 is a typed upcast, not container_of. */
 	struct dc dc;
 	enum dc2_selection selection;
+	enum dc2_init_method init_method;
 	/* Resolved by hardware init; later builds take it as dmub_abi. */
 	struct dmub_abi dmub_abi;
 	bool dmub_abi_resolved;
 	/* Set once by core2_construct; NULL where this DCN has no builder. */
 	const struct bls_builder *builders[BLS_BUILDER_NAME_COUNT];
+	struct pmfw_messenger pmfw_messenger;
 };
 
 #define TO_DC2(ptr) ((struct dc2 *)(ptr))
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +18 -1
index e447dd2c69ec..6e009ba37ff9 100644
@@ -38,6 +38,7 @@
 #include "link_service_types.h"
 #include "dmub/inc/dmub_cmd.h"
 #include "dc_dmub_srv.h"
+#include "pmfw_messenger/pmfw_messenger.h"
 
 struct pipe_ctx;
 struct dc_state;
@@ -147,6 +148,13 @@ struct send_dmcub_cmd_params {
 	bool continue_on_error;
 };
 
+struct send_dmcub_cmd2_params {
+	struct dc_context *ctx;
+	union dmub_rb_cmd cmd;
+	enum dm_dmub_wait_type wait_type;
+	bool continue_on_error;
+};
+
 struct dmub_gpint_params {
 	unsigned int command_code;
 	unsigned int param;
@@ -1350,6 +1358,12 @@ struct dccg_initialize_clocks_params {
 	struct dccg *dccg;
 };
 
+struct pmfw_send_and_wait_params {
+	struct pmfw_message message;
+	struct pmfw_response response;
+	bool continue_on_error;
+};
+
 struct hubbub_program_watermarks_params {
 	struct hubbub *hubbub;
 	/* Workaround: watermarks by value would add ~160 B to every step (~158 KiB per dc_state).
@@ -1398,6 +1412,7 @@ union block_sequence_params {
 	struct update_info_frame_params update_info_frame_params;
 	struct program_manual_trigger_params program_manual_trigger_params;
 	struct send_dmcub_cmd_params send_dmcub_cmd_params;
+	struct send_dmcub_cmd2_params send_dmcub_cmd2_params;
 	struct lsdma_send_pio_copy_params lsdma_send_pio_copy_params;
 	struct setup_dpp_params setup_dpp_params;
 	struct program_bias_and_scale_params program_bias_and_scale_params;
@@ -1634,6 +1649,7 @@ union block_sequence_params {
 	struct hubp_program_3dlut_fl_config_params
 			hubp_program_3dlut_fl_config_params;
 	struct hubp_set_3dlut_fl_params hubp_set_3dlut_fl_params;
+	struct pmfw_send_and_wait_params pmfw_send_and_wait_params;
 };
 
 enum block_sequence_func {
@@ -1811,7 +1827,6 @@ enum block_sequence_func {
 	DMUB_GPINT_SEND_AND_WAIT,
 	DMUB_HALT_FW,
 	PSP_RELOAD_DMUB_FW,
-	DMUB_INITIALIZE_DCN,
 	OPTC_SET_ODM_MEM_POWER,
 	MMHUBBUB_SET_MEM_POWER,
 	DCCG_GET_REF_FREQ,
@@ -1879,6 +1894,8 @@ enum block_sequence_func {
 	DPP_PROGRAM_GAMCOR_LUT,
 	HUBP_PROGRAM_3DLUT_FL_CONFIG,
 	HUBP_SET_3DLUT_FL,
+	PMFW_SEND_MESSAGE_AND_WAIT,
+	DMUB_SEND_DMCUB_CMD2,
 	/* This must be the last value in this enum, add new ones above */
 	HWSS_BLOCK_SEQUENCE_FUNC_COUNT
 };
drivers/gpu/drm/amd/display/dc/inc/core_types.h +3 -0
index 1d6bb41312b7..f1b6053fa5c6 100644
@@ -42,6 +42,7 @@
 #include "panel_cntl.h"
 #include "dmub/inc/dmub_cmd.h"
 #include "bls_builder/bls_builder_legacy_init.h"
+#include "bls_builder/bls_builder.h"
 #include "pg_cntl.h"
 #include "sspl/dc_spl.h"
 
@@ -730,6 +731,8 @@ struct dc_state {
 	 * outputs of each stage run so far
 	 */
 	struct bls_builder_legacy_hw_init_info hw_init_info;
+
+	struct bls_builder_initialization bls_builder_initialization;
 };
 
 struct replay_context {
drivers/gpu/drm/amd/display/dc/inc/dc_core_interface.h +6 -0
index 4cd01e34a959..6e21ddb839a3 100644
@@ -20,6 +20,12 @@ enum dc2_selection {
 	DC2_SELECTION_CORE2,
 };
 
+/* Temporary: picks the CORE2 hardware init flow for bring-up testing. */
+enum dc2_init_method {
+	DC2_INIT_METHOD_LEGACY = 0,
+	DC2_INIT_METHOD_WRAPPED,
+};
+
 enum dc2_hw_ownership {
 	DC2_HW_OWNERSHIP_RELEASED = 0,
 	DC2_HW_OWNERSHIP_OWNED,
drivers/gpu/drm/amd/display/dc/pmfw_messenger/dcn401_pmfw_messenger.c new file +211 -0

211 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/pmfw_messenger/pmfw_messenger.c new file +62 -0

62 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/pmfw_messenger/pmfw_messenger.h new file +118 -0

118 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#20 lore raw

PATCH 20/33 drm/amd/display: Honor the Replay stream regeneration wait event

In reply to James Lin

From: Harry VanZyllDeJong <[email protected]>

[Why]
The shared FreeSync Replay inactive mask omits the stream regeneration wait event. Replay can become eligible before the regeneration wait period expires after stream enable.

[How]
Include the regeneration wait in the inactive mask. Exercise the public event API to verify nominal coasting while waiting and restoration of static-screen coasting after the event clears.

---
 drivers/gpu/drm/amd/display/modules/power/power_replay.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/modules/power/power_replay.c +1 -0
index fcfb6066066c..6b1955ff2109 100644
@@ -232,6 +232,7 @@ static bool mod_power_update_replay_active_status(unsigned int active_replay_eve
 			replay_event_sleep_resume |
 			replay_event_disable_in_AC |
 			replay_event_disable_replay_while_detect_display |
+			replay_event_waiting_stream_regen |
 			replay_event_infopacket |
 			replay_event_crc_window_active))
 		return false;
Signature · 1 line
2.43.0
author
#21 lore raw

PATCH 21/33 drm/amd/display: Disable Replay when link off frame count is below 2

In reply to James Lin

From: Ray Wu <[email protected]>

[Why]
Replay must be disabled when the link off frame count of the selected timing, computed from the sink max deviation lines, is less than 2. amdgpu_dm_link_setup_replay() computed it but never used it.

[How]
Clear replay_supported on a modeset when link_off_frame_count is below PR_LINK_OFF_FRAME_COUNT_GOOD. Re-evaluate it on a later timing while keeping the disallow_edp_enter_replay and freesync caps disables.

---
 .../amd/display/amdgpu_dm/amdgpu_dm_replay.c  |  23 +++-
 .../amdgpu_dm/tests/amdgpu_dm_replay_test.c   | 129 ++++++++++++++++++
 2 files changed, 151 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c +22 -1
index ee2e4754b089..2106122d4031 100644
@@ -142,6 +142,7 @@ EXPORT_IF_KUNIT(amdgpu_dm_set_replay_caps);
 bool amdgpu_dm_link_setup_replay(struct dc_stream_state *stream,
 		struct mod_vrr_params *vrr_params)
 {
+	struct amdgpu_dm_connector *aconnector;
 	struct dc_link *link;
 	unsigned int static_coasting_vtotal;
 
@@ -149,7 +150,8 @@ bool amdgpu_dm_link_setup_replay(struct dc_stream_state *stream,
 		return false;
 
 	link = stream->link;
-	if (!link->replay_settings.config.replay_supported)
+	aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context;
+	if (!link->replay_settings.config.replay_cap_support || !aconnector)
 		return false;
 
 	if (link->replay_settings.replay_feature_enabled)
@@ -158,6 +160,25 @@ bool amdgpu_dm_link_setup_replay(struct dc_stream_state *stream,
 	calculate_replay_link_off_frame_count(link, stream->timing.v_total,
 			stream->timing.h_total);
 
+	/* FreeSync Replay must stay off for timings with link off frame count < 2 */
+	if (link->replay_settings.config.replay_version == DC_FREESYNC_REPLAY &&
+	    link->replay_settings.link_off_frame_count < PR_LINK_OFF_FRAME_COUNT_GOOD) {
+		link->replay_settings.config.replay_supported = false;
+		return false;
+	}
+
+	/*
+	 * replay_supported may have been cleared by the link off check of a
+	 * previous timing, by disallow_edp_enter_replay or by a freesync caps
+	 * update. Re-evaluate it so only the first case is restored here.
+	 */
+	if (!link->replay_settings.config.replay_supported)
+		link->replay_settings.config.replay_supported =
+			!aconnector->disallow_edp_enter_replay &&
+			amdgpu_dm_link_supports_replay(link, aconnector);
+	if (!link->replay_settings.config.replay_supported)
+		return false;
+
 	static_coasting_vtotal = mod_freesync_calc_v_total_from_refresh(stream,
 			vrr_params->min_refresh_in_uhz);
 
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_replay_test.c +129 -0

159 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#22 lore raw

PATCH 22/33 drm/amd/display: Skip DSC padding borrow estimate for zero padding

In reply to James Lin

From: Nicholas Kazlauskas <[email protected]>

[Why]
For non-DSC streams the DSC padding is zero.

This causes the borrow-mode estimate to always borrow instead of falling back to FRL_BORROW_MODE_NONE.

[How]
Return early in update_borrow_mode_from_dsc_padding() when both hactive and htotal padding are zero.

---
 drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.c +4 -0
index 2eaa830662b0..cb201c9ee3c6 100644
@@ -1173,6 +1173,10 @@ static void update_borrow_mode_from_dsc_padding(struct dsc_padding_params *dsc_p
 	uint32_t h_blank = timing->h_total - h_active;
 	struct frl_borrow_params *borrow_params = &frl_link_settings->borrow_params;
 
+	if (dsc_padding_params->dsc_hactive_padding == 0 &&
+	    dsc_padding_params->dsc_htotal_padding == 0)
+		return;
+
 	borrow_params->borrow_mode = frl_modify_borrow_mode_for_dsc_padding(timing->pix_clk_100hz,
 		h_active,
 		h_active + dsc_padding_params->dsc_hactive_padding,
Signature · 1 line
2.43.0
author
#23 lore raw

PATCH 23/33 drm/amd/display: Drop unused DC interfaces

In reply to James Lin

From: Nicholas Kazlauskas <[email protected]>

[why & how]
Cleanup for unused interfaces no longer in use by any DCN revision.

---
 drivers/gpu/drm/amd/display/dc/dc.h                      | 8 --------
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h             | 6 ------
 drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.h  | 8 --------
 drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h | 4 ----
 4 files changed, 26 deletions(-)
drivers/gpu/drm/amd/display/dc/dc.h +0 -8
index 775259e5e478..7d0a47e7bc1a 100644
@@ -2489,14 +2489,6 @@ struct dc_plane_state *dc_get_surface_for_mpcc(struct dc *dc,
 
 
 uint32_t dc_get_opp_for_plane(struct dc *dc, struct dc_plane_state *plane);
-bool dc_set_fva_vrr_adjust(struct dc *dc,
-	struct dc_stream_state *stream,
-	struct fva_adj *fva_adj,
-	struct dc_crtc_timing_adjust *vrr_adj);
-
-int dc_get_hw_max_fva_factor(struct dc *dc,
-		struct dc_stream_state *stream,
-		unsigned int max_pixel_clock);
 
 void dc_set_vstartup_start(struct dc *dc,
 		struct dc_stream_state *stream);
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +0 -6
index 20504dfb1b13..387d2ebb2b7c 100644
@@ -1207,12 +1207,6 @@ struct mcif_buf_params {
 	uint8_t				tmz_id;
 };
 
-struct fva_adj {
-	unsigned int pixel_clock_100hz;
-	unsigned int max_pixel_clock_100hz;
-	unsigned int fva_factor;
-};
-
 enum symclk_state {
 	SYMCLK_OFF_TX_OFF,
 	SYMCLK_ON_TX_ON,
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.h +0 -8
index 65014d42195c..61470a51da23 100644
@@ -72,14 +72,6 @@ enum dc_status dcn30_setup_hdmi_frl_link(
 		struct dc_link *link,
 		int hpo_inst,
 		enum clock_source_id frl_phy_clock_source_id);
-void dcn30_hw_set_fva_vrr_adj(struct dc *dc, struct pipe_ctx **pipe_ctx, int num_pipes,
-		struct fva_adj *fva_adj,
-		struct dc_crtc_timing_adjust *vrr_adj);
-
-int dcn30_hw_get_max_fva_factor(struct dc *dc,
-		struct pipe_ctx *pipe_ctx,
-		struct dc_crtc_timing *timing,
-		unsigned int max_pixel_clock);
 
 bool dcn30_does_plane_fit_in_mall(struct dc *dc,
 		unsigned int pitch,
drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h +0 -4
index 52d4d57358cd..c538e89bfac4 100644
@@ -494,10 +494,6 @@ struct timing_generator_funcs {
 	void (*set_out_mux)(struct timing_generator *tg, enum otg_out_mux_dest dest);
 	void (*set_drr_trigger_window)(struct timing_generator *optc,
 			uint32_t window_start, uint32_t window_end);
-	int (*set_fva_factor)(struct timing_generator *optc, struct fva_adj *fva_adj);
-	int (*get_max_hw_supported_fva_factor)(struct timing_generator *optc,
-		struct dc_crtc_timing *timing,
-		unsigned int max_pixclk_100hz);
 	void (*set_vtotal_change_limit)(struct timing_generator *optc,
 			uint32_t limit);
 	void (*align_vblanks)(struct timing_generator *master_optc,
Signature · 1 line
2.43.0
author
#24 lore raw

PATCH 24/33 drm/amd/display: Let the DC2 commit replace or keep a stream

In reply to James Lin

From: Tony Cheng <[email protected]>

[Why]
The dcn401 non-seamless commit builder rejects a commit when both states have a stream, or when the link of the new stream is active. A commit that replaces a stream on the same link fails.

[How]
Remove the check that rejects a stream in both states. The builder disables the current stream before it enables the new stream, so it programs all pipes of the new stream again. Accept an active link when the current stream uses that link.

---
 .../bls_builder/dcn401_non_seamless_builder.c | 24 +++++++++----------
 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c +11 -13
index f9aa8f0b9b1e..d5adbef8a6f1 100644
@@ -139,24 +139,23 @@ static enum bls_builder_result dcn401_check_commit_state_support(
 	return BLS_BUILD_SUCCESS;
 }
 
-static bool check_stream_not_kept(const struct dc *dc,
-		const struct dc_state *current_state,
-		const struct dc_state *new_state)
-{
-	(void)dc;
-	/* A stream is either removed or added, never kept. */
-	return !current_state->stream_count || !new_state->stream_count;
-}
-
+/*
+ * The current stream is disabled before the new one is enabled, so the
+ * link may be active when it carries the current stream.
+ */
 static bool check_link_not_active(const struct dc *dc,
 		const struct dc_state *current_state,
 		const struct dc_state *new_state)
 {
+	const struct dc_link *link;
+
 	(void)dc;
-	(void)current_state;
 	if (!new_state->stream_count)
 		return true;
-	return !new_state->streams[0]->link->link_status.link_active;
+	link = new_state->streams[0]->link;
+	return !link->link_status.link_active ||
+			(current_state->stream_count &&
+			current_state->streams[0]->link == link);
 }
 
 static enum bls_builder_result dcn401_check_non_seamless_commit_support(
@@ -180,8 +179,7 @@ static enum bls_builder_result dcn401_check_non_seamless_commit_support(
 	if (result != BLS_BUILD_SUCCESS)
 		return result;
 
-	CHECK_CONDITION(stream_not_kept, "stream is kept across the commit");
-	CHECK_CONDITION(link_not_active, "link is already active");
+	CHECK_CONDITION(link_not_active, "link is active on another stream");
 	return BLS_BUILD_SUCCESS;
 }
 
Signature · 1 line
2.43.0
author
#25 lore raw

PATCH 25/33 drm/amd/display: Support two streams in the dcn401 DC2 builders

In reply to James Lin

From: Tony Cheng <[email protected]>

[Why]
The DC2 builders check only the first stream and reject a state with two streams. Core2 cannot commit or update two streams.

[How]
Run the stream checks on each stream of a state. Find the OTG master of each stream, and reject two streams on one link. The non-seamless commit disables each current stream and enables each new stream. The seamless update programs only the stream that the update names. Core2 builds the info frame and sets the software state for each stream.

---
 .../amd/display/dc/bls_builder/bls_builder.h  |   3 +
 .../dc/bls_builder/dcn401_builder_internal.h  |  47 +-
 .../bls_builder/dcn401_non_seamless_builder.c | 158 ++---
 .../dc/bls_builder/dcn401_seamless_builder.c  | 601 ++++++++++--------
 .../gpu/drm/amd/display/dc/core2/dc_core2.c   |  70 +-
 5 files changed, 496 insertions(+), 383 deletions(-)
drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder.h +3 -0
index 627c6186d135..879ff188264d 100644
@@ -93,16 +93,19 @@ struct bls_builder_output_targets {
 	};
 };
 
+/* stream is the one stream an update changes, or NULL for a commit. */
 struct bls_builder_check_capability_params {
 	struct dc *dc;
 	const struct dc_state *current_state;
 	const struct dc_state *new_state;
+	const struct dc_stream_state *stream;
 };
 
 struct bls_builder_declarative_params {
 	struct dc *dc;
 	const struct dc_state *current_state;
 	const struct dc_state *new_state;
+	const struct dc_stream_state *stream;
 	struct bls_builder_output_targets *out_targets;
 	struct block_sequence head_sequence[DC2_BLS_MAX_STEPS];
 	unsigned int head_num_steps;
drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.h +38 -9

77 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c +79 -79

235 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c +344 -257

1,094 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core2/dc_core2.c +32 -38

155 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#26 lore raw

PATCH 26/33 drm/amd/display: Add a plane beside a kept plane in DC2 update

In reply to James Lin

From: Tony Cheng <[email protected]>

[Why]
The DC2 seamless update builder accepts a plane add only on a stream with no plane. An update that adds a second plane to a stream fails.

[How]
Accept one or two kept planes and at most one added plane. Each kept plane stays on its pipe, HUBP and DPP. Skip the first-enable steps of a kept pipe, and program the DET segments when its DET size changes.

---
 .../bls_builder/bls_builder_private_types.h   |  7 +-
 .../dc/bls_builder/dcn401_seamless_builder.c  | 72 ++++++++++++++-----
 2 files changed, 59 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h +5 -2
index cc301a02c494..ed9d2f7fc0a2 100644
@@ -116,10 +116,13 @@ struct dcn401_commit_step_meta {
 		/* The OPP MPC tree has no plane yet. */
 		bool opp_tree_empty;
 		/*
-		 * The HUBP/DPP block is already on. The step is part of
-		 * enabling that block the first time, not of reconfiguring it.
+		 * The pipe already showed the plane on this HUBP. The step is
+		 * part of enabling that block the first time, not of
+		 * reconfiguring it.
 		 */
 		bool hubp_dpp_already_enabled;
+		/* As hubp_dpp_already_enabled, and the DET size is the same. */
+		bool det_unchanged;
 		/*
 		 * Neither the plane scaling, the plane position nor the
 		 * stream scaling changed. A full update sets every plane bit,
drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c +54 -18

124 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#27 lore raw

PATCH 27/33 drm/amd/display: Keep an unchanged stream in the DC2 commit

In reply to James Lin

From: Tony Cheng <[email protected]>

[Why]
The DC2 non-seamless commit builder disables every current stream and enables every new stream. A commit that removes one of two streams blanks the other stream, or fails when that stream shows a plane.

[How]
Do not program a stream that is in both states on the same pipes with the same planes and blocks. The checks, the step walkers and the Core2 software state skip that stream.

---
 .../amd/display/dc/bls_builder/bls_builder.h  |  8 +++++
 .../dc/bls_builder/dcn401_builder_internal.h  | 10 ++----
 .../bls_builder/dcn401_non_seamless_builder.c | 31 ++++++++++++-------
 .../dc/bls_builder/dcn401_seamless_builder.c  | 15 +++++++--
 .../gpu/drm/amd/display/dc/core2/dc_core2.c   | 16 +++++++---
 5 files changed, 52 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder.h +8 -0
index 879ff188264d..f899c27ea836 100644
@@ -133,3 +133,11 @@ struct bls_builder {
 
 const struct bls_builder *bls_builder_create(struct dc *dc,
 		enum bls_builder_name name);
+
+/*
+ * stream is in both states on the same pipes, each with the same plane
+ * and blocks. DCN_DECL_NON_SEAMLESS_COMMIT leaves such a stream alone.
+ */
+bool dcn401_stream_unchanged(const struct dc_state *current_state,
+		const struct dc_state *new_state,
+		const struct dc_stream_state *stream);
drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.h +2 -8
index 35ad8982db9a..2d832017f613 100644
@@ -74,13 +74,6 @@ const struct pipe_ctx *dcn401_otg_master(const struct dc_state *state,
 /* The index of stream in state, or -1. */
 int dcn401_stream_index(const struct dc_state *state,
 		const struct dc_stream_state *stream);
-/*
- * stream is in both states on the same pipes, each with the same plane
- * and blocks.
- */
-bool dcn401_stream_unchanged(const struct dc_state *current_state,
-		const struct dc_state *new_state,
-		const struct dc_stream_state *stream);
 
 
 /* What both builders need of the dc, before either state. */
@@ -92,7 +85,8 @@ enum bls_builder_result dcn401_check_stream_support(const struct dc *dc,
 
 /*
  * pipe is NULL only for the bandwidth and p-state steps. The walkers
- * expand only stream when it is set.
+ * expand only stream when it is set, else each stream that is not
+ * unchanged.
  */
 struct dcn401_commit_step_args {
 	struct dc *dc;
drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c +19 -12
index bfbe2e0e7eb2..dcd1c8a50429 100644
@@ -10,10 +10,11 @@
 #include "state_facts/state_facts.h"
 
 /*
- * DCN_DECL_NON_SEAMLESS_COMMIT for virtual streams without planes. It
- * disables every current stream, each with one or two planes, one per DPP
- * pipe, then enables every new stream, each with no plane. Planes are
- * added later by DCN_DECL_SEAMLESS_UPDATE, not by this commit. Each
+ * DCN_DECL_NON_SEAMLESS_COMMIT for virtual streams. It disables every
+ * current stream, each with one or two planes, one per DPP pipe, then
+ * enables every new stream, each with no plane. A stream that is
+ * unchanged keeps its pipes and planes, and the commit programs none of
+ * them. Planes are added later by DCN_DECL_SEAMLESS_UPDATE. Each
  * stream is in ODM bypass, 2:1 or 3:1, with one OPP head and at most one
  * DPP pipe per slice.
  *
@@ -120,19 +121,23 @@ static enum bls_builder_result dcn401_check_new_stream(
 
 static enum bls_builder_result dcn401_check_commit_state_support(
 		const struct dc *dc, const struct dc_state *current_state,
-		const struct dc_state *new_state)
+		const struct dc_state *new_state, bool is_current)
 {
-	const struct dc_state *state = dcn401_checked_state(current_state,
-			new_state);
+	const struct dc_state *state = is_current ? current_state : new_state;
 	enum bls_builder_result result;
 	unsigned int i;
 
-	result = dcn401_check_stream_support(dc, current_state, new_state);
+	result = dcn401_check_stream_support(dc, is_current ? state : NULL,
+			is_current ? NULL : state);
 	for (i = 0; result == BLS_BUILD_SUCCESS && i < state->stream_count;
-			i++)
-		result = current_state ?
+			i++) {
+		if (dcn401_stream_unchanged(current_state, new_state,
+				state->streams[i]))
+			continue;
+		result = is_current ?
 				dcn401_check_current_stream(dc, state, i) :
 				dcn401_check_new_stream(dc, state, i);
+	}
 	return result;
 }
 
@@ -175,10 +180,12 @@ static enum bls_builder_result dcn401_check_non_seamless_commit_support(
 		return result;
 	CHECK_CONDITION(stream_config_update, "stream config update is set");
 
-	result = dcn401_check_commit_state_support(dc, current_state, NULL);
+	result = dcn401_check_commit_state_support(dc, current_state,
+			new_state, true);
 	if (result != BLS_BUILD_SUCCESS)
 		return result;
-	result = dcn401_check_commit_state_support(dc, NULL, new_state);
+	result = dcn401_check_commit_state_support(dc, current_state,
+			new_state, false);
 	if (result != BLS_BUILD_SUCCESS)
 		return result;
 
drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c +12 -3
index 178598f18517..3f0285763d52 100644
@@ -2152,6 +2152,15 @@ static void dcn401_add_steps(struct block_sequence_state *sequence,
 	}
 }
 
+static bool dcn401_walks_stream(const struct dcn401_commit_step_args *args,
+		const struct dc_stream_state *stream)
+{
+	if (args->stream)
+		return stream == args->stream;
+	return !dcn401_stream_unchanged(args->current_state, args->new_state,
+			stream);
+}
+
 static void dcn401_add_per_otg_master(struct block_sequence_state *sequence,
 		const struct dcn401_commit_step_args *state_args,
 		struct dc_state *state,
@@ -2161,7 +2170,7 @@ static void dcn401_add_per_otg_master(struct block_sequence_state *sequence,
 	unsigned int i;
 
 	for (i = 0; i < state->stream_count; i++) {
-		if (args.stream && state->streams[i] != args.stream)
+		if (!dcn401_walks_stream(&args, state->streams[i]))
 			continue;
 		args.pipe = resource_get_otg_master_for_stream(
 				&state->res_ctx, state->streams[i]);
@@ -2180,7 +2189,7 @@ static void dcn401_add_per_opp_head(struct block_sequence_state *sequence,
 	int j, n;
 
 	for (i = 0; i < state->stream_count; i++) {
-		if (args.stream && state->streams[i] != args.stream)
+		if (!dcn401_walks_stream(&args, state->streams[i]))
 			continue;
 		n = resource_get_opp_heads_for_stream(state->streams[i],
 				&state->res_ctx, opp_heads);
@@ -2202,7 +2211,7 @@ static void dcn401_add_per_dpp_pipe(struct block_sequence_state *sequence,
 	int j, n;
 
 	for (i = 0; i < state->stream_count; i++) {
-		if (args.stream && state->streams[i] != args.stream)
+		if (!dcn401_walks_stream(&args, state->streams[i]))
 			continue;
 		n = resource_get_dpp_pipes_for_stream(state->streams[i],
 				&state->res_ctx, dpp_pipes);
drivers/gpu/drm/amd/display/dc/core2/dc_core2.c +11 -5
index 90bcf02ded00..ce2b14bb7a5a 100644
@@ -245,12 +245,18 @@ enum dc_status core2_commit_state_hw(struct dc *dc, struct dc_state *context)
 
 	core2_commit_prepare_done(dc, context);
 	for (i = 0; i < current_state->stream_count; i++)
-		core2_commit_disable_done(dc, resource_get_otg_master_for_stream(
-				&current_state->res_ctx,
-				current_state->streams[i]));
+		if (!dcn401_stream_unchanged(current_state, context,
+				current_state->streams[i]))
+			core2_commit_disable_done(dc,
+					resource_get_otg_master_for_stream(
+					&current_state->res_ctx,
+					current_state->streams[i]));
 	for (i = 0; i < context->stream_count; i++)
-		core2_commit_enable_done(resource_get_otg_master_for_stream(
-				&context->res_ctx, context->streams[i]));
+		if (!dcn401_stream_unchanged(current_state, context,
+				context->streams[i]))
+			core2_commit_enable_done(
+					resource_get_otg_master_for_stream(
+					&context->res_ctx, context->streams[i]));
 	return DC_OK;
 }
 
Signature · 1 line
2.43.0
author
#28 lore raw

PATCH 28/33 drm/amd/display: Change the ODM and MPC layout in DC2 update

In reply to James Lin

From: Tony Cheng <[email protected]>

[Why]
The DC2 seamless update builder keeps the OPP of each ODM slice and does not remove a pipe. An update between ODM 2:1 and ODM bypass with two blended planes fails. The commit blanks a kept stream that changes its layout.

[How]
Accept an update where each pipe keeps its plane and blocks, joins on a free pipe, or leaves the stream on the same OTG. Under the lock, disconnect the MPCC and DET of each removed pipe, and program the ODM mode and each new OPP head. After the unlock, power down the removed pipes and wait for the ODM double buffer. The commit keeps a stream that keeps its OTG and programs its front end after the enable.

---
 .../amd/display/dc/bls_builder/bls_builder.h  |   8 +-
 .../bls_builder/bls_builder_private_types.h   |   9 +
 .../dc/bls_builder/dcn401_builder_internal.h  |  36 +++
 .../bls_builder/dcn401_non_seamless_builder.c |  60 ++--
 .../dc/bls_builder/dcn401_seamless_builder.c  | 276 +++++++++++-------
 .../gpu/drm/amd/display/dc/core2/dc_core2.c   |  79 +++--
 6 files changed, 305 insertions(+), 163 deletions(-)
drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder.h +5 -3
index f899c27ea836..c9a4e59056ae 100644
@@ -135,9 +135,11 @@ const struct bls_builder *bls_builder_create(struct dc *dc,
 		enum bls_builder_name name);
 
 /*
- * stream is in both states on the same pipes, each with the same plane
- * and blocks. DCN_DECL_NON_SEAMLESS_COMMIT leaves such a stream alone.
+ * stream is in both states and keeps its OTG, and the seamless update can
+ * program its front end. DCN_DECL_NON_SEAMLESS_COMMIT neither disables nor
+ * enables such a stream; it runs that front end when the stream changes.
  */
-bool dcn401_stream_unchanged(const struct dc_state *current_state,
+bool dcn401_stream_kept(const struct dc *dc,
+		const struct dc_state *current_state,
 		const struct dc_state *new_state,
 		const struct dc_stream_state *stream);
drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h +9 -0
index ed9d2f7fc0a2..de73efe274c1 100644
@@ -123,6 +123,15 @@ struct dcn401_commit_step_meta {
 		bool hubp_dpp_already_enabled;
 		/* As hubp_dpp_already_enabled, and the DET size is the same. */
 		bool det_unchanged;
+		/*
+		 * The current pipe had no plane, or keeps its plane, HUBP, DPP
+		 * and OPP in the new state.
+		 */
+		bool no_plane_removed;
+		/* As hubp_dpp_already_enabled, and each ODM slice keeps its OPP. */
+		bool odm_kept;
+		/* Each ODM slice of the stream keeps its OPP. */
+		bool same_opp_heads;
 		/*
 		 * Neither the plane scaling, the plane position nor the
 		 * stream scaling changed. A full update sets every plane bit,
drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.h +36 -0
index 2d832017f613..e9f190176485 100644
@@ -76,6 +76,27 @@ int dcn401_stream_index(const struct dc_state *state,
 		const struct dc_stream_state *stream);
 
 
+/*
+ * stream is in both states on the same pipes, each with the same plane
+ * and blocks.
+ */
+bool dcn401_stream_unchanged(const struct dc_state *current_state,
+		const struct dc_state *new_state,
+		const struct dc_stream_state *stream);
+/*
+ * The pipe shows a plane on the same HUBP, DPP and OPP. The plane may be a
+ * new dc_plane_state; the update reprograms its contents.
+ */
+bool dcn401_pipe_kept(const struct pipe_ctx *current_pipe,
+		const struct pipe_ctx *new_pipe);
+/*
+ * What the seamless update needs of stream i of new_state, apart from the
+ * other streams.
+ */
+enum bls_builder_result dcn401_check_stream_update(const struct dc *dc,
+		const struct dc_state *current_state,
+		const struct dc_state *new_state, unsigned int i);
+
 /* What both builders need of the dc, before either state. */
 enum bls_builder_result dcn401_check_dc_support(const struct dc *dc);
 /* What both builders need of each stream of a state, apart from its planes. */
@@ -122,6 +143,21 @@ void dcn401_add_sub_sequences(struct block_sequence_state *sequence,
 #define DCN401_ADD_SUB_SEQUENCES(sequence, args, subs) \
 	dcn401_add_sub_sequences(sequence, args, subs, ARRAY_SIZE(subs))
 
+#define DCN401_DISCONNECT_STEPS 2
+#define DCN401_POWER_DOWN_STEPS 12
+/*
+ * Per current DPP pipe that leaves the stream: the MPCC and DET disconnect
+ * under the lock, and disable_plane after it.
+ */
+extern const struct dcn401_commit_step
+		dcn401_disconnect[DCN401_DISCONNECT_STEPS];
+extern const struct dcn401_commit_step
+		dcn401_power_down[DCN401_POWER_DOWN_STEPS];
+
+/* The seamless update's front end for args->stream, between the waits. */
+void dcn401_add_stream_update(struct block_sequence_state *sequence,
+		const struct dcn401_commit_step_args *args);
+
 /*
  * Points the step arguments at the states and the sequence at
  * head_sequence, both empty. The entries point into the states; the build
drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c +26 -34

117 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c +176 -100

435 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core2/dc_core2.c +53 -26

115 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#29 lore raw

PATCH 29/33 drm/amd/display: Give the DC2 builders State pipe facts

In reply to James Lin

From: Tony Cheng <[email protected]>

[Why]
The dcn401 DC2 builders compare streams and pipe blocks by pointer, which is not a reliable identity between two states.

[How]
Add dc_state_compute_update_flags(). It records the facts of each pipe in the current and the new state. The builder finds a kept stream by stream_id and its pipe blocks by inst, and derives the deltas. The stream update steps skip when the kept stream did not change. Name the unfiltered trait match DC_TRAIT_MATCH_ANY.

---
 .../amd/display/dc/bls_builder/bls_builder.h  |   5 +
 .../bls_builder/bls_builder_private_types.h   |  40 +-
 .../dc/bls_builder/dcn401_builder_internal.h  |  14 +-
 .../bls_builder/dcn401_non_seamless_builder.c |  26 +-
 .../dc/bls_builder/dcn401_seamless_builder.c  | 497 ++++++++++++------
 .../gpu/drm/amd/display/dc/core/dc_state.c    |  28 +
 .../gpu/drm/amd/display/dc/core2/dc_core2.c   |  23 +-
 .../gpu/drm/amd/display/dc/dc_state_priv.h    |  23 +
 .../amd/display/dc/state_facts/state_facts.h  |   3 +
 9 files changed, 474 insertions(+), 185 deletions(-)
drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder.h +5 -0
index c9a4e59056ae..99d57e7c0789 100644
@@ -6,6 +6,7 @@
 #pragma once
 
 #include "dc.h"
+#include "dc_state_priv.h"
 #include "dmub_cmd.h"
 #include "dmub/dmub_srv.h"
 #include "hwss/hw_sequencer.h"
@@ -99,6 +100,8 @@ struct bls_builder_check_capability_params {
 	const struct dc_state *current_state;
 	const struct dc_state *new_state;
 	const struct dc_stream_state *stream;
+	/* The current -> new delta from dc_state_compute_update_flags. */
+	const struct dc_state_update_flags *update_flags;
 };
 
 struct bls_builder_declarative_params {
@@ -106,6 +109,8 @@ struct bls_builder_declarative_params {
 	const struct dc_state *current_state;
 	const struct dc_state *new_state;
 	const struct dc_stream_state *stream;
+	/* Pipe facts of both states, from dc_state_compute_update_flags. */
+	const struct dc_state_update_flags *update_flags;
 	struct bls_builder_output_targets *out_targets;
 	struct block_sequence head_sequence[DC2_BLS_MAX_STEPS];
 	unsigned int head_num_steps;
drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h +25 -15
index de73efe274c1..11e452b36e05 100644
@@ -7,12 +7,31 @@
 
 #include "hw_sequencer.h"
 #include "dccg.h"
+#include "dc_state_priv.h"
 
 /*
  * Step tables for the declarative builders. A change here changes what
  * a builder can express; a change to a builder's .c alone does not.
  */
 
+/*
+ * Conditions on pipe i that compare its facts in the current and the
+ * new state.
+ */
+struct dcn401_pipe_deltas {
+	/*
+	 * Both pipes are enabled and show a plane of the same stream on the
+	 * same HUBP, DPP and OPP.
+	 */
+	bool hubp_dpp_already_enabled;
+	/* The DET size is the same. */
+	bool det_unchanged;
+	/* The current pipe has no plane. */
+	bool current_has_no_plane;
+	/* The stream of the new pipe has the same OPP heads in both states. */
+	bool odm_kept;
+};
+
 /*
  * One dcn401 commit step is one BLS entry. The union holds the
  * arguments that differ between the times DC1 makes that call; the
@@ -109,29 +128,20 @@ struct dcn401_commit_step_meta {
 	struct {
 		/* The new state has a stream. */
 		bool new_state_has_stream;
+		/* The stream of the step is unchanged between the states. */
+		bool stream_unchanged;
 		/* dc->optimized_required is clear. */
 		bool optimized_not_required;
 		/* The plane has no address update, or skips the manual trigger. */
 		bool no_manual_trigger;
 		/* The OPP MPC tree has no plane yet. */
 		bool opp_tree_empty;
+		struct dcn401_pipe_deltas pipe_deltas;
 		/*
-		 * The pipe already showed the plane on this HUBP. The step is
-		 * part of enabling that block the first time, not of
-		 * reconfiguring it.
-		 */
-		bool hubp_dpp_already_enabled;
-		/* As hubp_dpp_already_enabled, and the DET size is the same. */
-		bool det_unchanged;
-		/*
-		 * The current pipe had no plane, or keeps its plane, HUBP, DPP
-		 * and OPP in the new state.
+		 * Skip only when each delta named in pipe_deltas is true. Clear,
+		 * skip when any of them is true.
 		 */
-		bool no_plane_removed;
-		/* As hubp_dpp_already_enabled, and each ODM slice keeps its OPP. */
-		bool odm_kept;
-		/* Each ODM slice of the stream keeps its OPP. */
-		bool same_opp_heads;
+		bool pipe_deltas_all;
 		/*
 		 * Neither the plane scaling, the plane position nor the
 		 * stream scaling changed. A full update sets every plane bit,
drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.h +12 -2
index e9f190176485..4af30178b42b 100644
@@ -44,6 +44,15 @@ void dcn401_commit_check_failed(const struct dc *dc, const char *msg);
 		} \
 	} while (0)
 
+/* As CHECK_UPDATE, for a helper that reads the update flags. */
+#define CHECK_UPDATE_FLAGS(name, msg) \
+	do { \
+		if (!check_##name(update_flags, current_state, new_state, i)) { \
+			dcn401_commit_check_failed(dc, msg); \
+			return BLS_BUILD_ERROR_UNSUPPORTED_STATE_UPDATE; \
+		} \
+	} while (0)
+
 /* Each check_<name> stream helper takes the state and a stream index. */
 #define CHECK_STREAM_CONDITION(name, msg) \
 	do { \
@@ -87,8 +96,6 @@ bool dcn401_stream_unchanged(const struct dc_state *current_state,
  * The pipe shows a plane on the same HUBP, DPP and OPP. The plane may be a
  * new dc_plane_state; the update reprograms its contents.
  */
-bool dcn401_pipe_kept(const struct pipe_ctx *current_pipe,
-		const struct pipe_ctx *new_pipe);
 /*
  * What the seamless update needs of stream i of new_state, apart from the
  * other streams.
@@ -115,6 +122,9 @@ struct dcn401_commit_step_args {
 	struct dc_state *new_state;
 	const struct dc_stream_state *stream;
 	struct pipe_ctx *pipe;
+	const struct dc_state_update_flags *update_flags;
+	/* stream is in both states on the same pipes, planes and blocks. */
+	bool stream_unchanged;
 };
 
 /*
drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c +16 -10
index f24480e949d6..2ce37c3aa982 100644
@@ -45,7 +45,7 @@ static bool check_current_planes(const struct dc *dc,
 	return planes && planes ==
 			facts.global.blend_tree[i].dpp_pipe_count &&
 			dc_state_facts_all_pipe(&facts, (uint8_t)i,
-			DC_TRAIT_MATCH(0, 0),
+			DC_TRAIT_MATCH_ANY,
 			DC_TRAIT_MATCH(DC_PIPE_TRAIT_PLANE, 0));
 }
 
@@ -57,7 +57,7 @@ static bool check_plane_blocks(const struct dc *dc,
 	(void)dc;
 	dc_state_facts_derive(state, &facts);
 	return dc_state_facts_all_pipe(&facts, (uint8_t)i,
-			DC_TRAIT_MATCH(0, 0),
+			DC_TRAIT_MATCH_ANY,
 			DC_TRAIT_MATCH(DC_PIPE_TRAIT_PLANE_RESOURCES, 0));
 }
 
@@ -168,11 +168,12 @@ static bool check_link_not_active(const struct dc *dc,
 
 static enum bls_builder_result dcn401_check_non_seamless_commit_support(
 		const struct dc *dc, const struct dc_state *current_state,
-		const struct dc_state *new_state)
+		const struct dc_state *new_state,
+		const struct dc_state_update_flags *update_flags)
 {
 	enum bls_builder_result result;
 
-	if (!dc || !current_state || !new_state)
+	if (!dc || !current_state || !new_state || !update_flags)
 		return BLS_BUILD_ERROR_UNSUPPORTED_STATE_UPDATE;
 
 	result = dcn401_check_dc_support(dc);
@@ -457,7 +458,8 @@ static enum bls_builder_result dcn401_build_non_seamless_commit(
 	if (!params)
 		return BLS_BUILD_ERROR_UNSUPPORTED_STATE_UPDATE;
 	result = dcn401_check_non_seamless_commit_support(params->dc,
-			params->current_state, params->new_state);
+			params->current_state, params->new_state,
+			params->update_flags);
 	if (result != BLS_BUILD_SUCCESS)
 		return result;
 
@@ -465,13 +467,16 @@ static enum bls_builder_result dcn401_build_non_seamless_commit(
 	DCN401_ADD_SUB_SEQUENCES(&head, &state_args, bls_head);
 	for (i = 0; i < state_args.new_state->stream_count; i++) {
 		state_args.stream = state_args.new_state->streams[i];
-		if (dcn401_stream_kept(params->dc, params->current_state,
-				params->new_state, state_args.stream) &&
-				!dcn401_stream_unchanged(params->current_state,
+		if (!dcn401_stream_kept(params->dc, params->current_state,
 				params->new_state, state_args.stream))
-			dcn401_add_stream_update(&head, &state_args);
+			continue;
+		state_args.stream_unchanged = dcn401_stream_unchanged(
+				params->current_state, params->new_state,
+				state_args.stream);
+		dcn401_add_stream_update(&head, &state_args);
 	}
 	state_args.stream = NULL;
+	state_args.stream_unchanged = false;
 	DCN401_ADD_SUB_SEQUENCES(&head, &state_args, bls_postamble);
 
 	return BLS_BUILD_SUCCESS;
@@ -481,7 +486,8 @@ static bool dcn401_non_seamless_commit_check_capability(
 		const struct bls_builder_check_capability_params *params)
 {
 	return params && dcn401_check_non_seamless_commit_support(params->dc,
-			params->current_state, params->new_state) ==
+			params->current_state, params->new_state,
+			params->update_flags) ==
 			BLS_BUILD_SUCCESS;
 }
 
drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c +345 -152

799 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc_state.c +28 -0
index edb50c23ce24..961c3c1ea51f 100644
@@ -1165,3 +1165,31 @@ bool dc_state_is_alt_in_use(const struct dc *dc, const struct dc_state *state)
 	}
 	return false;
 }
+
+static void pipe_flags(const struct pipe_ctx *pipe,
+		struct dc_state_pipe_flags *flags)
+{
+	flags->has_plane = pipe->plane_state != NULL;
+	flags->enabled = flags->has_plane && pipe->stream &&
+			pipe->plane_res.hubp && pipe->plane_res.dpp &&
+			pipe->stream_res.opp;
+	flags->det_size = pipe->hubp_regs.det_size;
+}
+
+enum dc_status dc_state_compute_update_flags(const struct dc_state *cur_state,
+		const struct dc_state *target_state,
+		struct dc_state_update_flags *out_flags)
+{
+	unsigned int i;
+
+	if (!cur_state || !target_state || !out_flags)
+		return DC_ERROR_UNEXPECTED;
+	memset(out_flags, 0, sizeof(*out_flags));
+	for (i = 0; i < MAX_PIPES; i++) {
+		pipe_flags(&cur_state->res_ctx.pipe_ctx[i],
+				&out_flags->cur_pipes[i]);
+		pipe_flags(&target_state->res_ctx.pipe_ctx[i],
+				&out_flags->new_pipes[i]);
+	}
+	return DC_OK;
+}
drivers/gpu/drm/amd/display/dc/core2/dc_core2.c +17 -6
index 22da4ebae256..c4e1fef8266e 100644
@@ -169,6 +169,7 @@ static enum dc_status core2_build_and_run(struct dc *dc,
 	const struct workaround_manager *wam = dc2_workaround_manager_get();
 	struct bls_builder_declarative_params *params;
 	enum dc_status status = DC_ERROR_UNEXPECTED;
+	struct dc_state_update_flags update_flags;
 
 	/* 256 block-sequence entries; keep them off the kernel stack. */
 	params = kvzalloc(sizeof(*params), GFP_KERNEL);
@@ -178,6 +179,10 @@ static enum dc_status core2_build_and_run(struct dc *dc,
 	params->current_state = dc->current_state;
 	params->new_state = new_state;
 	params->stream = stream;
+	if (dc_state_compute_update_flags(dc->current_state, new_state,
+			&update_flags) != DC_OK)
+		goto out;
+	params->update_flags = &update_flags;
 
 	/*
 	 * A tail runs on the vsync after the head, so Core would have to wait
@@ -203,14 +208,18 @@ static bool core2_builder_supports(struct dc *dc, enum bls_builder_name name,
 		struct dc_state *new_state, const struct dc_stream_state *stream)
 {
 	const struct bls_builder *builder = TO_DC2(dc)->builders[name];
+	struct dc_state_update_flags update_flags;
 	struct bls_builder_check_capability_params check = {
 		.dc = dc,
 		.current_state = dc->current_state,
 		.new_state = new_state,
 		.stream = stream,
+		.update_flags = &update_flags,
 	};
 
-	return builder && builder->check_capability &&
+	return dc_state_compute_update_flags(dc->current_state, new_state,
+			&update_flags) == DC_OK &&
+			builder && builder->check_capability &&
 			builder->kind == BLS_BUILDER_DECLARATIVE &&
 			builder->build.declarative &&
 			dc2_workaround_manager_get() &&
@@ -282,14 +291,16 @@ enum dc_status core2_commit_state_hw(struct dc *dc, struct dc_state *context)
 				context, current_state->streams[i]))
 			core2_commit_disable_done(dc, otg_master);
 	}
-	for (i = 0; i < context->stream_count; i++)
+	for (i = 0; i < context->stream_count; i++) {
+		struct pipe_ctx *otg_master = resource_get_otg_master_for_stream(
+				&context->res_ctx, context->streams[i]);
+
 		if (dcn401_stream_kept(dc, current_state, context,
 				context->streams[i]))
 			core2_update_done(dc, context, context->streams[i]);
-		else
-			core2_commit_enable_done(
-					resource_get_otg_master_for_stream(
-					&context->res_ctx, context->streams[i]));
+		else if (otg_master)
+			core2_commit_enable_done(otg_master);
+	}
 	return DC_OK;
 }
 
drivers/gpu/drm/amd/display/dc/dc_state_priv.h +23 -0
index 191bb431991f..0415e45d438e 100644
@@ -26,6 +26,7 @@
 #ifndef _DC_STATE_PRIV_H_
 #define _DC_STATE_PRIV_H_
 
+#include "dc.h"
 #include "dc_state.h"
 #include "dc_stream.h"
 
@@ -126,4 +127,26 @@ bool dc_state_can_clear_stream_cursor_subvp_limit(const struct dc_stream_state *
 bool dc_state_is_subvp_in_use(struct dc_state *state);
 
 bool dc_state_is_alt_in_use(const struct dc *dc, const struct dc_state *state);
+
+/* Facts about one pipe of one state. */
+struct dc_state_pipe_flags {
+	/* The pipe drives a stream through a HUBP, a DPP and an OPP. */
+	bool enabled;
+	/* The pipe shows a plane. */
+	bool has_plane;
+	/* The DET size from hubp_regs. */
+	uint32_t det_size;
+};
+
+/* The facts of pipe i in the current and in the target state. */
+struct dc_state_update_flags {
+	struct dc_state_pipe_flags cur_pipes[MAX_PIPES];
+	struct dc_state_pipe_flags new_pipes[MAX_PIPES];
+};
+
+/* Pure: reads both states and writes only out_flags. */
+enum dc_status dc_state_compute_update_flags(const struct dc_state *cur_state,
+		const struct dc_state *target_state,
+		struct dc_state_update_flags *out_flags);
+
 #endif /* _DC_STATE_PRIV_H_ */
drivers/gpu/drm/amd/display/dc/state_facts/state_facts.h +3 -0
index b8a8b8256262..c774ebdae968 100644
@@ -19,6 +19,9 @@ struct dc_trait_match {
 #define DC_TRAIT_MATCH(set, clear) \
 	((struct dc_trait_match){ .mask = (set) | (clear), .value = (set) })
 
+/* Every element matches: no trait constrains it. */
+#define DC_TRAIT_MATCH_ANY DC_TRAIT_MATCH(0, 0)
+
 /* Plane and pipe accessors: no stream filter. */
 #define DC_FACTS_ALL_STREAMS 0xFFu
 
Signature · 1 line
2.43.0
author
#30 lore raw

PATCH 30/33 drm/amd/display: Add RGBA8888 surface pixel format support

In reply to James Lin

From: Harry Wentland <[email protected]>

[why]
amdgpu_dm advertises DRM_FORMAT_RGBA8888 for its planes, but DC has no matching surface pixel format, so fill_dc_plane_info_and_addr() rejects the format with -EINVAL. KWin modesets then fail with "Unsupported screen format RA24 little-endian".

[how]
- Add SURFACE_PIXEL_FORMAT_GRPH_RGBA8888 to the surface_pixel_format enum.
- Map DRM_FORMAT_RGBA8888 to the new format in amdgpu_dm.
- Program the dedicated RGBA8888 encoding (value 9) in HUBP and DPP for all DCN generations. Unlike ABGR8888, there is no red/blue crossbar swap.
- Treat RGBA8888 as a 32bpp graphics format in bandwidth, bytes-per-pixel, DCC, and format-class helpers, the same as ARGB8888.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c            | 3 +++
 drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c            | 2 ++
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c            | 4 ++++
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h                 | 2 ++
 drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c           | 1 +
 drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.c   | 1 +
 drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calcs.c         | 1 +
 drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c         | 3 +++
 drivers/gpu/drm/amd/display/dc/dpp/dcn20/dcn20_dpp.c         | 3 +++
 drivers/gpu/drm/amd/display/dc/dpp/dcn201/dcn201_dpp.c       | 3 +++
 drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c         | 3 +++
 drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp.c       | 3 +++
 drivers/gpu/drm/amd/display/dc/dpp/dcn42/dcn42_dpp.c         | 3 +++
 drivers/gpu/drm/amd/display/dc/dpp/dcn50/dcn50_dpp.c         | 3 +++
 drivers/gpu/drm/amd/display/dc/dpp/dcn60/dcn60_dpp.c         | 3 +++
 drivers/gpu/drm/amd/display/dc/hubbub/dcn10/dcn10_hubbub.c   | 1 +
 drivers/gpu/drm/amd/display/dc/hubbub/dcn20/dcn20_hubbub.c   | 1 +
 drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c | 1 +
 drivers/gpu/drm/amd/display/dc/hubp/dcn10/dcn10_hubp.c       | 4 ++++
 drivers/gpu/drm/amd/display/dc/hubp/dcn20/dcn20_hubp.c       | 4 ++++
 drivers/gpu/drm/amd/display/dc/hubp/dcn35/dcn35_hubp.c       | 4 ++++
 drivers/gpu/drm/amd/display/dc/hubp/dcn42/dcn42_hubp.c       | 4 ++++
 drivers/gpu/drm/amd/display/dc/hubp/dcn50/dcn50_hubp.c       | 4 ++++
 drivers/gpu/drm/amd/display/dc/hwss/dce/dce_hwseq.c          | 1 +
 drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c    | 1 +
 25 files changed, 63 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -0
index 29d7c87a94ef..b6b67f730415 100644
@@ -3105,6 +3105,9 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev,
 	case DRM_FORMAT_ARGB8888:
 		plane_info->format = SURFACE_PIXEL_FORMAT_GRPH_ARGB8888;
 		break;
+	case DRM_FORMAT_RGBA8888:
+		plane_info->format = SURFACE_PIXEL_FORMAT_GRPH_RGBA8888;
+		break;
 	case DRM_FORMAT_XRGB2101010:
 	case DRM_FORMAT_ARGB2101010:
 		plane_info->format = SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010;
drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c +2 -0
index 1b8e843020d6..1ff1a6c23c65 100644
@@ -2853,6 +2853,7 @@ static void populate_initial_data(
 			break;
 		case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
 		case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
+		case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
 		case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 		case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 		case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS:
@@ -2957,6 +2958,7 @@ static void populate_initial_data(
 				break;
 			case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
 			case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
+			case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
 			case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 			case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 			case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS:
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +4 -0
index b09490c84438..ec11a79811e7 100644
@@ -808,6 +808,9 @@ static enum dc_pixel_format convert_pixel_format_to_dalsurface(
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
 		dal_pixel_format = PIXEL_FORMAT_ARGB8888;
 		break;
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
+		dal_pixel_format = PIXEL_FORMAT_ARGB8888;
+		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 		dal_pixel_format = PIXEL_FORMAT_ARGB2101010;
 		break;
@@ -5905,6 +5908,7 @@ unsigned int resource_pixel_format_to_bpp(enum surface_pixel_format format)
 		return 16;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS:
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +2 -0
index 387d2ebb2b7c..a361f5d9af50 100644
@@ -176,6 +176,8 @@ enum surface_pixel_format {
 	SURFACE_PIXEL_FORMAT_GRPH_ARGB8888,
 	/*32 bpp swaped*/
 	SURFACE_PIXEL_FORMAT_GRPH_ABGR8888,
+	/*32 bpp, alpha in LSB*/
+	SURFACE_PIXEL_FORMAT_GRPH_RGBA8888,
 
 	SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010,
 	/*swaped*/
drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c +1 -0
index 168c2d0a5eaa..08cde29a4a7a 100644
@@ -593,6 +593,7 @@ static void program_grph_pixel_format(
 		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
 		grph_depth = 2;
 		grph_format = 0;
 		break;
drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.c +1 -0
index 095869912c09..9d781d12d669 100644
@@ -381,6 +381,7 @@ static void program_pixel_format(
 			break;
 		case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
 		case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
+		case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
 			grph_depth = 2;
 			grph_format = 0;
 			break;
drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calcs.c +1 -0
index 2ad4a2635683..ec25a76dc3f1 100644
@@ -231,6 +231,7 @@ static enum dcn_bw_defs tl_pixel_format_to_bw_defs(enum surface_pixel_format for
 		return dcn_bw_rgb_sub_16;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS:
drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c +3 -0
index de420cdf1514..1156027198a4 100644
@@ -344,6 +344,9 @@ void dpp1_cnv_setup (
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
 		pixel_format = 8;
 		break;
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
+		pixel_format = 9;
+		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 		pixel_format = 10;
drivers/gpu/drm/amd/display/dc/dpp/dcn20/dcn20_dpp.c +3 -0
index 0f3b1717563b..5bf86b3cc388 100644
@@ -143,6 +143,9 @@ static void dpp2_cnv_setup (
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
 		pixel_format = 8;
 		break;
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
+		pixel_format = 9;
+		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 		pixel_format = 10;
drivers/gpu/drm/amd/display/dc/dpp/dcn201/dcn201_dpp.c +3 -0
index a2079db62f63..37a877f5b3e7 100644
@@ -87,6 +87,9 @@ static void dpp201_cnv_setup(
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
 		pixel_format = 8;
 		break;
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
+		pixel_format = 9;
+		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 		pixel_format = 10;
drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c +3 -0
index 3db10019fa84..58260e0a2172 100644
@@ -337,6 +337,9 @@ void dpp3_cnv_setup (
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
 		pixel_format = 8;
 		break;
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
+		pixel_format = 9;
+		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 		pixel_format = 10;
drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp.c +3 -0
index 7a3a7678c71a..379fe0f5531a 100644
@@ -99,6 +99,9 @@ void dpp401_dpp_setup(
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
 		pixel_format = 8;
 		break;
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
+		pixel_format = 9;
+		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 		pixel_format = 10;
drivers/gpu/drm/amd/display/dc/dpp/dcn42/dcn42_dpp.c +3 -0
index 2ce0694e3725..b0c1545fe3ff 100644
@@ -159,6 +159,9 @@ static void dpp42_dpp_setup(
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
 		pixel_format = 8;
 		break;
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
+		pixel_format = 9;
+		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 		pixel_format = 10;
drivers/gpu/drm/amd/display/dc/dpp/dcn50/dcn50_dpp.c +3 -0
index 5382fc656169..8857b7b33ab9 100644
@@ -131,6 +131,9 @@ void dpp50_dpp_setup(
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
 		pixel_format = 8;
 		break;
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
+		pixel_format = 9;
+		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 		pixel_format = 10;
drivers/gpu/drm/amd/display/dc/dpp/dcn60/dcn60_dpp.c +3 -0
index dfdbc539ac42..210e6658ac61 100644
@@ -63,6 +63,9 @@ void dpp60_dpp_setup(
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
 		pixel_format = 8;
 		break;
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
+		pixel_format = 9;
+		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 		pixel_format = 10;
drivers/gpu/drm/amd/display/dc/hubbub/dcn10/dcn10_hubbub.c +1 -0
index faad1c6f4509..238824369e00 100644
@@ -761,6 +761,7 @@ static bool hubbub1_dcc_support_pixel_format(
 		return true;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 		*bytes_per_element = 4;
drivers/gpu/drm/amd/display/dc/hubbub/dcn20/dcn20_hubbub.c +1 -0
index 464fc5924a56..6cfcce7bb48f 100644
@@ -147,6 +147,7 @@ bool hubbub2_dcc_support_pixel_format(
 		return true;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_RGB111110_FIX:
drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c +1 -0
index c18457c779de..cc3fda2c470c 100644
@@ -672,6 +672,7 @@ bool hubbub401_dcc_support_pixel_format(
 		return true;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS:
drivers/gpu/drm/amd/display/dc/hubp/dcn10/dcn10_hubp.c +4 -0
index 2a4be0c7a724..4723a390297c 100644
@@ -272,6 +272,10 @@ void hubp1_program_pixel_format(
 		REG_UPDATE(DCSURF_SURFACE_CONFIG,
 				SURFACE_PIXEL_FORMAT, 8);
 		break;
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
+		REG_UPDATE(DCSURF_SURFACE_CONFIG,
+				SURFACE_PIXEL_FORMAT, 9);
+		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS:
drivers/gpu/drm/amd/display/dc/hubp/dcn20/dcn20_hubp.c +4 -0
index 79a429814061..e82bb43be001 100644
@@ -473,6 +473,10 @@ void hubp2_program_pixel_format(
 		REG_UPDATE(DCSURF_SURFACE_CONFIG,
 				SURFACE_PIXEL_FORMAT, 8);
 		break;
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
+		REG_UPDATE(DCSURF_SURFACE_CONFIG,
+				SURFACE_PIXEL_FORMAT, 9);
+		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS:
drivers/gpu/drm/amd/display/dc/hubp/dcn35/dcn35_hubp.c +4 -0
index c879f4901c7d..69b5d41c959e 100644
@@ -94,6 +94,10 @@ void hubp35_program_pixel_format(
 		REG_UPDATE(DCSURF_SURFACE_CONFIG,
 				SURFACE_PIXEL_FORMAT, 8);
 		break;
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
+		REG_UPDATE(DCSURF_SURFACE_CONFIG,
+				SURFACE_PIXEL_FORMAT, 9);
+		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS:
drivers/gpu/drm/amd/display/dc/hubp/dcn42/dcn42_hubp.c +4 -0
index 0c8a23cef1e0..b70fc7c1c80d 100644
@@ -78,6 +78,10 @@ static void hubp42_program_pixel_format(
 		REG_UPDATE(DCSURF_SURFACE_CONFIG,
 				SURFACE_PIXEL_FORMAT, 8);
 		break;
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
+		REG_UPDATE(DCSURF_SURFACE_CONFIG,
+				SURFACE_PIXEL_FORMAT, 9);
+		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS:
drivers/gpu/drm/amd/display/dc/hubp/dcn50/dcn50_hubp.c +4 -0
index ceea0b766f5b..2aef6f239dc7 100644
@@ -264,6 +264,10 @@ static void hubp50_program_pixel_format(
 		REG_UPDATE(DCSURF_SURFACE_CONFIG,
 				SURFACE_PIXEL_FORMAT, 8);
 		break;
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
+		REG_UPDATE(DCSURF_SURFACE_CONFIG,
+				SURFACE_PIXEL_FORMAT, 9);
+		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS:
drivers/gpu/drm/amd/display/dc/hwss/dce/dce_hwseq.c +1 -0
index 0f44577572fb..9b8d4d1a2cbe 100644
@@ -228,6 +228,7 @@ bool dce_use_lut(enum surface_pixel_format format)
 	switch (format) {
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
 		return true;
 	default:
 		return false;
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +1 -0
index a08ceaeda91c..363961f700d9 100644
@@ -271,6 +271,7 @@ static void dce110_prescale_params(struct ipp_prescale_params *prescale_params,
 		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
 	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
 		prescale_params->scale = 0x2020;
 		break;
 	case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
Signature · 1 line
2.43.0
author
#31 lore raw

PATCH 31/33 drm/amd/display: Fix DCE crossbar for RGBA8888 surface format

In reply to James Lin

From: Harry Wentland <[email protected]>

[why]
DCE unpacks all 32bpp graphics formats as ARGB and has no native alpha-in-LSB encoding. Channel reordering is done only through the GRPH_SWAP_CNTL crossbar, which programmed just the red and blue selects. RGBA8888 was therefore scanned out with alpha in the MSB.

[how]
- Program all four GRPH_SWAP_CNTL crossbar selects (red, green, blue, alpha) in program_grph_pixel_format().
- Keep the existing R/B swap for ABGR formats.
- Add RGBA8888 with the mapping R<-A, G<-R, B<-G, A<-B.
- Add the GRPH_GREEN_CROSSBAR and GRPH_ALPHA_CROSSBAR fields to the DCP register mask and field lists.

---
 .../drm/amd/display/dc/dce/dce_mem_input.c    | 41 +++++++++++++------
 .../drm/amd/display/dc/dce/dce_mem_input.h    |  6 +++
 2 files changed, 34 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c +28 -13
index 08cde29a4a7a..4f1b8b2750d9 100644
@@ -558,25 +558,40 @@ static void program_grph_pixel_format(
 	struct dce_mem_input *dce_mi,
 	enum surface_pixel_format format)
 {
-	uint32_t red_xbar = 0, blue_xbar = 0; /* no swap */
+	/* Crossbar per output channel: 0 R, 1 G, 2 B, 3 A source (see
+	 * DCP_GRPH_*_CROSSBAR in the enum headers). DCE unpacks all 32bpp
+	 * as ARGB, so alpha-in-LSB layouts are reordered via the crossbar.
+	 */
+	uint32_t red_xbar = 0, green_xbar = 0, blue_xbar = 0, alpha_xbar = 0;
 	uint32_t grph_depth = 0, grph_format = 0;
 	uint32_t sign = 0, floating = 0;
 
-	if (format == SURFACE_PIXEL_FORMAT_GRPH_ABGR8888 ||
-			/*todo: doesn't look like we handle BGRA here,
-			 *  should problem swap endian*/
-		format == SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010 ||
-		format == SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS ||
-		format == SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616 ||
-		format == SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F) {
-		/* ABGR formats */
-		red_xbar = 2;
-		blue_xbar = 2;
+	switch (format) {
+	case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
+	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
+	case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS:
+	case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616:
+	case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F:
+		/* ABGR: swap R and B */
+		red_xbar = 2;  /* R from B */
+		blue_xbar = 2; /* B from R */
+		break;
+	case SURFACE_PIXEL_FORMAT_GRPH_RGBA8888:
+		/* rotate ARGB -> RGBA */
+		red_xbar = 3;   /* R from A */
+		green_xbar = 3; /* G from R */
+		blue_xbar = 3;  /* B from G */
+		alpha_xbar = 3; /* A from B */
+		break;
+	default:
+		break;
 	}
 
-	REG_SET_2(GRPH_SWAP_CNTL, 0,
+	REG_SET_4(GRPH_SWAP_CNTL, 0,
 			GRPH_RED_CROSSBAR, red_xbar,
-			GRPH_BLUE_CROSSBAR, blue_xbar);
+			GRPH_GREEN_CROSSBAR, green_xbar,
+			GRPH_BLUE_CROSSBAR, blue_xbar,
+			GRPH_ALPHA_CROSSBAR, alpha_xbar);
 
 	switch (format) {
 	case SURFACE_PIXEL_FORMAT_GRPH_PALETA_256_COLORS:
drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.h +6 -0
index e34e445a4013..a593842ee879 100644
@@ -189,7 +189,9 @@ struct dce_mem_input_registers {
 	SFB(blk, GRPH_PITCH, GRPH_PITCH, mask_sh),\
 	SFB(blk, HW_ROTATION, GRPH_ROTATION_ANGLE, mask_sh),\
 	SFB(blk, GRPH_SWAP_CNTL, GRPH_RED_CROSSBAR, mask_sh),\
+	SFB(blk, GRPH_SWAP_CNTL, GRPH_GREEN_CROSSBAR, mask_sh),\
 	SFB(blk, GRPH_SWAP_CNTL, GRPH_BLUE_CROSSBAR, mask_sh),\
+	SFB(blk, GRPH_SWAP_CNTL, GRPH_ALPHA_CROSSBAR, mask_sh),\
 	SFB(blk, PRESCALE_GRPH_CONTROL, GRPH_PRESCALE_SELECT, mask_sh),\
 	SFB(blk, PRESCALE_GRPH_CONTROL, GRPH_PRESCALE_R_SIGN, mask_sh),\
 	SFB(blk, PRESCALE_GRPH_CONTROL, GRPH_PRESCALE_G_SIGN, mask_sh),\
@@ -213,7 +215,9 @@ struct dce_mem_input_registers {
 	SFB(blk, GRPH_Y_END, GRPH_Y_END, mask_sh),\
 	SFB(blk, GRPH_PITCH, GRPH_PITCH, mask_sh),\
 	SFB(blk, GRPH_SWAP_CNTL, GRPH_RED_CROSSBAR, mask_sh),\
+	SFB(blk, GRPH_SWAP_CNTL, GRPH_GREEN_CROSSBAR, mask_sh),\
 	SFB(blk, GRPH_SWAP_CNTL, GRPH_BLUE_CROSSBAR, mask_sh),\
+	SFB(blk, GRPH_SWAP_CNTL, GRPH_ALPHA_CROSSBAR, mask_sh),\
 	SFB(blk, PRESCALE_GRPH_CONTROL, GRPH_PRESCALE_SELECT, mask_sh),\
 	SFB(blk, PRESCALE_GRPH_CONTROL, GRPH_PRESCALE_R_SIGN, mask_sh),\
 	SFB(blk, PRESCALE_GRPH_CONTROL, GRPH_PRESCALE_G_SIGN, mask_sh),\
@@ -344,7 +348,9 @@ struct dce_mem_input_registers {
 	type GRPH_PITCH; \
 	type GRPH_ROTATION_ANGLE; \
 	type GRPH_RED_CROSSBAR; \
+	type GRPH_GREEN_CROSSBAR; \
 	type GRPH_BLUE_CROSSBAR; \
+	type GRPH_ALPHA_CROSSBAR; \
 	type GRPH_PRESCALE_SELECT; \
 	type GRPH_PRESCALE_R_SIGN; \
 	type GRPH_PRESCALE_G_SIGN; \
Signature · 1 line
2.43.0
author
#32 lore raw

PATCH 32/33 drm/amd/display: [FW Promotion] Release 0.1.85.0

In reply to James Lin

From: Taimur Hassan <[email protected]>

Updated display microcontroller (DMUB) interface
- Add the PSR command DMUB_CMD__PSR_SET_EXTERNAL_DISPLAY_CONNECTED to tell the firmware whether an external (non-eDP) display is connected. While it is set, the firmware skips HUBP/DPG memory control for PSR.
- Add the Replay general command subtype REPLAY_GENERAL_CMD_SET_EXTERNAL_DISPLAY_CONNECTED.

---
 .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h   | 48 +++++++++++++++++++
 1 file changed, 48 insertions(+)
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +48 -0
index e9eee64fd834..3b0c9707437e 100644
@@ -3817,6 +3817,11 @@ enum dmub_cmd_psr_type {
 	 * Set PSR power option
 	 */
 	DMUB_CMD__SET_PSR_POWER_OPT = 7,
+	/**
+	 * Set whether an external (non-eDP) display is connected.
+	 * While set, FW skips HUBP/DPG memory control for PSR.
+	 */
+	DMUB_CMD__PSR_SET_EXTERNAL_DISPLAY_CONNECTED = 8,
 };
 
 /**
@@ -4568,6 +4573,44 @@ struct dmub_rb_cmd_psr_set_power_opt {
 	struct dmub_cmd_psr_set_power_opt_data psr_set_power_opt_data;
 };
 
+/**
+ * Data passed from driver to FW in a DMUB_CMD__PSR_SET_EXTERNAL_DISPLAY_CONNECTED command.
+ */
+struct dmub_cmd_psr_set_external_display_connected_data {
+	/**
+	 * PSR control version.
+	 */
+	uint8_t cmd_version;
+	/**
+	 * Panel Instance.
+	 * Panel instance to identify which psr_state to use
+	 * Currently the support is only for 0 or 1
+	 */
+	uint8_t panel_inst;
+	/**
+	 * 1 if an external (non-eDP) display is connected, 0 otherwise.
+	 */
+	uint8_t external_display_connected;
+	/**
+	 * Explicit padding to 4 byte boundary.
+	 */
+	uint8_t pad;
+};
+
+/**
+ * Definition of a DMUB_CMD__PSR_SET_EXTERNAL_DISPLAY_CONNECTED command.
+ */
+struct dmub_rb_cmd_psr_set_external_display_connected {
+	/**
+	 * Command header.
+	 */
+	struct dmub_cmd_header header;
+	/**
+	 * Definition of a DMUB_CMD__PSR_SET_EXTERNAL_DISPLAY_CONNECTED command.
+	 */
+	struct dmub_cmd_psr_set_external_display_connected_data psr_set_external_display_connected_data;
+};
+
 enum dmub_alpm_mode {
 	ALPM_AUXWAKE = 0,
 	ALPM_AUXLESS = 1,
@@ -4766,6 +4809,7 @@ enum dmub_cmd_replay_general_subtype {
 	REPLAY_GENERAL_CMD_SET_CONTINUOUSLY_RESYNC,
 	REPLAY_GENERAL_CMD_SET_COASTING_VTOTAL_WITHOUT_FRAME_UPDATE,
 	REPLAY_GENERAL_CMD_LIVE_CAPTURE_WITH_CVT,
+	REPLAY_GENERAL_CMD_SET_EXTERNAL_DISPLAY_CONNECTED,
 };
 
 struct dmub_alpm_auxless_data {
@@ -8009,6 +8053,10 @@ union dmub_rb_cmd {
 	 * Definition of a DMUB_CMD__SET_PSR_POWER_OPT command.
 	 */
 	struct dmub_rb_cmd_psr_set_power_opt psr_set_power_opt;
+	/**
+	 * Definition of a DMUB_CMD__PSR_SET_EXTERNAL_DISPLAY_CONNECTED command.
+	 */
+	struct dmub_rb_cmd_psr_set_external_display_connected psr_set_external_display_connected;
 	/**
 	 * Definition of a DMUB_CMD__PLAT_54186_WA command.
 	 */
Signature · 1 line
2.43.0
author
#33 lore raw

PATCH 33/33 drm/amd/display: Promote DC to 3.2.408

In reply to James Lin

From: Taimur Hassan <[email protected]>

This version brings along the following updates:
- Rename DPMS to DPMS_v1
- Power up eDP when detect link
- Add DPMS-v2 files
- Refactor DP retrain link HW sequence
- Add extra 0.25 line reserved for TSetup/TCalc inefficiency
- Use panel luminance range for AUX backlight in power module
- Read PWM back linearly with the linear backlight curve
- Add API to set brightness percent
- Pass linear brightness percent to power module
- Add DPMS-v2 types
- Always apply 0ppm pixel clock adjustment
- Add otg versions of get_vblank_counter/scanoutpos
- Queue vblank control work to sleepable context
- Fix KUnit tests for vblank control rework
- Add urgent request and assertion probes
- Fix G7 P-state aperture addresses
- Set stream min/max refresh from VRR config
- Add DC2 wrapped initialization for DCN401
- Honor the Replay stream regeneration wait event
- Disable Replay when link off frame count is below 2
- Skip DSC padding borrow estimate for zero padding
- Drop unused DC interfaces
- Let the DC2 commit replace or keep a stream
- Support two streams in the dcn401 DC2 builders
- Add a plane beside a kept plane in DC2 update
- Keep an unchanged stream in the DC2 commit
- Change the ODM and MPC layout in DC2 update
- Give the DC2 builders State pipe facts
- Add RGBA8888 surface pixel format support
- Fix DCE crossbar for RGBA8888 surface format

---
 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 7d0a47e7bc1a..908021f1ee36 100644
@@ -69,7 +69,7 @@ struct dcn_dsc_reg_state;
 struct dcn_optc_reg_state;
 struct dcn_dccg_reg_state;
 
-#define DC_VER "3.2.407"
+#define DC_VER "3.2.408"
 
 /**
  * MAX_SURFACES - representative of the upper bound of surfaces that can be piped to a single CRTC
Signature · 1 line
2.43.0
Reviewed-by on the v1 series
#34 lore raw
In reply to James Lin
Quoted 23 lines · James Lin

This DC patchset brings improvements in multiple areas. In summary, we have:
- Rename DPMS to DPMS_v1
- Power up eDP when detect link
- Add DPMS-v2 files
- Refactor DP retrain link HW sequence
- Add extra 0.25 line reserved for TSetup/TCalc inefficiency
- Use panel luminance range for AUX backlight in power module
- Read PWM back linearly with the linear backlight curve
- Add API to set brightness percent
- Pass linear brightness percent to power module
- Add DPMS-v2 types
- Always apply 0ppm pixel clock adjustment
- Add otg versions of get_vblank_counter/scanoutpos
- Queue vblank control work to sleepable context
- Fix KUnit tests for vblank control rework
- Add urgent request and assertion probes
- Fix G7 P-state aperture addresses
- Set stream min/max refresh from VRR config
- Add DC2 wrapped initialization for DCN401
- Honor the Replay stream regeneration wait event
- Disable Replay when link off frame count is below 2
- Skip DSC padding borrow estimate for zero padding
- Drop unused DC interfaces

Quoted 8 lines

- Let the DC2 commit replace or keep a stream
- Support two streams in the dcn401 DC2 builders
- Add a plane beside a kept plane in DC2 update
- Keep an unchanged stream in the DC2 commit
- Change the ODM and MPC layout in DC2 update
- Give the DC2 builders State pipe facts
- Add RGBA8888 surface pixel format support
- Fix DCE crossbar for RGBA8888 surface format

Series is

Wayne

Quoted 188 lines
Cc Dan Wheeler <[email protected]>

Allen Pan (1):
drm/amd/display: Always apply 0ppm pixel clock adjustment

Dominik Kowalski (3):
drm/amd/display: Rename DPMS to DPMS_v1
drm/amd/display: Add DPMS-v2 files
drm/amd/display: Add DPMS-v2 types

George Shen (1):
drm/amd/display: Refactor DP retrain link HW sequence

George Zhang (3):
drm/amd/display: Add otg versions of get_vblank_counter/scanoutpos drm/amd/display: Queue vblank control work to sleepable context drm/amd/display: Fix KUnit tests for vblank control rework

Harry VanZyllDeJong (1):
drm/amd/display: Honor the Replay stream regeneration wait event

Harry Wentland (2):
drm/amd/display: Add RGBA8888 surface pixel format support drm/amd/display: Fix DCE crossbar for RGBA8888 surface format

Ivan Lipski (2):
drm/amd/display: Fix G7 P-state aperture addresses drm/amd/display: Set stream min/max refresh from VRR config

Michael Strauss (1):
drm/amd/display: Clear OTG_AUTO_FORCE_VSYNC_MODE on OTG disable

Nicholas Kazlauskas (2):
drm/amd/display: Skip DSC padding borrow estimate for zero padding drm/amd/display: Drop unused DC interfaces

Ray Wu (5):
drm/amd/display: Use panel luminance range for AUX backlight in power
module
drm/amd/display: Read PWM back linearly with the linear backlight
curve
drm/amd/display: Add API to set brightness percent drm/amd/display: Pass linear brightness percent to power module drm/amd/display: Disable Replay when link off frame count is below 2

Samson Tam (1):
drm/amd/display: add extra 0.25 line reserved for TSetup/TCalc
inefficiency

Taimur Hassan (2):
drm/amd/display: [FW Promotion] Release 0.1.85.0 drm/amd/display: Promote DC to 3.2.408

Tomasz Siemek (1):
drm/amd/display: Add DC2 wrapped initialization for DCN401

Tony Cheng (6):
drm/amd/display: Let the DC2 commit replace or keep a stream drm/amd/display: Support two streams in the dcn401 DC2 builders drm/amd/display: Add a plane beside a kept plane in DC2 update drm/amd/display: Keep an unchanged stream in the DC2 commit drm/amd/display: Change the ODM and MPC layout in DC2 update drm/amd/display: Give the DC2 builders State pipe facts

Wenjing Liu (1):
drm/amd/display: Add urgent request and assertion probes

Zhikai Zhai (1):
drm/amd/display: Power up eDP when detect link

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  116 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   52 +
 .../display/amdgpu_dm/amdgpu_dm_backlight.c   |  208 +---
 .../display/amdgpu_dm/amdgpu_dm_backlight.h   |    9 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c    |  225 ++--
 .../amd/display/amdgpu_dm/amdgpu_dm_dmub.c    |    2 +-
 .../display/amdgpu_dm/amdgpu_dm_freesync.c    |    3 +
 .../display/amdgpu_dm/amdgpu_dm_irq_params.h  |    2 +
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c |   20 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_replay.c  |   23 +-
 .../tests/amdgpu_dm_backlight_test.c          |  552 ++-------
 .../amdgpu_dm/tests/amdgpu_dm_crtc_test.c     |  219 +++-
 .../amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c |    2 +
 .../amdgpu_dm/tests/amdgpu_dm_replay_test.c   |  129 ++
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  |   78 ++
 drivers/gpu/drm/amd/display/dc/Makefile       |    3 +
 .../gpu/drm/amd/display/dc/basics/dce_calcs.c |    2 +
 .../amd/display/dc/bls_builder/bls_builder.c  |   19 +
 .../amd/display/dc/bls_builder/bls_builder.h  |   86 +-
 .../dc/bls_builder/bls_builder_internal.h     |    3 +
 .../bls_builder/bls_builder_private_types.h   |   28 +-
 .../dc/bls_builder/dcn401_builder_internal.h  |   87 +-
 .../dc/bls_builder/dcn401_init_builder.c      |  812 ++++++------
 .../dc/bls_builder/dcn401_init_builder.h      |   16 -
 .../bls_builder/dcn401_init_builder_legacy.c  |   77 ++
 .../bls_builder/dcn401_non_seamless_builder.c |  243 ++--
 .../dc/bls_builder/dcn401_query_builder.c     |   41 +
 .../dc/bls_builder/dcn401_seamless_builder.c  | 1091 +++++++++++------
 .../display/dc/bls_executor/bls_executor.c    |   79 +-
 .../display/dc/bls_executor/bls_executor.h    |    2 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c      |    6 +-
 .../drm/amd/display/dc/core/dc_hw_sequencer.c |  267 +++-
 .../gpu/drm/amd/display/dc/core/dc_resource.c |   48 +-
 .../gpu/drm/amd/display/dc/core/dc_state.c    |   28 +
 .../gpu/drm/amd/display/dc/core/dc_stream.c   |   38 +
 .../gpu/drm/amd/display/dc/core2/dc_core2.c   |  142 ++-
 .../drm/amd/display/dc/core2/dc_core2_init.c  |  298 ++++-
 drivers/gpu/drm/amd/display/dc/dc.h           |   60 +-
 .../amd/display/dc/dc_api_dispatch/api_shim.c |    1 +
 .../amd/display/dc/dc_api_dispatch/api_shim.h |    3 +
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h  |    8 +-
 drivers/gpu/drm/amd/display/dc/dc_probe.h     |   61 +-
 .../gpu/drm/amd/display/dc/dc_state_priv.h    |   23 +
 drivers/gpu/drm/amd/display/dc/dc_stream.h    |    6 +
 .../drm/amd/display/dc/dce/dce_clock_source.c |   25 +
 .../drm/amd/display/dc/dce/dce_mem_input.c    |   42 +-
 .../drm/amd/display/dc/dce/dce_mem_input.h    |    6 +
 .../display/dc/dce110/dce110_mem_input_v.c    |    1 +
 .../drm/amd/display/dc/dml/calcs/dcn_calcs.c  |    1 +
 .../dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c |   13 +-
 .../drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c  |    3 +
 .../drm/amd/display/dc/dpp/dcn20/dcn20_dpp.c  |    3 +
 .../amd/display/dc/dpp/dcn201/dcn201_dpp.c    |    3 +
 .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c  |    3 +
 .../amd/display/dc/dpp/dcn401/dcn401_dpp.c    |    3 +
 .../drm/amd/display/dc/dpp/dcn42/dcn42_dpp.c  |    3 +
 .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.c  |    3 +
 .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.c  |    3 +
 .../display/dc/hubbub/dcn10/dcn10_hubbub.c    |    1 +
 .../display/dc/hubbub/dcn20/dcn20_hubbub.c    |    1 +
 .../display/dc/hubbub/dcn401/dcn401_hubbub.c  |    1 +
 .../display/dc/hubbub/dcn60/dcn60_hubbub.c    |   80 ++
 .../amd/display/dc/hubp/dcn10/dcn10_hubp.c    |    4 +
 .../amd/display/dc/hubp/dcn20/dcn20_hubp.c    |    4 +
 .../amd/display/dc/hubp/dcn20/dcn20_hubp.h    |    3 +-
 .../amd/display/dc/hubp/dcn35/dcn35_hubp.c    |    4 +
 .../amd/display/dc/hubp/dcn42/dcn42_hubp.c    |    4 +
 .../amd/display/dc/hubp/dcn50/dcn50_hubp.c    |    4 +
 .../amd/display/dc/hubp/dcn60/dcn60_hubp.c    |   35 +
 .../amd/display/dc/hubp/dcn60/dcn60_hubp.h    |    1 +
 .../drm/amd/display/dc/hwss/dce/dce_hwseq.c   |    1 +
 .../amd/display/dc/hwss/dce110/dce110_hwseq.c |    1 +
 .../amd/display/dc/hwss/dcn30/dcn30_hwseq.h   |    8 -
 .../amd/display/dc/hwss/dcn60/dcn60_hwseq.c   |  243 +++-
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |   80 +-
 .../gpu/drm/amd/display/dc/inc/core_types.h   |   61 +
 .../amd/display/dc/inc/dc_core_interface.h    |    6 +
 .../gpu/drm/amd/display/dc/inc/hw/dchubbub.h  |    3 +
 drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h  |   12 +
 .../amd/display/dc/inc/hw/timing_generator.h  |    4 -
 .../gpu/drm/amd/display/dc/inc/link_service.h |    6 +-
 drivers/gpu/drm/amd/display/dc/inc/link_tx.h  |   59 +
 drivers/gpu/drm/amd/display/dc/link/Makefile  |    9 +-
 .../display/dc/link/accessories/link_dp_cts.c |   43 +-
 .../drm/amd/display/dc/link/link_detection.c  |   17 +-
 .../dc/link/{link_dpms.c => link_dpms_v1.c}   |    6 +-
 .../dc/link/{link_dpms.h => link_dpms_v1.h}   |   10 +-
 .../drm/amd/display/dc/link/link_dpms_v2.c    |   44 +
 .../drm/amd/display/dc/link/link_dpms_v2.h    |   38 +
 .../drm/amd/display/dc/link/link_factory.c    |   23 +-
 .../dc/link/protocols/link_dp_irq_handler.c   |    6 +-
 .../display/dc/link/protocols/link_hdmi_frl.c |    8 +-
 .../amd/display/dc/optc/dcn31/dcn31_optc.c    |    4 +
 .../amd/display/dc/optc/dcn314/dcn314_optc.c  |    4 +
 .../amd/display/dc/optc/dcn35/dcn35_optc.c    |    4 +
 .../dc/pmfw_messenger/dcn401_pmfw_messenger.c |  211 ++++
 .../dc/pmfw_messenger/pmfw_messenger.c        |   62 +
 .../dc/pmfw_messenger/pmfw_messenger.h        |  118 ++
 .../amd/display/dc/state_facts/state_facts.h  |    3 +
 .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h   |   48 +
 .../drm/amd/display/modules/inc/mod_power.h   |    7 +
 .../drm/amd/display/modules/power/power_abm.c |   83 +-
 .../amd/display/modules/power/power_replay.c  |    1 +
 103 files changed, 4807 insertions(+), 1898 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_query_builder.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/inc/link_tx.h
 rename drivers/gpu/drm/amd/display/dc/link/{link_dpms.c => link_dpms_v1.c} (99%)
 rename drivers/gpu/drm/amd/display/dc/link/{link_dpms.h => link_dpms_v1.h} (92%)
 create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_dpms_v2.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_dpms_v2.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/pmfw_messenger/dcn401_pmfw_messenger.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/pmfw_messenger/pmfw_messenger.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/pmfw_messenger/pmfw_messenger.h
Signature · 1 line
2.43.0
Tested-by on the v1 series
#35 lore raw
In reply to James Lin

Public

Hi all,

This week this patchset was tested on 4 systems, two dGPU and two APU based, and tested across multiple display and connection types.

APU
* Single Display eDP -> 1080p 60hz, 1920x1200 165hz, 3840x2400 60hz
* Single Display DP (SST DSC) -> 4k144hz, 4k240hz
* Multi display -> eDP + DP/HDMI/USB-C -> 1080p 60hz eDP + 4k 144hz, 4k 240hz (Includes USB-C to DP/HDMI adapters)
* Thunderbolt -> LG Ultrafine 5k
* MST DSC -> Cable Matters 101075 (DP to 3x DP) with 3x 4k60hz displays, HP Hook G2 with 2x 4k60hz displays
* USB 4 -> HP Hook G4, Lenovo Thunderbolt Dock, both with 2x 4k60hz DP and 1x 4k60hz HDMI displays
* SST PCON -> Club3D CAC-1085 + 1x 4k 144hz, FRL3, at a max resolution supported by the dongle of 4k 120hz YUV420 12bpc.
* MST PCON -> 1x 4k 144hz, FRL3, at a max resolution supported by the adapter of 4k 120hz RGB 8bpc.

DGPU
* Single Display DP (SST DSC) -> 4k144hz, 4k240hz
* Multiple Display DP -> 4k240hz + 4k144hz
* MST (Startech MST14DP123DP [DP to 3x DP] and 2x 4k 60hz displays)
* MST DSC (with Cable Matters 101075 [DP to 3x DP] with 3x 4k60hz displays)

The testing is a mix of automated and manual tests. Manual testing includes (but is not limited to)
* Changing display configurations and settings
* Video/Audio playback
* Benchmark testing
* Suspend/Resume testing
* Feature testing (Freesync, HDCP, etc.)

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

The testing is mainly tested on the following displays, but occasionally there are tests with other displays
* Samsung G8 Neo 4k240hz
* Samsung QN55QN95B 4k 120hz
* Acer XV322QKKV 4k144hz
* HP U27 4k Wireless 4k60hz
* LG 27UD58B 4k60hz
* LG 32UN650WA 4k60hz
* LG Ultrafine 5k 5k60hz
* AU Optronics B140HAN01.1 1080p 60hz eDP
* AU Optronics B160UAN01.J 1920x1200 165hz eDP
* Samsung ATNA60YV02-0 3840x2400 60Hz OLED eDP

The patchset consists of the amd-staging-drm-next branch (Head commit -> a610ecccfc426cf1f4a25d3f06ff4671ed7c1963 -> drm/amdgpu: add support for FB carveout disablement) with new patches added on top of it.

Tested on Ubuntu 26.04, on Gnome Wayland.

Thank you,

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

-----Original Message-----
From: James Lin <[email protected]>
Sent: Monday, November 16, 2026 4:51 PM
To: [email protected]
Cc: Wentland, Harry <[email protected]>; Li, Sun peng (Leo) <[email protected]>; Pillai, Aurabindo <[email protected]>; Li, Roman <[email protected]>; Lin, Wayne <[email protected]>; Chung, ChiaHsuan (Tom) <[email protected]>; Zuo, Jerry <[email protected]>; Wheeler, Daniel <[email protected]>; Wu, Ray <[email protected]>; LIPSKI, IVAN <[email protected]>; Hung, Alex <[email protected]>; Lin, Ping Lei <[email protected]>; Chen, Chen-Yu <[email protected]>
Subject: [PATCH 00/33] DC Patches November 23, 2026

This DC patchset brings improvements in multiple areas. In summary, we have:
- Rename DPMS to DPMS_v1
- Power up eDP when detect link
- Add DPMS-v2 files
- Refactor DP retrain link HW sequence
- Add extra 0.25 line reserved for TSetup/TCalc inefficiency
- Use panel luminance range for AUX backlight in power module
- Read PWM back linearly with the linear backlight curve
- Add API to set brightness percent
- Pass linear brightness percent to power module
- Add DPMS-v2 types
- Always apply 0ppm pixel clock adjustment
- Add otg versions of get_vblank_counter/scanoutpos
- Queue vblank control work to sleepable context
- Fix KUnit tests for vblank control rework
- Add urgent request and assertion probes
- Fix G7 P-state aperture addresses
- Set stream min/max refresh from VRR config
- Add DC2 wrapped initialization for DCN401
- Honor the Replay stream regeneration wait event
- Disable Replay when link off frame count is below 2
- Skip DSC padding borrow estimate for zero padding
- Drop unused DC interfaces
- Let the DC2 commit replace or keep a stream
- Support two streams in the dcn401 DC2 builders
- Add a plane beside a kept plane in DC2 update
- Keep an unchanged stream in the DC2 commit
- Change the ODM and MPC layout in DC2 update
- Give the DC2 builders State pipe facts
- Add RGBA8888 surface pixel format support
- Fix DCE crossbar for RGBA8888 surface format

Cc Dan Wheeler <[email protected]>

Allen Pan (1):
drm/amd/display: Always apply 0ppm pixel clock adjustment

Dominik Kowalski (3):
drm/amd/display: Rename DPMS to DPMS_v1
drm/amd/display: Add DPMS-v2 files
drm/amd/display: Add DPMS-v2 types

George Shen (1):
drm/amd/display: Refactor DP retrain link HW sequence

George Zhang (3):
drm/amd/display: Add otg versions of get_vblank_counter/scanoutpos drm/amd/display: Queue vblank control work to sleepable context drm/amd/display: Fix KUnit tests for vblank control rework

Harry VanZyllDeJong (1):
drm/amd/display: Honor the Replay stream regeneration wait event

Harry Wentland (2):
drm/amd/display: Add RGBA8888 surface pixel format support drm/amd/display: Fix DCE crossbar for RGBA8888 surface format

Ivan Lipski (2):
drm/amd/display: Fix G7 P-state aperture addresses drm/amd/display: Set stream min/max refresh from VRR config

Michael Strauss (1):
drm/amd/display: Clear OTG_AUTO_FORCE_VSYNC_MODE on OTG disable

Nicholas Kazlauskas (2):
drm/amd/display: Skip DSC padding borrow estimate for zero padding drm/amd/display: Drop unused DC interfaces

Ray Wu (5):
drm/amd/display: Use panel luminance range for AUX backlight in power
module
drm/amd/display: Read PWM back linearly with the linear backlight
curve
drm/amd/display: Add API to set brightness percent drm/amd/display: Pass linear brightness percent to power module drm/amd/display: Disable Replay when link off frame count is below 2

Samson Tam (1):
drm/amd/display: add extra 0.25 line reserved for TSetup/TCalc
inefficiency

Taimur Hassan (2):
drm/amd/display: [FW Promotion] Release 0.1.85.0 drm/amd/display: Promote DC to 3.2.408

Tomasz Siemek (1):
drm/amd/display: Add DC2 wrapped initialization for DCN401

Tony Cheng (6):
drm/amd/display: Let the DC2 commit replace or keep a stream drm/amd/display: Support two streams in the dcn401 DC2 builders drm/amd/display: Add a plane beside a kept plane in DC2 update drm/amd/display: Keep an unchanged stream in the DC2 commit drm/amd/display: Change the ODM and MPC layout in DC2 update drm/amd/display: Give the DC2 builders State pipe facts

Wenjing Liu (1):
drm/amd/display: Add urgent request and assertion probes

Zhikai Zhai (1):
drm/amd/display: Power up eDP when detect link

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  116 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   52 +
 .../display/amdgpu_dm/amdgpu_dm_backlight.c   |  208 +---
 .../display/amdgpu_dm/amdgpu_dm_backlight.h   |    9 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c    |  225 ++--
 .../amd/display/amdgpu_dm/amdgpu_dm_dmub.c    |    2 +-
 .../display/amdgpu_dm/amdgpu_dm_freesync.c    |    3 +
 .../display/amdgpu_dm/amdgpu_dm_irq_params.h  |    2 +
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c |   20 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_replay.c  |   23 +-
 .../tests/amdgpu_dm_backlight_test.c          |  552 ++-------
 .../amdgpu_dm/tests/amdgpu_dm_crtc_test.c     |  219 +++-
 .../amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c |    2 +
 .../amdgpu_dm/tests/amdgpu_dm_replay_test.c   |  129 ++
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  |   78 ++
 drivers/gpu/drm/amd/display/dc/Makefile       |    3 +
 .../gpu/drm/amd/display/dc/basics/dce_calcs.c |    2 +
 .../amd/display/dc/bls_builder/bls_builder.c  |   19 +
 .../amd/display/dc/bls_builder/bls_builder.h  |   86 +-
 .../dc/bls_builder/bls_builder_internal.h     |    3 +
 .../bls_builder/bls_builder_private_types.h   |   28 +-
 .../dc/bls_builder/dcn401_builder_internal.h  |   87 +-
 .../dc/bls_builder/dcn401_init_builder.c      |  812 ++++++------
 .../dc/bls_builder/dcn401_init_builder.h      |   16 -
 .../bls_builder/dcn401_init_builder_legacy.c  |   77 ++
 .../bls_builder/dcn401_non_seamless_builder.c |  243 ++--
 .../dc/bls_builder/dcn401_query_builder.c     |   41 +
 .../dc/bls_builder/dcn401_seamless_builder.c  | 1091 +++++++++++------
 .../display/dc/bls_executor/bls_executor.c    |   79 +-
 .../display/dc/bls_executor/bls_executor.h    |    2 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c      |    6 +-
 .../drm/amd/display/dc/core/dc_hw_sequencer.c |  267 +++-
 .../gpu/drm/amd/display/dc/core/dc_resource.c |   48 +-
 .../gpu/drm/amd/display/dc/core/dc_state.c    |   28 +
 .../gpu/drm/amd/display/dc/core/dc_stream.c   |   38 +
 .../gpu/drm/amd/display/dc/core2/dc_core2.c   |  142 ++-
 .../drm/amd/display/dc/core2/dc_core2_init.c  |  298 ++++-
 drivers/gpu/drm/amd/display/dc/dc.h           |   60 +-
 .../amd/display/dc/dc_api_dispatch/api_shim.c |    1 +
 .../amd/display/dc/dc_api_dispatch/api_shim.h |    3 +
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h  |    8 +-
 drivers/gpu/drm/amd/display/dc/dc_probe.h     |   61 +-
 .../gpu/drm/amd/display/dc/dc_state_priv.h    |   23 +
 drivers/gpu/drm/amd/display/dc/dc_stream.h    |    6 +
 .../drm/amd/display/dc/dce/dce_clock_source.c |   25 +
 .../drm/amd/display/dc/dce/dce_mem_input.c    |   42 +-
 .../drm/amd/display/dc/dce/dce_mem_input.h    |    6 +
 .../display/dc/dce110/dce110_mem_input_v.c    |    1 +
 .../drm/amd/display/dc/dml/calcs/dcn_calcs.c  |    1 +
 .../dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c |   13 +-
 .../drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c  |    3 +
 .../drm/amd/display/dc/dpp/dcn20/dcn20_dpp.c  |    3 +
 .../amd/display/dc/dpp/dcn201/dcn201_dpp.c    |    3 +
 .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c  |    3 +
 .../amd/display/dc/dpp/dcn401/dcn401_dpp.c    |    3 +
 .../drm/amd/display/dc/dpp/dcn42/dcn42_dpp.c  |    3 +
 .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.c  |    3 +
 .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.c  |    3 +
 .../display/dc/hubbub/dcn10/dcn10_hubbub.c    |    1 +
 .../display/dc/hubbub/dcn20/dcn20_hubbub.c    |    1 +
 .../display/dc/hubbub/dcn401/dcn401_hubbub.c  |    1 +
 .../display/dc/hubbub/dcn60/dcn60_hubbub.c    |   80 ++
 .../amd/display/dc/hubp/dcn10/dcn10_hubp.c    |    4 +
 .../amd/display/dc/hubp/dcn20/dcn20_hubp.c    |    4 +
 .../amd/display/dc/hubp/dcn20/dcn20_hubp.h    |    3 +-
 .../amd/display/dc/hubp/dcn35/dcn35_hubp.c    |    4 +
 .../amd/display/dc/hubp/dcn42/dcn42_hubp.c    |    4 +
 .../amd/display/dc/hubp/dcn50/dcn50_hubp.c    |    4 +
 .../amd/display/dc/hubp/dcn60/dcn60_hubp.c    |   35 +
 .../amd/display/dc/hubp/dcn60/dcn60_hubp.h    |    1 +
 .../drm/amd/display/dc/hwss/dce/dce_hwseq.c   |    1 +
 .../amd/display/dc/hwss/dce110/dce110_hwseq.c |    1 +
 .../amd/display/dc/hwss/dcn30/dcn30_hwseq.h   |    8 -
 .../amd/display/dc/hwss/dcn60/dcn60_hwseq.c   |  243 +++-
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |   80 +-
 .../gpu/drm/amd/display/dc/inc/core_types.h   |   61 +
 .../amd/display/dc/inc/dc_core_interface.h    |    6 +
 .../gpu/drm/amd/display/dc/inc/hw/dchubbub.h  |    3 +
 drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h  |   12 +
 .../amd/display/dc/inc/hw/timing_generator.h  |    4 -
 .../gpu/drm/amd/display/dc/inc/link_service.h |    6 +-
 drivers/gpu/drm/amd/display/dc/inc/link_tx.h  |   59 +
 drivers/gpu/drm/amd/display/dc/link/Makefile  |    9 +-
 .../display/dc/link/accessories/link_dp_cts.c |   43 +-
 .../drm/amd/display/dc/link/link_detection.c  |   17 +-
 .../dc/link/{link_dpms.c => link_dpms_v1.c}   |    6 +-
 .../dc/link/{link_dpms.h => link_dpms_v1.h}   |   10 +-
 .../drm/amd/display/dc/link/link_dpms_v2.c    |   44 +
 .../drm/amd/display/dc/link/link_dpms_v2.h    |   38 +
 .../drm/amd/display/dc/link/link_factory.c    |   23 +-
 .../dc/link/protocols/link_dp_irq_handler.c   |    6 +-
 .../display/dc/link/protocols/link_hdmi_frl.c |    8 +-
 .../amd/display/dc/optc/dcn31/dcn31_optc.c    |    4 +
 .../amd/display/dc/optc/dcn314/dcn314_optc.c  |    4 +
 .../amd/display/dc/optc/dcn35/dcn35_optc.c    |    4 +
 .../dc/pmfw_messenger/dcn401_pmfw_messenger.c |  211 ++++
 .../dc/pmfw_messenger/pmfw_messenger.c        |   62 +
 .../dc/pmfw_messenger/pmfw_messenger.h        |  118 ++
 .../amd/display/dc/state_facts/state_facts.h  |    3 +
 .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h   |   48 +
 .../drm/amd/display/modules/inc/mod_power.h   |    7 +
 .../drm/amd/display/modules/power/power_abm.c |   83 +-
 .../amd/display/modules/power/power_replay.c  |    1 +
 103 files changed, 4807 insertions(+), 1898 deletions(-)  create mode 100644 drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_query_builder.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/inc/link_tx.h
 rename drivers/gpu/drm/amd/display/dc/link/{link_dpms.c => link_dpms_v1.c} (99%)  rename drivers/gpu/drm/amd/display/dc/link/{link_dpms.h => link_dpms_v1.h} (92%)  create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_dpms_v2.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/link/link_dpms_v2.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/pmfw_messenger/dcn401_pmfw_messenger.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/pmfw_messenger/pmfw_messenger.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/pmfw_messenger/pmfw_messenger.h

--
2.43.0