Commit f316b25a authored by Archit Taneja's avatar Archit Taneja Committed by Rob Clark

drm/msm/mdp5: Remove mixer/intf pointers from mdp5_ctl

These are a part of CRTC state, it doesn't feel nice to leave them
hanging in mdp5_ctl struct. Pass mdp5_pipeline pointer instead
wherever it is needed.

We still have some params in mdp5_ctl like start_mask etc which
are derivative of atomic state, and should be rolled back if
a commit fails, but it doesn't seem to cause much trouble.
Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent 0ddc3a63
...@@ -132,8 +132,6 @@ void mdp5_cmd_encoder_mode_set(struct drm_encoder *encoder, ...@@ -132,8 +132,6 @@ void mdp5_cmd_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode, struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode) struct drm_display_mode *adjusted_mode)
{ {
struct mdp5_encoder *mdp5_cmd_enc = to_mdp5_encoder(encoder);
mode = adjusted_mode; mode = adjusted_mode;
DBG("set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x", DBG("set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x",
...@@ -145,8 +143,7 @@ void mdp5_cmd_encoder_mode_set(struct drm_encoder *encoder, ...@@ -145,8 +143,7 @@ void mdp5_cmd_encoder_mode_set(struct drm_encoder *encoder,
mode->vsync_end, mode->vtotal, mode->vsync_end, mode->vtotal,
mode->type, mode->flags); mode->type, mode->flags);
pingpong_tearcheck_setup(encoder, mode); pingpong_tearcheck_setup(encoder, mode);
mdp5_crtc_set_pipeline(encoder->crtc, mdp5_cmd_enc->intf, mdp5_crtc_set_pipeline(encoder->crtc);
mdp5_cmd_enc->ctl);
} }
void mdp5_cmd_encoder_disable(struct drm_encoder *encoder) void mdp5_cmd_encoder_disable(struct drm_encoder *encoder)
...@@ -154,14 +151,15 @@ void mdp5_cmd_encoder_disable(struct drm_encoder *encoder) ...@@ -154,14 +151,15 @@ void mdp5_cmd_encoder_disable(struct drm_encoder *encoder)
struct mdp5_encoder *mdp5_cmd_enc = to_mdp5_encoder(encoder); struct mdp5_encoder *mdp5_cmd_enc = to_mdp5_encoder(encoder);
struct mdp5_ctl *ctl = mdp5_cmd_enc->ctl; struct mdp5_ctl *ctl = mdp5_cmd_enc->ctl;
struct mdp5_interface *intf = mdp5_cmd_enc->intf; struct mdp5_interface *intf = mdp5_cmd_enc->intf;
struct mdp5_pipeline *pipeline = mdp5_crtc_get_pipeline(encoder->crtc);
if (WARN_ON(!mdp5_cmd_enc->enabled)) if (WARN_ON(!mdp5_cmd_enc->enabled))
return; return;
pingpong_tearcheck_disable(encoder); pingpong_tearcheck_disable(encoder);
mdp5_ctl_set_encoder_state(ctl, false); mdp5_ctl_set_encoder_state(ctl, pipeline, false);
mdp5_ctl_commit(ctl, mdp_ctl_flush_mask_encoder(intf)); mdp5_ctl_commit(ctl, pipeline, mdp_ctl_flush_mask_encoder(intf));
bs_set(mdp5_cmd_enc, 0); bs_set(mdp5_cmd_enc, 0);
...@@ -173,6 +171,7 @@ void mdp5_cmd_encoder_enable(struct drm_encoder *encoder) ...@@ -173,6 +171,7 @@ void mdp5_cmd_encoder_enable(struct drm_encoder *encoder)
struct mdp5_encoder *mdp5_cmd_enc = to_mdp5_encoder(encoder); struct mdp5_encoder *mdp5_cmd_enc = to_mdp5_encoder(encoder);
struct mdp5_ctl *ctl = mdp5_cmd_enc->ctl; struct mdp5_ctl *ctl = mdp5_cmd_enc->ctl;
struct mdp5_interface *intf = mdp5_cmd_enc->intf; struct mdp5_interface *intf = mdp5_cmd_enc->intf;
struct mdp5_pipeline *pipeline = mdp5_crtc_get_pipeline(encoder->crtc);
if (WARN_ON(mdp5_cmd_enc->enabled)) if (WARN_ON(mdp5_cmd_enc->enabled))
return; return;
...@@ -181,9 +180,9 @@ void mdp5_cmd_encoder_enable(struct drm_encoder *encoder) ...@@ -181,9 +180,9 @@ void mdp5_cmd_encoder_enable(struct drm_encoder *encoder)
if (pingpong_tearcheck_enable(encoder)) if (pingpong_tearcheck_enable(encoder))
return; return;
mdp5_ctl_commit(ctl, mdp_ctl_flush_mask_encoder(intf)); mdp5_ctl_commit(ctl, pipeline, mdp_ctl_flush_mask_encoder(intf));
mdp5_ctl_set_encoder_state(ctl, true); mdp5_ctl_set_encoder_state(ctl, pipeline, true);
mdp5_cmd_enc->enabled = true; mdp5_cmd_enc->enabled = true;
} }
......
...@@ -91,9 +91,10 @@ static u32 crtc_flush(struct drm_crtc *crtc, u32 flush_mask) ...@@ -91,9 +91,10 @@ static u32 crtc_flush(struct drm_crtc *crtc, u32 flush_mask)
{ {
struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state); struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
struct mdp5_ctl *ctl = mdp5_cstate->ctl; struct mdp5_ctl *ctl = mdp5_cstate->ctl;
struct mdp5_pipeline *pipeline = &mdp5_cstate->pipeline;
DBG("%s: flush=%08x", crtc->name, flush_mask); DBG("%s: flush=%08x", crtc->name, flush_mask);
return mdp5_ctl_commit(ctl, flush_mask); return mdp5_ctl_commit(ctl, pipeline, flush_mask);
} }
/* /*
...@@ -126,6 +127,7 @@ static u32 crtc_flush_all(struct drm_crtc *crtc) ...@@ -126,6 +127,7 @@ static u32 crtc_flush_all(struct drm_crtc *crtc)
static void complete_flip(struct drm_crtc *crtc, struct drm_file *file) static void complete_flip(struct drm_crtc *crtc, struct drm_file *file)
{ {
struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state); struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
struct mdp5_pipeline *pipeline = &mdp5_cstate->pipeline;
struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc);
struct mdp5_ctl *ctl = mdp5_cstate->ctl; struct mdp5_ctl *ctl = mdp5_cstate->ctl;
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
...@@ -143,7 +145,7 @@ static void complete_flip(struct drm_crtc *crtc, struct drm_file *file) ...@@ -143,7 +145,7 @@ static void complete_flip(struct drm_crtc *crtc, struct drm_file *file)
if (ctl && !crtc->state->enable) { if (ctl && !crtc->state->enable) {
/* set STAGE_UNUSED for all layers */ /* set STAGE_UNUSED for all layers */
mdp5_ctl_blend(ctl, NULL, 0, 0); mdp5_ctl_blend(ctl, pipeline, NULL, 0, 0);
/* XXX: What to do here? */ /* XXX: What to do here? */
/* mdp5_crtc->ctl = NULL; */ /* mdp5_crtc->ctl = NULL; */
} }
...@@ -195,12 +197,13 @@ static void blend_setup(struct drm_crtc *crtc) ...@@ -195,12 +197,13 @@ static void blend_setup(struct drm_crtc *crtc)
{ {
struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc);
struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state); struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
struct mdp5_pipeline *pipeline = &mdp5_cstate->pipeline;
struct mdp5_kms *mdp5_kms = get_kms(crtc); struct mdp5_kms *mdp5_kms = get_kms(crtc);
struct drm_plane *plane; struct drm_plane *plane;
const struct mdp5_cfg_hw *hw_cfg; const struct mdp5_cfg_hw *hw_cfg;
struct mdp5_plane_state *pstate, *pstates[STAGE_MAX + 1] = {NULL}; struct mdp5_plane_state *pstate, *pstates[STAGE_MAX + 1] = {NULL};
const struct mdp_format *format; const struct mdp_format *format;
struct mdp5_hw_mixer *mixer = mdp5_cstate->pipeline.mixer; struct mdp5_hw_mixer *mixer = pipeline->mixer;
uint32_t lm = mixer->lm; uint32_t lm = mixer->lm;
struct mdp5_ctl *ctl = mdp5_cstate->ctl; struct mdp5_ctl *ctl = mdp5_cstate->ctl;
uint32_t blend_op, fg_alpha, bg_alpha, ctl_blend_flags = 0; uint32_t blend_op, fg_alpha, bg_alpha, ctl_blend_flags = 0;
...@@ -294,7 +297,7 @@ static void blend_setup(struct drm_crtc *crtc) ...@@ -294,7 +297,7 @@ static void blend_setup(struct drm_crtc *crtc)
mdp5_write(mdp5_kms, REG_MDP5_LM_BLEND_COLOR_OUT(lm), mixer_op_mode); mdp5_write(mdp5_kms, REG_MDP5_LM_BLEND_COLOR_OUT(lm), mixer_op_mode);
mdp5_ctl_blend(ctl, stage, plane_cnt, ctl_blend_flags); mdp5_ctl_blend(ctl, pipeline, stage, plane_cnt, ctl_blend_flags);
out: out:
spin_unlock_irqrestore(&mdp5_crtc->lm_lock, flags); spin_unlock_irqrestore(&mdp5_crtc->lm_lock, flags);
...@@ -586,6 +589,7 @@ static int mdp5_crtc_cursor_set(struct drm_crtc *crtc, ...@@ -586,6 +589,7 @@ static int mdp5_crtc_cursor_set(struct drm_crtc *crtc,
{ {
struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc);
struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state); struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
struct mdp5_pipeline *pipeline = &mdp5_cstate->pipeline;
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct mdp5_kms *mdp5_kms = get_kms(crtc); struct mdp5_kms *mdp5_kms = get_kms(crtc);
struct drm_gem_object *cursor_bo, *old_bo = NULL; struct drm_gem_object *cursor_bo, *old_bo = NULL;
...@@ -652,7 +656,7 @@ static int mdp5_crtc_cursor_set(struct drm_crtc *crtc, ...@@ -652,7 +656,7 @@ static int mdp5_crtc_cursor_set(struct drm_crtc *crtc,
spin_unlock_irqrestore(&mdp5_crtc->cursor.lock, flags); spin_unlock_irqrestore(&mdp5_crtc->cursor.lock, flags);
set_cursor: set_cursor:
ret = mdp5_ctl_set_cursor(ctl, 0, cursor_enable); ret = mdp5_ctl_set_cursor(ctl, pipeline, 0, cursor_enable);
if (ret) { if (ret) {
dev_err(dev->dev, "failed to %sable cursor: %d\n", dev_err(dev->dev, "failed to %sable cursor: %d\n",
cursor_enable ? "en" : "dis", ret); cursor_enable ? "en" : "dis", ret);
...@@ -877,17 +881,15 @@ uint32_t mdp5_crtc_vblank(struct drm_crtc *crtc) ...@@ -877,17 +881,15 @@ uint32_t mdp5_crtc_vblank(struct drm_crtc *crtc)
return mdp5_crtc->vblank.irqmask; return mdp5_crtc->vblank.irqmask;
} }
void mdp5_crtc_set_pipeline(struct drm_crtc *crtc, void mdp5_crtc_set_pipeline(struct drm_crtc *crtc)
struct mdp5_interface *intf, struct mdp5_ctl *ctl)
{ {
struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state); struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
struct mdp5_hw_mixer *mixer = mdp5_cstate->pipeline.mixer;
struct mdp5_kms *mdp5_kms = get_kms(crtc); struct mdp5_kms *mdp5_kms = get_kms(crtc);
/* should this be done elsewhere ? */ /* should this be done elsewhere ? */
mdp_irq_update(&mdp5_kms->base); mdp_irq_update(&mdp5_kms->base);
mdp5_ctl_set_pipeline(ctl, intf, mixer); mdp5_ctl_set_pipeline(mdp5_cstate->ctl, &mdp5_cstate->pipeline);
} }
struct mdp5_ctl *mdp5_crtc_get_ctl(struct drm_crtc *crtc) struct mdp5_ctl *mdp5_crtc_get_ctl(struct drm_crtc *crtc)
...@@ -910,6 +912,18 @@ struct mdp5_hw_mixer *mdp5_crtc_get_mixer(struct drm_crtc *crtc) ...@@ -910,6 +912,18 @@ struct mdp5_hw_mixer *mdp5_crtc_get_mixer(struct drm_crtc *crtc)
ERR_PTR(-EINVAL) : mdp5_cstate->pipeline.mixer; ERR_PTR(-EINVAL) : mdp5_cstate->pipeline.mixer;
} }
struct mdp5_pipeline *mdp5_crtc_get_pipeline(struct drm_crtc *crtc)
{
struct mdp5_crtc_state *mdp5_cstate;
if (WARN_ON(!crtc))
return ERR_PTR(-EINVAL);
mdp5_cstate = to_mdp5_crtc_state(crtc->state);
return &mdp5_cstate->pipeline;
}
void mdp5_crtc_wait_for_commit_done(struct drm_crtc *crtc) void mdp5_crtc_wait_for_commit_done(struct drm_crtc *crtc)
{ {
struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state); struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
......
...@@ -36,14 +36,10 @@ struct mdp5_ctl { ...@@ -36,14 +36,10 @@ struct mdp5_ctl {
struct mdp5_ctl_manager *ctlm; struct mdp5_ctl_manager *ctlm;
u32 id; u32 id;
struct mdp5_hw_mixer *mixer;
/* CTL status bitmask */ /* CTL status bitmask */
u32 status; u32 status;
/* Operation Mode Configuration for the Pipeline */
struct mdp5_interface *intf;
bool encoder_enabled; bool encoder_enabled;
uint32_t start_mask; uint32_t start_mask;
...@@ -170,14 +166,12 @@ static void set_ctl_op(struct mdp5_ctl *ctl, struct mdp5_interface *intf) ...@@ -170,14 +166,12 @@ static void set_ctl_op(struct mdp5_ctl *ctl, struct mdp5_interface *intf)
spin_unlock_irqrestore(&ctl->hw_lock, flags); spin_unlock_irqrestore(&ctl->hw_lock, flags);
} }
int mdp5_ctl_set_pipeline(struct mdp5_ctl *ctl, struct mdp5_interface *intf, int mdp5_ctl_set_pipeline(struct mdp5_ctl *ctl, struct mdp5_pipeline *pipeline)
struct mdp5_hw_mixer *mixer)
{ {
struct mdp5_ctl_manager *ctl_mgr = ctl->ctlm; struct mdp5_ctl_manager *ctl_mgr = ctl->ctlm;
struct mdp5_kms *mdp5_kms = get_kms(ctl_mgr); struct mdp5_kms *mdp5_kms = get_kms(ctl_mgr);
struct mdp5_interface *intf = pipeline->intf;
ctl->mixer = mixer; struct mdp5_hw_mixer *mixer = pipeline->mixer;
ctl->intf = intf;
ctl->start_mask = mdp_ctl_flush_mask_lm(mixer->lm) | ctl->start_mask = mdp_ctl_flush_mask_lm(mixer->lm) |
mdp_ctl_flush_mask_encoder(intf); mdp_ctl_flush_mask_encoder(intf);
...@@ -191,16 +185,19 @@ int mdp5_ctl_set_pipeline(struct mdp5_ctl *ctl, struct mdp5_interface *intf, ...@@ -191,16 +185,19 @@ int mdp5_ctl_set_pipeline(struct mdp5_ctl *ctl, struct mdp5_interface *intf,
return 0; return 0;
} }
static bool start_signal_needed(struct mdp5_ctl *ctl) static bool start_signal_needed(struct mdp5_ctl *ctl,
struct mdp5_pipeline *pipeline)
{ {
struct mdp5_interface *intf = pipeline->intf;
if (!ctl->encoder_enabled || ctl->start_mask != 0) if (!ctl->encoder_enabled || ctl->start_mask != 0)
return false; return false;
switch (ctl->intf->type) { switch (intf->type) {
case INTF_WB: case INTF_WB:
return true; return true;
case INTF_DSI: case INTF_DSI:
return ctl->intf->mode == MDP5_INTF_DSI_MODE_COMMAND; return intf->mode == MDP5_INTF_DSI_MODE_COMMAND;
default: default:
return false; return false;
} }
...@@ -222,11 +219,13 @@ static void send_start_signal(struct mdp5_ctl *ctl) ...@@ -222,11 +219,13 @@ static void send_start_signal(struct mdp5_ctl *ctl)
spin_unlock_irqrestore(&ctl->hw_lock, flags); spin_unlock_irqrestore(&ctl->hw_lock, flags);
} }
static void refill_start_mask(struct mdp5_ctl *ctl) static void refill_start_mask(struct mdp5_ctl *ctl,
struct mdp5_pipeline *pipeline)
{ {
struct mdp5_interface *intf = ctl->intf; struct mdp5_interface *intf = pipeline->intf;
struct mdp5_hw_mixer *mixer = pipeline->mixer;
ctl->start_mask = mdp_ctl_flush_mask_lm(ctl->mixer->lm); ctl->start_mask = mdp_ctl_flush_mask_lm(mixer->lm);
/* /*
* Writeback encoder needs to program & flush * Writeback encoder needs to program & flush
...@@ -244,17 +243,21 @@ static void refill_start_mask(struct mdp5_ctl *ctl) ...@@ -244,17 +243,21 @@ static void refill_start_mask(struct mdp5_ctl *ctl)
* Note: * Note:
* This encoder state is needed to trigger START signal (data path kickoff). * This encoder state is needed to trigger START signal (data path kickoff).
*/ */
int mdp5_ctl_set_encoder_state(struct mdp5_ctl *ctl, bool enabled) int mdp5_ctl_set_encoder_state(struct mdp5_ctl *ctl,
struct mdp5_pipeline *pipeline,
bool enabled)
{ {
struct mdp5_interface *intf = pipeline->intf;
if (WARN_ON(!ctl)) if (WARN_ON(!ctl))
return -EINVAL; return -EINVAL;
ctl->encoder_enabled = enabled; ctl->encoder_enabled = enabled;
DBG("intf_%d: %s", ctl->intf->num, enabled ? "on" : "off"); DBG("intf_%d: %s", intf->num, enabled ? "on" : "off");
if (start_signal_needed(ctl)) { if (start_signal_needed(ctl, pipeline)) {
send_start_signal(ctl); send_start_signal(ctl);
refill_start_mask(ctl); refill_start_mask(ctl, pipeline);
} }
return 0; return 0;
...@@ -265,12 +268,13 @@ int mdp5_ctl_set_encoder_state(struct mdp5_ctl *ctl, bool enabled) ...@@ -265,12 +268,13 @@ int mdp5_ctl_set_encoder_state(struct mdp5_ctl *ctl, bool enabled)
* CTL registers need to be flushed after calling this function * CTL registers need to be flushed after calling this function
* (call mdp5_ctl_commit() with mdp_ctl_flush_mask_ctl() mask) * (call mdp5_ctl_commit() with mdp_ctl_flush_mask_ctl() mask)
*/ */
int mdp5_ctl_set_cursor(struct mdp5_ctl *ctl, int cursor_id, bool enable) int mdp5_ctl_set_cursor(struct mdp5_ctl *ctl, struct mdp5_pipeline *pipeline,
int cursor_id, bool enable)
{ {
struct mdp5_ctl_manager *ctl_mgr = ctl->ctlm; struct mdp5_ctl_manager *ctl_mgr = ctl->ctlm;
unsigned long flags; unsigned long flags;
u32 blend_cfg; u32 blend_cfg;
struct mdp5_hw_mixer *mixer = ctl->mixer; struct mdp5_hw_mixer *mixer = pipeline->mixer;
if (unlikely(WARN_ON(!mixer))) { if (unlikely(WARN_ON(!mixer))) {
dev_err(ctl_mgr->dev->dev, "CTL %d cannot find LM", dev_err(ctl_mgr->dev->dev, "CTL %d cannot find LM",
...@@ -340,10 +344,10 @@ static u32 mdp_ctl_blend_ext_mask(enum mdp5_pipe pipe, ...@@ -340,10 +344,10 @@ static u32 mdp_ctl_blend_ext_mask(enum mdp5_pipe pipe,
} }
} }
int mdp5_ctl_blend(struct mdp5_ctl *ctl, enum mdp5_pipe *stage, u32 stage_cnt, int mdp5_ctl_blend(struct mdp5_ctl *ctl, struct mdp5_pipeline *pipeline,
u32 ctl_blend_op_flags) enum mdp5_pipe *stage, u32 stage_cnt, u32 ctl_blend_op_flags)
{ {
struct mdp5_hw_mixer *mixer = ctl->mixer; struct mdp5_hw_mixer *mixer = pipeline->mixer;
unsigned long flags; unsigned long flags;
u32 blend_cfg = 0, blend_ext_cfg = 0; u32 blend_cfg = 0, blend_ext_cfg = 0;
int i, start_stage; int i, start_stage;
...@@ -430,7 +434,8 @@ u32 mdp_ctl_flush_mask_lm(int lm) ...@@ -430,7 +434,8 @@ u32 mdp_ctl_flush_mask_lm(int lm)
} }
} }
static u32 fix_sw_flush(struct mdp5_ctl *ctl, u32 flush_mask) static u32 fix_sw_flush(struct mdp5_ctl *ctl, struct mdp5_pipeline *pipeline,
u32 flush_mask)
{ {
struct mdp5_ctl_manager *ctl_mgr = ctl->ctlm; struct mdp5_ctl_manager *ctl_mgr = ctl->ctlm;
u32 sw_mask = 0; u32 sw_mask = 0;
...@@ -439,7 +444,7 @@ static u32 fix_sw_flush(struct mdp5_ctl *ctl, u32 flush_mask) ...@@ -439,7 +444,7 @@ static u32 fix_sw_flush(struct mdp5_ctl *ctl, u32 flush_mask)
/* for some targets, cursor bit is the same as LM bit */ /* for some targets, cursor bit is the same as LM bit */
if (BIT_NEEDS_SW_FIX(MDP5_CTL_FLUSH_CURSOR_0)) if (BIT_NEEDS_SW_FIX(MDP5_CTL_FLUSH_CURSOR_0))
sw_mask |= mdp_ctl_flush_mask_lm(ctl->mixer->lm); sw_mask |= mdp_ctl_flush_mask_lm(pipeline->mixer->lm);
return sw_mask; return sw_mask;
} }
...@@ -485,7 +490,9 @@ static void fix_for_single_flush(struct mdp5_ctl *ctl, u32 *flush_mask, ...@@ -485,7 +490,9 @@ static void fix_for_single_flush(struct mdp5_ctl *ctl, u32 *flush_mask,
* *
* Return H/W flushed bit mask. * Return H/W flushed bit mask.
*/ */
u32 mdp5_ctl_commit(struct mdp5_ctl *ctl, u32 flush_mask) u32 mdp5_ctl_commit(struct mdp5_ctl *ctl,
struct mdp5_pipeline *pipeline,
u32 flush_mask)
{ {
struct mdp5_ctl_manager *ctl_mgr = ctl->ctlm; struct mdp5_ctl_manager *ctl_mgr = ctl->ctlm;
unsigned long flags; unsigned long flags;
...@@ -502,7 +509,7 @@ u32 mdp5_ctl_commit(struct mdp5_ctl *ctl, u32 flush_mask) ...@@ -502,7 +509,7 @@ u32 mdp5_ctl_commit(struct mdp5_ctl *ctl, u32 flush_mask)
ctl->pending_ctl_trigger = 0; ctl->pending_ctl_trigger = 0;
} }
flush_mask |= fix_sw_flush(ctl, flush_mask); flush_mask |= fix_sw_flush(ctl, pipeline, flush_mask);
flush_mask &= ctl_mgr->flush_hw_mask; flush_mask &= ctl_mgr->flush_hw_mask;
...@@ -516,9 +523,9 @@ u32 mdp5_ctl_commit(struct mdp5_ctl *ctl, u32 flush_mask) ...@@ -516,9 +523,9 @@ u32 mdp5_ctl_commit(struct mdp5_ctl *ctl, u32 flush_mask)
spin_unlock_irqrestore(&ctl->hw_lock, flags); spin_unlock_irqrestore(&ctl->hw_lock, flags);
} }
if (start_signal_needed(ctl)) { if (start_signal_needed(ctl, pipeline)) {
send_start_signal(ctl); send_start_signal(ctl);
refill_start_mask(ctl); refill_start_mask(ctl, pipeline);
} }
return curr_ctl_flush_mask; return curr_ctl_flush_mask;
...@@ -605,7 +612,6 @@ struct mdp5_ctl *mdp5_ctlm_request(struct mdp5_ctl_manager *ctl_mgr, ...@@ -605,7 +612,6 @@ struct mdp5_ctl *mdp5_ctlm_request(struct mdp5_ctl_manager *ctl_mgr,
found: found:
ctl = &ctl_mgr->ctls[c]; ctl = &ctl_mgr->ctls[c];
ctl->mixer = NULL;
ctl->status |= CTL_STAT_BUSY; ctl->status |= CTL_STAT_BUSY;
ctl->pending_ctl_trigger = 0; ctl->pending_ctl_trigger = 0;
DBG("CTL %d allocated", ctl->id); DBG("CTL %d allocated", ctl->id);
......
...@@ -37,11 +37,13 @@ struct mdp5_ctl *mdp5_ctlm_request(struct mdp5_ctl_manager *ctlm, int intf_num); ...@@ -37,11 +37,13 @@ struct mdp5_ctl *mdp5_ctlm_request(struct mdp5_ctl_manager *ctlm, int intf_num);
int mdp5_ctl_get_ctl_id(struct mdp5_ctl *ctl); int mdp5_ctl_get_ctl_id(struct mdp5_ctl *ctl);
struct mdp5_interface; struct mdp5_interface;
int mdp5_ctl_set_pipeline(struct mdp5_ctl *ctl, struct mdp5_interface *intf, struct mdp5_pipeline;
struct mdp5_hw_mixer *lm); int mdp5_ctl_set_pipeline(struct mdp5_ctl *ctl, struct mdp5_pipeline *p);
int mdp5_ctl_set_encoder_state(struct mdp5_ctl *ctl, bool enabled); int mdp5_ctl_set_encoder_state(struct mdp5_ctl *ctl, struct mdp5_pipeline *p,
bool enabled);
int mdp5_ctl_set_cursor(struct mdp5_ctl *ctl, int cursor_id, bool enable); int mdp5_ctl_set_cursor(struct mdp5_ctl *ctl, struct mdp5_pipeline *pipeline,
int cursor_id, bool enable);
int mdp5_ctl_pair(struct mdp5_ctl *ctlx, struct mdp5_ctl *ctly, bool enable); int mdp5_ctl_pair(struct mdp5_ctl *ctlx, struct mdp5_ctl *ctly, bool enable);
/* /*
...@@ -56,7 +58,8 @@ int mdp5_ctl_pair(struct mdp5_ctl *ctlx, struct mdp5_ctl *ctly, bool enable); ...@@ -56,7 +58,8 @@ int mdp5_ctl_pair(struct mdp5_ctl *ctlx, struct mdp5_ctl *ctly, bool enable);
* (call mdp5_ctl_commit() with mdp_ctl_flush_mask_ctl() mask) * (call mdp5_ctl_commit() with mdp_ctl_flush_mask_ctl() mask)
*/ */
#define MDP5_CTL_BLEND_OP_FLAG_BORDER_OUT BIT(0) #define MDP5_CTL_BLEND_OP_FLAG_BORDER_OUT BIT(0)
int mdp5_ctl_blend(struct mdp5_ctl *ctl, enum mdp5_pipe *stage, u32 stage_cnt, int mdp5_ctl_blend(struct mdp5_ctl *ctl, struct mdp5_pipeline *pipeline,
enum mdp5_pipe *stage, u32 stage_cnt,
u32 ctl_blend_op_flags); u32 ctl_blend_op_flags);
/** /**
...@@ -71,7 +74,8 @@ u32 mdp_ctl_flush_mask_cursor(int cursor_id); ...@@ -71,7 +74,8 @@ u32 mdp_ctl_flush_mask_cursor(int cursor_id);
u32 mdp_ctl_flush_mask_encoder(struct mdp5_interface *intf); u32 mdp_ctl_flush_mask_encoder(struct mdp5_interface *intf);
/* @flush_mask: see CTL flush masks definitions below */ /* @flush_mask: see CTL flush masks definitions below */
u32 mdp5_ctl_commit(struct mdp5_ctl *ctl, u32 flush_mask); u32 mdp5_ctl_commit(struct mdp5_ctl *ctl, struct mdp5_pipeline *pipeline,
u32 flush_mask);
u32 mdp5_ctl_get_commit_status(struct mdp5_ctl *ctl); u32 mdp5_ctl_get_commit_status(struct mdp5_ctl *ctl);
......
...@@ -206,8 +206,7 @@ static void mdp5_vid_encoder_mode_set(struct drm_encoder *encoder, ...@@ -206,8 +206,7 @@ static void mdp5_vid_encoder_mode_set(struct drm_encoder *encoder,
spin_unlock_irqrestore(&mdp5_encoder->intf_lock, flags); spin_unlock_irqrestore(&mdp5_encoder->intf_lock, flags);
mdp5_crtc_set_pipeline(encoder->crtc, mdp5_encoder->intf, mdp5_crtc_set_pipeline(encoder->crtc);
mdp5_encoder->ctl);
} }
static void mdp5_vid_encoder_disable(struct drm_encoder *encoder) static void mdp5_vid_encoder_disable(struct drm_encoder *encoder)
...@@ -215,6 +214,7 @@ static void mdp5_vid_encoder_disable(struct drm_encoder *encoder) ...@@ -215,6 +214,7 @@ static void mdp5_vid_encoder_disable(struct drm_encoder *encoder)
struct mdp5_encoder *mdp5_encoder = to_mdp5_encoder(encoder); struct mdp5_encoder *mdp5_encoder = to_mdp5_encoder(encoder);
struct mdp5_kms *mdp5_kms = get_kms(encoder); struct mdp5_kms *mdp5_kms = get_kms(encoder);
struct mdp5_ctl *ctl = mdp5_encoder->ctl; struct mdp5_ctl *ctl = mdp5_encoder->ctl;
struct mdp5_pipeline *pipeline = mdp5_crtc_get_pipeline(encoder->crtc);
struct mdp5_hw_mixer *mixer = mdp5_crtc_get_mixer(encoder->crtc); struct mdp5_hw_mixer *mixer = mdp5_crtc_get_mixer(encoder->crtc);
struct mdp5_interface *intf = mdp5_encoder->intf; struct mdp5_interface *intf = mdp5_encoder->intf;
int intfn = mdp5_encoder->intf->num; int intfn = mdp5_encoder->intf->num;
...@@ -223,12 +223,12 @@ static void mdp5_vid_encoder_disable(struct drm_encoder *encoder) ...@@ -223,12 +223,12 @@ static void mdp5_vid_encoder_disable(struct drm_encoder *encoder)
if (WARN_ON(!mdp5_encoder->enabled)) if (WARN_ON(!mdp5_encoder->enabled))
return; return;
mdp5_ctl_set_encoder_state(ctl, false); mdp5_ctl_set_encoder_state(ctl, pipeline, false);
spin_lock_irqsave(&mdp5_encoder->intf_lock, flags); spin_lock_irqsave(&mdp5_encoder->intf_lock, flags);
mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(intfn), 0); mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(intfn), 0);
spin_unlock_irqrestore(&mdp5_encoder->intf_lock, flags); spin_unlock_irqrestore(&mdp5_encoder->intf_lock, flags);
mdp5_ctl_commit(ctl, mdp_ctl_flush_mask_encoder(intf)); mdp5_ctl_commit(ctl, pipeline, mdp_ctl_flush_mask_encoder(intf));
/* /*
* Wait for a vsync so we know the ENABLE=0 latched before * Wait for a vsync so we know the ENABLE=0 latched before
...@@ -251,6 +251,7 @@ static void mdp5_vid_encoder_enable(struct drm_encoder *encoder) ...@@ -251,6 +251,7 @@ static void mdp5_vid_encoder_enable(struct drm_encoder *encoder)
struct mdp5_kms *mdp5_kms = get_kms(encoder); struct mdp5_kms *mdp5_kms = get_kms(encoder);
struct mdp5_ctl *ctl = mdp5_encoder->ctl; struct mdp5_ctl *ctl = mdp5_encoder->ctl;
struct mdp5_interface *intf = mdp5_encoder->intf; struct mdp5_interface *intf = mdp5_encoder->intf;
struct mdp5_pipeline *pipeline = mdp5_crtc_get_pipeline(encoder->crtc);
int intfn = intf->num; int intfn = intf->num;
unsigned long flags; unsigned long flags;
...@@ -261,9 +262,9 @@ static void mdp5_vid_encoder_enable(struct drm_encoder *encoder) ...@@ -261,9 +262,9 @@ static void mdp5_vid_encoder_enable(struct drm_encoder *encoder)
spin_lock_irqsave(&mdp5_encoder->intf_lock, flags); spin_lock_irqsave(&mdp5_encoder->intf_lock, flags);
mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(intfn), 1); mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(intfn), 1);
spin_unlock_irqrestore(&mdp5_encoder->intf_lock, flags); spin_unlock_irqrestore(&mdp5_encoder->intf_lock, flags);
mdp5_ctl_commit(ctl, mdp_ctl_flush_mask_encoder(intf)); mdp5_ctl_commit(ctl, pipeline, mdp_ctl_flush_mask_encoder(intf));
mdp5_ctl_set_encoder_state(ctl, true); mdp5_ctl_set_encoder_state(ctl, pipeline, true);
mdp5_encoder->enabled = true; mdp5_encoder->enabled = true;
} }
......
...@@ -280,8 +280,8 @@ struct mdp5_ctl *mdp5_crtc_get_ctl(struct drm_crtc *crtc); ...@@ -280,8 +280,8 @@ struct mdp5_ctl *mdp5_crtc_get_ctl(struct drm_crtc *crtc);
uint32_t mdp5_crtc_vblank(struct drm_crtc *crtc); uint32_t mdp5_crtc_vblank(struct drm_crtc *crtc);
struct mdp5_hw_mixer *mdp5_crtc_get_mixer(struct drm_crtc *crtc); struct mdp5_hw_mixer *mdp5_crtc_get_mixer(struct drm_crtc *crtc);
void mdp5_crtc_set_pipeline(struct drm_crtc *crtc, struct mdp5_pipeline *mdp5_crtc_get_pipeline(struct drm_crtc *crtc);
struct mdp5_interface *intf, struct mdp5_ctl *ctl); void mdp5_crtc_set_pipeline(struct drm_crtc *crtc);
void mdp5_crtc_wait_for_commit_done(struct drm_crtc *crtc); void mdp5_crtc_wait_for_commit_done(struct drm_crtc *crtc);
struct drm_crtc *mdp5_crtc_init(struct drm_device *dev, struct drm_crtc *mdp5_crtc_init(struct drm_device *dev,
struct drm_plane *plane, struct drm_plane *plane,
......
...@@ -937,6 +937,7 @@ static int mdp5_update_cursor_plane_legacy(struct drm_plane *plane, ...@@ -937,6 +937,7 @@ static int mdp5_update_cursor_plane_legacy(struct drm_plane *plane,
if (new_plane_state->visible) { if (new_plane_state->visible) {
struct mdp5_ctl *ctl; struct mdp5_ctl *ctl;
struct mdp5_pipeline *pipeline = mdp5_crtc_get_pipeline(crtc);
ret = mdp5_plane_mode_set(plane, crtc, fb, ret = mdp5_plane_mode_set(plane, crtc, fb,
&new_plane_state->src, &new_plane_state->src,
...@@ -945,7 +946,7 @@ static int mdp5_update_cursor_plane_legacy(struct drm_plane *plane, ...@@ -945,7 +946,7 @@ static int mdp5_update_cursor_plane_legacy(struct drm_plane *plane,
ctl = mdp5_crtc_get_ctl(crtc); ctl = mdp5_crtc_get_ctl(crtc);
mdp5_ctl_commit(ctl, mdp5_plane_get_flush(plane)); mdp5_ctl_commit(ctl, pipeline, mdp5_plane_get_flush(plane));
} }
*to_mdp5_plane_state(plane_state) = *to_mdp5_plane_state(plane_state) =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment