Skip to content

Commit 745395b

Browse files
committed
drm/i915/dp: Add intel_dp_mode_valid_with_dsc()
Add intel_dp_mode_valid_with_dsc() and call this for an SST/MST mode validation to prepare for a follow-up change using a way to verify the mode's required BW the same way this is done elsewhere during state computation (which in turn depends on the mode's effective data rate with the corresponding BW overhead). Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Link: https://patch.msgid.link/20251222153547.713360-13-imre.deak@intel.com
1 parent e68aecf commit 745395b

3 files changed

Lines changed: 57 additions & 36 deletions

File tree

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

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,24 +1580,20 @@ intel_dp_mode_valid(struct drm_connector *_connector,
15801580
dsc_slice_count =
15811581
drm_dp_dsc_sink_max_slice_count(connector->dp.dsc_dpcd,
15821582
true);
1583+
dsc = dsc_max_compressed_bpp && dsc_slice_count;
15831584
} else if (drm_dp_sink_supports_fec(connector->dp.fec_capability)) {
1584-
dsc_max_compressed_bpp =
1585-
intel_dp_dsc_get_max_compressed_bpp(display,
1586-
max_link_clock,
1587-
max_lanes,
1588-
target_clock,
1589-
mode->hdisplay,
1590-
num_joined_pipes,
1591-
output_format,
1592-
pipe_bpp, 64);
1593-
dsc_slice_count =
1594-
intel_dp_dsc_get_slice_count(connector,
1595-
target_clock,
1596-
mode->hdisplay,
1597-
num_joined_pipes);
1598-
}
1585+
unsigned long bw_overhead_flags = 0;
15991586

1600-
dsc = dsc_max_compressed_bpp && dsc_slice_count;
1587+
if (!drm_dp_is_uhbr_rate(max_link_clock))
1588+
bw_overhead_flags |= DRM_DP_BW_OVERHEAD_FEC;
1589+
1590+
dsc = intel_dp_mode_valid_with_dsc(connector,
1591+
max_link_clock, max_lanes,
1592+
target_clock, mode->hdisplay,
1593+
num_joined_pipes,
1594+
output_format, pipe_bpp,
1595+
bw_overhead_flags);
1596+
}
16011597
}
16021598

16031599
if (intel_dp_joiner_needs_dsc(display, num_joined_pipes) && !dsc)
@@ -2705,6 +2701,35 @@ static int compute_max_compressed_bpp_x16(struct intel_connector *connector,
27052701
return max_link_bpp_x16;
27062702
}
27072703

2704+
bool intel_dp_mode_valid_with_dsc(struct intel_connector *connector,
2705+
int link_clock, int lane_count,
2706+
int mode_clock, int mode_hdisplay,
2707+
int num_joined_pipes,
2708+
enum intel_output_format output_format,
2709+
int pipe_bpp, unsigned long bw_overhead_flags)
2710+
{
2711+
struct intel_display *display = to_intel_display(connector);
2712+
int dsc_max_compressed_bpp;
2713+
int dsc_slice_count;
2714+
2715+
dsc_max_compressed_bpp =
2716+
intel_dp_dsc_get_max_compressed_bpp(display,
2717+
link_clock,
2718+
lane_count,
2719+
mode_clock,
2720+
mode_hdisplay,
2721+
num_joined_pipes,
2722+
output_format,
2723+
pipe_bpp, 64);
2724+
dsc_slice_count =
2725+
intel_dp_dsc_get_slice_count(connector,
2726+
mode_clock,
2727+
mode_hdisplay,
2728+
num_joined_pipes);
2729+
2730+
return dsc_max_compressed_bpp && dsc_slice_count;
2731+
}
2732+
27082733
/*
27092734
* Calculate the output link min, max bpp values in limits based on the pipe bpp
27102735
* range, crtc_state and dsc mode. Return true on success.

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ u16 intel_dp_dsc_get_max_compressed_bpp(struct intel_display *display,
150150
enum intel_output_format output_format,
151151
u32 pipe_bpp,
152152
u32 timeslots);
153+
154+
bool intel_dp_mode_valid_with_dsc(struct intel_connector *connector,
155+
int link_clock, int lane_count,
156+
int mode_clock, int mode_hdisplay,
157+
int num_joined_pipes,
158+
enum intel_output_format output_format,
159+
int pipe_bpp, unsigned long bw_overhead_flags);
153160
bool intel_dp_dsc_valid_compressed_bpp(struct intel_dp *intel_dp, int bpp_x16);
154161
u8 intel_dp_dsc_get_slice_count(const struct intel_connector *connector,
155162
int mode_clock, int mode_hdisplay,

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

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,8 +1462,6 @@ mst_connector_mode_valid_ctx(struct drm_connector *_connector,
14621462
DRM_DP_BW_OVERHEAD_MST | DRM_DP_BW_OVERHEAD_SSC_REF_CLK;
14631463
int ret;
14641464
bool dsc = false;
1465-
u16 dsc_max_compressed_bpp = 0;
1466-
u8 dsc_slice_count = 0;
14671465
int target_clock = mode->clock;
14681466
int num_joined_pipes;
14691467

@@ -1522,31 +1520,22 @@ mst_connector_mode_valid_ctx(struct drm_connector *_connector,
15221520
return 0;
15231521
}
15241522

1525-
if (intel_dp_has_dsc(connector)) {
1523+
if (intel_dp_has_dsc(connector) && drm_dp_sink_supports_fec(connector->dp.fec_capability)) {
15261524
/*
15271525
* TBD pass the connector BPC,
15281526
* for now U8_MAX so that max BPC on that platform would be picked
15291527
*/
15301528
int pipe_bpp = intel_dp_dsc_compute_max_bpp(connector, U8_MAX);
15311529

1532-
if (drm_dp_sink_supports_fec(connector->dp.fec_capability)) {
1533-
dsc_max_compressed_bpp =
1534-
intel_dp_dsc_get_max_compressed_bpp(display,
1535-
max_link_clock,
1536-
max_lanes,
1537-
target_clock,
1538-
mode->hdisplay,
1539-
num_joined_pipes,
1540-
INTEL_OUTPUT_FORMAT_RGB,
1541-
pipe_bpp, 64);
1542-
dsc_slice_count =
1543-
intel_dp_dsc_get_slice_count(connector,
1544-
target_clock,
1545-
mode->hdisplay,
1546-
num_joined_pipes);
1547-
}
1530+
if (!drm_dp_is_uhbr_rate(max_link_clock))
1531+
bw_overhead_flags |= DRM_DP_BW_OVERHEAD_FEC;
15481532

1549-
dsc = dsc_max_compressed_bpp && dsc_slice_count;
1533+
dsc = intel_dp_mode_valid_with_dsc(connector,
1534+
max_link_clock, max_lanes,
1535+
target_clock, mode->hdisplay,
1536+
num_joined_pipes,
1537+
INTEL_OUTPUT_FORMAT_RGB, pipe_bpp,
1538+
bw_overhead_flags);
15501539
}
15511540

15521541
if (intel_dp_joiner_needs_dsc(display, num_joined_pipes) && !dsc) {

0 commit comments

Comments
 (0)