dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Brian Starkey <brian.starkey@arm.com>
To: dri-devel@lists.freedesktop.org
Cc: liviu.dudau@arm.com, linux-kernel@vger.kernel.org
Subject: [PATCH 8/8] drm: mali-dp: Store internal format and n_planes in plane state
Date: Tue, 11 Oct 2016 15:26:09 +0100	[thread overview]
Message-ID: <1476195969-23655-8-git-send-email-brian.starkey@arm.com> (raw)
In-Reply-To: <1476195969-23655-1-git-send-email-brian.starkey@arm.com>

Save a search through the format lists at commit-time by storing the
internal format ID and number of planes in our plane state.

Signed-off-by: Brian Starkey <brian.starkey@arm.com>
---
 drivers/gpu/drm/arm/malidp_drv.h    |    3 +++
 drivers/gpu/drm/arm/malidp_planes.c |   27 ++++++++++++---------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h
index 271d2fb..9fc8a2e 100644
--- a/drivers/gpu/drm/arm/malidp_drv.h
+++ b/drivers/gpu/drm/arm/malidp_drv.h
@@ -39,6 +39,9 @@ struct malidp_plane_state {
 
 	/* size of the required rotation memory if plane is rotated */
 	u32 rotmem_size;
+	/* internal format ID */
+	u8 format;
+	u8 n_planes;
 };
 
 #define to_malidp_plane(x) container_of(x, struct malidp_plane, base)
diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 667b9ca..80f389b 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -70,6 +70,8 @@ struct drm_plane_state *malidp_duplicate_plane_state(struct drm_plane *plane)
 		m_state = to_malidp_plane_state(plane->state);
 		__drm_atomic_helper_plane_duplicate_state(plane, &state->base);
 		state->rotmem_size = m_state->rotmem_size;
+		state->format = m_state->format;
+		state->n_planes = m_state->n_planes;
 	}
 
 	return &state->base;
@@ -99,8 +101,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
 	struct malidp_plane *mp = to_malidp_plane(plane);
 	struct malidp_plane_state *ms = to_malidp_plane_state(state);
 	struct drm_framebuffer *fb;
-	int n_planes, i;
-	u8 format_id;
+	int i;
 	u32 src_w, src_h;
 
 	if (!state->crtc || !state->fb)
@@ -108,13 +109,13 @@ static int malidp_de_plane_check(struct drm_plane *plane,
 
 	fb = state->fb;
 
-	format_id = malidp_hw_get_format_id(&mp->hwdev->map, mp->layer->id,
+	ms->format = malidp_hw_get_format_id(&mp->hwdev->map, mp->layer->id,
 					    fb->pixel_format);
-	if (format_id == MALIDP_INVALID_FORMAT_ID)
+	if (ms->format == MALIDP_INVALID_FORMAT_ID)
 		return -EINVAL;
 
-	n_planes = drm_format_num_planes(fb->pixel_format);
-	for (i = 0; i < n_planes; i++) {
+	ms->n_planes = drm_format_num_planes(fb->pixel_format);
+	for (i = 0; i < ms->n_planes; i++) {
 		if (!malidp_hw_pitch_valid(mp->hwdev, fb->pitches[i])) {
 			DRM_DEBUG_KMS("Invalid pitch %u for plane %d\n",
 				      fb->pitches[i], i);
@@ -160,17 +161,13 @@ static void malidp_de_plane_update(struct drm_plane *plane,
 	struct drm_gem_cma_object *obj;
 	struct malidp_plane *mp;
 	const struct malidp_hw_regmap *map;
-	u8 format_id;
+	struct malidp_plane_state *ms = to_malidp_plane_state(plane->state);
 	u16 ptr;
-	u32 format, src_w, src_h, dest_w, dest_h, val;
-	int num_planes, i;
+	u32 src_w, src_h, dest_w, dest_h, val;
+	int i;
 
 	mp = to_malidp_plane(plane);
-
 	map = &mp->hwdev->map;
-	format = plane->state->fb->pixel_format;
-	format_id = malidp_hw_get_format_id(map, mp->layer->id, format);
-	num_planes = drm_format_num_planes(format);
 
 	/* convert src values from Q16 fixed point to integer */
 	src_w = plane->state->src_w >> 16;
@@ -183,9 +180,9 @@ static void malidp_de_plane_update(struct drm_plane *plane,
 		dest_h = plane->state->crtc_h;
 	}
 
-	malidp_hw_write(mp->hwdev, format_id, mp->layer->base);
+	malidp_hw_write(mp->hwdev, ms->format, mp->layer->base);
 
-	for (i = 0; i < num_planes; i++) {
+	for (i = 0; i < ms->n_planes; i++) {
 		/* calculate the offset for the layer's plane registers */
 		ptr = mp->layer->ptr + (i << 4);
 
-- 
1.7.9.5

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

  parent reply	other threads:[~2016-10-11 14:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-11 14:26 [PATCH 1/8] drm: mali-dp: Set the drm->irq_enabled flag to match driver's state Brian Starkey
2016-10-11 14:26 ` [PATCH 2/8] drm: mali-dp: Clear the config_valid flag before using it in wait_event Brian Starkey
2016-10-11 14:26 ` [PATCH 3/8] drm: mali-dp: Add pitch alignment check function Brian Starkey
2016-10-11 14:26 ` [PATCH 4/8] drm: mali-dp: Add pitch alignment check for planes Brian Starkey
2016-10-11 14:26 ` [PATCH 5/8] arm: mali-dp: Extract mode_config cleanup into malidp_fini Brian Starkey
2016-10-11 14:26 ` [PATCH 6/8] drm: mali-dp: Refactor plane initialisation Brian Starkey
2016-10-11 14:26 ` [PATCH 7/8] drm: mali-dp: Enable alpha blending Brian Starkey
2016-10-11 14:26 ` Brian Starkey [this message]
2016-10-11 15:03 ` [PATCH 1/8] drm: mali-dp: Set the drm->irq_enabled flag to match driver's state liviu.dudau

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=1476195969-23655-8-git-send-email-brian.starkey@arm.com \
    --to=brian.starkey@arm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.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).