Skip to content

Commit 3384654

Browse files
committed
drm/i915/dp: Fail state computation for invalid DSC source input BPP values
There is no reason to accept an invalid minimum/maximum DSC source input BPP value (i.e a minimum DSC input BPP value above the maximum pipe BPP or a maximum DSC input BPP value below the minimum pipe BPP value), fail the state computation in these cases. Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Link: https://patch.msgid.link/20251215192357.172201-17-imre.deak@intel.com
1 parent a63bbb8 commit 3384654

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

drivers/gpu/drm/i915/display/intel_dp.c

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2661,16 +2661,30 @@ intel_dp_compute_config_link_bpp_limits(struct intel_dp *intel_dp,
26612661
return true;
26622662
}
26632663

2664-
static void
2665-
intel_dp_dsc_compute_pipe_bpp_limits(struct intel_dp *intel_dp,
2664+
static bool
2665+
intel_dp_dsc_compute_pipe_bpp_limits(struct intel_connector *connector,
26662666
struct link_config_limits *limits)
26672667
{
2668-
struct intel_display *display = to_intel_display(intel_dp);
2668+
struct intel_display *display = to_intel_display(connector);
2669+
const struct link_config_limits orig_limits = *limits;
26692670
int dsc_min_bpc = intel_dp_dsc_min_src_input_bpc();
26702671
int dsc_max_bpc = intel_dp_dsc_max_src_input_bpc(display);
26712672

2672-
limits->pipe.max_bpp = clamp(limits->pipe.max_bpp, dsc_min_bpc * 3, dsc_max_bpc * 3);
2673-
limits->pipe.min_bpp = clamp(limits->pipe.min_bpp, dsc_min_bpc * 3, dsc_max_bpc * 3);
2673+
limits->pipe.min_bpp = max(limits->pipe.min_bpp, dsc_min_bpc * 3);
2674+
limits->pipe.max_bpp = min(limits->pipe.max_bpp, dsc_max_bpc * 3);
2675+
2676+
if (limits->pipe.min_bpp <= 0 ||
2677+
limits->pipe.min_bpp > limits->pipe.max_bpp) {
2678+
drm_dbg_kms(display->drm,
2679+
"[CONNECTOR:%d:%s] Invalid DSC src/sink input BPP (src:%d-%d pipe:%d-%d)\n",
2680+
connector->base.base.id, connector->base.name,
2681+
dsc_min_bpc * 3, dsc_max_bpc * 3,
2682+
orig_limits.pipe.min_bpp, orig_limits.pipe.max_bpp);
2683+
2684+
return false;
2685+
}
2686+
2687+
return true;
26742688
}
26752689

26762690
bool
@@ -2710,8 +2724,8 @@ intel_dp_compute_config_limits(struct intel_dp *intel_dp,
27102724
respect_downstream_limits);
27112725
}
27122726

2713-
if (dsc)
2714-
intel_dp_dsc_compute_pipe_bpp_limits(intel_dp, limits);
2727+
if (dsc && !intel_dp_dsc_compute_pipe_bpp_limits(connector, limits))
2728+
return false;
27152729

27162730
if (is_mst || intel_dp->use_max_params) {
27172731
/*

0 commit comments

Comments
 (0)