Skip to content

Commit 375c740

Browse files
ideakSasha Levin
authored andcommitted
drm/i915/dp: Fail state computation for invalid DSC source input BPP values
[ Upstream commit 3384654 ] 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 Stable-dep-of: fe26ae6 ("drm/i915/dp: Fix pipe BPP clamping due to HDR") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 8f5ea84 commit 375c740

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

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

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2605,16 +2605,30 @@ intel_dp_compute_config_link_bpp_limits(struct intel_dp *intel_dp,
26052605
return true;
26062606
}
26072607

2608-
static void
2609-
intel_dp_dsc_compute_pipe_bpp_limits(struct intel_dp *intel_dp,
2608+
static bool
2609+
intel_dp_dsc_compute_pipe_bpp_limits(struct intel_connector *connector,
26102610
struct link_config_limits *limits)
26112611
{
2612-
struct intel_display *display = to_intel_display(intel_dp);
2612+
struct intel_display *display = to_intel_display(connector);
2613+
const struct link_config_limits orig_limits = *limits;
26132614
int dsc_min_bpc = intel_dp_dsc_min_src_input_bpc();
26142615
int dsc_max_bpc = intel_dp_dsc_max_src_input_bpc(display);
26152616

2616-
limits->pipe.max_bpp = clamp(limits->pipe.max_bpp, dsc_min_bpc * 3, dsc_max_bpc * 3);
2617-
limits->pipe.min_bpp = clamp(limits->pipe.min_bpp, dsc_min_bpc * 3, dsc_max_bpc * 3);
2617+
limits->pipe.min_bpp = max(limits->pipe.min_bpp, dsc_min_bpc * 3);
2618+
limits->pipe.max_bpp = min(limits->pipe.max_bpp, dsc_max_bpc * 3);
2619+
2620+
if (limits->pipe.min_bpp <= 0 ||
2621+
limits->pipe.min_bpp > limits->pipe.max_bpp) {
2622+
drm_dbg_kms(display->drm,
2623+
"[CONNECTOR:%d:%s] Invalid DSC src/sink input BPP (src:%d-%d pipe:%d-%d)\n",
2624+
connector->base.base.id, connector->base.name,
2625+
dsc_min_bpc * 3, dsc_max_bpc * 3,
2626+
orig_limits.pipe.min_bpp, orig_limits.pipe.max_bpp);
2627+
2628+
return false;
2629+
}
2630+
2631+
return true;
26182632
}
26192633

26202634
bool
@@ -2654,8 +2668,8 @@ intel_dp_compute_config_limits(struct intel_dp *intel_dp,
26542668
respect_downstream_limits);
26552669
}
26562670

2657-
if (dsc)
2658-
intel_dp_dsc_compute_pipe_bpp_limits(intel_dp, limits);
2671+
if (dsc && !intel_dp_dsc_compute_pipe_bpp_limits(connector, limits))
2672+
return false;
26592673

26602674
if (is_mst || intel_dp->use_max_params) {
26612675
/*

0 commit comments

Comments
 (0)