Skip to content

Commit b3652e8

Browse files
Krishna Manikandanrobclark
authored andcommitted
drm/msm/disp/dpu1: add support to program fetch active in ctl path
A new register called CTL_FETCH_ACTIVE is introduced in SC7280 family which is used to inform the HW about the pipes which are active in the current ctl path. This change adds support to program this register based on the active pipes in the current composition. Signed-off-by: Krishna Manikandan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Clark <[email protected]>
1 parent ed6154a commit b3652e8

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc *crtc,
209209
uint32_t stage_idx, lm_idx;
210210
int zpos_cnt[DPU_STAGE_MAX + 1] = { 0 };
211211
bool bg_alpha_enable = false;
212+
DECLARE_BITMAP(fetch_active, SSPP_MAX);
212213

214+
memset(fetch_active, 0, sizeof(fetch_active));
213215
drm_atomic_crtc_for_each_plane(plane, crtc) {
214216
state = plane->state;
215217
if (!state)
@@ -219,7 +221,7 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc *crtc,
219221
fb = state->fb;
220222

221223
dpu_plane_get_ctl_flush(plane, ctl, &flush_mask);
222-
224+
set_bit(dpu_plane_pipe(plane), fetch_active);
223225
DPU_DEBUG("crtc %d stage:%d - plane %d sspp %d fb %d\n",
224226
crtc->base.id,
225227
pstate->stage,
@@ -259,6 +261,9 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc *crtc,
259261
}
260262
}
261263

264+
if (ctl->ops.set_active_pipes)
265+
ctl->ops.set_active_pipes(ctl, fetch_active);
266+
262267
_dpu_crtc_program_lm_output_roi(crtc);
263268
}
264269

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,19 @@
2727
#define CTL_MERGE_3D_FLUSH 0x100
2828
#define CTL_INTF_FLUSH 0x110
2929
#define CTL_INTF_MASTER 0x134
30+
#define CTL_FETCH_PIPE_ACTIVE 0x0FC
3031

3132
#define CTL_MIXER_BORDER_OUT BIT(24)
3233
#define CTL_FLUSH_MASK_CTL BIT(17)
3334

3435
#define DPU_REG_RESET_TIMEOUT_US 2000
3536
#define MERGE_3D_IDX 23
3637
#define INTF_IDX 31
38+
#define CTL_INVALID_BIT 0xffff
39+
40+
static const u32 fetch_tbl[SSPP_MAX] = {CTL_INVALID_BIT, 16, 17, 18, 19,
41+
CTL_INVALID_BIT, CTL_INVALID_BIT, CTL_INVALID_BIT, CTL_INVALID_BIT, 0,
42+
1, 2, 3, CTL_INVALID_BIT, CTL_INVALID_BIT};
3743

3844
static const struct dpu_ctl_cfg *_ctl_offset(enum dpu_ctl ctl,
3945
const struct dpu_mdss_cfg *m,
@@ -344,6 +350,8 @@ static void dpu_hw_ctl_clear_all_blendstages(struct dpu_hw_ctl *ctx)
344350
DPU_REG_WRITE(c, CTL_LAYER_EXT2(LM_0 + i), 0);
345351
DPU_REG_WRITE(c, CTL_LAYER_EXT3(LM_0 + i), 0);
346352
}
353+
354+
DPU_REG_WRITE(c, CTL_FETCH_PIPE_ACTIVE, 0);
347355
}
348356

349357
static void dpu_hw_ctl_setup_blendstage(struct dpu_hw_ctl *ctx,
@@ -531,6 +539,23 @@ static void dpu_hw_ctl_intf_cfg(struct dpu_hw_ctl *ctx,
531539
DPU_REG_WRITE(c, CTL_TOP, intf_cfg);
532540
}
533541

542+
static void dpu_hw_ctl_set_fetch_pipe_active(struct dpu_hw_ctl *ctx,
543+
unsigned long *fetch_active)
544+
{
545+
int i;
546+
u32 val = 0;
547+
548+
if (fetch_active) {
549+
for (i = 0; i < SSPP_MAX; i++) {
550+
if (test_bit(i, fetch_active) &&
551+
fetch_tbl[i] != CTL_INVALID_BIT)
552+
val |= BIT(fetch_tbl[i]);
553+
}
554+
}
555+
556+
DPU_REG_WRITE(&ctx->hw, CTL_FETCH_PIPE_ACTIVE, val);
557+
}
558+
534559
static void _setup_ctl_ops(struct dpu_hw_ctl_ops *ops,
535560
unsigned long cap)
536561
{
@@ -560,6 +585,8 @@ static void _setup_ctl_ops(struct dpu_hw_ctl_ops *ops,
560585
ops->get_bitmask_sspp = dpu_hw_ctl_get_bitmask_sspp;
561586
ops->get_bitmask_mixer = dpu_hw_ctl_get_bitmask_mixer;
562587
ops->get_bitmask_dspp = dpu_hw_ctl_get_bitmask_dspp;
588+
if (cap & BIT(DPU_CTL_FETCH_ACTIVE))
589+
ops->set_active_pipes = dpu_hw_ctl_set_fetch_pipe_active;
563590
};
564591

565592
static struct dpu_hw_blk_ops dpu_hw_ops;

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ struct dpu_hw_ctl_ops {
167167
*/
168168
void (*setup_blendstage)(struct dpu_hw_ctl *ctx,
169169
enum dpu_lm lm, struct dpu_hw_stage_cfg *cfg);
170+
171+
void (*set_active_pipes)(struct dpu_hw_ctl *ctx,
172+
unsigned long *fetch_active);
170173
};
171174

172175
/**

0 commit comments

Comments
 (0)