DC Patches Apr 18, 2019
Subsystems (3)
cover DC Patches Apr 18, 2019
From: Leo Li <[email protected]>
Summary of change:
* Implement ability to have an active CRTC, without any active planes
* Removed deprecated pplib interface
* Fixed potential register wait warning on boot
* Fixed potential eDP blackscreen on S4 resume
Anthony Koo (3):
drm/amd/display: Allow system to enter stutter on init drm/amd/display: Send DMCU messages only if FW loaded drm/amd/display: Fix eDP Black screen after S4 resume
Aric Cyr (1):
drm/amd/display: 3.2.27
Charlene Liu (1):
drm/amd/display: Add hubp_init entry to hubp vtable
Eric Bernstein (1):
drm/amd/display: Allow cursor position when plane_res.ipp is NULL
Eric Yang (1):
drm/amd/display: remove deprecated pplib interface
John Barberiz (1):
drm/amd/display: Refactor dp vendor parsing logic to a function
Jun Lei (1):
drm/amd/display: add explicit handshake between x86 and DMCU
Nicholas Kazlauskas (6):
drm/amd/display: Refactor CRTC interrupt toggling logic drm/amd/display: Disable cursors before disabling planes drm/amd/display: Fix CRC vblank refs when changing interrupts drm/amd/display: Split enabling CRTC interrupts into two passes drm/amd/display: Allow commits with no planes active drm/amd/display: Do VRR transition before enable_crc_interrupts
Thomas Lim (1):
drm/amd/display: Add power down display on boot flag
Wenjing Liu (1):
drm/amd/display: Add function to copy DC streams
Yongqiang Sun (1):
drm/amd/display: Refactor watermark programming
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 230 ++++++++++++++++----- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 3 + drivers/gpu/drm/amd/display/dc/core/dc_link.c | 71 +++++-- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 77 +++---- drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 21 +- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 23 ++- drivers/gpu/drm/amd/display/dc/dc.h | 3 +- drivers/gpu/drm/amd/display/dc/dc_link.h | 1 + drivers/gpu/drm/amd/display/dc/dc_stream.h | 2 + drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 18 -- drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c | 35 +++- .../gpu/drm/amd/display/dc/dcn10/dcn10_clk_mgr.c | 27 +-- .../gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c | 49 +++-- .../gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.h | 63 +++++- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c | 6 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h | 4 + .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 13 +- drivers/gpu/drm/amd/display/dc/dm_pp_smu.h | 23 --- drivers/gpu/drm/amd/display/dc/inc/core_types.h | 1 - drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 6 + drivers/gpu/drm/amd/display/dc/inc/hw/dmcu.h | 2 + drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h | 1 + 22 files changed, 462 insertions(+), 217 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1555612024-359-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org
PATCH 1/18 drm/amd/display: Allow system to enter stutter on init
From: Anthony Koo <[email protected]>
[Why]
Workaround was missing in one HW disable path, meaning when all pipes are power gated, stutter was not working
[How]
Add workaround for init_hw path for stutter workaround
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 -0
@@ -1126,6 +1126,8 @@ static void dcn10_init_hw(struct dc *dc) dc->res_pool->opps[i]->mpc_tree_params.opp_id = dc->res_pool->opps[i]->inst;plane_atomic_power_down (dc, dpp, hubp); } + +apply_DEGVIDCN10_253_wa (dc); }for (i =0 ; i < dc->res_pool->audio_count; i++) {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/18 drm/amd/display: Add function to copy DC streams
In reply to a message not in the archiveFrom: Wenjing Liu <[email protected]>
We'll need the ability to copy a dc_stream_state for some features. Implement it here.
--- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 21 +++++++++++++++++++++ drivers/gpu/drm/amd/display/dc/dc_stream.h | 2 ++ 2 files changed, 23 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +21 -0
@@ -163,6 +163,27 @@ struct dc_stream_state *dc_create_stream_for_sink(return stream; } +struct dc_stream_state *dc_copy_stream (const struct dc_stream_state *stream) +{ +struct dc_stream_state *new_stream; + + new_stream =kzalloc (sizeof (struct dc_stream_state ),GFP_KERNEL ); +if (stream ==NULL ) +return NULL ; + +memcpy (new_stream, stream,sizeof (struct dc_stream_state )); + +if (new_stream->sink) +dc_sink_retain (new_stream->sink); + +if (new_stream->out_transfer_func) +dc_transfer_func_retain (new_stream->out_transfer_func); + +kref_init (&new_stream->refcount); + +return new_stream; +} +/** * dc_stream_get_status_from_state - Get stream status from given dc state * @state: DC state to find the stream status in
drivers/gpu/drm/amd/display/dc/dc_stream.h +2 -0
@@ -307,6 +307,8 @@ enum surface_update_type dc_check_update_surfaces_for_stream(*/ struct dc_stream_state *dc_create_stream_for_sink (struct dc_sink *dc_sink); +struct dc_stream_state *dc_copy_stream (const struct dc_stream_state *stream); +void update_stream_signal (struct dc_stream_state *stream,struct dc_sink *sink);void dc_stream_retain (struct dc_stream_state *dc_stream);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/18 drm/amd/display: Send DMCU messages only if FW loaded
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
[Why]
Some DMCU messages were being sent in cases where there was no DMCU FW at all, which resulted in some wait timeouts
[How]
Delay sending some of the DMCU messages after FW init is called and DMCU is running.
--- drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 18 ---------------- drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c | 31 ++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_abm.c +0 -18
@@ -50,7 +50,6 @@#define MCP_ABM_LEVEL_SET 0x65#define MCP_ABM_PIPE_SET 0x66#define MCP_BL_SET 0x67 -#define MCP_BL_SET_PWM_FRAC 0x6A/* Enable or disable Fractional PWM */ #define MCP_DISABLE_ABM_IMMEDIATELY 255
@@ -391,23 +390,6 @@ static bool dce_abm_init_backlight(struct abm *abm)REG_UPDATE (BL_PWM_GRP1_REG_LOCK ,BL_PWM_GRP1_REG_LOCK ,0 ); -/* Wait until microcontroller is ready to process interrupt */ -REG_WAIT (MASTER_COMM_CNTL_REG ,MASTER_COMM_INTERRUPT ,0 ,100 ,800 ); - -/* Set PWM fractional enable/disable */ - value = (abm->ctx->dc->config.disable_fractional_pwm == false) ?1 :0 ; -REG_WRITE (MASTER_COMM_DATA_REG1 , value); - -/* Set command to enable or disable fractional PWM microcontroller */ -REG_UPDATE (MASTER_COMM_CMD_REG ,MASTER_COMM_CMD_REG_BYTE0 , -MCP_BL_SET_PWM_FRAC ); - -/* Notify microcontroller of new command */ -REG_UPDATE (MASTER_COMM_CNTL_REG ,MASTER_COMM_INTERRUPT ,1 ); - -/* Ensure command has been executed before continuing */ -REG_WAIT (MASTER_COMM_CNTL_REG ,MASTER_COMM_INTERRUPT ,0 ,100 ,800 ); -return true; }
drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c +30 -1
@@ -51,6 +51,7 @@#define PSR_SET_WAITLOOP 0x31#define MCP_INIT_DMCU 0x88#define MCP_INIT_IRAM 0x89 +#define MCP_BL_SET_PWM_FRAC 0x6A/* Enable or disable Fractional PWM */ #define MASTER_COMM_CNTL_REG__MASTER_COMM_INTERRUPT_MASK 0x00000001Lstatic bool dce_dmcu_init (struct dmcu *dmcu)
@@ -339,9 +340,32 @@ static void dcn10_get_dmcu_version(struct dmcu *dmcu) IRAM_RD_ADDR_AUTO_INC, 0); } +static void dcn10_dmcu_enable_fractional_pwm (struct dmcu *dmcu, +uint32_t fractional_pwm) +{ +struct dce_dmcu *dmcu_dce =TO_DCE_DMCU (dmcu); + +/* Wait until microcontroller is ready to process interrupt */ +REG_WAIT (MASTER_COMM_CNTL_REG ,MASTER_COMM_INTERRUPT ,0 ,100 ,800 ); + +/* Set PWM fractional enable/disable */ +REG_WRITE (MASTER_COMM_DATA_REG1 , fractional_pwm); + +/* Set command to enable or disable fractional PWM microcontroller */ +REG_UPDATE (MASTER_COMM_CMD_REG ,MASTER_COMM_CMD_REG_BYTE0 , +MCP_BL_SET_PWM_FRAC ); + +/* Notify microcontroller of new command */ +REG_UPDATE (MASTER_COMM_CNTL_REG ,MASTER_COMM_INTERRUPT ,1 ); + +/* Ensure command has been executed before continuing */ +REG_WAIT (MASTER_COMM_CNTL_REG ,MASTER_COMM_INTERRUPT ,0 ,100 ,800 ); +} +static bool dcn10_dmcu_init (struct dmcu *dmcu) {struct dce_dmcu *dmcu_dce =TO_DCE_DMCU (dmcu); +const struct dc_config *config = &dmcu->ctx->dc->config;bool status = false;/* Definition of DC_DMCU_SCRATCH
@@ -379,9 +403,14 @@ static bool dcn10_dmcu_init(struct dmcu *dmcu)if (dmcu->dmcu_state ==DMCU_RUNNING ) {/* Retrieve and cache the DMCU firmware version. */ dcn10_get_dmcu_version (dmcu); + +/* Initialize DMCU to use fractional PWM or not */ +dcn10_dmcu_enable_fractional_pwm (dmcu, + (config->disable_fractional_pwm == false) ?1 :0 ); status = true; - }else + }else { status = false; + }break ;case DMCU_RUNNING :
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/18 drm/amd/display: Fix eDP Black screen after S4 resume
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
[Why]
Power down of PHY on eDP requires us to call eDP power control to power on again
[How]
1. In the case link rates don't match, disable PHY requires calling of eDP power control ON after
2. Link disable case limit to eDP path since this is not really applicable to DP since we do power down PHY as part of verify link cap
3. Move detection of eDP link settings to be done even for S4 resume cases where other dpcd cap read and edid read can be skipped
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 71 ++++++++++++++++++------ drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 30 ---------- 2 files changed, 55 insertions(+), 46 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +55 -16
@@ -514,6 +514,40 @@ static void link_disconnect_remap(struct dc_sink *prev_sink, struct dc_link *lin } +static void read_edp_current_link_settings_on_detect (struct dc_link *link) +{ +union lane_count_set lane_count_set = { {0 } }; +uint8_t link_bw_set; +uint8_t link_rate_set; + +// Read DPCD 00101h to find out the number of lanes currently set +core_link_read_dpcd (link,DP_LANE_COUNT_SET , + &lane_count_set.raw,sizeof (lane_count_set)); + link->cur_link_settings.lane_count = lane_count_set.bits.LANE_COUNT_SET; + +// Read DPCD 00100h to find if standard link rates are set +core_link_read_dpcd (link,DP_LINK_BW_SET , + &link_bw_set,sizeof (link_bw_set)); + +if (link_bw_set ==0 ) { +/* If standard link rates are not being used, +* Read DPCD 00115h to find the link rate set used +*/ +core_link_read_dpcd (link,DP_LINK_RATE_SET , + &link_rate_set,sizeof (link_rate_set)); + +if (link_rate_set < link->dpcd_caps.edp_supported_link_rates_count) { + link->cur_link_settings.link_rate = + link->dpcd_caps.edp_supported_link_rates[link_rate_set]; + link->cur_link_settings.link_rate_set = link_rate_set; + link->cur_link_settings.use_link_rate_set = true; + } + }else { + link->cur_link_settings.link_rate = link_bw_set; + link->cur_link_settings.use_link_rate_set = false; + } +} + static bool detect_dp( struct dc_link *link, struct display_sink_capability *sink_caps,
@@ -648,9 +682,14 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)return false; } -if (link->connector_signal ==SIGNAL_TYPE_EDP && - link->local_sink) -return true; +if (link->connector_signal ==SIGNAL_TYPE_EDP ) { +/* On detect, we want to make sure current link settings are +* up to date, especially if link was powered on by GOP. +*/ +read_edp_current_link_settings_on_detect (link); +if (link->local_sink) +return true; + }if (link->connector_signal ==SIGNAL_TYPE_LVDS && link->local_sink)
@@ -1396,13 +1435,19 @@ static enum dc_status enable_link_dp(/* get link settings for video mode timing */ decide_link_settings (stream, &link_settings); -/* If link settings are different than current and link already enabled -* then need to disable before programming to new rate. -*/ -if (link->link_status.link_active && - (link->cur_link_settings.lane_count != link_settings.lane_count || - link->cur_link_settings.link_rate != link_settings.link_rate)) { -dp_disable_link_phy (link, pipe_ctx->stream->signal); +if (pipe_ctx->stream->signal ==SIGNAL_TYPE_EDP ) { +/* If link settings are different than current and link already enabled +* then need to disable before programming to new rate. +*/ +if (link->link_status.link_active && + (link->cur_link_settings.lane_count != link_settings.lane_count || + link->cur_link_settings.link_rate != link_settings.link_rate)) { +dp_disable_link_phy (link, pipe_ctx->stream->signal); + } + +/*in case it is not on*/ + link->dc->hwss.edp_power_control (link, true); + link->dc->hwss.edp_wait_for_hpd_ready (link, true); } pipe_ctx->stream_res.pix_clk_params.requested_sym_clk =
@@ -1448,15 +1493,9 @@ static enum dc_status enable_link_edp( struct pipe_ctx *pipe_ctx) {enum dc_status status; -struct dc_stream_state *stream = pipe_ctx->stream; -struct dc_link *link = stream->link; -/*in case it is not on*/ - link->dc->hwss.edp_power_control (link, true); - link->dc->hwss.edp_wait_for_hpd_ready (link, true); status =enable_link_dp (state, pipe_ctx); -return status; }
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +0 -30
@@ -2586,9 +2586,6 @@ void detect_edp_sink_caps(struct dc_link *link)uint32_t entry;uint32_t link_rate_in_khz;enum dc_link_rate link_rate =LINK_RATE_UNKNOWN ; -union lane_count_set lane_count_set = { {0 } }; -uint8_t link_bw_set; -uint8_t link_rate_set;retrieve_link_cap (link); link->dpcd_caps.edp_supported_link_rates_count =0 ;
@@ -2614,33 +2611,6 @@ void detect_edp_sink_caps(struct dc_link *link) } } link->verified_link_cap = link->reported_link_cap; - -// Read DPCD 00101h to find out the number of lanes currently set -core_link_read_dpcd (link,DP_LANE_COUNT_SET , - &lane_count_set.raw,sizeof (lane_count_set)); - link->cur_link_settings.lane_count = lane_count_set.bits.LANE_COUNT_SET; - -// Read DPCD 00100h to find if standard link rates are set -core_link_read_dpcd (link,DP_LINK_BW_SET , - &link_bw_set,sizeof (link_bw_set)); - -if (link_bw_set ==0 ) { -/* If standard link rates are not being used, -* Read DPCD 00115h to find the link rate set used -*/ -core_link_read_dpcd (link,DP_LINK_RATE_SET , - &link_rate_set,sizeof (link_rate_set)); - -if (link_rate_set < link->dpcd_caps.edp_supported_link_rates_count) { - link->cur_link_settings.link_rate = - link->dpcd_caps.edp_supported_link_rates[link_rate_set]; - link->cur_link_settings.link_rate_set = link_rate_set; - link->cur_link_settings.use_link_rate_set = true; - } - }else { - link->cur_link_settings.link_rate = link_bw_set; - link->cur_link_settings.use_link_rate_set = false; - } }void dc_link_dp_enable_hpd (const struct dc_link *link)
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/18 drm/amd/display: 3.2.27
In reply to a message not in the archiveFrom: Aric Cyr <[email protected]>
--- 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
@@ -42,7 +42,7 @@#include "inc/hw/dmcu.h" #include "dml/display_mode_lib.h" -#define DC_VER "3.2.26" +#define DC_VER "3.2.27"#define MAX_SURFACES 3#define MAX_PLANES 6
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/18 drm/amd/display: Allow cursor position when plane_res.ipp is NULL
In reply to a message not in the archiveFrom: Eric Bernstein <[email protected]>
[Why]
Starting with DCN1, the input_pixel_processor (ipp) struct has been replaced by dpp struct (part of DAL3.1 SW architecture change). Need to update logic to handle cases where ipp is never allocated.
[How]
Only skip cursor position programming if both ipp and dpp resources are NULL.
--- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +1 -1
@@ -333,7 +333,7 @@ bool dc_stream_set_cursor_position( (!pipe_ctx->plane_res.mi && !pipe_ctx->plane_res.hubp) || !pipe_ctx->plane_state || (!pipe_ctx->plane_res.xfm && !pipe_ctx->plane_res.dpp) || - !pipe_ctx->plane_res.ipp) + (!pipe_ctx->plane_res.ipp && !pipe_ctx->plane_res.dpp)) continue;if (!pipe_to_program) {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/18 drm/amd/display: add explicit handshake between x86 and DMCU
In reply to a message not in the archiveFrom: Jun Lei <[email protected]>
[why]
When DMCU interrupts x86, it leads to undefined phy programming
[how]
expand dmcu interface to support new PHY lock and unlock commands if DMCU FW doesn't support these commands, they fail silently so its okay
--- drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 21 ++++++++++++++++++++- drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c | 4 +++- drivers/gpu/drm/amd/display/dc/inc/hw/dmcu.h | 2 ++ 3 files changed, 25 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +20 -1
@@ -58,6 +58,8 @@ void dp_enable_link_phy( const struct dc_link_settings *link_settings) {struct link_encoder *link_enc = link->link_enc; +struct dc *core_dc = link->ctx->dc; +struct dmcu *dmcu = core_dc->res_pool->dmcu;struct pipe_ctx *pipes = link->dc->current_state->res_ctx.pipe_ctx;
@@ -84,6 +86,9 @@ void dp_enable_link_phy( } } +if (dmcu !=NULL && dmcu->funcs->lock_phy) + dmcu->funcs->lock_phy (dmcu); +if (dc_is_dp_sst_signal (signal)) { link_enc->funcs->enable_dp_output( link_enc,
@@ -95,6 +100,10 @@ void dp_enable_link_phy( link_settings, clock_source); } + +if (dmcu !=NULL && dmcu->funcs->unlock_phy) + dmcu->funcs->unlock_phy (dmcu); + link->cur_link_settings = *link_settings;dp_receiver_power_ctrl (link, true);
@@ -150,15 +159,25 @@ bool edp_receiver_ready_T7(struct dc_link *link)void dp_disable_link_phy (struct dc_link *link,enum signal_type signal) { +struct dc *core_dc = link->ctx->dc; +struct dmcu *dmcu = core_dc->res_pool->dmcu; +if (!link->wa_flags.dp_keep_receiver_powered)dp_receiver_power_ctrl (link, false);if (signal ==SIGNAL_TYPE_EDP ) { link->link_enc->funcs->disable_output (link->link_enc, signal); link->dc->hwss.edp_power_control (link, false); - }else + }else { +if (dmcu !=NULL && dmcu->funcs->lock_phy) + dmcu->funcs->lock_phy (dmcu); + link->link_enc->funcs->disable_output (link->link_enc, signal); +if (dmcu !=NULL && dmcu->funcs->unlock_phy) + dmcu->funcs->unlock_phy (dmcu); + } +/* Clear current link setting.*/ memset (&link->cur_link_settings,0 ,sizeof (link->cur_link_settings));
drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c +3 -1
@@ -51,6 +51,8 @@#define PSR_SET_WAITLOOP 0x31#define MCP_INIT_DMCU 0x88#define MCP_INIT_IRAM 0x89 +#define MCP_SYNC_PHY_LOCK 0x90 +#define MCP_SYNC_PHY_UNLOCK 0x91#define MCP_BL_SET_PWM_FRAC 0x6A/* Enable or disable Fractional PWM */ #define MASTER_COMM_CNTL_REG__MASTER_COMM_INTERRUPT_MASK 0x00000001L
@@ -719,7 +721,7 @@ static bool dcn10_is_dmcu_initialized(struct dmcu *dmcu)return true; } -#endif +#endif //(CONFIG_DRM_AMD_DC_DCN1_0) static const struct dmcu_funcs dce_funcs = { .dmcu_init = dce_dmcu_init,
drivers/gpu/drm/amd/display/dc/inc/hw/dmcu.h +2 -0
@@ -70,6 +70,8 @@ struct dmcu_funcs {void (*get_psr_wait_loop)(struct dmcu *dmcu,unsigned int *psr_wait_loop_number);bool (*is_dmcu_initialized)(struct dmcu *dmcu); +bool (*lock_phy)(struct dmcu *dmcu); + bool (*unlock_phy)(struct dmcu *dmcu); };#endif
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/18 drm/amd/display: Refactor CRTC interrupt toggling logic
In reply to a message not in the archiveFrom: Nicholas Kazlauskas <[email protected]>
[Why]
The vblank and pageflip interrupts should only be enabled for a CRTC that's enabled and has active planes.
The current logic takes care of this, but isn't setup to handle the case where the active plane count goes to zero but the stream remains enabled.
We currently block this case since we don't allow commits that enable a CRTC with no active planes, but shouldn't be any reason we can't support this from a hardware perspective and many userspace applications expect to be able to do it (like IGT).
[How]
The count_crtc_active_planes function fills in the number of "active_planes" on the dm_crtc_state. This should be the same as DC's plane_count on the stream_status but easier to access since we don't need to lock the private atomic state with the DC context.
Add the "interrupts_enabled" flag to the dm_crtc_state and set it based on whether the stream exists and if there are active planes on the stream.
Update the disable and enable logic to make use of this new flag.
There shouldn't be any functional change (yet) with this patch.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 86 +++++++++++++++++------ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 3 + 2 files changed, 68 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +65 -21
@@ -3511,6 +3511,8 @@ dm_crtc_duplicate_state(struct drm_crtc *crtc)dc_stream_retain (state->stream); } + state->active_planes = cur->active_planes; + state->interrupts_enabled = cur->interrupts_enabled; state->vrr_params = cur->vrr_params; state->vrr_infopacket = cur->vrr_infopacket; state->abm_level = cur->abm_level;
@@ -3948,7 +3950,7 @@ static void dm_crtc_helper_disable(struct drm_crtc *crtc) { } -static bool does_crtc_have_active_plane (struct drm_crtc_state *new_crtc_state) +static int count_crtc_active_planes (struct drm_crtc_state *new_crtc_state) {struct drm_atomic_state *state = new_crtc_state->state;struct drm_plane *plane;
@@ -3977,7 +3979,32 @@ static bool does_crtc_have_active_plane(struct drm_crtc_state *new_crtc_state) num_active += (new_plane_state->fb !=NULL ); } -return num_active >0 ; +return num_active; +} + +/* +* Sets whether interrupts should be enabled on a specific CRTC. +* We require that the stream be enabled and that there exist active +* DC planes on the stream. +*/ +static void +dm_update_crtc_interrupt_state (struct drm_crtc *crtc, +struct drm_crtc_state *new_crtc_state) +{ +struct dm_crtc_state *dm_new_crtc_state = +to_dm_crtc_state (new_crtc_state); + + dm_new_crtc_state->active_planes =0 ; + dm_new_crtc_state->interrupts_enabled = false; + +if (!dm_new_crtc_state->stream) +return ; + + dm_new_crtc_state->active_planes = +count_crtc_active_planes (new_crtc_state); + + dm_new_crtc_state->interrupts_enabled = + dm_new_crtc_state->active_planes >0 ; } static int dm_crtc_helper_atomic_check(struct drm_crtc *crtc,
@@ -3988,6 +4015,14 @@ static int dm_crtc_helper_atomic_check(struct drm_crtc *crtc,struct dm_crtc_state *dm_crtc_state =to_dm_crtc_state (state);int ret = -EINVAL ; +/* +* Update interrupt state for the CRTC. This needs to happen whenever +* the CRTC has changed or whenever any of its planes have changed. +* Atomic check satisfies both of these requirements since the CRTC +* is added to the state by DRM during drm_atomic_helper_check_planes. +*/ +dm_update_crtc_interrupt_state (crtc, state); +if (unlikely (!dm_crtc_state->stream &&modeset_required (state,NULL , dm_crtc_state->stream))) {WARN_ON (1 );
@@ -4000,7 +4035,7 @@ static int dm_crtc_helper_atomic_check(struct drm_crtc *crtc,/* We want at least one hardware plane enabled to use the stream. */ if (state->enable && state->active && - !does_crtc_have_active_plane (state)) + dm_crtc_state->active_planes ==0 )return -EINVAL ;if (dc_validate_stream (dc, dm_crtc_state->stream) ==DC_OK )
@@ -5475,24 +5510,33 @@ static int amdgpu_dm_atomic_commit(struct drm_device *dev,int i;/* -* We evade vblanks and pflips on crtc that -* should be changed. We do it here to flush & disable -* interrupts before drm_swap_state is called in drm_atomic_helper_commit -* it will update crtc->dm_crtc_state->stream pointer which is used in -* the ISRs. +* We evade vblank and pflip interrupts on CRTCs that are undergoing +* a modeset, being disabled, or have no active planes. +* +* It's done in atomic commit rather than commit tail for now since +* some of these interrupt handlers access the current CRTC state and +* potentially the stream pointer itself. +* +* Since the atomic state is swapped within atomic commit and not within +* commit tail this would leave to new state (that hasn't been committed yet) +* being accesssed from within the handlers. +* +* TODO: Fix this so we can do this in commit tail and not have to block +* in atomic check. */ for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {struct dm_crtc_state *dm_old_crtc_state =to_dm_crtc_state (old_crtc_state);struct dm_crtc_state *dm_new_crtc_state =to_dm_crtc_state (new_crtc_state);struct amdgpu_crtc *acrtc =to_amdgpu_crtc (crtc); -if (drm_atomic_crtc_needs_modeset (new_crtc_state) - && dm_old_crtc_state->stream) { +if (dm_old_crtc_state->interrupts_enabled && + (!dm_new_crtc_state->interrupts_enabled || +drm_atomic_crtc_needs_modeset (new_crtc_state))) {/* * If the stream is removed and CRC capture was * enabled on the CRTC the extra vblank reference -* needs to be dropped since CRC capture will be -* disabled. +* needs to be dropped since CRC capture will not +* be re-enabled. */ if (!dm_new_crtc_state->stream && dm_new_crtc_state->crc_enabled) {
@@ -5720,13 +5764,14 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)pre_update_freesync_state_on_stream (dm, dm_new_crtc_state); } +/* +* Enable interrupts on CRTCs that are newly active, undergone +* a modeset, or have active planes again. +*/ for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { -/* -* loop to enable interrupts on newly arrived crtc -*/ struct amdgpu_crtc *acrtc =to_amdgpu_crtc (crtc); -bool modeset_needed; +bool enable;if (old_crtc_state->active && !new_crtc_state->active) crtc_disable_count++;
@@ -5738,12 +5783,11 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)amdgpu_dm_handle_vrr_transition (dm_old_crtc_state, dm_new_crtc_state); - modeset_needed =modeset_required ( - new_crtc_state, - dm_new_crtc_state->stream, - dm_old_crtc_state->stream); + enable = dm_new_crtc_state->interrupts_enabled && + (!dm_old_crtc_state->interrupts_enabled || +drm_atomic_crtc_needs_modeset (new_crtc_state)); -if (dm_new_crtc_state->stream ==NULL || !modeset_needed) +if (!enable)continue ;manage_dm_interrupts (adev, acrtc, true);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +3 -0
@@ -271,6 +271,9 @@ struct dm_crtc_state {struct drm_crtc_state base;struct dc_stream_state *stream; +int active_planes; +bool interrupts_enabled; +int crc_skip_count;bool crc_enabled;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/18 drm/amd/display: Disable cursors before disabling planes
In reply to a message not in the archiveFrom: Nicholas Kazlauskas <[email protected]>
[Why]
We can't do cursor programming after the planes have been disabled since there won't be any pipes - leading to lock warnings and the wrong cursor state being left in the registers.
When we re-enable the planes after the previous cursor state will also remain if we don't have a cursor plane.
[How]
If we're disabling the planes then do the cursor programming first. If we're not disabling the planes then do the cursor programming after.
Introduce the amdgpu_dm_commit_cursors helper to avoid code duplication for both of these cases.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 34 +++++++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +31 -3
@@ -5249,6 +5249,22 @@ static void amdgpu_dm_handle_vrr_transition(struct dm_crtc_state *old_state, } } +static void amdgpu_dm_commit_cursors (struct drm_atomic_state *state) +{ +struct drm_plane *plane; +struct drm_plane_state *old_plane_state, *new_plane_state; +int i; + +/* +* TODO: Make this per-stream so we don't issue redundant updates for +* commits with multiple streams. +*/ +for_each_oldnew_plane_in_state (state, plane, old_plane_state, + new_plane_state, i) +if (plane->type ==DRM_PLANE_TYPE_CURSOR ) +handle_cursor_update (plane, old_plane_state); +} + static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, struct dc_state *dc_state, struct drm_device *dev,
@@ -5288,6 +5304,14 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, goto cleanup; } +/* +* Disable the cursor first if we're disabling all the planes. +* It'll remain on the screen after the planes are re-enabled +* if we don't. +*/ +if (acrtc_state->active_planes ==0 ) +amdgpu_dm_commit_cursors (state); +/* update planes when needed */ for_each_oldnew_plane_in_state (state, plane, old_plane_state, new_plane_state, i) {struct drm_crtc *crtc = new_plane_state->crtc;
@@ -5478,9 +5502,13 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,mutex_unlock (&dm->dc_lock); } -for_each_oldnew_plane_in_state (state, plane, old_plane_state, new_plane_state, i) -if (plane->type ==DRM_PLANE_TYPE_CURSOR ) -handle_cursor_update (plane, old_plane_state); +/* +* Update cursor state *after* programming all the planes. +* This avoids redundant programming in the case where we're going +* to be disabling a single plane - those pipes are being disabled. +*/ +if (acrtc_state->active_planes) +amdgpu_dm_commit_cursors (state); cleanup:kfree (bundle);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/18 drm/amd/display: Fix CRC vblank refs when changing interrupts
In reply to a message not in the archiveFrom: Nicholas Kazlauskas <[email protected]>
[Why]
We only currently drop the vblank reference when the stream is being removed from the context. We should be dropping it whenever we disable interrupts and reaquiring it after we re-enable them.
We also never get the extra reference correctly when re-enabling interrupts, since grabbing the reference has the following condition:
if (!crtc_state->crc_enabled && enable)
drm_crtc_vblank_get(crtc);
This means that crc_enabled must be *false* in order to grab the extra reference.
[How]
Always drop the ref whenever we're disabling interrupts.
Only disable CRC capture when the stream is being removed.
Always grab the ref by setting dm_new_crtc_state->crc_enabled = false before the call to re-enable CRC capture.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +12 -8
@@ -5561,16 +5561,18 @@ static int amdgpu_dm_atomic_commit(struct drm_device *dev, (!dm_new_crtc_state->interrupts_enabled || drm_atomic_crtc_needs_modeset(new_crtc_state))) {/* -* If the stream is removed and CRC capture was -* enabled on the CRTC the extra vblank reference -* needs to be dropped since CRC capture will not -* be re-enabled. +* Drop the extra vblank reference added by CRC +* capture if applicable. */ -if (!dm_new_crtc_state->stream - && dm_new_crtc_state->crc_enabled) { +if (dm_new_crtc_state->crc_enabled)drm_crtc_vblank_put (crtc); + +/* +* Only keep CRC capture enabled if there's +* still a stream for the CRTC. +*/ +if (!dm_new_crtc_state->stream) dm_new_crtc_state->crc_enabled = false; - }manage_dm_interrupts (adev, acrtc, false); }
@@ -5822,8 +5824,10 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)#ifdef CONFIG_DEBUG_FS /* The stream has changed so CRC capture needs to re-enabled. */ -if (dm_new_crtc_state->crc_enabled) +if (dm_new_crtc_state->crc_enabled) { + dm_new_crtc_state->crc_enabled = false;amdgpu_dm_crtc_set_crc_source (crtc,"auto" ); + }#endif }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 11/18 drm/amd/display: Split enabling CRTC interrupts into two passes
In reply to a message not in the archiveFrom: Nicholas Kazlauskas <[email protected]>
[Why]
When disabling all the pipes for a CRTC the page-flip interrupt also gets disabled on Raven. We can't re-enable the page-flip interrupt unless we give DC at least one active DC plane.
We currently enable interrupts after the call to dc_commit_state since there's currently no valid sequence that should disable all the planes or re-enable planes for a CRTC without first going through dc_commit_state.
If we were to allow for a CRTC to be enabled with no primary plane this would not be the case - the call to dc_commit_updates_for_stream would enable the planes when going from zero to at least one active plane, but manage_dm_interrupts would have been called too early.
This results in a page-flip timeout on any subsequent commits since we think the page-flip are now enabled when they're actually disabled.
We need to enable interrupts after the call todc_commit_updates_for_stream.
[How]
Split enabling interrupts into two passes. One pass before dc_commit_updates_for_stream and one after it.
Shifting all the interrupts to be strictly below the call doesn't currently work even though it should in theory. We end up queuing off the vblank event to be handle by the flip handler before it's actually enabled in some cases, particularly:
old_crtc_state->active = false -> new_crtc_state->active = true
The framebuffer states haven't changed and we can technically still do a "pageflip" in this case and send back the event.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 95 +++++++++++++++-------- 1 file changed, 63 insertions(+), 32 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +63 -32
@@ -5515,6 +5515,63 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, }/* +* Enable interrupts on CRTCs that are newly active, undergone +* a modeset, or have active planes again. +* +* Done in two passes, based on the for_modeset flag: +* Pass 1: For CRTCs going through modeset +* Pass 2: For CRTCs going from 0 to n active planes +* +* Interrupts can only be enabled after the planes are programmed, +* so this requires a two-pass approach since we don't want to +* just defer the interrupts until after commit planes every time. +*/ +static void amdgpu_dm_enable_crtc_interrupts (struct drm_device *dev, +struct drm_atomic_state *state, +bool for_modeset) +{ +struct amdgpu_device *adev = dev->dev_private; +struct drm_crtc *crtc; +struct drm_crtc_state *old_crtc_state, *new_crtc_state; +int i; + +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, + new_crtc_state, i) { +struct amdgpu_crtc *acrtc =to_amdgpu_crtc (crtc); +struct dm_crtc_state *dm_new_crtc_state = +to_dm_crtc_state (new_crtc_state); +struct dm_crtc_state *dm_old_crtc_state = +to_dm_crtc_state (old_crtc_state); +bool modeset =drm_atomic_crtc_needs_modeset (new_crtc_state); +bool run_pass; + + run_pass = (for_modeset && modeset) || + (!for_modeset && !modeset && + !dm_old_crtc_state->interrupts_enabled); + +if (!run_pass) +continue ; + +/* Handle vrr on->off / off->on transitions */ +amdgpu_dm_handle_vrr_transition (dm_old_crtc_state, + dm_new_crtc_state); + +if (!dm_new_crtc_state->interrupts_enabled) +continue ; + +manage_dm_interrupts (adev, acrtc, true); + +#ifdef CONFIG_DEBUG_FS +/* The stream has changed so CRC capture needs to re-enabled. */ +if (dm_new_crtc_state->crc_enabled) { + dm_new_crtc_state->crc_enabled = false; +amdgpu_dm_crtc_set_crc_source (crtc,"auto" ); + } +#endif + } +} + +/* * amdgpu_dm_crtc_copy_transient_flags - copy mirrored flags from DRM to DC * @crtc_state: the DRM CRTC state * @stream_state: the DC stream state.
@@ -5794,42 +5851,14 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)pre_update_freesync_state_on_stream (dm, dm_new_crtc_state); } -/* -* Enable interrupts on CRTCs that are newly active, undergone -* a modeset, or have active planes again. -*/ +/* Count number of newly disabled CRTCs for dropping PM refs later. */ for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, - new_crtc_state, i) { -struct amdgpu_crtc *acrtc =to_amdgpu_crtc (crtc); -bool enable; - + new_crtc_state, i)if (old_crtc_state->active && !new_crtc_state->active) crtc_disable_count++; - dm_new_crtc_state =to_dm_crtc_state (new_crtc_state); - dm_old_crtc_state =to_dm_crtc_state (old_crtc_state); - -/* Handle vrr on->off / off->on transitions */ -amdgpu_dm_handle_vrr_transition (dm_old_crtc_state, - dm_new_crtc_state); - - enable = dm_new_crtc_state->interrupts_enabled && - (!dm_old_crtc_state->interrupts_enabled || -drm_atomic_crtc_needs_modeset (new_crtc_state)); - -if (!enable) -continue ; - -manage_dm_interrupts (adev, acrtc, true); - -#ifdef CONFIG_DEBUG_FS -/* The stream has changed so CRC capture needs to re-enabled. */ -if (dm_new_crtc_state->crc_enabled) { - dm_new_crtc_state->crc_enabled = false; -amdgpu_dm_crtc_set_crc_source (crtc,"auto" ); - } -#endif - } +/* Enable interrupts for CRTCs going through a modeset. */ +amdgpu_dm_enable_crtc_interrupts (dev, state, true);for_each_new_crtc_in_state (state, crtc, new_crtc_state, j)if (new_crtc_state->pageflip_flags &DRM_MODE_PAGE_FLIP_ASYNC )
@@ -5844,6 +5873,8 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) dm, crtc, wait_for_vblank); } +/* Enable interrupts for CRTCs going from 0 to n active planes. */ +amdgpu_dm_enable_crtc_interrupts (dev, state, false);/* * send vblank event on all events not handled in flip and
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 12/18 drm/amd/display: Allow commits with no planes active
In reply to a message not in the archiveFrom: Nicholas Kazlauskas <[email protected]>
[Why]
Many userspace applications (and IGT) seem to expect that most drivers can keep a CRTC active and enabled if there are no primary or overlay planes.
DC is setup to handle this but only in the case where there are absolutely no planes on the CRTC - no primary, cursor, or overlay.
[How]
Add a check to reject commits that have cursor planes enabled and nothing else on CRTCs since we can't handle that. The new helper does_crtc_have_active_cursor is used for this.
In atomic commit tail, we need to let DC know that there are zero planes enabled when doing stream updates to let it disable and blank pipes as appropriate.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +20 -2
@@ -3950,6 +3950,19 @@ static void dm_crtc_helper_disable(struct drm_crtc *crtc) { } +static bool does_crtc_have_active_cursor (struct drm_crtc_state *new_crtc_state) +{ +struct drm_device *dev = new_crtc_state->crtc->dev; +struct drm_plane *plane; + +drm_for_each_plane_mask (plane, dev, new_crtc_state->plane_mask) { +if (plane->type ==DRM_PLANE_TYPE_CURSOR ) +return true; + } + +return false; +} +static int count_crtc_active_planes (struct drm_crtc_state *new_crtc_state) {struct drm_atomic_state *state = new_crtc_state->state;
@@ -4033,8 +4046,12 @@ static int dm_crtc_helper_atomic_check(struct drm_crtc *crtc,if (!dm_crtc_state->stream)return 0 ; -/* We want at least one hardware plane enabled to use the stream. */ +/* +* We want at least one hardware plane enabled to use +* the stream with a cursor enabled. +*/ if (state->enable && state->active && +does_crtc_have_active_cursor (state) && dm_crtc_state->active_planes ==0 )return -EINVAL ;
@@ -5479,7 +5496,8 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, } } -if (planes_count) { +/* Update the planes if changed or disable if we don't have any. */ +if (planes_count || acrtc_state->active_planes ==0 ) {if (new_pcrtc_state->mode_changed) { bundle->stream_update.src = acrtc_state->stream->src; bundle->stream_update.dst = acrtc_state->stream->dst;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 13/18 drm/amd/display: Refactor watermark programming
In reply to a message not in the archiveFrom: Yongqiang Sun <[email protected]>
* Replace certain register writes with register sets that overwrites the the entire register, instead of only a field within the register.
* Add program_watermarks() entry to hubbub vtable. Hook it up to existing functions that program watermarks.
* Add additional watermark registers.
--- .../gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c | 49 +++++++++++------ .../gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.h | 63 ++++++++++++++++++---- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 8 ++- drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 6 +++ 4 files changed, 97 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c +33 -16
@@ -283,7 +283,8 @@ void hubbub1_program_watermarks( hubbub1->watermarks.a.urgent_ns = watermarks->a.urgent_ns; prog_wm_value =convert_and_clamp (watermarks->a.urgent_ns, refclk_mhz,0x1fffff ); -REG_WRITE (DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_A , prog_wm_value); +REG_SET (DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_A ,0 , +DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_A , prog_wm_value); DC_LOG_BANDWIDTH_CALCS("URGENCY_WATERMARK_A calculated =%d\n" "HW register value = 0x%x\n",
@@ -310,7 +311,8 @@ void hubbub1_program_watermarks( prog_wm_value =convert_and_clamp ( watermarks->a.cstate_pstate.cstate_enter_plus_exit_ns, refclk_mhz,0x1fffff ); -REG_WRITE (DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_A , prog_wm_value); +REG_SET (DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_A ,0 , +DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_A , prog_wm_value);DC_LOG_BANDWIDTH_CALCS ("SR_ENTER_EXIT_WATERMARK_A calculated =%d\n" "HW register value = 0x%x\n" , watermarks->a.cstate_pstate.cstate_enter_plus_exit_ns, prog_wm_value);
@@ -323,7 +325,8 @@ void hubbub1_program_watermarks( prog_wm_value =convert_and_clamp ( watermarks->a.cstate_pstate.cstate_exit_ns, refclk_mhz,0x1fffff ); -REG_WRITE (DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_A , prog_wm_value); +REG_SET (DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_A ,0 , +DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_A , prog_wm_value);DC_LOG_BANDWIDTH_CALCS ("SR_EXIT_WATERMARK_A calculated =%d\n" "HW register value = 0x%x\n" , watermarks->a.cstate_pstate.cstate_exit_ns, prog_wm_value);
@@ -337,7 +340,8 @@ void hubbub1_program_watermarks( prog_wm_value =convert_and_clamp ( watermarks->a.cstate_pstate.pstate_change_ns, refclk_mhz,0x1fffff ); -REG_WRITE (DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_A , prog_wm_value); +REG_SET (DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_A ,0 , +DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_A , prog_wm_value);DC_LOG_BANDWIDTH_CALCS ("DRAM_CLK_CHANGE_WATERMARK_A calculated =%d\n" "HW register value = 0x%x\n\n" , watermarks->a.cstate_pstate.pstate_change_ns, prog_wm_value);
@@ -348,7 +352,8 @@ void hubbub1_program_watermarks( hubbub1->watermarks.b.urgent_ns = watermarks->b.urgent_ns; prog_wm_value =convert_and_clamp (watermarks->b.urgent_ns, refclk_mhz,0x1fffff ); -REG_WRITE (DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_B , prog_wm_value); +REG_SET (DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_B ,0 , +DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_B , prog_wm_value); DC_LOG_BANDWIDTH_CALCS("URGENCY_WATERMARK_B calculated =%d\n" "HW register value = 0x%x\n",
@@ -375,7 +380,8 @@ void hubbub1_program_watermarks( prog_wm_value =convert_and_clamp ( watermarks->b.cstate_pstate.cstate_enter_plus_exit_ns, refclk_mhz,0x1fffff ); -REG_WRITE (DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_B , prog_wm_value); +REG_SET (DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_B ,0 , +DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_B , prog_wm_value);DC_LOG_BANDWIDTH_CALCS ("SR_ENTER_EXIT_WATERMARK_B calculated =%d\n" "HW register value = 0x%x\n" , watermarks->b.cstate_pstate.cstate_enter_plus_exit_ns, prog_wm_value);
@@ -388,7 +394,8 @@ void hubbub1_program_watermarks( prog_wm_value =convert_and_clamp ( watermarks->b.cstate_pstate.cstate_exit_ns, refclk_mhz,0x1fffff ); -REG_WRITE (DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_B , prog_wm_value); +REG_SET (DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_B ,0 , +DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_B , prog_wm_value);DC_LOG_BANDWIDTH_CALCS ("SR_EXIT_WATERMARK_B calculated =%d\n" "HW register value = 0x%x\n" , watermarks->b.cstate_pstate.cstate_exit_ns, prog_wm_value);
@@ -402,7 +409,8 @@ void hubbub1_program_watermarks( prog_wm_value =convert_and_clamp ( watermarks->b.cstate_pstate.pstate_change_ns, refclk_mhz,0x1fffff ); -REG_WRITE (DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_B , prog_wm_value); +REG_SET (DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_B ,0 , +DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_B , prog_wm_value);DC_LOG_BANDWIDTH_CALCS ("DRAM_CLK_CHANGE_WATERMARK_B calculated =%d\n" "HW register value = 0x%x\n\n" , watermarks->b.cstate_pstate.pstate_change_ns, prog_wm_value);
@@ -413,7 +421,8 @@ void hubbub1_program_watermarks( hubbub1->watermarks.c.urgent_ns = watermarks->c.urgent_ns; prog_wm_value =convert_and_clamp (watermarks->c.urgent_ns, refclk_mhz,0x1fffff ); -REG_WRITE (DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_C , prog_wm_value); +REG_SET (DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_C ,0 , +DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_C , prog_wm_value); DC_LOG_BANDWIDTH_CALCS("URGENCY_WATERMARK_C calculated =%d\n" "HW register value = 0x%x\n",
@@ -440,7 +449,8 @@ void hubbub1_program_watermarks( prog_wm_value =convert_and_clamp ( watermarks->c.cstate_pstate.cstate_enter_plus_exit_ns, refclk_mhz,0x1fffff ); -REG_WRITE (DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_C , prog_wm_value); +REG_SET (DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_C ,0 , +DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_C , prog_wm_value);DC_LOG_BANDWIDTH_CALCS ("SR_ENTER_EXIT_WATERMARK_C calculated =%d\n" "HW register value = 0x%x\n" , watermarks->c.cstate_pstate.cstate_enter_plus_exit_ns, prog_wm_value);
@@ -453,7 +463,8 @@ void hubbub1_program_watermarks( prog_wm_value =convert_and_clamp ( watermarks->c.cstate_pstate.cstate_exit_ns, refclk_mhz,0x1fffff ); -REG_WRITE (DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_C , prog_wm_value); +REG_SET (DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_C ,0 , +DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_C , prog_wm_value);DC_LOG_BANDWIDTH_CALCS ("SR_EXIT_WATERMARK_C calculated =%d\n" "HW register value = 0x%x\n" , watermarks->c.cstate_pstate.cstate_exit_ns, prog_wm_value);
@@ -467,7 +478,8 @@ void hubbub1_program_watermarks( prog_wm_value =convert_and_clamp ( watermarks->c.cstate_pstate.pstate_change_ns, refclk_mhz,0x1fffff ); -REG_WRITE (DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_C , prog_wm_value); +REG_SET (DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_C ,0 , +DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_C , prog_wm_value);DC_LOG_BANDWIDTH_CALCS ("DRAM_CLK_CHANGE_WATERMARK_C calculated =%d\n" "HW register value = 0x%x\n\n" , watermarks->c.cstate_pstate.pstate_change_ns, prog_wm_value);
@@ -478,7 +490,8 @@ void hubbub1_program_watermarks( hubbub1->watermarks.d.urgent_ns = watermarks->d.urgent_ns; prog_wm_value =convert_and_clamp (watermarks->d.urgent_ns, refclk_mhz,0x1fffff ); -REG_WRITE (DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_D , prog_wm_value); +REG_SET (DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_D ,0 , +DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_D , prog_wm_value); DC_LOG_BANDWIDTH_CALCS("URGENCY_WATERMARK_D calculated =%d\n" "HW register value = 0x%x\n",
@@ -505,7 +518,8 @@ void hubbub1_program_watermarks( prog_wm_value =convert_and_clamp ( watermarks->d.cstate_pstate.cstate_enter_plus_exit_ns, refclk_mhz,0x1fffff ); -REG_WRITE (DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_D , prog_wm_value); +REG_SET (DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_D ,0 , +DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_D , prog_wm_value);DC_LOG_BANDWIDTH_CALCS ("SR_ENTER_EXIT_WATERMARK_D calculated =%d\n" "HW register value = 0x%x\n" , watermarks->d.cstate_pstate.cstate_enter_plus_exit_ns, prog_wm_value);
@@ -518,7 +532,8 @@ void hubbub1_program_watermarks( prog_wm_value =convert_and_clamp ( watermarks->d.cstate_pstate.cstate_exit_ns, refclk_mhz,0x1fffff ); -REG_WRITE (DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_D , prog_wm_value); +REG_SET (DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_D ,0 , +DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_D , prog_wm_value);DC_LOG_BANDWIDTH_CALCS ("SR_EXIT_WATERMARK_D calculated =%d\n" "HW register value = 0x%x\n" , watermarks->d.cstate_pstate.cstate_exit_ns, prog_wm_value);
@@ -532,7 +547,8 @@ void hubbub1_program_watermarks( prog_wm_value =convert_and_clamp ( watermarks->d.cstate_pstate.pstate_change_ns, refclk_mhz,0x1fffff ); -REG_WRITE (DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_D , prog_wm_value); +REG_SET (DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_D ,0 , +DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_D , prog_wm_value);DC_LOG_BANDWIDTH_CALCS ("DRAM_CLK_CHANGE_WATERMARK_D calculated =%d\n" "HW register value = 0x%x\n\n" , watermarks->d.cstate_pstate.pstate_change_ns, prog_wm_value);
@@ -867,6 +883,7 @@ static const struct hubbub_funcs hubbub1_funcs = { .dcc_support_pixel_format = hubbub1_dcc_support_pixel_format, .get_dcc_compression_cap = hubbub1_get_dcc_compression_cap, .wm_read_state = hubbub1_wm_read_state, + .program_watermarks = hubbub1_program_watermarks, }; void hubbub1_construct(struct hubbub *hubbub,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.h +52 -11
116 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +6 -2
@@ -2438,6 +2438,8 @@ static void dcn10_prepare_bandwidth(struct dc *dc, struct dc_state *context) { + struct hubbub *hubbub = dc->res_pool->hubbub; +if (dc->debug.sanity_checks)dcn10_verify_allow_pstate_change_high (dc);
@@ -2451,7 +2453,7 @@ static void dcn10_prepare_bandwidth( false); } -hubbub1_program_watermarks (dc->res_pool->hubbub, + hubbub->funcs->program_watermarks (hubbub, &context->bw_ctx.bw.dcn.watermarks, dc->res_pool->ref_clocks.dchub_ref_clock_inKhz /1000 , true);
@@ -2468,6 +2470,8 @@ static void dcn10_optimize_bandwidth(struct dc *dc, struct dc_state *context) { + struct hubbub *hubbub = dc->res_pool->hubbub; +if (dc->debug.sanity_checks)dcn10_verify_allow_pstate_change_high (dc);
@@ -2481,7 +2485,7 @@ static void dcn10_optimize_bandwidth( true); } -hubbub1_program_watermarks (dc->res_pool->hubbub, + hubbub->funcs->program_watermarks (hubbub, &context->bw_ctx.bw.dcn.watermarks, dc->res_pool->ref_clocks.dchub_ref_clock_inKhz /1000 , true);
drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h +6 -0
@@ -77,6 +77,12 @@ struct hubbub_funcs {void (*get_dchub_ref_freq)(struct hubbub *hubbub,unsigned int dccg_ref_freq_inKhz,unsigned int *dchub_ref_freq_inKhz); + +void (*program_watermarks)( +struct hubbub *hubbub, +struct dcn_watermark_set *watermarks, +unsigned int refclk_mhz, +bool safe_to_lower); };struct hubbub {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 14/18 drm/amd/display: Add power down display on boot flag
In reply to a message not in the archiveFrom: Thomas Lim <[email protected]>
[Why]
Due to the generic introduction of seamless boot, the display is no longer blanked upon boot. However, this causes corruption on some systems that does not lock the memory in the non-secure boot case, resulting in brief corruption on boot due to garbage being written into the frame buffer.
[How]
Add a flag, read during DC init, to determine whether display should be blanked on boot. Default to true.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++ drivers/gpu/drm/amd/display/dc/dc.h | 1 + drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
@@ -534,6 +534,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)if (amdgpu_dc_feature_mask &DC_FBC_MASK ) init_data.flags.fbc_support = true; + init_data.flags.power_down_display_on_boot = true; +/* Display Core create. */ adev->dm.dc =dc_create (&init_data);
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
@@ -207,6 +207,7 @@ struct dc_config {bool optimize_edp_link_rate;bool disable_fractional_pwm;bool allow_seamless_boot_optimization; +bool power_down_display_on_boot; };enum visual_confirm {
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -1
@@ -1118,7 +1118,7 @@ static void dcn10_init_hw(struct dc *dc)* Otherwise, if taking control is not possible, we need to power * everything down. */ -if (dcb->funcs->is_accelerated_mode (dcb)) { +if (dcb->funcs->is_accelerated_mode (dcb) || dc->config.power_down_display_on_boot) {for (i =0 ; i < dc->res_pool->pipe_count; i++) {struct hubp *hubp = dc->res_pool->hubps[i];struct dpp *dpp = dc->res_pool->dpps[i];
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 15/18 drm/amd/display: remove deprecated pplib interface
In reply to a message not in the archiveFrom: Eric Yang <[email protected]>
[Why]
The new interface now replaces the old interface for all known configurations.
--- .../gpu/drm/amd/display/dc/dcn10/dcn10_clk_mgr.c | 27 +++++----------------- drivers/gpu/drm/amd/display/dc/dm_pp_smu.h | 23 ------------------ drivers/gpu/drm/amd/display/dc/inc/core_types.h | 1 - 3 files changed, 6 insertions(+), 45 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_clk_mgr.c +6 -21
@@ -151,9 +151,6 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr,struct dc *dc = clk_mgr->ctx->dc;struct dc_debug_options *debug = &dc->debug;struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk; -struct pp_smu_display_requirement_rv *smu_req_cur = - &dc->res_pool->pp_smu_req; -struct pp_smu_display_requirement_rv smu_req = *smu_req_cur;struct pp_smu_funcs_rv *pp_smu =NULL ;bool send_request_to_increase = false;bool send_request_to_lower = false;
@@ -175,8 +172,6 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr,*/ if (pp_smu && pp_smu->set_display_count) pp_smu->set_display_count (&pp_smu->pp_smu, display_count); - - smu_req.display_count = display_count; } if (new_clocks->dispclk_khz > clk_mgr->clks.dispclk_khz
@@ -187,7 +182,6 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr,if (should_set_clock (safe_to_lower, new_clocks->phyclk_khz, clk_mgr->clks.phyclk_khz)) { clk_mgr->clks.phyclk_khz = new_clocks->phyclk_khz; - send_request_to_lower = true; }
@@ -197,24 +191,18 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr,if (should_set_clock (safe_to_lower, new_clocks->fclk_khz, clk_mgr->clks.fclk_khz)) { clk_mgr->clks.fclk_khz = new_clocks->fclk_khz; - smu_req.hard_min_fclk_mhz = new_clocks->fclk_khz /1000 ; - send_request_to_lower = true; }//DCF Clock if (should_set_clock (safe_to_lower, new_clocks->dcfclk_khz, clk_mgr->clks.dcfclk_khz)) { clk_mgr->clks.dcfclk_khz = new_clocks->dcfclk_khz; - smu_req.hard_min_dcefclk_mhz = new_clocks->dcfclk_khz /1000 ; - send_request_to_lower = true; }if (should_set_clock (safe_to_lower, new_clocks->dcfclk_deep_sleep_khz, clk_mgr->clks.dcfclk_deep_sleep_khz)) { clk_mgr->clks.dcfclk_deep_sleep_khz = new_clocks->dcfclk_deep_sleep_khz; - smu_req.min_deep_sleep_dcefclk_mhz = (new_clocks->dcfclk_deep_sleep_khz +999 ) /1000 ; - send_request_to_lower = true; }
@@ -227,9 +215,9 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr, pp_smu->set_hard_min_dcfclk_by_freq && pp_smu->set_min_deep_sleep_dcfclk) { - pp_smu->set_hard_min_fclk_by_freq (&pp_smu->pp_smu, smu_req.hard_min_fclk_mhz); - pp_smu->set_hard_min_dcfclk_by_freq (&pp_smu->pp_smu, smu_req.hard_min_dcefclk_mhz); - pp_smu->set_min_deep_sleep_dcfclk (&pp_smu->pp_smu, smu_req.min_deep_sleep_dcefclk_mhz); + pp_smu->set_hard_min_fclk_by_freq (&pp_smu->pp_smu, new_clocks->fclk_khz /1000 ); + pp_smu->set_hard_min_dcfclk_by_freq (&pp_smu->pp_smu, new_clocks->dcfclk_khz /1000 ); + pp_smu->set_min_deep_sleep_dcfclk (&pp_smu->pp_smu, (new_clocks->dcfclk_deep_sleep_khz +999 ) /1000 ); } }
@@ -239,7 +227,6 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr, || new_clocks->dispclk_khz == clk_mgr->clks.dispclk_khz) {dcn1_ramp_up_dispclk_with_dpp (clk_mgr, new_clocks); clk_mgr->clks.dispclk_khz = new_clocks->dispclk_khz; - send_request_to_lower = true; }
@@ -249,13 +236,11 @@ static void dcn1_update_clocks(struct clk_mgr *clk_mgr, pp_smu->set_hard_min_dcfclk_by_freq && pp_smu->set_min_deep_sleep_dcfclk) { - pp_smu->set_hard_min_fclk_by_freq (&pp_smu->pp_smu, smu_req.hard_min_fclk_mhz); - pp_smu->set_hard_min_dcfclk_by_freq (&pp_smu->pp_smu, smu_req.hard_min_dcefclk_mhz); - pp_smu->set_min_deep_sleep_dcfclk (&pp_smu->pp_smu, smu_req.min_deep_sleep_dcefclk_mhz); + pp_smu->set_hard_min_fclk_by_freq (&pp_smu->pp_smu, new_clocks->fclk_khz /1000 ); + pp_smu->set_hard_min_dcfclk_by_freq (&pp_smu->pp_smu, new_clocks->dcfclk_khz /1000 ); + pp_smu->set_min_deep_sleep_dcfclk (&pp_smu->pp_smu, (new_clocks->dcfclk_deep_sleep_khz +999 ) /1000 ); } } - - *smu_req_cur = smu_req; }static const struct clk_mgr_funcs dcn1_funcs = { .get_dp_ref_clk_frequency = dce12_get_dp_ref_freq_khz,
drivers/gpu/drm/amd/display/dc/dm_pp_smu.h +0 -23
@@ -74,29 +74,6 @@ struct pp_smu_wm_range_sets {struct pp_smu_wm_set_range writer_wm_sets[MAX_WATERMARK_SETS ]; }; -struct pp_smu_display_requirement_rv { -/* PPSMC_MSG_SetDisplayCount: count -* 0 triggers S0i2 optimization -*/ -unsigned int display_count; - -/* PPSMC_MSG_SetHardMinFclkByFreq: mhz -* FCLK will vary with DPM, but never below requested hard min -*/ -unsigned int hard_min_fclk_mhz; - -/* PPSMC_MSG_SetHardMinDcefclkByFreq: mhz -* fixed clock at requested freq, either from FCH bypass or DFS -*/ -unsigned int hard_min_dcefclk_mhz; - -/* PPSMC_MSG_SetMinDeepSleepDcefclk: mhz -* when DF is in cstate, dcf clock is further divided down -* to just above given frequency -*/ -unsigned int min_deep_sleep_dcefclk_mhz; -}; -struct pp_smu_funcs_rv {struct pp_smu pp_smu;
drivers/gpu/drm/amd/display/dc/inc/core_types.h +0 -1
@@ -145,7 +145,6 @@ struct resource_pool {struct hubbub *hubbub;struct mpc *mpc;struct pp_smu_funcs *pp_smu; -struct pp_smu_display_requirement_rv pp_smu_req;struct dce_aux *engines[MAX_PIPES ];struct dce_i2c_hw *hw_i2cs[MAX_PIPES ];struct dce_i2c_sw *sw_i2cs[MAX_PIPES ];
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 16/18 drm/amd/display: Add hubp_init entry to hubp vtable
In reply to a message not in the archiveFrom: Charlene Liu <[email protected]>
Different HW will need to init HUBP differently. For now, add a vtable entry, and hook a NO-OP for DCN1.
In addition, future HW will need to access the HUBPREQ_DEBUG register for hubp_init. Add it to the reg list.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c | 6 +++++- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h | 4 ++++ drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h | 1 + 4 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c +5 -1
@@ -1178,6 +1178,10 @@ void hubp1_vtg_sel(struct hubp *hubp, uint32_t otg_inst)REG_UPDATE (DCHUBP_CNTL ,HUBP_VTG_SEL , otg_inst); } +void hubp1_init (struct hubp *hubp) +{ +//do nothing +}static const struct hubp_funcs dcn10_hubp_funcs = { .hubp_program_surface_flip_and_addr = hubp1_program_surface_flip_and_addr,
@@ -1201,7 +1205,7 @@ static const struct hubp_funcs dcn10_hubp_funcs = { .hubp_clear_underflow = hubp1_clear_underflow, .hubp_disable_control = hubp1_disable_control, .hubp_get_underflow_status = hubp1_get_underflow_status, - + .hubp_init = hubp1_init, };/*****************************************/
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h +4 -0
@@ -34,6 +34,7 @@#define HUBP_REG_LIST_DCN (id)\ SRI(DCHUBP_CNTL, HUBP, id),\ SRI(HUBPREQ_DEBUG_DB, HUBP, id),\ + SRI(HUBPREQ_DEBUG, HUBP, id),\ SRI(DCSURF_ADDR_CONFIG, HUBP, id),\ SRI(DCSURF_TILING_CONFIG, HUBP, id),\ SRI(DCSURF_SURFACE_PITCH, HUBPREQ, id),\
@@ -138,6 +139,7 @@#define HUBP_COMMON_REG_VARIABLE_LIST \ uint32_t DCHUBP_CNTL; \ uint32_t HUBPREQ_DEBUG_DB; \ + uint32_t HUBPREQ_DEBUG; \ uint32_t DCSURF_ADDR_CONFIG; \ uint32_t DCSURF_TILING_CONFIG; \ uint32_t DCSURF_SURFACE_PITCH; \
@@ -749,4 +751,6 @@ enum cursor_pitch hubp1_get_cursor_pitch(unsigned int pitch);void hubp1_vready_workaround (struct hubp *hubp,struct _vcs_dpi_display_pipe_dest_params_st *pipe_dest); +void hubp1_init (struct hubp *hubp); +#endif
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -0
@@ -1123,6 +1123,7 @@ static void dcn10_init_hw(struct dc *dc)struct hubp *hubp = dc->res_pool->hubps[i];struct dpp *dpp = dc->res_pool->dpps[i]; + hubp->funcs->hubp_init (hubp); dc->res_pool->opps[i]->mpc_tree_params.opp_id = dc->res_pool->opps[i]->inst;plane_atomic_power_down (dc, dpp, hubp); }
drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h +1 -0
@@ -130,6 +130,7 @@ struct hubp_funcs {void (*hubp_clear_underflow)(struct hubp *hubp);void (*hubp_disable_control)(struct hubp *hubp,bool disable_hubp);unsigned int (*hubp_get_underflow_status)(struct hubp *hubp); +void (*hubp_init)(struct hubp *hubp); };
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 17/18 drm/amd/display: Refactor dp vendor parsing logic to a function
In reply to a message not in the archiveFrom: John Barberiz <[email protected]>
Refactor dp vendor parsing int to a new function, and call it before get_active_converter_info().
Also, add a flag to skip parsing of Display ID 2.0. Some devices fail on readind DID2, but we shouldn't fail EDID read because of it. Add this flag to facilitate the logic.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 47 +++++++++++++----------- drivers/gpu/drm/amd/display/dc/dc_link.h | 1 + 2 files changed, 27 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +26 -21
@@ -2185,6 +2185,30 @@ static int translate_dpcd_max_bpc(enum dpcd_downstream_port_max_bpc bpc)return -1 ; } +static void read_dp_device_vendor_id (struct dc_link *link) +{ +struct dp_device_vendor_id dp_id; + +/* read IEEE branch device id */ +core_link_read_dpcd ( + link, +DP_BRANCH_OUI , + (uint8_t *)&dp_id, +sizeof (dp_id)); + + link->dpcd_caps.branch_dev_id = + (dp_id.ieee_oui[0 ] <<16 ) + + (dp_id.ieee_oui[1 ] <<8 ) + + dp_id.ieee_oui[2 ]; + +memmove ( + link->dpcd_caps.branch_dev_name, + dp_id.ieee_device_id, +sizeof (dp_id.ieee_device_id)); +} + + +static void get_active_converter_info (uint8_t data,struct dc_link *link) {
@@ -2271,27 +2295,6 @@ static void get_active_converter_info(ddc_service_set_dongle_type (link->ddc, link->dpcd_caps.dongle_type); { -struct dp_device_vendor_id dp_id; - -/* read IEEE branch device id */ -core_link_read_dpcd ( - link, -DP_BRANCH_OUI , - (uint8_t *)&dp_id, -sizeof (dp_id)); - - link->dpcd_caps.branch_dev_id = - (dp_id.ieee_oui[0 ] <<16 ) + - (dp_id.ieee_oui[1 ] <<8 ) + - dp_id.ieee_oui[2 ]; - -memmove ( - link->dpcd_caps.branch_dev_name, - dp_id.ieee_device_id, -sizeof (dp_id.ieee_device_id)); - } - - {struct dp_sink_hw_fw_revision dp_hw_fw_revision; core_link_read_dpcd(
@@ -2455,6 +2458,8 @@ static bool retrieve_link_cap(struct dc_link *link) ds_port.byte = dpcd_data[DP_DOWNSTREAMPORT_PRESENT -DP_DPCD_REV ]; +read_dp_device_vendor_id (link); +get_active_converter_info (ds_port.byte, link);dp_wa_power_up_0010FA (link, dpcd_data,sizeof (dpcd_data));
drivers/gpu/drm/amd/display/dc/dc_link.h +1 -0
@@ -120,6 +120,7 @@ struct dc_link {/* MST record stream using this link */ struct link_flags {bool dp_keep_receiver_powered; +bool dp_skip_DID2; } wa_flags;struct link_mst_stream_allocation_table mst_stream_alloc_table;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 18/18 drm/amd/display: Do VRR transition before enable_crc_interrupts
In reply to a message not in the archiveFrom: Nicholas Kazlauskas <[email protected]>
[Why]
Originally we did the amdgpu_dm_handle_vrr_transition call before interrupts were enabled. After the interrupt toggling logic was moved around for support enabling CRTCs with no primary planes active this was no longer being called in the case where there wasn't a modeset.
This fixes failures in igt@kms_vrr@* with error
"Timed out: Waiting for vblank event".
[How]
Shift them back into the loop that always ran before interrupts were enabled.
Pull out the logic that updated VRR state into the same loop since there's no reason these need to be split.
In the case where we're going from VRR off, no planes to VRR on, some active planes we'll still be covered for having the VRR vupdate handler enabled - vblank will be re-enabled at this point, it will see that VRR is active and set the vupdate interrupt on there.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +12 -11
@@ -5572,10 +5572,6 @@ static void amdgpu_dm_enable_crtc_interrupts(struct drm_device *dev,if (!run_pass)continue ; -/* Handle vrr on->off / off->on transitions */ -amdgpu_dm_handle_vrr_transition (dm_old_crtc_state, - dm_new_crtc_state); -if (!dm_new_crtc_state->interrupts_enabled)continue ;
@@ -5865,18 +5861,23 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)mutex_unlock (&dm->dc_lock); } -/* Update freesync state before amdgpu_dm_handle_vrr_transition(). */ -for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) { - dm_new_crtc_state =to_dm_crtc_state (new_crtc_state); -pre_update_freesync_state_on_stream (dm, dm_new_crtc_state); - } -/* Count number of newly disabled CRTCs for dropping PM refs later. */ for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, - new_crtc_state, i) + new_crtc_state, i) {if (old_crtc_state->active && !new_crtc_state->active) crtc_disable_count++; + dm_new_crtc_state =to_dm_crtc_state (new_crtc_state); + dm_old_crtc_state =to_dm_crtc_state (old_crtc_state); + +/* Update freesync active state. */ +pre_update_freesync_state_on_stream (dm, dm_new_crtc_state); + +/* Handle vrr on->off / off->on transitions */ +amdgpu_dm_handle_vrr_transition (dm_old_crtc_state, + dm_new_crtc_state); + } +/* Enable interrupts for CRTCs going through a modeset. */ amdgpu_dm_enable_crtc_interrupts (dev, state, true);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx