All of lore.kernel.org
 help / color / mirror / Atom feed
From: ville.syrjala@linux.intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v2 8/9] drm/i915: Use state->visible in wm calculation
Date: Thu, 19 Mar 2015 16:31:57 +0200	[thread overview]
Message-ID: <1426775517-25242-1-git-send-email-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <1425986129-15547-9-git-send-email-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

v2: Rebase and update the vlv/chv code as well

Cc: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 42 ++++++++++++++++++-----------------------
 1 file changed, 18 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index e18f0fd..a8c6578 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -915,18 +915,16 @@ static uint8_t vlv_compute_drain_latency(struct drm_crtc *crtc,
 	int entries, prec_mult, drain_latency, pixel_size;
 	int clock = intel_crtc->config->base.adjusted_mode.crtc_clock;
 	const int high_precision = IS_CHERRYVIEW(dev) ? 16 : 64;
+	const struct intel_plane_state *state =
+		to_intel_plane_state(plane->state);
 
-	/*
-	 * FIXME the plane might have an fb
-	 * but be invisible (eg. due to clipping)
-	 */
-	if (!intel_crtc->active || !plane->state->fb)
+	if (!state->visible)
 		return 0;
 
 	if (WARN(clock == 0, "Pixel clock is zero!\n"))
 		return 0;
 
-	pixel_size = drm_format_plane_cpp(plane->state->fb->pixel_format, 0);
+	pixel_size = drm_format_plane_cpp(state->base.fb->pixel_format, 0);
 
 	if (WARN(pixel_size == 0, "Pixel size is zero!\n"))
 		return 0;
@@ -953,15 +951,13 @@ static int vlv_compute_wm(struct intel_crtc *crtc,
 			  int fifo_size)
 {
 	int clock, entries, pixel_size;
+	const struct intel_plane_state *state =
+		to_intel_plane_state(plane->base.state);
 
-	/*
-	 * FIXME the plane might have an fb
-	 * but be invisible (eg. due to clipping)
-	 */
-	if (!crtc->active || !plane->base.state->fb)
+	if (!state->visible)
 		return 0;
 
-	pixel_size = drm_format_plane_cpp(plane->base.state->fb->pixel_format, 0);
+	pixel_size = drm_format_plane_cpp(state->base.fb->pixel_format, 0);
 	clock = crtc->config->base.adjusted_mode.crtc_clock;
 
 	entries = DIV_ROUND_UP(clock, 1000) * pixel_size;
@@ -2037,6 +2033,7 @@ static void ilk_compute_wm_parameters(struct drm_crtc *crtc,
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	enum pipe pipe = intel_crtc->pipe;
 	struct drm_plane *plane;
+	const struct intel_plane_state *state;
 
 	if (!intel_crtc->active)
 		return;
@@ -2045,24 +2042,21 @@ static void ilk_compute_wm_parameters(struct drm_crtc *crtc,
 	p->pipe_htotal = intel_crtc->config->base.adjusted_mode.crtc_htotal;
 	p->pixel_rate = ilk_pipe_pixel_rate(dev, crtc);
 
-	if (crtc->primary->state->fb) {
+	state = to_intel_plane_state(crtc->primary->state);
+	if (state->visible) {
 		p->pri.enabled = true;
 		p->pri.bytes_per_pixel =
-			crtc->primary->state->fb->bits_per_pixel / 8;
-	} else {
-		p->pri.enabled = false;
-		p->pri.bytes_per_pixel = 0;
+			drm_format_plane_cpp(state->base.fb->pixel_format, 0);
+		p->pri.horiz_pixels = drm_rect_width(&state->dst);
 	}
 
-	if (crtc->cursor->state->fb) {
+	state = to_intel_plane_state(crtc->cursor->state);
+	if (state->visible) {
 		p->cur.enabled = true;
-		p->cur.bytes_per_pixel = 4;
-	} else {
-		p->cur.enabled = false;
-		p->cur.bytes_per_pixel = 0;
+		p->cur.bytes_per_pixel =
+			drm_format_plane_cpp(state->base.fb->pixel_format, 0);
+		p->cur.horiz_pixels = state->base.crtc_w;
 	}
-	p->pri.horiz_pixels = intel_crtc->config->pipe_src_w;
-	p->cur.horiz_pixels = intel_crtc->base.cursor->state->crtc_w;
 
 	drm_for_each_legacy_plane(plane, &dev->mode_config.plane_list) {
 		struct intel_plane *intel_plane = to_intel_plane(plane);
-- 
2.0.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-03-19 14:32 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10 11:15 [PATCH 0/9] drm/i915: Update derived plane state at crtc enable/disable ville.syrjala
2015-03-10 11:15 ` [PATCH 1/9] drm/i915: Remove debug prints from primary plane update funcs ville.syrjala
2015-03-10 15:55   ` Jesse Barnes
2015-03-10 11:15 ` [PATCH 2/9] drm/i915: Reduce clutter by using the local plane pointer ville.syrjala
2015-03-10 16:00   ` Jesse Barnes
2015-03-10 11:15 ` [PATCH 3/9] drm/i915: Use plane->state->fb instead of plane->fb in intel_plane_restore() ville.syrjala
2015-03-10 17:01   ` Matt Roper
2015-03-10 17:48     ` Ville Syrjälä
2015-03-11  9:41       ` Daniel Vetter
2015-03-11 10:04         ` Daniel Vetter
2015-03-10 11:15 ` [PATCH 4/9] drm/i915: Make derived plane state correct after crtc_enable ville.syrjala
2015-03-10 17:01   ` Matt Roper
2015-03-10 17:57     ` Ville Syrjälä
2015-03-11  9:52       ` Daniel Vetter
2015-03-11 10:03         ` Daniel Vetter
2015-03-11 10:05         ` Ville Syrjälä
2015-03-11 10:24           ` Daniel Vetter
2015-03-11 12:19             ` Ville Syrjälä
2015-03-11 16:23               ` Daniel Vetter
2015-03-11 16:40                 ` Ville Syrjälä
2015-03-10 11:15 ` [PATCH 5/9] drm/i915: Pass primary plane size to .update_primary_plane() ville.syrjala
2015-03-10 17:10   ` Matt Roper
2015-03-10 17:59     ` Ville Syrjälä
2015-03-10 20:57       ` Matt Roper
2015-03-11  9:42         ` Ville Syrjälä
2015-03-11  9:57       ` Daniel Vetter
2015-03-11  5:09   ` sonika
2015-03-11  9:27     ` Ville Syrjälä
2015-03-11  9:26       ` sonika
2015-03-19 14:28   ` [PATCH v2 " ville.syrjala
2015-03-20  9:49     ` Jindal, Sonika
2015-03-20 10:04       ` Ville Syrjälä
2015-03-20 10:53         ` Jindal, Sonika
2015-03-20 14:26           ` Ville Syrjälä
2015-03-23  4:11     ` sonika
2015-03-10 11:15 ` [PATCH 6/9] drm/i915: Pass the primary plane position " ville.syrjala
2015-03-19 14:29   ` [PATCH v2 " ville.syrjala
2015-03-20 11:22     ` Jindal, Sonika
2015-03-10 11:15 ` [PATCH 7/9] drm/i915: Update watermarks after the derived plane state is uptodate ville.syrjala
2015-03-10 17:13   ` Matt Roper
2015-03-11  9:59     ` Daniel Vetter
2015-03-10 11:15 ` [PATCH 8/9] drm/i915: Use state->visible in wm calculation ville.syrjala
2015-03-10 17:19   ` Matt Roper
2015-03-10 18:01     ` Ville Syrjälä
2015-03-19 14:31   ` ville.syrjala [this message]
2015-03-10 11:15 ` [PATCH 9/9] drm/i915: Don't re-enable an explicitly disabled primary plane due to sprite coverage changes ville.syrjala
2015-03-10 17:58   ` shuang.he
2015-03-11 10:00   ` Daniel Vetter
2015-03-11 10:09     ` Ville Syrjälä
2015-03-11 10:28       ` Daniel Vetter

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=1426775517-25242-1-git-send-email-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.