From: Thomas Richter <richter@rus.uni-stuttgart.de>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx <intel-gfx@lists.freedesktop.org>
Subject: [PATCH] Align i830 watermark to cache lines
Date: Mon, 02 Jun 2014 12:34:59 +0200 [thread overview]
Message-ID: <538C5353.40001@rus.uni-stuttgart.de> (raw)
In-Reply-To: <20140602082705.GJ19050@phenom.ffwll.local>
[-- Attachment #1: Type: text/plain, Size: 813 bytes --]
Hi folks,
as by discussion, the problem with the i830 watermark problems is likely
that the 830 requires the number of entries in the buffer to be a
multiple of the cache line size. I provide hereby a small patch
against intel_pm.c that performs the alignment for GEN2 chips.
Tested on the Fujitsu S6010 and R31, seems to work fine here and
generates reasonable watermarks that do not flicker.
What is a bit unsatisfactory is that, due to the nature of the patch,
the number of entries in the buffer is always rounded up (necessarily,
to be conservative), even though for all practical configurations, the
rounded up size is too large to fit into the buffer, and thus the
rounding direction is "round down" instead of "round up" for all
realistic settings.
Anyhow, the stuff works.
Greetings,
Thomas
[-- Attachment #2: 0001-Align-i830-watermark-to-cache-lines.patch --]
[-- Type: text/x-patch, Size: 2663 bytes --]
>From ee1210a1f49abaddc2c6c46cfb521db6ab08c261 Mon Sep 17 00:00:00 2001
From: thor <thor@math.tu-berlin.de>
Date: Sun, 1 Jun 2014 18:33:20 +0200
Subject: [PATCH] Align i830 watermark to cache lines.
Signed-off-by: thor <thor@math.tu-berlin.de>
---
drivers/gpu/drm/i915/intel_pm.c | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 1840d15..fbfd57c 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -1489,6 +1489,22 @@ static void i965_update_wm(struct drm_crtc *unused_crtc)
I915_WRITE(DSPFW3, (cursor_sr << DSPFW_CURSOR_SR_SHIFT));
}
+static int round_to_lines(int watermark, int fifo_size, int line_size)
+{
+ int entries = fifo_size - watermark;
+
+ if (entries < 0)
+ entries = 0;
+
+ entries = DIV_ROUND_UP(entries, line_size);
+ while (entries > fifo_size)
+ entries -= line_size;
+
+ watermark = fifo_size - line_size;
+
+ return watermark;
+}
+
static void i9xx_update_wm(struct drm_crtc *unused_crtc)
{
struct drm_device *dev = unused_crtc->dev;
@@ -1520,6 +1536,12 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc)
planea_wm = intel_calculate_wm(adjusted_mode->crtc_clock,
wm_info, fifo_size, cpp,
latency_ns);
+
+ if (IS_GEN2(dev))
+ planea_wm = round_to_lines(planea_wm,
+ fifo_size,
+ I830_FIFO_LINE_SIZE);
+
enabled = crtc;
} else
planea_wm = fifo_size - wm_info->guard_size;
@@ -1536,6 +1558,12 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc)
planeb_wm = intel_calculate_wm(adjusted_mode->crtc_clock,
wm_info, fifo_size, cpp,
latency_ns);
+
+ if (IS_GEN2(dev))
+ planeb_wm = round_to_lines(planeb_wm,
+ fifo_size,
+ I830_FIFO_LINE_SIZE);
+
if (enabled == NULL)
enabled = crtc;
else
@@ -1631,16 +1659,24 @@ static void i845_update_wm(struct drm_crtc *unused_crtc)
const struct drm_display_mode *adjusted_mode;
uint32_t fwater_lo;
int planea_wm;
+ int fifo_size;
crtc = single_enabled_crtc(dev);
if (crtc == NULL)
return;
adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode;
+ fifo_size = dev_priv->display.get_fifo_size(dev, 0);
planea_wm = intel_calculate_wm(adjusted_mode->crtc_clock,
&i845_wm_info,
- dev_priv->display.get_fifo_size(dev, 0),
+ fifo_size,
4, latency_ns);
+
+ planea_wm = round_to_lines(planea_wm,
+ fifo_size,
+ I830_FIFO_LINE_SIZE);
+
+
fwater_lo = I915_READ(FW_BLC) & ~0xfff;
fwater_lo |= (3<<8) | planea_wm;
--
1.7.10.4
[-- Attachment #3: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2014-06-02 10:35 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-16 14:02 830GM still woes Thomas Richter
2014-05-16 14:41 ` Chris Wilson
2014-05-16 15:09 ` Daniel Vetter
2014-05-16 16:04 ` Ville Syrjälä
2014-05-16 16:50 ` Daniel Vetter
[not found] ` <23914_1400259040_537641E0_23914_9298_1_20140516165034.GT8790@phenom.ffwll.local>
2014-05-17 10:58 ` Thomas Richter
2014-05-29 14:10 ` Thomas Richter
2014-05-29 21:19 ` Breaking suspend/resume by the Pipe A quirk Thomas Richter
2014-06-02 8:27 ` Daniel Vetter
2014-06-02 10:34 ` Thomas Richter [this message]
2014-06-02 10:41 ` Thomas Richter
2014-06-02 15:27 ` Daniel Vetter
2014-06-02 15:38 ` [Patch] Disabling the pipe A quirk for the Fujitsu S6010 Thomas Richter
2014-06-02 15:56 ` Daniel Vetter
2014-06-02 16:52 ` Thomas Richter
2014-06-02 17:39 ` Daniel Vetter
2014-06-02 18:44 ` Thomas Richter
[not found] ` <1027_1401722832_538C97D0_1027_15897_1_20140602152702.GU19050@phenom.ffwll.local>
2014-06-03 14:38 ` Breaking suspend/resume by the Pipe A quirk Thomas Richter
2014-06-03 14:45 ` Daniel Vetter
2014-06-03 15:04 ` Thomas Richter
2014-06-03 15:14 ` Chris Wilson
2014-06-03 15:19 ` Thomas Richter
2014-06-03 15:26 ` Chris Wilson
2014-06-03 15:50 ` Thomas Richter
2014-06-03 16:03 ` Chris Wilson
[not found] ` <17205_1401811442_538DF1F2_17205_16362_1_20140603160352.GA6129@nuc-i3427.alporthouse.com>
2014-06-04 22:43 ` Bug: Pipe A underrun on resolution switching on 830MG Thomas Richter
2014-06-08 21:20 ` Broken suspend/resume on i830 (with debug information) Thomas Richter
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=538C5353.40001@rus.uni-stuttgart.de \
--to=richter@rus.uni-stuttgart.de \
--cc=daniel@ffwll.ch \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox