All of lore.kernel.org
 help / color / mirror / Atom feed
From: Archit Taneja <architt@codeaurora.org>
To: robdclark@gmail.com
Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: [PATCH v2 4/8] drm/msm/mdp5: Configure COLOR3_OUT propagation
Date: Tue, 17 Jan 2017 10:15:08 +0530	[thread overview]
Message-ID: <20170117044512.22934-5-architt@codeaurora.org> (raw)
In-Reply-To: <20170117044512.22934-1-architt@codeaurora.org>

In MDP5 Layer Mixer HW, the blender output is only the blended color
components (i.e R, G and B, or COLOR0/1/2 in MDP5 HW terminology). This
is fed to the BG input of the next blender. We also need to provide an
alpha (COLOR3) value for the BG input at the next stage.

This is configured via using the REG_MDP5_LM_BLEND_COLOR_OUT register.
For each stage, we can propagate either the BG or FG alpha to the next
stage.

The approach taken by the driver is to propagate FG alpha, if the plane
staged on that blender has an alpha. If it doesn't, we try to propagate
the base layer's alpha.

This is borrowed from downstream MDP5 kernel driver. Without this, we
don't see any cursor plane content.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
index 7a47209b0c6f..fec966293f9a 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
@@ -177,6 +177,21 @@ static void mdp5_crtc_destroy(struct drm_crtc *crtc)
 	kfree(mdp5_crtc);
 }
 
+static inline u32 mdp5_lm_use_fg_alpha_mask(enum mdp_mixer_stage_id stage)
+{
+	switch (stage) {
+	case STAGE0: return MDP5_LM_BLEND_COLOR_OUT_STAGE0_FG_ALPHA;
+	case STAGE1: return MDP5_LM_BLEND_COLOR_OUT_STAGE1_FG_ALPHA;
+	case STAGE2: return MDP5_LM_BLEND_COLOR_OUT_STAGE2_FG_ALPHA;
+	case STAGE3: return MDP5_LM_BLEND_COLOR_OUT_STAGE3_FG_ALPHA;
+	case STAGE4: return MDP5_LM_BLEND_COLOR_OUT_STAGE4_FG_ALPHA;
+	case STAGE5: return MDP5_LM_BLEND_COLOR_OUT_STAGE5_FG_ALPHA;
+	case STAGE6: return MDP5_LM_BLEND_COLOR_OUT_STAGE6_FG_ALPHA;
+	default:
+		return 0;
+	}
+}
+
 /*
  * blend_setup() - blend all the planes of a CRTC
  *
@@ -197,6 +212,8 @@ static void blend_setup(struct drm_crtc *crtc)
 	unsigned long flags;
 	enum mdp5_pipe stage[STAGE_MAX + 1] = { SSPP_NONE };
 	int i, plane_cnt = 0;
+	bool bg_alpha_enabled = false;
+	u32 mixer_op_mode = 0;
 #define blender(stage)	((stage) - STAGE0)
 
 	hw_cfg = mdp5_cfg_get_hw_config(mdp5_kms->cfg);
@@ -218,6 +235,11 @@ static void blend_setup(struct drm_crtc *crtc)
 	if (!pstates[STAGE_BASE]) {
 		ctl_blend_flags |= MDP5_CTL_BLEND_OP_FLAG_BORDER_OUT;
 		DBG("Border Color is enabled");
+	} else if (plane_cnt) {
+		format = to_mdp_format(msm_framebuffer_format(pstates[STAGE_BASE]->base.fb));
+
+		if (format->alpha_enable)
+			bg_alpha_enabled = true;
 	}
 
 	/* The reset for blending */
@@ -232,6 +254,12 @@ static void blend_setup(struct drm_crtc *crtc)
 			MDP5_LM_BLEND_OP_MODE_BG_ALPHA(BG_CONST);
 		fg_alpha = pstates[i]->alpha;
 		bg_alpha = 0xFF - pstates[i]->alpha;
