linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gummerer <t.gummerer@gmail.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, David Airlie <airlied@linux.ie>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Daniel Vetter <daniel.vetter@intel.com>,
	jan@gondor.com, Tvrtko Ursulin <tvrtko.ursulin@intel.com>,
	Michael Leuchtenburg <michael@slashhome.org>,
	Thomas Gummerer <t.gummerer@gmail.com>
Subject: [PATCH v2] drm/i915: fix screen flickering
Date: Thu, 14 May 2015 09:16:39 +0200	[thread overview]
Message-ID: <1431587799-5399-1-git-send-email-t.gummerer@gmail.com> (raw)
In-Reply-To: <20150514032118.GD25648@intel.com>

Commit c9f038a1a592 ("drm/i915: Don't assume primary & cursor are
always on for wm calculation (v4)") fixes a null pointer dereference.
Setting the primary and cursor panes to false in
ilk_compute_wm_parameters to false does however give the following
errors in the kernel log and causes the screen to flicker.

[  101.133716] [drm:intel_set_cpu_fifo_underrun_reporting [i915]]
*ERROR* uncleared fifo underrun on pipe A
[  101.133725] [drm:intel_cpu_fifo_underrun_irq_handler [i915]]
*ERROR* CPU pipe A FIFO underrun

Always setting the panes to enabled fixes this error.

Helped-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
---

> Sorry, I missed your patch when you first sent it.  That type of fix
> looks like an okay workaround while we do a more in-depth rework of the
> watermark system.  However I think your patch could cause a crash if we
> disable the primary plane via the universal plane interface; if we do
> that, p->pri.bytes_per_pixel is set to 0, but since we're now pretending
> the primary plane is always enabled, ilk_wm_fbc() can eventually get
> called and use that 0 in the denominator of a division operation.
>
> If you just squash the following change into your patch, I think it should be
> safe:
> [...]

Thank you very much for the suggestion, here is an updated version of the 
patch.

 drivers/gpu/drm/i915/intel_pm.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index fa4ccb3..555b896 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2045,22 +2045,20 @@ 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) {
-		p->pri.enabled = true;
+	if (crtc->primary->state->fb)
 		p->pri.bytes_per_pixel =
 			crtc->primary->state->fb->bits_per_pixel / 8;
-	} else {
-		p->pri.enabled = false;
-		p->pri.bytes_per_pixel = 0;
-	}
+	else
+		p->pri.bytes_per_pixel = 4;
+
+	p->cur.bytes_per_pixel = 4;
+	/*
+	 * TODO: for now, assume primary and cursor planes are always enabled.
+	 * Setting them to false makes the screen flicker.
+	 */
+	p->pri.enabled = true;
+	p->cur.enabled = true;
 
-	if (crtc->cursor->state->fb) {
-		p->cur.enabled = true;
-		p->cur.bytes_per_pixel = 4;
-	} else {
-		p->cur.enabled = false;
-		p->cur.bytes_per_pixel = 0;
-	}
 	p->pri.horiz_pixels = intel_crtc->config->pipe_src_w;
 	p->cur.horiz_pixels = intel_crtc->base.cursor->state->crtc_w;
 
-- 
2.4.0.184.g8e1974e


  reply	other threads:[~2015-05-14  7:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12 19:54 [BUG/REGRESSION] Screen flickering Thomas Gummerer
2015-05-13  9:14 ` Jani Nikula
2015-05-13  9:53   ` Jan Niehusmann
2015-05-13 10:32     ` Sudip Mukherjee
2015-05-13 11:10       ` Jan Niehusmann
2015-05-13 11:28         ` Sudip Mukherjee
2015-05-13 11:27       ` Thomas Gummerer
2015-05-13 11:34         ` Sudip Mukherjee
2015-05-13 11:23     ` Thomas Gummerer
2015-05-14  3:21 ` Matt Roper
2015-05-14  7:16   ` Thomas Gummerer [this message]
2015-05-14 14:28     ` [PATCH v2] drm/i915: fix screen flickering Matt Roper
2015-05-19  7:37       ` Jani Nikula

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=1431587799-5399-1-git-send-email-t.gummerer@gmail.com \
    --to=t.gummerer@gmail.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jan@gondor.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.d.roper@intel.com \
    --cc=michael@slashhome.org \
    --cc=tvrtko.ursulin@intel.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).