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 6/8] drm/msm/mdp5: Add cursor planes
Date: Tue, 17 Jan 2017 10:15:10 +0530	[thread overview]
Message-ID: <20170117044512.22934-7-architt@codeaurora.org> (raw)
In-Reply-To: <20170117044512.22934-1-architt@codeaurora.org>

Register cursor drm_planes. The loop in modeset_init that inits the
planes and crtcs has to be refactored a bit. We first iterate all the
hwpipes to find the cursor planes. Then, we loop again to create
crtcs.

In msm_atomic_wait_for_commit_done, remove the check which bypasses
waiting for vsyncs if state->legacy_cursor_updates is true.

We will later create a fast path for cursor position changes in the
cursor plane's update_plane func that doesn't go via the regular
atomic commit path. For rest of cursor related updates, we will have
to wait for vsyncs, so ignore the legacy_cursor_updates flag.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 33 ++++++++++++++++++++++++++-------
 drivers/gpu/drm/msm/msm_atomic.c        |  5 -----
 2 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
index 70a1950de8ae..3eb0749223d9 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
@@ -411,7 +411,9 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)
 	struct msm_drm_private *priv = dev->dev_private;
 	const struct mdp5_cfg_hw *hw_cfg;
 	unsigned int num_crtcs;
-	int i, ret;
+	int i, ret, pi = 0, ci = 0;
+	struct drm_plane *primary[MAX_BASES] = { NULL };
+	struct drm_plane *cursor[MAX_BASES] = { NULL };
 
 	hw_cfg = mdp5_cfg_get_hw_config(mdp5_kms->cfg);
 
@@ -438,13 +440,14 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)
 	 * planes for the CRTCs, with the remainder as overlay planes:
 	 */
 	for (i = 0; i < mdp5_kms->num_hwpipes; i++) {
-		bool primary = i < num_crtcs;
+		struct mdp5_hw_pipe *hwpipe = mdp5_kms->hwpipes[i];
 		struct drm_plane *plane;
-		struct drm_crtc *crtc;
 		enum drm_plane_type type;
 
-		if (primary)
+		if (i < num_crtcs)
 			type = DRM_PLANE_TYPE_PRIMARY;
+		else if (hwpipe->caps & MDP_PIPE_CAP_CURSOR)
+			type = DRM_PLANE_TYPE_CURSOR;
 		else
 			type = DRM_PLANE_TYPE_OVERLAY;
 
@@ -456,10 +459,16 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)
 		}
 		priv->planes[priv->num_planes++] = plane;
 
-		if (!primary)
-			continue;
+		if (type == DRM_PLANE_TYPE_PRIMARY)
+			primary[pi++] = plane;
+		if (type == DRM_PLANE_TYPE_CURSOR)
+			cursor[ci++] = plane;
+	}
+
+	for (i = 0; i < num_crtcs; i++) {
+		struct drm_crtc *crtc;
 
-		crtc  = mdp5_crtc_init(dev, plane, NULL, i);
+		crtc  = mdp5_crtc_init(dev, primary[i], cursor[i], i);
 		if (IS_ERR(crtc)) {
 			ret = PTR_ERR(crtc);
 			dev_err(dev->dev, "failed to construct crtc %d (%d)\n", i, ret);
@@ -791,6 +800,9 @@ static int hwpipe_init(struct mdp5_kms *mdp5_kms)
 	static const enum mdp5_pipe dma_planes[] = {
 			SSPP_DMA0, SSPP_DMA1,
 	};
+	static const enum mdp5_pipe cursor_planes[] = {
+			SSPP_CURSOR0, SSPP_CURSOR1,
+	};
 	const struct mdp5_cfg_hw *hw_cfg;
 	int ret;
 
@@ -814,6 +826,13 @@ static int hwpipe_init(struct mdp5_kms *mdp5_kms)
 	if (ret)
 		return ret;
 
+	/* Construct cursor pipes: */
+	ret = construct_pipes(mdp5_kms, hw_cfg->pipe_cursor.count,
+			cursor_planes, hw_cfg->pipe_cursor.base,
+			hw_cfg->pipe_cursor.caps);
+	if (ret)
+		return ret;
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c
index 6924fa28f04f..9633a68b14d7 100644
--- a/drivers/gpu/drm/msm/msm_atomic.c
+++ b/drivers/gpu/drm/msm/msm_atomic.c
@@ -93,11 +93,6 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev,
 		if (!crtc->state->enable)
 			continue;
 
-		/* Legacy cursor ioctls are completely unsynced, and userspace
-		 * relies on that (by doing tons of cursor updates). */
-		if (old_state->legacy_cursor_update)
-			continue;
-
 		kms->funcs->wait_for_crtc_commit_done(kms, crtc);
 	}
 }
-- 
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   ` [PATCH v2 4/8] drm/msm/mdp5: Configure COLOR3_OUT propagation Archit Taneja
2017-01-17  4:45   ` [PATCH v2 5/8] drm/msm/mdp5: Misc cursor plane bits Archit Taneja
2017-01-17  4:45   ` Archit Taneja [this message]
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-7-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.