drm/amd/display: Embed DCN2 SOC bounding box
Subsystems (3)
PATCH 1/2 drm/amd/display: Embed DCN2 SOC bounding box
[Why]
In order to support uclk switching on NV10 the SOC bounding box needs to be updated.
[How]
We currently read the constants from the gpu info FW, but supporting workarounds in DC for different versions of the FW adds additional complexity to the codebase.
NV10 has been released so it's cleanest to keep the bounding box and source code in sync by embedding the bounding box like we do for other ASICs.
--- .../drm/amd/display/dc/dcn20/dcn20_resource.c | 114 +++++++++++++++++- 1 file changed, 112 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +112 -2
@@ -80,7 +80,7 @@#include "amdgpu_socbb.h" -#define SOC_BOUNDING_BOX_VALID false +#define SOC_BOUNDING_BOX_VALID true#define DC_LOGGER_INIT (logger)struct _vcs_dpi_ip_params_st dcn2_0_ip = {
@@ -154,7 +154,117 @@ struct _vcs_dpi_ip_params_st dcn2_0_ip = { .xfc_fill_constant_bytes = 0, }; -struct _vcs_dpi_soc_bounding_box_st dcn2_0_soc = {0 }; +struct _vcs_dpi_soc_bounding_box_st dcn2_0_soc = { +/* Defaults that get patched on driver load from firmware. */ + .clock_limits = { + { + .state =0 , + .dcfclk_mhz =560.0 , + .fabricclk_mhz =560.0 , + .dispclk_mhz =513.0 , + .dppclk_mhz =513.0 , + .phyclk_mhz =540.0 , + .socclk_mhz =560.0 , + .dscclk_mhz =171.0 , + .dram_speed_mts =8960.0 , + }, + { + .state =1 , + .dcfclk_mhz =694.0 , + .fabricclk_mhz =694.0 , + .dispclk_mhz =642.0 , + .dppclk_mhz =642.0 , + .phyclk_mhz =600.0 , + .socclk_mhz =694.0 , + .dscclk_mhz =214.0 , + .dram_speed_mts =11104.0 , + }, + { + .state =2 , + .dcfclk_mhz =875.0 , + .fabricclk_mhz =875.0 , + .dispclk_mhz =734.0 , + .dppclk_mhz =734.0 , + .phyclk_mhz =810.0 , + .socclk_mhz =875.0 , + .dscclk_mhz =245.0 , + .dram_speed_mts =14000.0 , + }, + { + .state =3 , + .dcfclk_mhz =1000.0 , + .fabricclk_mhz =1000.0 , + .dispclk_mhz =1100.0 , + .dppclk_mhz =1100.0 , + .phyclk_mhz =810.0 , + .socclk_mhz =1000.0 , + .dscclk_mhz =367.0 , + .dram_speed_mts =16000.0 , + }, + { + .state =4 , + .dcfclk_mhz =1200.0 , + .fabricclk_mhz =1200.0 , + .dispclk_mhz =1284.0 , + .dppclk_mhz =1284.0 , + .phyclk_mhz =810.0 , + .socclk_mhz =1200.0 , + .dscclk_mhz =428.0 , + .dram_speed_mts =16000.0 , + }, +/*Extra state, no dispclk ramping*/ + { + .state =5 , + .dcfclk_mhz =1200.0 , + .fabricclk_mhz =1200.0 , + .dispclk_mhz =1284.0 , + .dppclk_mhz =1284.0 , + .phyclk_mhz =810.0 , + .socclk_mhz =1200.0 , + .dscclk_mhz =428.0 , + .dram_speed_mts =16000.0 , + }, + }, + .num_states =5 , + .sr_exit_time_us =8.6 , + .sr_enter_plus_exit_time_us =10.9 , + .urgent_latency_us =4.0 , + .urgent_latency_pixel_data_only_us =4.0 , + .urgent_latency_pixel_mixed_with_vm_data_us =4.0 , + .urgent_latency_vm_data_only_us =4.0 , + .urgent_out_of_order_return_per_channel_pixel_only_bytes =4096 , + .urgent_out_of_order_return_per_channel_pixel_and_vm_bytes =4096 , + .urgent_out_of_order_return_per_channel_vm_only_bytes =4096 , + .pct_ideal_dram_sdp_bw_after_urgent_pixel_only =40.0 , + .pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm =40.0 , + .pct_ideal_dram_sdp_bw_after_urgent_vm_only =40.0 , + .max_avg_sdp_bw_use_normal_percent =40.0 , + .max_avg_dram_bw_use_normal_percent =40.0 , + .writeback_latency_us =12.0 , + .ideal_dram_bw_after_urgent_percent =40.0 , + .max_request_size_bytes =256 , + .dram_channel_width_bytes =2 , + .fabric_datapath_to_dcn_data_return_bytes =64 , + .dcn_downspread_percent =0.5 , + .downspread_percent =0.38 , + .dram_page_open_time_ns =50.0 , + .dram_rw_turnaround_time_ns =17.5 , + .dram_return_buffer_per_channel_bytes =8192 , + .round_trip_ping_latency_dcfclk_cycles =131 , + .urgent_out_of_order_return_per_channel_bytes =256 , + .channel_interleave_bytes =256 , + .num_banks =8 , + .num_chans =16 , + .vmm_page_size_bytes =4096 , + .dram_clock_change_latency_us =404.0 , + .dummy_pstate_latency_us =5.0 , + .writeback_dram_clock_change_latency_us =23.0 , + .return_bus_width_bytes =64 , + .dispclk_dppclk_vco_speed_mhz =3850 , + .xfc_bus_transport_time_us =20 , + .xfc_xbuf_latency_tolerance_us =4 , + .use_urgent_burst_bw =0 +};#ifndef mmDP0_DP_DPHY_INTERNAL_CTRL
Signature · 6 lines
2.17.1 _______________________________________________ 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): 20190730135733.14563-1-nicholas.kazlauskas-5C7GfCeVMHo@public.gmane.org
PATCH 2/2 drm/amd/display: Support uclk switching for DCN2
[Why]
We were previously forcing the uclk for every state to max and reducing the switch time to prevent uclk switching from occuring. This workaround was previously needed in order to avoid hangs + underflow under certain display configurations.
Now that DC has the proper fix complete we can drop the hacks and improve power for most display configurations.
[How]
We still need the function pointers hooked up to grab the real uclk states from pplib. The rest of the prior hack can be reverted.
The key requirements here are really just DC support, updated firmware, and support for disabling p-state support when needed in pplib/smu.
When these requirements are met uclk switching works without underflow or hangs.
--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +0 -10
@@ -2817,9 +2817,6 @@ static void cap_soc_clocks( && max_clocks.uClockInKhz != 0) bb->clock_limits[i].dram_speed_mts = (max_clocks.uClockInKhz /1000 ) *16 ; -// HACK: Force every uclk to max for now to "disable" uclk switching. - bb->clock_limits[i].dram_speed_mts = (max_clocks.uClockInKhz /1000 ) *16 ; -if ((bb->clock_limits[i].fabricclk_mhz > (max_clocks.fabricClockInKhz /1000 )) && max_clocks.fabricClockInKhz !=0 ) bb->clock_limits[i].fabricclk_mhz = (max_clocks.fabricClockInKhz /1000 );
@@ -3035,8 +3032,6 @@ static bool init_soc_bounding_box(struct dc *dc,le32_to_cpu (bb->vmm_page_size_bytes); dcn2_0_soc.dram_clock_change_latency_us =fixed16_to_double_to_cpu (bb->dram_clock_change_latency_us); -// HACK!! Lower uclock latency switch time so we don't switch - dcn2_0_soc.dram_clock_change_latency_us =10 ; dcn2_0_soc.writeback_dram_clock_change_latency_us =fixed16_to_double_to_cpu (bb->writeback_dram_clock_change_latency_us); dcn2_0_soc.return_bus_width_bytes =
@@ -3078,7 +3073,6 @@ static bool init_soc_bounding_box(struct dc *dc,struct pp_smu_nv_clock_table max_clocks = {0 };unsigned int uclk_states[8 ] = {0 };unsigned int num_states =0 ; -int i;enum pp_smu_status status;bool clock_limits_available = false;bool uclk_states_available = false;
@@ -3100,10 +3094,6 @@ static bool init_soc_bounding_box(struct dc *dc, clock_limits_available = (status ==PP_SMU_RESULT_OK ); } -// HACK: Use the max uclk_states value for all elements. -for (i =0 ; i < num_states; i++) - uclk_states[i] = uclk_states[num_states -1 ]; -if (clock_limits_available && uclk_states_available && num_states)update_bounding_box (dc, &dcn2_0_soc, &max_clocks, uclk_states, num_states);else if (clock_limits_available)
Signature · 6 lines
2.17.1 _______________________________________________ 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): 20190730135733.14563-2-nicholas.kazlauskas-5C7GfCeVMHo@public.gmane.org
Alex Deucher
Acked-byRe: [PATCH 2/2] drm/amd/display: Support uclk switching for DCN2
Series is:
Quoted 74 lines · Nicholas Kazlauskas
[Why]
We were previously forcing the uclk for every state to max and reducing the switch time to prevent uclk switching from occuring. This workaround was previously needed in order to avoid hangs + underflow under certain display configurations.Now that DC has the proper fix complete we can drop the hacks and improve power for most display configurations.
[How]
We still need the function pointers hooked up to grab the real uclk states from pplib. The rest of the prior hack can be reverted.The key requirements here are really just DC support, updated firmware, and support for disabling p-state support when needed in pplib/smu.
When these requirements are met uclk switching works without underflow or hangs.
Fixes 02316e963a5a ("drm/amd/display: Force uclk to max for every state")Cc Leo Li <[email protected]>Cc Harry Wentland <[email protected]>Signed-off-by Nicholas Kazlauskas <[email protected]>--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 10 ---------- 1 file changed, 10 deletions(-)drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +0
-11@@ -2817,9 +2817,6 @@ static void cap_soc_clocks( && max_clocks.uClockInKhz != 0) bb->clock_limits[i].dram_speed_mts = (max_clocks.uClockInKhz /1000 ) *16 ; -// HACK: Force every uclk to max for now to "disable" uclk switching. - bb->clock_limits[i].dram_speed_mts = (max_clocks.uClockInKhz /1000 ) *16 ; -if ((bb->clock_limits[i].fabricclk_mhz > (max_clocks.fabricClockInKhz /1000 )) && max_clocks.fabricClockInKhz !=0 ) bb->clock_limits[i].fabricclk_mhz = (max_clocks.fabricClockInKhz /1000 );@@ -3035,8 +3032,6 @@ static bool init_soc_bounding_box(struct dc *dc,le32_to_cpu (bb->vmm_page_size_bytes); dcn2_0_soc.dram_clock_change_latency_us =fixed16_to_double_to_cpu (bb->dram_clock_change_latency_us); -// HACK!! Lower uclock latency switch time so we don't switch - dcn2_0_soc.dram_clock_change_latency_us =10 ; dcn2_0_soc.writeback_dram_clock_change_latency_us =fixed16_to_double_to_cpu (bb->writeback_dram_clock_change_latency_us); dcn2_0_soc.return_bus_width_bytes =@@ -3078,7 +3073,6 @@ static bool init_soc_bounding_box(struct dc *dc,struct pp_smu_nv_clock_table max_clocks = {0 };unsigned int uclk_states[8 ] = {0 };unsigned int num_states =0 ; -int i;enum pp_smu_status status;bool clock_limits_available = false;bool uclk_states_available = false;@@ -3100,10 +3094,6 @@ static bool init_soc_bounding_box(struct dc *dc, clock_limits_available = (status ==PP_SMU_RESULT_OK ); } -// HACK: Use the max uclk_states value for all elements. -for (i =0 ; i < num_states; i++) - uclk_states[i] = uclk_states[num_states -1 ]; -if (clock_limits_available && uclk_states_available && num_states)update_bounding_box (dc, &dcn2_0_soc, &max_clocks, uclk_states, num_states);else if (clock_limits_available) --2.17.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Harry Wentland
Reviewed-byRe: [PATCH 2/2] drm/amd/display: Support uclk switching for DCN2
In reply to a message not in the archiveQuoted 16 lines · Nicholas Kazlauskas
[Why]
We were previously forcing the uclk for every state to max and reducing the switch time to prevent uclk switching from occuring. This workaround was previously needed in order to avoid hangs + underflow under certain display configurations.Now that DC has the proper fix complete we can drop the hacks and improve power for most display configurations.
[How]
We still need the function pointers hooked up to grab the real uclk states from pplib. The rest of the prior hack can be reverted.The key requirements here are really just DC support, updated firmware, and support for disabling p-state support when needed in pplib/smu.
Quoted 8 lines
When these requirements are met uclk switching works without underflow or hangs.
Fixes 02316e963a5a ("drm/amd/display: Force uclk to max for every state")Cc Leo Li <[email protected]>Cc Harry Wentland <[email protected]>Signed-off-by Nicholas Kazlauskas <[email protected]>
Series is
Harry
Quoted 37 lines
--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 10 ---------- 1 file changed, 10 deletions(-)drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +0
-6@@ -2817,9 +2817,6 @@ static void cap_soc_clocks( && max_clocks.uClockInKhz != 0) bb->clock_limits[i].dram_speed_mts = (max_clocks.uClockInKhz /1000 ) *16 ; -// HACK: Force every uclk to max for now to "disable" uclk switching. - bb->clock_limits[i].dram_speed_mts = (max_clocks.uClockInKhz /1000 ) *16 ; -if ((bb->clock_limits[i].fabricclk_mhz > (max_clocks.fabricClockInKhz /1000 )) && max_clocks.fabricClockInKhz !=0 ) bb->clock_limits[i].fabricclk_mhz = (max_clocks.fabricClockInKhz /1000 );@@ -3035,8 +3032,6 @@ static bool init_soc_bounding_box(struct dc *dc,le32_to_cpu (bb->vmm_page_size_bytes); dcn2_0_soc.dram_clock_change_latency_us =fixed16_to_double_to_cpu (bb->dram_clock_change_latency_us); -// HACK!! Lower uclock latency switch time so we don't switch - dcn2_0_soc.dram_clock_change_latency_us =10 ; dcn2_0_soc.writeback_dram_clock_change_latency_us =fixed16_to_double_to_cpu (bb->writeback_dram_clock_change_latency_us); dcn2_0_soc.return_bus_width_bytes =@@ -3078,7 +3073,6 @@ static bool init_soc_bounding_box(struct dc *dc,struct pp_smu_nv_clock_table max_clocks = {0 };unsigned int uclk_states[8 ] = {0 };unsigned int num_states =0 ; -int i;enum pp_smu_status status;bool clock_limits_available = false;bool uclk_states_available = false;
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c static bool init_soc_bounding_box(struct dc *dc, · line 3099
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +0
-4@@ -3100,10 +3094,6 @@ static bool init_soc_bounding_box(struct dc *dc, clock_limits_available = (status ==PP_SMU_RESULT_OK ); } -// HACK: Use the max uclk_states value for all elements. -for (i =0 ; i < num_states; i++) - uclk_states[i] = uclk_states[num_states -1 ]; -if (clock_limits_available && uclk_states_available && num_states)update_bounding_box (dc, &dcn2_0_soc, &max_clocks, uclk_states, num_states);else if (clock_limits_available)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Isn't NV10 a family of chips in Nouveau?
Regards
//Ernst
Den tis 30 juli 2019 kl 15:57 skrev Nicholas Kazlauskas <[email protected]>:
Quoted 158 lines
[Why]
In order to support uclk switching on NV10 the SOC bounding box needs to be updated.[How]
We currently read the constants from the gpu info FW, but supporting workarounds in DC for different versions of the FW adds additional complexity to the codebase.NV10 has been released so it's cleanest to keep the bounding box and source code in sync by embedding the bounding box like we do for other ASICs.
Fixes 02316e963a5a ("drm/amd/display: Force uclk to max for every state")Cc Alex Deucher <[email protected]>Cc Harry Wentland <[email protected]>Signed-off-by Nicholas Kazlauskas <[email protected]>--- .../drm/amd/display/dc/dcn20/dcn20_resource.c | 114 +++++++++++++++++- 1 file changed, 112 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +112
-3@@ -80,7 +80,7 @@#include "amdgpu_socbb.h" -#define SOC_BOUNDING_BOX_VALID false +#define SOC_BOUNDING_BOX_VALID true#define DC_LOGGER_INIT (logger)struct _vcs_dpi_ip_params_st dcn2_0_ip = {@@ -154,7 +154,117 @@ struct _vcs_dpi_ip_params_st dcn2_0_ip = { .xfc_fill_constant_bytes = 0, }; -struct _vcs_dpi_soc_bounding_box_st dcn2_0_soc = {0 }; +struct _vcs_dpi_soc_bounding_box_st dcn2_0_soc = { +/* Defaults that get patched on driver load from firmware. */ + .clock_limits = { + { + .state =0 , + .dcfclk_mhz =560.0 , + .fabricclk_mhz =560.0 , + .dispclk_mhz =513.0 , + .dppclk_mhz =513.0 , + .phyclk_mhz =540.0 , + .socclk_mhz =560.0 , + .dscclk_mhz =171.0 , + .dram_speed_mts =8960.0 , + }, + { + .state =1 , + .dcfclk_mhz =694.0 , + .fabricclk_mhz =694.0 , + .dispclk_mhz =642.0 , + .dppclk_mhz =642.0 , + .phyclk_mhz =600.0 , + .socclk_mhz =694.0 , + .dscclk_mhz =214.0 , + .dram_speed_mts =11104.0 , + }, + { + .state =2 , + .dcfclk_mhz =875.0 , + .fabricclk_mhz =875.0 , + .dispclk_mhz =734.0 , + .dppclk_mhz =734.0 , + .phyclk_mhz =810.0 , + .socclk_mhz =875.0 , + .dscclk_mhz =245.0 , + .dram_speed_mts =14000.0 , + }, + { + .state =3 , + .dcfclk_mhz =1000.0 , + .fabricclk_mhz =1000.0 , + .dispclk_mhz =1100.0 , + .dppclk_mhz =1100.0 , + .phyclk_mhz =810.0 , + .socclk_mhz =1000.0 , + .dscclk_mhz =367.0 , + .dram_speed_mts =16000.0 , + }, + { + .state =4 , + .dcfclk_mhz =1200.0 , + .fabricclk_mhz =1200.0 , + .dispclk_mhz =1284.0 , + .dppclk_mhz =1284.0 , + .phyclk_mhz =810.0 , + .socclk_mhz =1200.0 , + .dscclk_mhz =428.0 , + .dram_speed_mts =16000.0 , + }, +/*Extra state, no dispclk ramping*/ + { + .state =5 , + .dcfclk_mhz =1200.0 , + .fabricclk_mhz =1200.0 , + .dispclk_mhz =1284.0 , + .dppclk_mhz =1284.0 , + .phyclk_mhz =810.0 , + .socclk_mhz =1200.0 , + .dscclk_mhz =428.0 , + .dram_speed_mts =16000.0 , + }, + }, + .num_states =5 , + .sr_exit_time_us =8.6 , + .sr_enter_plus_exit_time_us =10.9 , + .urgent_latency_us =4.0 , + .urgent_latency_pixel_data_only_us =4.0 , + .urgent_latency_pixel_mixed_with_vm_data_us =4.0 , + .urgent_latency_vm_data_only_us =4.0 , + .urgent_out_of_order_return_per_channel_pixel_only_bytes =4096 , + .urgent_out_of_order_return_per_channel_pixel_and_vm_bytes =4096 , + .urgent_out_of_order_return_per_channel_vm_only_bytes =4096 , + .pct_ideal_dram_sdp_bw_after_urgent_pixel_only =40.0 , + .pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm =40.0 , + .pct_ideal_dram_sdp_bw_after_urgent_vm_only =40.0 , + .max_avg_sdp_bw_use_normal_percent =40.0 , + .max_avg_dram_bw_use_normal_percent =40.0 , + .writeback_latency_us =12.0 , + .ideal_dram_bw_after_urgent_percent =40.0 , + .max_request_size_bytes =256 , + .dram_channel_width_bytes =2 , + .fabric_datapath_to_dcn_data_return_bytes =64 , + .dcn_downspread_percent =0.5 , + .downspread_percent =0.38 , + .dram_page_open_time_ns =50.0 , + .dram_rw_turnaround_time_ns =17.5 , + .dram_return_buffer_per_channel_bytes =8192 , + .round_trip_ping_latency_dcfclk_cycles =131 , + .urgent_out_of_order_return_per_channel_bytes =256 , + .channel_interleave_bytes =256 , + .num_banks =8 , + .num_chans =16 , + .vmm_page_size_bytes =4096 , + .dram_clock_change_latency_us =404.0 , + .dummy_pstate_latency_us =5.0 , + .writeback_dram_clock_change_latency_us =23.0 , + .return_bus_width_bytes =64 , + .dispclk_dppclk_vco_speed_mhz =3850 , + .xfc_bus_transport_time_us =20 , + .xfc_xbuf_latency_tolerance_us =4 , + .use_urgent_burst_bw =0 +};#ifndef mmDP0_DP_DPHY_INTERNAL_CTRL --2.17.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx