Skip to content

Commit 643b06e

Browse files
committed
drm/i915/mst: change return value of mst_stream_find_vcpi_slots_for_bpp()
The callers of mst_stream_find_vcpi_slots_for_bpp() don't need the returned slots for anything. On the contrary, they need to jump through hoops to just distinguish between success and failure. Just return 0 instead of slots from mst_stream_find_vcpi_slots_for_bpp() for success, and simplify the callers. There's a pointless ret local variable that we can drop in the process. Reviewed-by: Imre Deak <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/7b3671a548c893b1bb62151d41f90bb8ce842ccc.1735912293.git.jani.nikula@intel.com
1 parent d7cde2e commit 643b06e

File tree

1 file changed

+18
-34
lines changed

1 file changed

+18
-34
lines changed

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

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ static int mst_stream_find_vcpi_slots_for_bpp(struct intel_dp *intel_dp,
226226
int bpp, slots = -EINVAL;
227227
int dsc_slice_count = 0;
228228
int max_dpt_bpp;
229-
int ret = 0;
230229

231230
mst_state = drm_atomic_get_mst_topology_state(state, &intel_dp->mst_mgr);
232231
if (IS_ERR(mst_state))
@@ -340,46 +339,37 @@ static int mst_stream_find_vcpi_slots_for_bpp(struct intel_dp *intel_dp,
340339
}
341340
}
342341

343-
/* We failed to find a proper bpp/timeslots, return error */
344-
if (ret)
345-
slots = ret;
346-
347342
if (slots < 0) {
348343
drm_dbg_kms(display->drm, "failed finding vcpi slots:%d\n",
349344
slots);
350-
} else {
351-
if (!dsc)
352-
crtc_state->pipe_bpp = bpp;
353-
else
354-
crtc_state->dsc.compressed_bpp_x16 = fxp_q4_from_int(bpp);
355-
drm_dbg_kms(display->drm, "Got %d slots for pipe bpp %d dsc %d\n",
356-
slots, bpp, dsc);
345+
return slots;
357346
}
358347

359-
return slots;
348+
if (!dsc)
349+
crtc_state->pipe_bpp = bpp;
350+
else
351+
crtc_state->dsc.compressed_bpp_x16 = fxp_q4_from_int(bpp);
352+
353+
drm_dbg_kms(display->drm, "Got %d slots for pipe bpp %d dsc %d\n",
354+
slots, bpp, dsc);
355+
356+
return 0;
360357
}
361358

362359
static int mst_stream_compute_link_config(struct intel_dp *intel_dp,
363360
struct intel_crtc_state *crtc_state,
364361
struct drm_connector_state *conn_state,
365362
struct link_config_limits *limits)
366363
{
367-
int slots = -EINVAL;
368-
369364
/*
370365
* FIXME: allocate the BW according to link_bpp, which in the case of
371366
* YUV420 is only half of the pipe bpp value.
372367
*/
373-
slots = mst_stream_find_vcpi_slots_for_bpp(intel_dp, crtc_state,
374-
fxp_q4_to_int(limits->link.max_bpp_x16),
375-
fxp_q4_to_int(limits->link.min_bpp_x16),
376-
limits,
377-
conn_state, 2 * 3, false);
378-
379-
if (slots < 0)
380-
return slots;
381-
382-
return 0;
368+
return mst_stream_find_vcpi_slots_for_bpp(intel_dp, crtc_state,
369+
fxp_q4_to_int(limits->link.max_bpp_x16),
370+
fxp_q4_to_int(limits->link.min_bpp_x16),
371+
limits,
372+
conn_state, 2 * 3, false);
383373
}
384374

385375
static int mst_stream_dsc_compute_link_config(struct intel_dp *intel_dp,
@@ -389,7 +379,6 @@ static int mst_stream_dsc_compute_link_config(struct intel_dp *intel_dp,
389379
{
390380
struct intel_display *display = to_intel_display(intel_dp);
391381
struct intel_connector *connector = to_intel_connector(conn_state->connector);
392-
int slots = -EINVAL;
393382
int i, num_bpc;
394383
u8 dsc_bpc[3] = {};
395384
int min_bpp, max_bpp, sink_min_bpp, sink_max_bpp;
@@ -437,14 +426,9 @@ static int mst_stream_dsc_compute_link_config(struct intel_dp *intel_dp,
437426
min_compressed_bpp = intel_dp_dsc_nearest_valid_bpp(display, min_compressed_bpp,
438427
crtc_state->pipe_bpp);
439428

440-
slots = mst_stream_find_vcpi_slots_for_bpp(intel_dp, crtc_state, max_compressed_bpp,
441-
min_compressed_bpp, limits,
442-
conn_state, 1, true);
443-
444-
if (slots < 0)
445-
return slots;
446-
447-
return 0;
429+
return mst_stream_find_vcpi_slots_for_bpp(intel_dp, crtc_state, max_compressed_bpp,
430+
min_compressed_bpp, limits,
431+
conn_state, 1, true);
448432
}
449433

450434
static int mst_stream_update_slots(struct intel_dp *intel_dp,

0 commit comments

Comments
 (0)