aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni.dodonov@intel.com>2012-05-09 14:37:24 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-05-19 16:39:49 -0400
commit1f8eeabf2e6f4a6cb5afe9e90d2a705e9709f1a1 (patch)
tree47fe6297ab6872b5d3491474f2e86b6b3683c3b9 /drivers/gpu
parent6b8a5eeb9f428becc88adef148518ed07bf06d02 (diff)
drm/i915: program WM_LINETIME on Haswell
The line time can be programmed according to the number of horizontal pixels vs effective pixel rate ratio. v2: improve comment as per Chris Wilson suggestion v3: incorporate latest changes in specs. v4: move into wm update routine, also mention that the same routine can program IPS watermarks. We do not have their enablement code yet, nor handle the required clock settings at the moment, so this patch won't program those values for now. Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c2
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h2
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c37
4 files changed, 43 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e03a4f80c5c9..83a557c7bcc5 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -243,6 +243,8 @@ struct drm_i915_display_funcs {
243 void (*update_sprite_wm)(struct drm_device *dev, int pipe, 243 void (*update_sprite_wm)(struct drm_device *dev, int pipe,
244 uint32_t sprite_width, int pixel_size); 244 uint32_t sprite_width, int pixel_size);
245 void (*sanitize_pm)(struct drm_device *dev); 245 void (*sanitize_pm)(struct drm_device *dev);
246 void (*update_linetime_wm)(struct drm_device *dev, int pipe,
247 struct drm_display_mode *mode);
246 int (*crtc_mode_set)(struct drm_crtc *crtc, 248 int (*crtc_mode_set)(struct drm_crtc *crtc,
247 struct drm_display_mode *mode, 249 struct drm_display_mode *mode,
248 struct drm_display_mode *adjusted_mode, 250 struct drm_display_mode *adjusted_mode,
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 39f122b3ce70..fb3f4aaca2c4 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4609,6 +4609,8 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
4609 4609
4610 intel_update_watermarks(dev); 4610 intel_update_watermarks(dev);
4611 4611
4612 intel_update_linetime_watermarks(dev, pipe, adjusted_mode);
4613
4612 return ret; 4614 return ret;
4613} 4615}
4614 4616
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index a5bb5b6ebb4f..0ad1bb383976 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -454,6 +454,8 @@ extern void intel_update_watermarks(struct drm_device *dev);
454extern void intel_update_sprite_watermarks(struct drm_device *dev, int pipe, 454extern void intel_update_sprite_watermarks(struct drm_device *dev, int pipe,
455 uint32_t sprite_width, 455 uint32_t sprite_width,
456 int pixel_size); 456 int pixel_size);
457extern void intel_update_linetime_watermarks(struct drm_device *dev, int pipe,
458 struct drm_display_mode *mode);
457 459
458extern int intel_sprite_set_colorkey(struct drm_device *dev, void *data, 460extern int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
459 struct drm_file *file_priv); 461 struct drm_file *file_priv);
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 452a9bce8162..8f8d1daf1cac 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -1883,6 +1883,33 @@ static void sandybridge_update_wm(struct drm_device *dev)
1883 cursor_wm); 1883 cursor_wm);
1884} 1884}
1885 1885
1886static void
1887haswell_update_linetime_wm(struct drm_device *dev, int pipe,
1888 struct drm_display_mode *mode)
1889{
1890 struct drm_i915_private *dev_priv = dev->dev_private;
1891 u32 temp;
1892
1893 temp = I915_READ(PIPE_WM_LINETIME(pipe));
1894 temp &= ~PIPE_WM_LINETIME_MASK;
1895
1896 /* The WM are computed with base on how long it takes to fill a single
1897 * row at the given clock rate, multiplied by 8.
1898 * */
1899 temp |= PIPE_WM_LINETIME_TIME(
1900 ((mode->crtc_hdisplay * 1000) / mode->clock) * 8);
1901
1902 /* IPS watermarks are only used by pipe A, and are ignored by
1903 * pipes B and C. They are calculated similarly to the common
1904 * linetime values, except that we are using CD clock frequency
1905 * in MHz instead of pixel rate for the division.
1906 *
1907 * This is a placeholder for the IPS watermark calculation code.
1908 */
1909
1910 I915_WRITE(PIPE_WM_LINETIME(pipe), temp);
1911}
1912
1886static bool 1913static bool
1887sandybridge_compute_sprite_wm(struct drm_device *dev, int plane, 1914sandybridge_compute_sprite_wm(struct drm_device *dev, int plane,
1888 uint32_t sprite_width, int pixel_size, 1915 uint32_t sprite_width, int pixel_size,
@@ -2078,6 +2105,15 @@ void intel_update_watermarks(struct drm_device *dev)
2078 dev_priv->display.update_wm(dev); 2105 dev_priv->display.update_wm(dev);
2079} 2106}
2080 2107
2108void intel_update_linetime_watermarks(struct drm_device *dev,
2109 int pipe, struct drm_display_mode *mode)
2110{
2111 struct drm_i915_private *dev_priv = dev->dev_private;
2112
2113 if (dev_priv->display.update_linetime_wm)
2114 dev_priv->display.update_linetime_wm(dev, pipe, mode);
2115}
2116
2081void intel_update_sprite_watermarks(struct drm_device *dev, int pipe, 2117void intel_update_sprite_watermarks(struct drm_device *dev, int pipe,
2082 uint32_t sprite_width, int pixel_size) 2118 uint32_t sprite_width, int pixel_size)
2083{ 2119{
@@ -3689,6 +3725,7 @@ void intel_init_pm(struct drm_device *dev)
3689 if (SNB_READ_WM0_LATENCY()) { 3725 if (SNB_READ_WM0_LATENCY()) {
3690 dev_priv->display.update_wm = sandybridge_update_wm; 3726 dev_priv->display.update_wm = sandybridge_update_wm;
3691 dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm; 3727 dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm;
3728 dev_priv->display.update_linetime_wm = haswell_update_linetime_wm;
3692 } else { 3729 } else {
3693 DRM_DEBUG_KMS("Failed to read display plane latency. " 3730 DRM_DEBUG_KMS("Failed to read display plane latency. "
3694 "Disable CxSR\n"); 3731 "Disable CxSR\n");