DC Patches August 24, 2020
Subsystems (3)
cover DC Patches August 24, 2020
This DC patchset brings improvements in multiple areas. In summary, we highlight:
* Fixes on HDMI, HDCP, and EDID Emulation;
* Enhancements in DMUB;
* Improvements on ABM, DSC and others.
Aric Cyr (1):
drm/amd/display: 3.2.99
Brandon Syu (1):
drm/amd/display: Keep current gain when ABM disable immediately
Chris Park (1):
drm/amd/display: Call DMUB for eDP power control
Eryk Brol (2):
drm/amd/display: Add debugfs for connector's FEC & DSC capabilities drm/amd/display: Add connector HPD trigger debugfs entry
Jaehyun Chung (1):
drm/amd/display: Revert HDCP disable sequence change
Samson Tam (1):
drm/amd/display: Fix passive dongle mistaken as active dongle in EDID
emulation
Sung Lee (1):
drm/amd/display: Send DISPLAY_OFF after power down on boot
Wayne Lin (1):
drm/amd/display: Send H14b-VSIF specified in HDMI
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +- .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 154 +++++++++++++++++- .../drm/amd/display/dc/bios/command_table2.c | 28 ++++ .../amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 10 ++ drivers/gpu/drm/amd/display/dc/core/dc_link.c | 3 +- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- drivers/gpu/drm/amd/display/dc/dc_stream.h | 2 +- .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 53 +++--- .../gpu/drm/amd/display/dc/inc/hw/clk_mgr.h | 2 + .../amd/display/modules/inc/mod_info_packet.h | 2 +- .../display/modules/info_packet/info_packet.c | 16 +- 11 files changed, 233 insertions(+), 42 deletions(-)
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 1/9 drm/amd/display: 3.2.99
From: 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.98" +#define DC_VER "3.2.99"#define MAX_SURFACES 3#define MAX_PLANES 6
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/9 drm/amd/display: Call DMUB for eDP power control
In reply to Eryk BrolFrom: Chris Park <[email protected]>
[Why]
If DMUB is used, LVTMA VBIOS call can be used to control eDP instead of tranditional transmitter control. Interface is agreed with VBIOS for eDP to use this new path to program LVTMA registers.
[How]
Expose DAL interface to send DMUB command for LVTMA control that VBIOS currently uses.
--- .../drm/amd/display/dc/bios/command_table2.c | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/gpu/drm/amd/display/dc/bios/command_table2.c +28 -0
@@ -920,11 +920,39 @@ static void init_enable_lvtma_control(struct bios_parser *bp) } +static void enable_lvtma_control_dmcub ( +struct dc_dmub_srv *dmcub, +uint8_t uc_pwr_on) +{ + +union dmub_rb_cmd cmd; + +memset (&cmd,0 ,sizeof (cmd)); + + cmd.cmd_common.header.type =DMUB_CMD__VBIOS ; + cmd.cmd_common.header.sub_type = +DMUB_CMD__VBIOS_LVTMA_CONTROL ; + cmd.cmd_common.cmd_buffer[0 ] = + uc_pwr_on; + +dc_dmub_srv_cmd_queue (dmcub, &cmd); +dc_dmub_srv_cmd_execute (dmcub); +dc_dmub_srv_wait_idle (dmcub); + +} +static enum bp_result enable_lvtma_control (struct bios_parser *bp,uint8_t uc_pwr_on) {enum bp_result result =BP_RESULT_FAILURE ; + +if (bp->base.ctx->dc->ctx->dmub_srv && + bp->base.ctx->dc->debug.dmub_command_table) { +enable_lvtma_control_dmcub (bp->base.ctx->dmub_srv, + uc_pwr_on); +return BP_RESULT_OK ; + }return result; }
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/9 drm/amd/display: Send H14b-VSIF specified in HDMI
In reply to Eryk BrolFrom: Wayne Lin <[email protected]>
[Why]
Current function excludes the logic to generate H14b-VSIF. Now it constructs HF-VSIF only and causes HDMI compliace test fail.
[How]
According to HDMI spec, source devices shall utilize the H14b-VSIF whenever the signaling capabilities of the H14b-VSIF allow this.
Here keep the logic for HF-VSIF and add H14b-VSIF construction part.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- .../amd/display/modules/inc/mod_info_packet.h | 2 +- .../display/modules/info_packet/info_packet.c | 16 ++-------------- 3 files changed, 5 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
@@ -4757,7 +4757,8 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,update_stream_signal (stream, sink);if (stream->signal ==SIGNAL_TYPE_HDMI_TYPE_A ) -mod_build_hf_vsif_infopacket (stream, &stream->vsp_infopacket, false, false); +mod_build_hf_vsif_infopacket (stream, &stream->vsp_infopacket); +if (stream->link->psr_settings.psr_feature_enabled) {// // should decide stream support vsc sdp colorimetry capability
drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h +1 -1
@@ -37,6 +37,6 @@ void mod_build_vsc_infopacket(const struct dc_stream_state *stream, struct dc_info_packet *info_packet);void mod_build_hf_vsif_infopacket (const struct dc_stream_state *stream, -struct dc_info_packet *info_packet,int ALLMEnabled,int ALLMValue); +struct dc_info_packet *info_packet);#endif
drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c +2 -14
@@ -421,15 +421,13 @@ void mod_build_vsc_infopacket(const struct dc_stream_state *stream,***************************************************************************** */ void mod_build_hf_vsif_infopacket (const struct dc_stream_state *stream, -struct dc_info_packet *info_packet,int ALLMEnabled,int ALLMValue) +struct dc_info_packet *info_packet) {unsigned int length =5 ;bool hdmi_vic_mode = false;uint8_t checksum =0 ;uint32_t i =0 ;enum dc_timing_3d_format format; -bool bALLM = (bool )ALLMEnabled; -bool bALLMVal = (bool )ALLMValue; info_packet->valid = false; format = stream->timing.timing_3d_format;
@@ -442,20 +440,13 @@ void mod_build_hf_vsif_infopacket(const struct dc_stream_state *stream, && format == TIMING_3D_FORMAT_NONE) hdmi_vic_mode = true; -if ((format ==TIMING_3D_FORMAT_NONE ) && !hdmi_vic_mode && !bALLM) +if ((format ==TIMING_3D_FORMAT_NONE ) && !hdmi_vic_mode)return ; info_packet->sb[1 ] =0x03 ; info_packet->sb[2 ] =0x0C ; info_packet->sb[3 ] =0x00 ; -if (bALLM) { - info_packet->sb[1 ] =0xD8 ; - info_packet->sb[2 ] =0x5D ; - info_packet->sb[3 ] =0xC4 ; - info_packet->sb[4 ] =HF_VSIF_VERSION ; - } -if (format !=TIMING_3D_FORMAT_NONE ) info_packet->sb[4 ] = (2 <<5 );
@@ -490,9 +481,6 @@ void mod_build_hf_vsif_infopacket(const struct dc_stream_state *stream, info_packet->hb1 =0x01 ; info_packet->hb2 = (uint8_t ) (length); -if (bALLM) - info_packet->sb[5 ] = (info_packet->sb[5 ] & ~0x02 ) | (bALLMVal <<1 ); - checksum += info_packet->hb0; checksum += info_packet->hb1; checksum += info_packet->hb2;
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/9 drm/amd/display: Revert HDCP disable sequence change
In reply to Eryk BrolFrom: Jaehyun Chung <[email protected]>
[Why]
Revert HDCP disable sequence change that blanks stream before disabling HDCP. PSP and HW teams are currently investigating the root cause of why HDCP cannot be disabled before stream blank, which is expected to work without issues.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1 -1
@@ -3286,10 +3286,10 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx)core_link_set_avmute (pipe_ctx, true); } - dc->hwss.blank_stream (pipe_ctx);#if defined(CONFIG_DRM_AMD_DC_HDCP )update_psp_stream_config (pipe_ctx, true);#endif + dc->hwss.blank_stream (pipe_ctx);if (pipe_ctx->stream->signal ==SIGNAL_TYPE_DISPLAY_PORT_MST )deallocate_mst_payload (pipe_ctx);
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/9 drm/amd/display: Send DISPLAY_OFF after power down on boot
In reply to Eryk BrolFrom: Sung Lee <[email protected]>
[WHY]update_clocks might not be called on headless adapters. This means DISPLAY_OFF may not be sent in headless cases.
[HOW]
If hardware is powered down on boot because it is headless (mode set does not happen on that adapter) also send DISPLAY_OFF notification.
--- .../amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 10 ++++ .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 53 +++++++++++-------- .../gpu/drm/amd/display/dc/inc/hw/clk_mgr.h | 2 + 3 files changed, 43 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +10 -0
@@ -94,6 +94,15 @@ int rn_get_active_display_cnt_wa(return display_count; } +void rn_set_low_power_state (struct clk_mgr *clk_mgr_base) +{ +struct clk_mgr_internal *clk_mgr =TO_CLK_MGR_INTERNAL (clk_mgr_base); + +rn_vbios_smu_set_dcn_low_power_state (clk_mgr,DCN_PWR_STATE_LOW_POWER ); +/* update power state */ + clk_mgr_base->clks.pwr_state =DCN_PWR_STATE_LOW_POWER ; +} +void rn_update_clocks (struct clk_mgr *clk_mgr_base,struct dc_state *context,bool safe_to_lower)
@@ -516,6 +525,7 @@ static struct clk_mgr_funcs dcn21_funcs = { .init_clocks = rn_init_clocks, .enable_pme_wa = rn_enable_pme_wa, .are_clock_states_equal = rn_are_clock_states_equal, + .set_low_power_state = rn_set_low_power_state, .notify_wm_ranges = rn_notify_wm_ranges, .notify_link_rate_change = rn_notify_link_rate_change, };
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +31 -22
64 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h +2 -0
@@ -230,6 +230,8 @@ struct clk_mgr_funcs {int (*get_dp_ref_clk_frequency)(struct clk_mgr *clk_mgr); +void (*set_low_power_state)(struct clk_mgr *clk_mgr); +void (*init_clocks)(struct clk_mgr *clk_mgr);void (*enable_pme_wa) (struct clk_mgr *clk_mgr);
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/9 drm/amd/display: Add debugfs for connector's FEC & DSC capabilities
In reply to Eryk Brol[why & how]
Useful entry to understand if link has DSC or FEC capabilities, implemented to read DPCD caps stored on the link. Better than manually reading the registers with aux dpcd helper.
--- .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 73 ++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +72 -1
@@ -49,6 +49,10 @@ struct dmub_debugfs_trace_entry {uint32_t param1; }; +static inline const char *yesno (bool v) +{ +return v ?"yes" :"no" ; +}/* parse_write_buffer_into_params - Helper function to parse debugfs write buffer into an array *
@@ -998,6 +1002,71 @@ static ssize_t dp_dpcd_data_read(struct file *f, char __user *buf,return read_size - r; } +/* function: Read link's DSC & FEC capabilities +* +* +* Access it with the following command (you need to specify +* connector like DP-1): +* +* cat /sys/kernel/debug/dri/0/DP-X/dp_dsc_fec_support +* +*/ +static int dp_dsc_fec_support_show (struct seq_file *m,void *data) +{ +struct drm_connector *connector = m->private; +struct drm_modeset_acquire_ctx ctx; +struct drm_device *dev = connector->dev; +struct amdgpu_dm_connector *aconnector =to_amdgpu_dm_connector (connector); +int ret =0 ; +bool try_again = false; +bool is_fec_supported = false; +bool is_dsc_supported = false; +struct dpcd_caps dpcd_caps; + +drm_modeset_acquire_init (&ctx,DRM_MODESET_ACQUIRE_INTERRUPTIBLE ); +do { + try_again = false; + ret =drm_modeset_lock (&dev->mode_config.connection_mutex, &ctx); +if (ret) { +if (ret == -EDEADLK ) { + ret =drm_modeset_backoff (&ctx); +if (!ret) { + try_again = true; +continue ; + } + } +break ; + } +if (connector->status != connector_status_connected) { + ret = -ENODEV ; +break ; + } + dpcd_caps = aconnector->dc_link->dpcd_caps; +if (aconnector->port) { +/* aconnector sets dsc_aux during get_modes call +* if MST connector has it means it can either +* enable DSC on the sink device or on MST branch +* its connected to. +*/ +if (aconnector->dsc_aux) { + is_fec_supported = true; + is_dsc_supported = true; + } + }else { + is_fec_supported = dpcd_caps.fec_cap.raw &0x1 ; + is_dsc_supported = dpcd_caps.dsc_caps.dsc_basic_caps.raw[0 ] &0x1 ; + } + }while (try_again); + +drm_modeset_drop_locks (&ctx); +drm_modeset_acquire_fini (&ctx); + +seq_printf (m,"FEC_Sink_Support: %s\n" ,yesno (is_fec_supported)); +seq_printf (m,"DSC_Sink_Support: %s\n" ,yesno (is_dsc_supported)); + +return ret; +} +/* function: read DSC status on the connector * * The read function: dp_dsc_clock_en_read
@@ -1856,6 +1925,7 @@ static ssize_t dp_dsc_slice_bpg_offset_read(struct file *f, char __user *buf,return result; } +DEFINE_SHOW_ATTRIBUTE (dp_dsc_fec_support);DEFINE_SHOW_ATTRIBUTE (dmub_fw_state);DEFINE_SHOW_ATTRIBUTE (dmub_tracebuffer);DEFINE_SHOW_ATTRIBUTE (output_bpc);
@@ -1983,7 +2053,8 @@ static const struct { {"dsc_pic_width", &dp_dsc_pic_width_debugfs_fops}, {"dsc_pic_height", &dp_dsc_pic_height_debugfs_fops}, {"dsc_chunk_size", &dp_dsc_chunk_size_debugfs_fops}, - {"dsc_slice_bpg", &dp_dsc_slice_bpg_offset_debugfs_fops} + {"dsc_slice_bpg", &dp_dsc_slice_bpg_offset_debugfs_fops}, + {"dp_dsc_fec_support", &dp_dsc_fec_support_fops} };#ifdef CONFIG_DRM_AMD_DC_HDCP
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/9 drm/amd/display: Add connector HPD trigger debugfs entry
In reply to Eryk Brol[why]
Need a tool to retrigger a virtual hotplug for testing purposes with force redetection in both DC and DM.
[how]
Emulate handle_hpd_irq for connector as if usermode would trigger a hotplug. Perform DC link discovery, DM connector update, and DM force atomic commit.
In order to trigger HPD on the connector user needs to echo 1 into "trigger_hotplug" debugfs entry on its respective connector.
--- .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +81 -0
@@ -1067,6 +1067,81 @@ static int dp_dsc_fec_support_show(struct seq_file *m, void *data)return ret; } +/* function: Trigger virtual HPD redetection on connector +* +* This function will perform link rediscovery, link disable +* and enable, and dm connector state update. +* +* Retrigger HPD on an existing connector by echoing 1 into +* its respectful "trigger_hotplug" debugfs entry: +* +* echo 1 > /sys/kernel/debug/dri/0/DP-X/trigger_hotplug +* +*/ +static ssize_t dp_trigger_hotplug (struct file *f,const char __user *buf, +size_t size,loff_t *pos) +{ +struct amdgpu_dm_connector *aconnector =file_inode (f)->i_private; +struct drm_connector *connector = &aconnector->base; +struct drm_device *dev = connector->dev; +enum dc_connection_type new_connection_type = dc_connection_none; +char *wr_buf =NULL ; +uint32_t wr_buf_size =42 ; +int max_param_num =1 ; +long param[1 ] = {0 }; +uint8_t param_nums =0 ; + +if (!aconnector || !aconnector->dc_link) +return -EINVAL ; + +if (size ==0 ) +return -EINVAL ; + + wr_buf =kcalloc (wr_buf_size,sizeof (char ),GFP_KERNEL ); + +if (!wr_buf) { +DRM_DEBUG_DRIVER ("no memory to allocate write buffer\n" ); +return -ENOSPC ; + } + +if (parse_write_buffer_into_params (wr_buf, wr_buf_size, + (long *)param, buf, + max_param_num, + ¶m_nums)) +return -EINVAL ; + +if (param_nums <=0 ) { +DRM_DEBUG_DRIVER ("user data not be read\n" ); +kfree (wr_buf); +return -EINVAL ; + } + +if (param[0 ] ==1 ) { +mutex_lock (&aconnector->hpd_lock); + +if (!dc_link_detect_sink (aconnector->dc_link, &new_connection_type) && + new_connection_type != dc_connection_none) + goto unlock; + +if (!dc_link_detect (aconnector->dc_link,DETECT_REASON_HPD )) + goto unlock; + +amdgpu_dm_update_connector_after_detect (aconnector); + +drm_modeset_lock_all (dev); +dm_restore_drm_connector_state (dev, connector); +drm_modeset_unlock_all (dev); + +drm_kms_helper_hotplug_event (dev); + +unlock: +mutex_unlock (&aconnector->hpd_lock); + } + +kfree (wr_buf); +return size; +} +/* function: read DSC status on the connector * * The read function: dp_dsc_clock_en_read
@@ -1986,6 +2061,12 @@ static const struct file_operations dp_dsc_slice_bpg_offset_debugfs_fops = { .llseek = default_llseek }; +static const struct file_operations dp_trigger_hotplug_debugfs_fops = { + .owner =THIS_MODULE , + .write = dp_trigger_hotplug, + .llseek = default_llseek +}; +static const struct file_operations dp_link_settings_debugfs_fops = { .owner =THIS_MODULE , .read = dp_link_settings_read,
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/9 drm/amd/display: Fix passive dongle mistaken as active dongle in EDID emulation
In reply to Eryk BrolFrom: Samson Tam <[email protected]>
[Why]dongle_type is set during dongle connection but for passive dongles, dongle_type is not set. If user starts with an active dongle and then switches to a passive dongle, it will still report as an active dongle. Trying to emulate the wrong connecter type results in display not lighting up.
[How]
Set dpcd_caps.dongle_type for passive dongles in detect_dp().
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1 -0
@@ -763,6 +763,7 @@ static bool detect_dp(struct dc_link *link, sink_caps->signal =dp_passive_dongle_detection (link->ddc, sink_caps, audio_support); + link->dpcd_caps.dongle_type = sink_caps->dongle_type; }return true;
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/9 drm/amd/display: Keep current gain when ABM disable immediately
In reply to Eryk BrolFrom: Brandon Syu <[email protected]>
[Why]
When system enters s3/s0i3, backlight PWM would set user level.
[How]
ABM disable function add keep current gain to avoid it.
--- drivers/gpu/drm/amd/display/dc/dc_stream.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc_stream.h +1 -1
@@ -233,7 +233,7 @@ struct dc_stream_state {union stream_update_flags update_flags; }; -#define ABM_LEVEL_IMMEDIATE_DISABLE 0xFFFFFFFF +#define ABM_LEVEL_IMMEDIATE_DISABLE 255struct dc_stream_update {struct dc_stream_state *stream;
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx