aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArchit Taneja <architt@codeaurora.org>2017-03-23 06:28:14 -0400
committerRob Clark <robdclark@gmail.com>2017-04-08 06:59:36 -0400
commit359ae86248a5f92dd475e2d8012364a97e57026a (patch)
treeb7b564b7b73a313a7ff713205ad6b0208c746c2a
parentbf8dc0a04e52ddccfaa47cf7a3238753344155fa (diff)
drm/msm/mdp5: Stage border out on base stage if CRTC has 2 LMs
If a CRTC comprises of 2 LMs, it is mandatory to enable border out and assign it to the base stage. We had to enable border out also when the base plane wasn't fullscreen. Club these checks and put them in a separate function called get_start_stage() that returns the starting stage for assigning planes. Signed-off-by: Archit Taneja <architt@codeaurora.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c45
1 files changed, 35 insertions, 10 deletions
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
index 1276f81b413b..708d748275cd 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
@@ -512,6 +512,29 @@ static bool is_fullscreen(struct drm_crtc_state *cstate,
512 ((pstate->crtc_y + pstate->crtc_h) >= cstate->mode.vdisplay); 512 ((pstate->crtc_y + pstate->crtc_h) >= cstate->mode.vdisplay);
513} 513}
514 514
515enum mdp_mixer_stage_id get_start_stage(struct drm_crtc *crtc,
516 struct drm_crtc_state *new_crtc_state,
517 struct drm_plane_state *bpstate)
518{
519 struct mdp5_crtc_state *mdp5_cstate =
520 to_mdp5_crtc_state(new_crtc_state);
521
522 /*
523 * if we're in source split mode, it's mandatory to have
524 * border out on the base stage
525 */
526 if (mdp5_cstate->pipeline.r_mixer)
527 return STAGE0;
528
529 /* if the bottom-most layer is not fullscreen, we need to use
530 * it for solid-color:
531 */
532 if (!is_fullscreen(new_crtc_state, bpstate))
533 return STAGE0;
534
535 return STAGE_BASE;
536}
537
515static int mdp5_crtc_atomic_check(struct drm_crtc *crtc, 538static int mdp5_crtc_atomic_check(struct drm_crtc *crtc,
516 struct drm_crtc_state *state) 539 struct drm_crtc_state *state)
517{ 540{
@@ -522,8 +545,9 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *crtc,
522 const struct mdp5_cfg_hw *hw_cfg; 545 const struct mdp5_cfg_hw *hw_cfg;
523 const struct drm_plane_state *pstate; 546 const struct drm_plane_state *pstate;
524 bool cursor_plane = false; 547 bool cursor_plane = false;
525 int cnt = 0, base = 0, i; 548 int cnt = 0, i;
526 int ret; 549 int ret;
550 enum mdp_mixer_stage_id start;
527 551
528 DBG("%s: check", crtc->name); 552 DBG("%s: check", crtc->name);
529 553
@@ -537,6 +561,10 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *crtc,
537 cursor_plane = true; 561 cursor_plane = true;
538 } 562 }
539 563
564 /* bail out early if there aren't any planes */
565 if (!cnt)
566 return 0;
567
540 ret = mdp5_crtc_setup_pipeline(crtc, state); 568 ret = mdp5_crtc_setup_pipeline(crtc, state);
541 if (ret) { 569 if (ret) {
542 dev_err(dev->dev, "couldn't assign mixers %d\n", ret); 570 dev_err(dev->dev, "couldn't assign mixers %d\n", ret);
@@ -546,23 +574,20 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *crtc,
546 /* assign a stage based on sorted zpos property */ 574 /* assign a stage based on sorted zpos property */
547 sort(pstates, cnt, sizeof(pstates[0]), pstate_cmp, NULL); 575 sort(pstates, cnt, sizeof(pstates[0]), pstate_cmp, NULL);
548 576
549 /* if the bottom-most layer is not fullscreen, we need to use
550 * it for solid-color:
551 */
552 if ((cnt > 0) && !is_fullscreen(state, &pstates[0].state->base))
553 base++;
554
555 /* trigger a warning if cursor isn't the highest zorder */ 577 /* trigger a warning if cursor isn't the highest zorder */
556 WARN_ON(cursor_plane && 578 WARN_ON(cursor_plane &&
557 (pstates[cnt - 1].plane->type != DRM_PLANE_TYPE_CURSOR)); 579 (pstates[cnt - 1].plane->type != DRM_PLANE_TYPE_CURSOR));
558 580
581 start = get_start_stage(crtc, state, &pstates[0].state->base);
582
559 /* verify that there are not too many planes attached to crtc 583 /* verify that there are not too many planes attached to crtc
560 * and that we don't have conflicting mixer stages: 584 * and that we don't have conflicting mixer stages:
561 */ 585 */
562 hw_cfg = mdp5_cfg_get_hw_config(mdp5_kms->cfg); 586 hw_cfg = mdp5_cfg_get_hw_config(mdp5_kms->cfg);
563 587
564 if ((cnt + base) >= hw_cfg->lm.nb_stages) { 588 if ((cnt + start - 1) >= hw_cfg->lm.nb_stages) {
565 dev_err(dev->dev, "too many planes! cnt=%d, base=%d\n", cnt, base); 589 dev_err(dev->dev, "too many planes! cnt=%d, start stage=%d\n",
590 cnt, start);
566 return -EINVAL; 591 return -EINVAL;
567 } 592 }
568 593
@@ -570,7 +595,7 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *crtc,
570 if (cursor_plane && (i == (cnt - 1))) 595 if (cursor_plane && (i == (cnt - 1)))
571 pstates[i].state->stage = hw_cfg->lm.nb_stages; 596 pstates[i].state->stage = hw_cfg->lm.nb_stages;
572 else 597 else
573 pstates[i].state->stage = STAGE_BASE + i + base; 598 pstates[i].state->stage = start + i;
574 DBG("%s: assign pipe %s on stage=%d", crtc->name, 599 DBG("%s: assign pipe %s on stage=%d", crtc->name,
575 pstates[i].plane->name, 600 pstates[i].plane->name,
576 pstates[i].state->stage); 601 pstates[i].state->stage);