Skip to content

Commit 05e8155

Browse files
committed
drm/i915: Use a sentinel to terminate the dbuf slice arrays
Make life a bit simpler by sticking a sentinel at the end of the dbuf slice arrays. This way we don't need to pass in the size. Also unify the types (u8 vs. u32) for active_pipes. Cc: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200225171125.28885-5-ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula <jani.nikula@intel.com>
1 parent 06812bd commit 05e8155

1 file changed

Lines changed: 13 additions & 21 deletions

File tree

‎drivers/gpu/drm/i915/intel_pm.c‎

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3833,7 +3833,7 @@ static u16 intel_get_ddb_size(struct drm_i915_private *dev_priv)
38333833
}
38343834

38353835
static u8 skl_compute_dbuf_slices(const struct intel_crtc_state *crtc_state,
3836-
u32 active_pipes);
3836+
u8 active_pipes);
38373837

38383838
static void
38393839
skl_ddb_get_pipe_allocation_limits(struct drm_i915_private *dev_priv,
@@ -4218,6 +4218,7 @@ static const struct dbuf_slice_conf_entry icl_allowed_dbufs[] =
42184218
[PIPE_C] = BIT(DBUF_S2),
42194219
},
42204220
},
4221+
{}
42214222
};
42224223

42234224
/*
@@ -4340,16 +4341,15 @@ static const struct dbuf_slice_conf_entry tgl_allowed_dbufs[] =
43404341
[PIPE_D] = BIT(DBUF_S2),
43414342
},
43424343
},
4344+
{}
43434345
};
43444346

4345-
static u8 compute_dbuf_slices(enum pipe pipe,
4346-
u32 active_pipes,
4347-
const struct dbuf_slice_conf_entry *dbuf_slices,
4348-
int size)
4347+
static u8 compute_dbuf_slices(enum pipe pipe, u8 active_pipes,
4348+
const struct dbuf_slice_conf_entry *dbuf_slices)
43494349
{
43504350
int i;
43514351

4352-
for (i = 0; i < size; i++) {
4352+
for (i = 0; i < dbuf_slices[i].active_pipes; i++) {
43534353
if (dbuf_slices[i].active_pipes == active_pipes)
43544354
return dbuf_slices[i].dbuf_mask[pipe];
43554355
}
@@ -4361,8 +4361,7 @@ static u8 compute_dbuf_slices(enum pipe pipe,
43614361
* returns correspondent DBuf slice mask as stated in BSpec for particular
43624362
* platform.
43634363
*/
4364-
static u32 icl_compute_dbuf_slices(enum pipe pipe,
4365-
u32 active_pipes)
4364+
static u8 icl_compute_dbuf_slices(enum pipe pipe, u8 active_pipes)
43664365
{
43674366
/*
43684367
* FIXME: For ICL this is still a bit unclear as prev BSpec revision
@@ -4376,32 +4375,25 @@ static u32 icl_compute_dbuf_slices(enum pipe pipe,
43764375
* still here - we will need it once those additional constraints
43774376
* pop up.
43784377
*/
4379-
return compute_dbuf_slices(pipe, active_pipes,
4380-
icl_allowed_dbufs,
4381-
ARRAY_SIZE(icl_allowed_dbufs));
4378+
return compute_dbuf_slices(pipe, active_pipes, icl_allowed_dbufs);
43824379
}
43834380

4384-
static u32 tgl_compute_dbuf_slices(enum pipe pipe,
4385-
u32 active_pipes)
4381+
static u8 tgl_compute_dbuf_slices(enum pipe pipe, u8 active_pipes)
43864382
{
4387-
return compute_dbuf_slices(pipe, active_pipes,
4388-
tgl_allowed_dbufs,
4389-
ARRAY_SIZE(tgl_allowed_dbufs));
4383+
return compute_dbuf_slices(pipe, active_pipes, tgl_allowed_dbufs);
43904384
}
43914385

43924386
static u8 skl_compute_dbuf_slices(const struct intel_crtc_state *crtc_state,
4393-
u32 active_pipes)
4387+
u8 active_pipes)
43944388
{
43954389
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
43964390
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
43974391
enum pipe pipe = crtc->pipe;
43984392

43994393
if (IS_GEN(dev_priv, 12))
4400-
return tgl_compute_dbuf_slices(pipe,
4401-
active_pipes);
4394+
return tgl_compute_dbuf_slices(pipe, active_pipes);
44024395
else if (IS_GEN(dev_priv, 11))
4403-
return icl_compute_dbuf_slices(pipe,
4404-
active_pipes);
4396+
return icl_compute_dbuf_slices(pipe, active_pipes);
44054397
/*
44064398
* For anything else just return one slice yet.
44074399
* Should be extended for other platforms.

0 commit comments

Comments
 (0)