Skip to content

Commit 703c599

Browse files
committed
drm/i915/dp: Track the pipe and link bpp limits separately
A follow-up patch will need to limit the output link bpp both in the non-DSC and DSC configuration, so track the pipe and link bpp limits separately in the link_config_limits struct. Use .4 fixed point format for link bpp matching the 1/16 bpp granularity in DSC mode and for now keep this limit matching the pipe bpp limit. v2: (Jani) - Add to_bpp_int(), to_bpp_x16() helpers instead of opencoding them. - Rename link_config_limits::link.min/max_bpp to min/max_bpp_x16. Cc: Jani Nikula <jani.nikula@linux.intel.com> Reviewed-by: Luca Coelho <luciano.coelho@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230921195159.2646027-3-imre.deak@intel.com
1 parent 72b2d2a commit 703c599

4 files changed

Lines changed: 45 additions & 18 deletions

File tree

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,4 +2115,14 @@ to_intel_frontbuffer(struct drm_framebuffer *fb)
21152115
return fb ? to_intel_framebuffer(fb)->frontbuffer : NULL;
21162116
}
21172117

2118+
static inline int to_bpp_int(int bpp_x16)
2119+
{
2120+
return bpp_x16 >> 4;
2121+
}
2122+
2123+
static inline int to_bpp_x16(int bpp)
2124+
{
2125+
return bpp << 4;
2126+
}
2127+
21182128
#endif /* __INTEL_DISPLAY_TYPES_H__ */

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

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,7 @@ intel_dp_adjust_compliance_config(struct intel_dp *intel_dp,
14701470
if (intel_dp->compliance.test_data.bpc != 0) {
14711471
int bpp = 3 * intel_dp->compliance.test_data.bpc;
14721472

1473-
limits->min_bpp = limits->max_bpp = bpp;
1473+
limits->pipe.min_bpp = limits->pipe.max_bpp = bpp;
14741474
pipe_config->dither_force_disable = bpp == 6 * 3;
14751475

14761476
drm_dbg_kms(&i915->drm, "Setting pipe_bpp to %d\n", bpp);
@@ -1532,7 +1532,9 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp,
15321532
int bpp, i, lane_count, clock = intel_dp_mode_clock(pipe_config, conn_state);
15331533
int mode_rate, link_rate, link_avail;
15341534

1535-
for (bpp = limits->max_bpp; bpp >= limits->min_bpp; bpp -= 2 * 3) {
1535+
for (bpp = to_bpp_int(limits->link.max_bpp_x16);
1536+
bpp >= to_bpp_int(limits->link.min_bpp_x16);
1537+
bpp -= 2 * 3) {
15361538
int link_bpp = intel_dp_output_bpp(pipe_config->output_format, bpp);
15371539

15381540
mode_rate = intel_dp_link_required(clock, link_bpp);
@@ -1958,8 +1960,8 @@ bool is_dsc_pipe_bpp_sufficient(struct drm_i915_private *i915,
19581960
dsc_max_bpc = min(intel_dp_dsc_max_src_input_bpc(i915), conn_state->max_requested_bpc);
19591961
dsc_min_bpc = intel_dp_dsc_min_src_input_bpc(i915);
19601962

1961-
dsc_max_pipe_bpp = min(dsc_max_bpc * 3, limits->max_bpp);
1962-
dsc_min_pipe_bpp = max(dsc_min_bpc * 3, limits->min_bpp);
1963+
dsc_max_pipe_bpp = min(dsc_max_bpc * 3, limits->pipe.max_bpp);
1964+
dsc_min_pipe_bpp = max(dsc_min_bpc * 3, limits->pipe.min_bpp);
19631965

19641966
return pipe_bpp >= dsc_min_pipe_bpp &&
19651967
pipe_bpp <= dsc_max_pipe_bpp;
@@ -2019,10 +2021,10 @@ static int intel_dp_dsc_compute_pipe_bpp(struct intel_dp *intel_dp,
20192021
return -EINVAL;
20202022

20212023
dsc_max_bpc = min_t(u8, dsc_max_bpc, max_req_bpc);
2022-
dsc_max_bpp = min(dsc_max_bpc * 3, limits->max_bpp);
2024+
dsc_max_bpp = min(dsc_max_bpc * 3, limits->pipe.max_bpp);
20232025

20242026
dsc_min_bpc = intel_dp_dsc_min_src_input_bpc(i915);
2025-
dsc_min_bpp = max(dsc_min_bpc * 3, limits->min_bpp);
2027+
dsc_min_bpp = max(dsc_min_bpc * 3, limits->pipe.min_bpp);
20262028

20272029
/*
20282030
* Get the maximum DSC bpc that will be supported by any valid
@@ -2061,7 +2063,7 @@ static int intel_edp_dsc_compute_pipe_bpp(struct intel_dp *intel_dp,
20612063
if (forced_bpp) {
20622064
pipe_bpp = forced_bpp;
20632065
} else {
2064-
int max_bpc = min(limits->max_bpp / 3, (int)conn_state->max_requested_bpc);
2066+
int max_bpc = min(limits->pipe.max_bpp / 3, (int)conn_state->max_requested_bpc);
20652067

20662068
/* For eDP use max bpp that can be supported with DSC. */
20672069
pipe_bpp = intel_dp_dsc_compute_max_bpp(intel_dp, max_bpc);
@@ -2204,9 +2206,9 @@ intel_dp_compute_config_limits(struct intel_dp *intel_dp,
22042206
limits->min_lane_count = 1;
22052207
limits->max_lane_count = intel_dp_max_lane_count(intel_dp);
22062208

2207-
limits->min_bpp = intel_dp_min_bpp(crtc_state->output_format);
2208-
limits->max_bpp = intel_dp_max_bpp(intel_dp, crtc_state,
2209-
respect_downstream_limits);
2209+
limits->pipe.min_bpp = intel_dp_min_bpp(crtc_state->output_format);
2210+
limits->pipe.max_bpp = intel_dp_max_bpp(intel_dp, crtc_state,
2211+
respect_downstream_limits);
22102212

22112213
if (intel_dp->use_max_params) {
22122214
/*
@@ -2223,10 +2225,13 @@ intel_dp_compute_config_limits(struct intel_dp *intel_dp,
22232225

22242226
intel_dp_adjust_compliance_config(intel_dp, crtc_state, limits);
22252227

2228+
limits->link.min_bpp_x16 = to_bpp_x16(limits->pipe.min_bpp);
2229+
limits->link.max_bpp_x16 = to_bpp_x16(limits->pipe.max_bpp);
2230+
22262231
drm_dbg_kms(&i915->drm, "DP link computation with max lane count %i "
22272232
"max rate %d max bpp %d pixel clock %iKHz\n",
22282233
limits->max_lane_count, limits->max_rate,
2229-
limits->max_bpp, adjusted_mode->crtc_clock);
2234+
to_bpp_int(limits->link.max_bpp_x16), adjusted_mode->crtc_clock);
22302235
}
22312236

22322237
static int

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@ struct intel_encoder;
2626
struct link_config_limits {
2727
int min_rate, max_rate;
2828
int min_lane_count, max_lane_count;
29-
int min_bpp, max_bpp;
29+
struct {
30+
/* Uncompressed DSC input or link output bpp in 1 bpp units */
31+
int min_bpp, max_bpp;
32+
} pipe;
33+
struct {
34+
/* Compressed or uncompressed link output bpp in 1/16 bpp units */
35+
int min_bpp_x16, max_bpp_x16;
36+
} link;
3037
};
3138

3239
void intel_edp_fixup_vbt_bpp(struct intel_encoder *encoder, int pipe_bpp);

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,10 @@ static int intel_dp_mst_compute_link_config(struct intel_encoder *encoder,
157157
int slots = -EINVAL;
158158
int link_bpp;
159159

160-
slots = intel_dp_mst_find_vcpi_slots_for_bpp(encoder, crtc_state, limits->max_bpp,
161-
limits->min_bpp, limits,
160+
slots = intel_dp_mst_find_vcpi_slots_for_bpp(encoder, crtc_state,
161+
to_bpp_int(limits->link.max_bpp_x16),
162+
to_bpp_int(limits->link.min_bpp_x16),
163+
limits,
162164
conn_state, 2 * 3, false);
163165

164166
if (slots < 0)
@@ -203,8 +205,8 @@ static int intel_dp_dsc_mst_compute_link_config(struct intel_encoder *encoder,
203205
else
204206
dsc_max_bpc = min_t(u8, 10, conn_state->max_requested_bpc);
205207

206-
max_bpp = min_t(u8, dsc_max_bpc * 3, limits->max_bpp);
207-
min_bpp = limits->min_bpp;
208+
max_bpp = min_t(u8, dsc_max_bpc * 3, limits->pipe.max_bpp);
209+
min_bpp = limits->pipe.min_bpp;
208210

209211
num_bpc = drm_dp_dsc_sink_supported_input_bpcs(intel_dp->dsc_dpcd,
210212
dsc_bpc);
@@ -308,7 +310,7 @@ intel_dp_mst_compute_config_limits(struct intel_dp *intel_dp,
308310
limits->min_lane_count = limits->max_lane_count =
309311
intel_dp_max_lane_count(intel_dp);
310312

311-
limits->min_bpp = intel_dp_min_bpp(crtc_state->output_format);
313+
limits->pipe.min_bpp = intel_dp_min_bpp(crtc_state->output_format);
312314
/*
313315
* FIXME: If all the streams can't fit into the link with
314316
* their current pipe_bpp we should reduce pipe_bpp across
@@ -317,9 +319,12 @@ intel_dp_mst_compute_config_limits(struct intel_dp *intel_dp,
317319
* MST streams previously. This hack should be removed once
318320
* we have the proper retry logic in place.
319321
*/
320-
limits->max_bpp = min(crtc_state->pipe_bpp, 24);
322+
limits->pipe.max_bpp = min(crtc_state->pipe_bpp, 24);
321323

322324
intel_dp_adjust_compliance_config(intel_dp, crtc_state, limits);
325+
326+
limits->link.min_bpp_x16 = to_bpp_x16(limits->pipe.min_bpp);
327+
limits->link.max_bpp_x16 = to_bpp_x16(limits->pipe.max_bpp);
323328
}
324329

325330
static int intel_dp_mst_compute_config(struct intel_encoder *encoder,

0 commit comments

Comments
 (0)