linux-arm-msm.vger.kernel.org archive mirror
 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,
	daniel@ffwll.ch, maarten.lankhorst@linux.intel.com,
	Archit Taneja <architt@codeaurora.org>
Subject: [PATCH 7/9] drm/msm/mdp5: Refactor mdp5_plane_atomic_check
Date: Mon, 19 Dec 2016 17:38:56 +0530	[thread overview]
Message-ID: <1482149338-586-8-git-send-email-architt@codeaurora.org> (raw)
In-Reply-To: <1482149338-586-1-git-send-email-architt@codeaurora.org>

In mdp5_plane_atomic_check, we get crtc_state from
drm_plane_state.

Later, for cursor planes, we'll populate the update_plane()
func that takes a fast asynchronous path to implement cursor
movements. There, we would need to call a similar atomic_check
func to validate the plane state, but crtc_state would need to
be derived differently.

Refactor mdp5_plane_atomic_check to mdp5_plane_atomic_check_with_state
such that the latter takes crtc_state as an argument.

This is similar to what the intel driver has done for async cursor
updates.

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

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index c813ea7..107bb3a 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -273,16 +273,15 @@ static void mdp5_plane_cleanup_fb(struct drm_plane *plane,
 }
 
 #define FRAC_16_16(mult, div)    (((mult) << 16) / (div))
-static int mdp5_plane_atomic_check(struct drm_plane *plane,
-		struct drm_plane_state *state)
+static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
+					      struct drm_plane_state *state)
 {
 	struct mdp5_plane_state *mdp5_state = to_mdp5_plane_state(state);
+	struct drm_plane *plane = state->plane;
 	struct drm_plane_state *old_state = plane->state;
 	struct mdp5_cfg *config = mdp5_cfg_get_config(get_kms(plane)->cfg);
 	bool new_hwpipe = false;
 	uint32_t max_width, max_height;
-	struct drm_crtc *crtc;
-	struct drm_crtc_state *crtc_state;
 	struct drm_rect clip;
 	int min_scale, max_scale;
 	uint32_t caps = 0;
@@ -291,10 +290,6 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
 	DBG("%s: check (%d -> %d)", plane->name,
 			plane_enabled(old_state), plane_enabled(state));
 
-	crtc = state->crtc ? state->crtc : plane->state->crtc;
-	if (!crtc)
-		return 0;
-
 	/* We don't allow faster-than-vblank updates.. if we did add this
 	 * some day, we would need to disallow in cases where hwpipe
 	 * changes
@@ -313,10 +308,6 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
 		return -ERANGE;
 	}
 
-	crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc);
-	if (WARN_ON(!crtc_state))
-		return -EINVAL;
-
 	clip.x1 = 0;
 	clip.y1 = 0;
 	clip.x2 = crtc_state->adjusted_mode.hdisplay;
@@ -392,6 +383,23 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
 	return 0;
 }
 
+static int mdp5_plane_atomic_check(struct drm_plane *plane,
+				   struct drm_plane_state *state)
+{
+	struct drm_crtc *crtc;
+	struct drm_crtc_state *crtc_state;
+
+	crtc = state->crtc ? state->crtc : plane->state->crtc;
+	if (!crtc)
+		return 0;
+
+	crtc_state = drm_atomic_get_existing_crtc_state(state->state, crtc);
+	if (WARN_ON(!crtc_state))
+		return -EINVAL;
+
+	return mdp5_plane_atomic_check_with_state(crtc_state, state);
+}
+
 static void mdp5_plane_atomic_update(struct drm_plane *plane,
 				     struct drm_plane_state *old_state)
 {
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

  parent reply	other threads:[~2016-12-19 12:09 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 ` Archit Taneja [this message]
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   ` [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=1482149338-586-8-git-send-email-architt@codeaurora.org \
    --to=architt@codeaurora.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).