aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorDmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>2018-09-18 15:00:49 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-11-05 14:20:40 -0500
commit9566b67586fb1d96c36207fd975087d68296755c (patch)
treeaffd7cb835bd7e002d6ba1bcb82a5fe7f284a9af /drivers/gpu/drm
parent24f7dd7ea98dc54fa45a0dd10c7a472e00ca01d4 (diff)
drm/amd/display: remove safe_to_lower flag from dc, use 2 functions instead
This is done to keep things more readable, avoids a true/false flag in dc interface layer. Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com> Reviewed-by: Tony Cheng <Tony.Cheng@amd.com> Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/amd/display/dc/core/dc.c8
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.c15
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.h5
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c30
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.h9
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce80/dce80_hw_sequencer.c3
-rw-r--r--drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c39
-rw-r--r--drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h8
8 files changed, 79 insertions, 38 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 2bbc39de10cc..20dd062d7a33 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -941,7 +941,7 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c
941 if (!dcb->funcs->is_accelerated_mode(dcb)) 941 if (!dcb->funcs->is_accelerated_mode(dcb))
942 dc->hwss.enable_accelerated_mode(dc, context); 942 dc->hwss.enable_accelerated_mode(dc, context);
943 943
944 dc->hwss.set_bandwidth(dc, context, false); 944 dc->hwss.prepare_bandwidth(dc, context);
945 945
946 /* re-program planes for existing stream, in case we need to 946 /* re-program planes for existing stream, in case we need to
947 * free up plane resource for later use 947 * free up plane resource for later use
@@ -1010,7 +1010,7 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c
1010 dc_enable_stereo(dc, context, dc_streams, context->stream_count); 1010 dc_enable_stereo(dc, context, dc_streams, context->stream_count);
1011 1011
1012 /* pplib is notified if disp_num changed */ 1012 /* pplib is notified if disp_num changed */
1013 dc->hwss.set_bandwidth(dc, context, true); 1013 dc->hwss.optimize_bandwidth(dc, context);
1014 1014
1015 dc_release_state(dc->current_state); 1015 dc_release_state(dc->current_state);
1016 1016
@@ -1059,7 +1059,7 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
1059 1059
1060 dc->optimized_required = false; 1060 dc->optimized_required = false;
1061 1061
1062 dc->hwss.set_bandwidth(dc, context, true); 1062 dc->hwss.optimize_bandwidth(dc, context);
1063 return true; 1063 return true;
1064} 1064}
1065 1065
@@ -1479,7 +1479,7 @@ static void commit_planes_for_stream(struct dc *dc,
1479 struct pipe_ctx *top_pipe_to_program = NULL; 1479 struct pipe_ctx *top_pipe_to_program = NULL;
1480 1480
1481 if (update_type == UPDATE_TYPE_FULL) { 1481 if (update_type == UPDATE_TYPE_FULL) {
1482 dc->hwss.set_bandwidth(dc, context, false); 1482 dc->hwss.prepare_bandwidth(dc, context);
1483 context_clock_trace(dc, context); 1483 context_clock_trace(dc, context);
1484 } 1484 }
1485 1485
diff --git a/drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.c
index 2725eac4baab..5055026e553f 100644
--- a/drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.c
@@ -105,22 +105,16 @@ bool dce100_enable_display_power_gating(
105 return false; 105 return false;
106} 106}
107 107
108void dce100_set_bandwidth( 108void dce100_prepare_bandwidth(
109 struct dc *dc, 109 struct dc *dc,
110 struct dc_state *context, 110 struct dc_state *context)
111 bool decrease_allowed)
112{ 111{
113 int dispclk_khz = context->bw.dce.dispclk_khz;
114
115 context->bw.dce.dispclk_khz = context->bw.dce.dispclk_khz * 115 / 100;
116
117 dce110_set_safe_displaymarks(&context->res_ctx, dc->res_pool); 112 dce110_set_safe_displaymarks(&context->res_ctx, dc->res_pool);
118 113
119 dc->res_pool->dccg->funcs->update_clocks( 114 dc->res_pool->dccg->funcs->update_clocks(
120 dc->res_pool->dccg, 115 dc->res_pool->dccg,
121 context, 116 context,
122 decrease_allowed); 117 false);
123 context->bw.dce.dispclk_khz = dispclk_khz;
124} 118}
125 119
126/**************************************************************************/ 120/**************************************************************************/
@@ -130,6 +124,7 @@ void dce100_hw_sequencer_construct(struct dc *dc)
130 dce110_hw_sequencer_construct(dc); 124 dce110_hw_sequencer_construct(dc);
131 125
132 dc->hwss.enable_display_power_gating = dce100_enable_display_power_gating; 126 dc->hwss.enable_display_power_gating = dce100_enable_display_power_gating;
133 dc->hwss.set_bandwidth = dce100_set_bandwidth; 127 dc->hwss.prepare_bandwidth = dce100_prepare_bandwidth;
128 dc->hwss.optimize_bandwidth = dce100_prepare_bandwidth;
134} 129}
135 130
diff --git a/drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.h
index c6ec0ed6ec3d..acd418515346 100644
--- a/drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.h
+++ b/drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.h
@@ -33,10 +33,9 @@ struct dc_state;
33 33
34void dce100_hw_sequencer_construct(struct dc *dc); 34void dce100_hw_sequencer_construct(struct dc *dc);
35 35
36void dce100_set_bandwidth( 36void dce100_prepare_bandwidth(
37 struct dc *dc, 37 struct dc *dc,
38 struct dc_state *context, 38 struct dc_state *context);
39 bool decrease_allowed);
40 39
41bool dce100_enable_display_power_gating(struct dc *dc, uint8_t controller_id, 40bool dce100_enable_display_power_gating(struct dc *dc, uint8_t controller_id,
42 struct dc_bios *dcb, 41 struct dc_bios *dcb,
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
index 0d25dcf6408a..bd3ce10f6309 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
@@ -2352,22 +2352,33 @@ static void init_hw(struct dc *dc)
2352 2352
2353} 2353}
2354 2354
2355void dce110_set_bandwidth( 2355
2356void dce110_prepare_bandwidth(
2356 struct dc *dc, 2357 struct dc *dc,
2357 struct dc_state *context, 2358 struct dc_state *context)
2358 bool decrease_allowed)
2359{ 2359{
2360 struct dccg *dccg = dc->res_pool->dccg; 2360 struct dccg *dccg = dc->res_pool->dccg;
2361 2361
2362 if (decrease_allowed) 2362 dce110_set_safe_displaymarks(&context->res_ctx, dc->res_pool);
2363 dce110_set_displaymarks(dc, context);
2364 else
2365 dce110_set_safe_displaymarks(&context->res_ctx, dc->res_pool);
2366 2363
2367 dccg->funcs->update_clocks( 2364 dccg->funcs->update_clocks(
2368 dccg, 2365 dccg,
2369 context, 2366 context,
2370 decrease_allowed); 2367 false);
2368}
2369
2370void dce110_optimize_bandwidth(
2371 struct dc *dc,
2372 struct dc_state *context)
2373{
2374 struct dccg *dccg = dc->res_pool->dccg;
2375
2376 dce110_set_displaymarks(dc, context);
2377
2378 dccg->funcs->update_clocks(
2379 dccg,
2380 context,
2381 true);
2371} 2382}
2372 2383
2373static void dce110_program_front_end_for_pipe( 2384static void dce110_program_front_end_for_pipe(
@@ -2667,7 +2678,8 @@ static const struct hw_sequencer_funcs dce110_funcs = {
2667 .enable_display_power_gating = dce110_enable_display_power_gating, 2678 .enable_display_power_gating = dce110_enable_display_power_gating,
2668 .disable_plane = dce110_power_down_fe, 2679 .disable_plane = dce110_power_down_fe,
2669 .pipe_control_lock = dce_pipe_control_lock, 2680 .pipe_control_lock = dce_pipe_control_lock,
2670 .set_bandwidth = dce110_set_bandwidth, 2681 .prepare_bandwidth = dce110_prepare_bandwidth,
2682 .optimize_bandwidth = dce110_optimize_bandwidth,
2671 .set_drr = set_drr, 2683 .set_drr = set_drr,
2672 .get_position = get_position, 2684 .get_position = get_position,
2673 .set_static_screen_control = set_static_screen_control, 2685 .set_static_screen_control = set_static_screen_control,
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.h
index c5e04f856e2c..cd3e36d52a52 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.h
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.h
@@ -63,10 +63,13 @@ void dce110_set_safe_displaymarks(
63 struct resource_context *res_ctx, 63 struct resource_context *res_ctx,
64 const struct resource_pool *pool); 64 const struct resource_pool *pool);
65 65
66void dce110_set_bandwidth( 66void dce110_prepare_bandwidth(
67 struct dc *dc, 67 struct dc *dc,
68 struct dc_state *context, 68 struct dc_state *context);
69 bool decrease_allowed); 69
70void dce110_optimize_bandwidth(
71 struct dc *dc,
72 struct dc_state *context);
70 73
71void dp_receiver_power_ctrl(struct dc_link *link, bool on); 74void dp_receiver_power_ctrl(struct dc_link *link, bool on);
72 75
diff --git a/drivers/gpu/drm/amd/display/dc/dce80/dce80_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce80/dce80_hw_sequencer.c
index 6c6a1a16af19..a60a90e68d91 100644
--- a/drivers/gpu/drm/amd/display/dc/dce80/dce80_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce80/dce80_hw_sequencer.c
@@ -76,6 +76,7 @@ void dce80_hw_sequencer_construct(struct dc *dc)
76 76
77 dc->hwss.enable_display_power_gating = dce100_enable_display_power_gating; 77 dc->hwss.enable_display_power_gating = dce100_enable_display_power_gating;
78 dc->hwss.pipe_control_lock = dce_pipe_control_lock; 78 dc->hwss.pipe_control_lock = dce_pipe_control_lock;
79 dc->hwss.set_bandwidth = dce100_set_bandwidth; 79 dc->hwss.prepare_bandwidth = dce100_prepare_bandwidth;
80 dc->hwss.optimize_bandwidth = dce100_prepare_bandwidth;
80} 81}
81 82
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
index 4976230f78e4..637524128176 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
@@ -2358,10 +2358,9 @@ static void dcn10_apply_ctx_for_surface(
2358 hubbub1_wm_change_req_wa(dc->res_pool->hubbub); 2358 hubbub1_wm_change_req_wa(dc->res_pool->hubbub);
2359} 2359}
2360 2360
2361static void dcn10_set_bandwidth( 2361static void dcn10_prepare_bandwidth(
2362 struct dc *dc, 2362 struct dc *dc,
2363 struct dc_state *context, 2363 struct dc_state *context)
2364 bool safe_to_lower)
2365{ 2364{
2366 if (dc->debug.sanity_checks) 2365 if (dc->debug.sanity_checks)
2367 dcn10_verify_allow_pstate_change_high(dc); 2366 dcn10_verify_allow_pstate_change_high(dc);
@@ -2373,7 +2372,36 @@ static void dcn10_set_bandwidth(
2373 dc->res_pool->dccg->funcs->update_clocks( 2372 dc->res_pool->dccg->funcs->update_clocks(
2374 dc->res_pool->dccg, 2373 dc->res_pool->dccg,
2375 context, 2374 context,
2376 safe_to_lower); 2375 false);
2376 }
2377
2378 hubbub1_program_watermarks(dc->res_pool->hubbub,
2379 &context->bw.dcn.watermarks,
2380 dc->res_pool->ref_clock_inKhz / 1000,
2381 true);
2382
2383 if (dc->debug.pplib_wm_report_mode == WM_REPORT_OVERRIDE)
2384 dcn_bw_notify_pplib_of_wm_ranges(dc);
2385
2386 if (dc->debug.sanity_checks)
2387 dcn10_verify_allow_pstate_change_high(dc);
2388}
2389
2390static void dcn10_optimize_bandwidth(
2391 struct dc *dc,
2392 struct dc_state *context)
2393{
2394 if (dc->debug.sanity_checks)
2395 dcn10_verify_allow_pstate_change_high(dc);
2396
2397 if (!IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment)) {
2398 if (context->stream_count == 0)
2399 context->bw.dcn.clk.phyclk_khz = 0;
2400
2401 dc->res_pool->dccg->funcs->update_clocks(
2402 dc->res_pool->dccg,
2403 context,
2404 true);
2377 } 2405 }
2378 2406
2379 hubbub1_program_watermarks(dc->res_pool->hubbub, 2407 hubbub1_program_watermarks(dc->res_pool->hubbub,
@@ -2682,7 +2710,8 @@ static const struct hw_sequencer_funcs dcn10_funcs = {
2682 .disable_plane = dcn10_disable_plane, 2710 .disable_plane = dcn10_disable_plane,
2683 .blank_pixel_data = dcn10_blank_pixel_data, 2711 .blank_pixel_data = dcn10_blank_pixel_data,
2684 .pipe_control_lock = dcn10_pipe_control_lock, 2712 .pipe_control_lock = dcn10_pipe_control_lock,
2685 .set_bandwidth = dcn10_set_bandwidth, 2713 .prepare_bandwidth = dcn10_prepare_bandwidth,
2714 .optimize_bandwidth = dcn10_optimize_bandwidth,
2686 .reset_hw_ctx_wrap = reset_hw_ctx_wrap, 2715 .reset_hw_ctx_wrap = reset_hw_ctx_wrap,
2687 .enable_stream_timing = dcn10_enable_stream_timing, 2716 .enable_stream_timing = dcn10_enable_stream_timing,
2688 .set_drr = set_drr, 2717 .set_drr = set_drr,
diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h
index c673d3ef67cc..75de1d8d0c20 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h
@@ -177,10 +177,12 @@ struct hw_sequencer_funcs {
177 struct pipe_ctx *pipe_ctx, 177 struct pipe_ctx *pipe_ctx,
178 bool blank); 178 bool blank);
179 179
180 void (*set_bandwidth)( 180 void (*prepare_bandwidth)(
181 struct dc *dc, 181 struct dc *dc,
182 struct dc_state *context, 182 struct dc_state *context);
183 bool safe_to_lower); 183 void (*optimize_bandwidth)(
184 struct dc *dc,
185 struct dc_state *context);
184 186
185 void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes, 187 void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes,
186 int vmin, int vmax); 188 int vmin, int vmax);