Skip to content

Commit 118800b

Browse files
Timur Kristófalexdeucher
authored andcommitted
drm/amd/display: Reject modes with too high pixel clock on DCE6-10
Reject modes with a pixel clock higher than the maximum display clock. Use 400 MHz as a fallback value when the maximum display clock is not known. Pixel clocks that are higher than the display clock just won't work and are not supported. With the addition of the YUV422 fallback, DC can now accidentally select a mode requiring higher pixel clock than actually supported when the DP version supports the required bandwidth but the clock is otherwise too high for the display engine. DCE 6-10 don't support these modes but they don't have a bandwidth calculation to reject them properly. Fixes: db291ed ("drm/amd/display: Add fallback path for YCBCR422") Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Timur Kristóf <[email protected]> Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 210844d commit 118800b

File tree

5 files changed

+35
-3
lines changed

5 files changed

+35
-3
lines changed

drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ void dce_clk_mgr_construct(
463463
clk_mgr->max_clks_state = DM_PP_CLOCKS_STATE_NOMINAL;
464464
clk_mgr->cur_min_clks_state = DM_PP_CLOCKS_STATE_INVALID;
465465

466+
base->clks.max_supported_dispclk_khz =
467+
clk_mgr->max_clks_by_state[DM_PP_CLOCKS_STATE_PERFORMANCE].display_clk_khz;
468+
466469
dce_clock_read_integrated_info(clk_mgr);
467470
dce_clock_read_ss_info(clk_mgr);
468471
}

drivers/gpu/drm/amd/display/dc/clk_mgr/dce60/dce60_clk_mgr.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ void dce60_clk_mgr_construct(
147147
struct dc_context *ctx,
148148
struct clk_mgr_internal *clk_mgr)
149149
{
150+
struct clk_mgr *base = &clk_mgr->base;
151+
150152
dce_clk_mgr_construct(ctx, clk_mgr);
151153

152154
memcpy(clk_mgr->max_clks_by_state,
@@ -157,5 +159,8 @@ void dce60_clk_mgr_construct(
157159
clk_mgr->clk_mgr_shift = &disp_clk_shift;
158160
clk_mgr->clk_mgr_mask = &disp_clk_mask;
159161
clk_mgr->base.funcs = &dce60_funcs;
162+
163+
base->clks.max_supported_dispclk_khz =
164+
clk_mgr->max_clks_by_state[DM_PP_CLOCKS_STATE_PERFORMANCE].display_clk_khz;
160165
}
161166

drivers/gpu/drm/amd/display/dc/resource/dce100/dce100_resource.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "stream_encoder.h"
3030

3131
#include "resource.h"
32+
#include "clk_mgr.h"
3233
#include "include/irq_service_interface.h"
3334
#include "virtual/virtual_stream_encoder.h"
3435
#include "dce110/dce110_resource.h"
@@ -843,10 +844,17 @@ static enum dc_status dce100_validate_bandwidth(
843844
{
844845
int i;
845846
bool at_least_one_pipe = false;
847+
struct dc_stream_state *stream = NULL;
848+
const uint32_t max_pix_clk_khz = max(dc->clk_mgr->clks.max_supported_dispclk_khz, 400000);
846849

847850
for (i = 0; i < dc->res_pool->pipe_count; i++) {
848-
if (context->res_ctx.pipe_ctx[i].stream)
851+
stream = context->res_ctx.pipe_ctx[i].stream;
852+
if (stream) {
849853
at_least_one_pipe = true;
854+
855+
if (stream->timing.pix_clk_100hz >= max_pix_clk_khz * 10)
856+
return DC_FAIL_BANDWIDTH_VALIDATE;
857+
}
850858
}
851859

852860
if (at_least_one_pipe) {

drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "stream_encoder.h"
3535

3636
#include "resource.h"
37+
#include "clk_mgr.h"
3738
#include "include/irq_service_interface.h"
3839
#include "irq/dce60/irq_service_dce60.h"
3940
#include "dce110/dce110_timing_generator.h"
@@ -870,10 +871,17 @@ static enum dc_status dce60_validate_bandwidth(
870871
{
871872
int i;
872873
bool at_least_one_pipe = false;
874+
struct dc_stream_state *stream = NULL;
875+
const uint32_t max_pix_clk_khz = max(dc->clk_mgr->clks.max_supported_dispclk_khz, 400000);
873876

874877
for (i = 0; i < dc->res_pool->pipe_count; i++) {
875-
if (context->res_ctx.pipe_ctx[i].stream)
878+
stream = context->res_ctx.pipe_ctx[i].stream;
879+
if (stream) {
876880
at_least_one_pipe = true;
881+
882+
if (stream->timing.pix_clk_100hz >= max_pix_clk_khz * 10)
883+
return DC_FAIL_BANDWIDTH_VALIDATE;
884+
}
877885
}
878886

879887
if (at_least_one_pipe) {

drivers/gpu/drm/amd/display/dc/resource/dce80/dce80_resource.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "stream_encoder.h"
3333

3434
#include "resource.h"
35+
#include "clk_mgr.h"
3536
#include "include/irq_service_interface.h"
3637
#include "irq/dce80/irq_service_dce80.h"
3738
#include "dce110/dce110_timing_generator.h"
@@ -876,10 +877,17 @@ static enum dc_status dce80_validate_bandwidth(
876877
{
877878
int i;
878879
bool at_least_one_pipe = false;
880+
struct dc_stream_state *stream = NULL;
881+
const uint32_t max_pix_clk_khz = max(dc->clk_mgr->clks.max_supported_dispclk_khz, 400000);
879882

880883
for (i = 0; i < dc->res_pool->pipe_count; i++) {
881-
if (context->res_ctx.pipe_ctx[i].stream)
884+
stream = context->res_ctx.pipe_ctx[i].stream;
885+
if (stream) {
882886
at_least_one_pipe = true;
887+
888+
if (stream->timing.pix_clk_100hz >= max_pix_clk_khz * 10)
889+
return DC_FAIL_BANDWIDTH_VALIDATE;
890+
}
883891
}
884892

885893
if (at_least_one_pipe) {

0 commit comments

Comments
 (0)