+
+		if (!format->alpha_enable && bg_alpha_enabled)
+			mixer_op_mode = 0;
+		else
+			mixer_op_mode |= mdp5_lm_use_fg_alpha_mask(i);
+
 		DBG("Stage %d fg_alpha %x bg_alpha %x", i, fg_alpha, bg_alpha);
 
 		if (format->alpha_enable && pstates[i]->premultiplied) {
@@ -268,6 +296,8 @@ static void blend_setup(struct drm_crtc *crtc)
 				blender(i)), bg_alpha);
 	}
 
+	mdp5_write(mdp5_kms, REG_MDP5_LM_BLEND_COLOR_OUT(lm), mixer_op_mode);
+
 	mdp5_ctl_blend(mdp5_crtc->ctl, stage, plane_cnt, ctl_blend_flags);
 
 out:
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-01-17  4:45 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19 12:08 [PATCH 0/9] drm/msm/mdp5: Cursor plane stuff Archit Taneja
2016-12-19 12:08 ` [PATCH 1/9] drm/msm/mdp5: cfg: Add pipe_cursor block Archit Taneja
2016-12-19 12:08 ` [PATCH 2/9] drm/msm/mdp5: Update generated headers Archit Taneja
2016-12-19 12:08 ` [PATCH 3/9] drm/msm/mdp5: Prepare CRTC/LM for empty stages Archit Taneja
2016-12-19 12:08 ` [PATCH 4/9] drm/msm/mdp5: Use plane helpers to configure src/dst rectangles Archit Taneja
2016-12-19 12:08 ` [PATCH 5/9] drm/msm/mdp5: Configure COLOR3_OUT propagation Archit Taneja
2016-12-19 12:08 ` [PATCH 6/9] drm/msm/mdp5: Misc cursor plane bits Archit Taneja
2016-12-19 12:08 ` [PATCH 7/9] drm/msm/mdp5: Refactor mdp5_plane_atomic_check Archit Taneja
2016-12-19 12:08 ` [RFC 8/9] HACK: drm/msm/mdp5: Add support for legacy cursor updates Archit Taneja
2016-12-19 12:50   ` Maarten Lankhorst
2016-12-20  6:23     ` Archit Taneja
2016-12-20 13:40       ` Maarten Lankhorst
2016-12-21  5:23         ` Archit Taneja
2016-12-19 16:00   ` Daniel Vetter
2016-12-19 16:51     ` Daniel Vetter
2016-12-19 12:08 ` [PATCH 9/9] drm/msm/mdp5: Add cursor planes Archit Taneja
2016-12-19 15:50 ` [PATCH 0/9] drm/msm/mdp5: Cursor plane stuff Daniel Vetter
2017-01-17  4:45 ` [PATCH v2 0/8] " Archit Taneja
2017-01-17  4:45   ` [PATCH v2 1/8] drm/msm/mdp5: cfg: Add pipe_cursor block Archit Taneja
2017-01-17  4:45   ` [PATCH v2 2/8] drm/msm/mdp5: Prepare CRTC/LM for empty stages Archit Taneja
2017-01-17  4:45   ` [PATCH v2 3/8] drm/msm/mdp5: Use plane helpers to configure src/dst rectangles Archit Taneja
2017-01-17  4:45   ` Archit Taneja [this message]
2017-01-17  4:45   ` [PATCH v2 5/8] drm/msm/mdp5: Misc cursor plane bits Archit Taneja
2017-01-17  4:45   ` [PATCH v2 6/8] drm/msm/mdp5: Add cursor planes Archit Taneja
2017-01-17  4:45   ` [PATCH v2 7/8] drm/msm/mdp5: Refactor mdp5_plane_atomic_check Archit Taneja
2017-01-17  4:45   ` [PATCH v2 8/8] HACK: drm/msm/mdp5: Add support for legacy cursor updates Archit Taneja

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170117044512.22934-5-architt@codeaurora.org \
    --to=architt@codeaurora.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=robdclark@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.