Commit 624a0ac3 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Fix the g4x watermark TLB miss workaround

The g4x watermark TLB miss workaround requires that we bump up the
watermark by the difference between 8 full lines and the FIFO size.
Unfortunately the way we compute it at the moment ignores the size
of the pixels. The code also used the primary plane width as the
cursor width when computing the TLB miss w/a for the cursor.
Let's fix both problems.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170421181432.15216-9-ville.syrjala@linux.intel.comReviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
parent 99834b14
...@@ -811,7 +811,7 @@ static bool g4x_compute_wm0(struct drm_i915_private *dev_priv, ...@@ -811,7 +811,7 @@ static bool g4x_compute_wm0(struct drm_i915_private *dev_priv,
struct intel_crtc *crtc; struct intel_crtc *crtc;
const struct drm_display_mode *adjusted_mode; const struct drm_display_mode *adjusted_mode;
const struct drm_framebuffer *fb; const struct drm_framebuffer *fb;
int htotal, hdisplay, clock, cpp; int htotal, plane_width, cursor_width, clock, cpp;
int line_time_us, line_count; int line_time_us, line_count;
int entries, tlb_miss; int entries, tlb_miss;
...@@ -826,12 +826,13 @@ static bool g4x_compute_wm0(struct drm_i915_private *dev_priv, ...@@ -826,12 +826,13 @@ static bool g4x_compute_wm0(struct drm_i915_private *dev_priv,
fb = crtc->base.primary->state->fb; fb = crtc->base.primary->state->fb;
clock = adjusted_mode->crtc_clock; clock = adjusted_mode->crtc_clock;
htotal = adjusted_mode->crtc_htotal; htotal = adjusted_mode->crtc_htotal;
hdisplay = crtc->config->pipe_src_w; plane_width = crtc->config->pipe_src_w;
cursor_width = crtc->base.cursor->state->crtc_w;
cpp = fb->format->cpp[0]; cpp = fb->format->cpp[0];
/* Use the small buffer method to calculate plane watermark */ /* Use the small buffer method to calculate plane watermark */
entries = ((clock * cpp / 1000) * display_latency_ns) / 1000; entries = ((clock * cpp / 1000) * display_latency_ns) / 1000;
tlb_miss = display->fifo_size*display->cacheline_size - hdisplay * 8; tlb_miss = display->fifo_size*display->cacheline_size - plane_width * cpp * 8;
if (tlb_miss > 0) if (tlb_miss > 0)
entries += tlb_miss; entries += tlb_miss;
entries = DIV_ROUND_UP(entries, display->cacheline_size); entries = DIV_ROUND_UP(entries, display->cacheline_size);
...@@ -842,8 +843,8 @@ static bool g4x_compute_wm0(struct drm_i915_private *dev_priv, ...@@ -842,8 +843,8 @@ static bool g4x_compute_wm0(struct drm_i915_private *dev_priv,
/* Use the large buffer method to calculate cursor watermark */ /* Use the large buffer method to calculate cursor watermark */
line_time_us = max(htotal * 1000 / clock, 1); line_time_us = max(htotal * 1000 / clock, 1);
line_count = (cursor_latency_ns / line_time_us + 1000) / 1000; line_count = (cursor_latency_ns / line_time_us + 1000) / 1000;
entries = line_count * crtc->base.cursor->state->crtc_w * 4; entries = line_count * cursor_width * 4;
tlb_miss = cursor->fifo_size*cursor->cacheline_size - hdisplay * 8; tlb_miss = cursor->fifo_size*cursor->cacheline_size - cursor_width * 4 * 8;
if (tlb_miss > 0) if (tlb_miss > 0)
entries += tlb_miss; entries += tlb_miss;
entries = DIV_ROUND_UP(entries, cursor->cacheline_size); entries = DIV_ROUND_UP(entries, cursor->cacheline_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment