aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
authorZhao Yakui <yakui.zhao@intel.com>2010-06-12 02:32:25 -0400
committerEric Anholt <eric@anholt.net>2010-08-01 22:03:43 -0400
commit4fe5e61180d8ea2268d6e64972d90efbe2bab4aa (patch)
tree872f4cdcb027fb6144032dcde67e176c8b99be14 /drivers/gpu/drm/i915/intel_display.c
parent1b07e04e9cd443fc333f4036d129ba7c08d340c4 (diff)
drm/i915: Apply self-refresh watermark calculation for cursor plane
In SR mode cursor plane watermark calculation uses same formula like display plane. This one fixes the case for 965G and G45. Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 09e3f02f529e..b580cd872b10 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2539,6 +2539,20 @@ static struct intel_watermark_params g4x_wm_info = {
2539 2, 2539 2,
2540 G4X_FIFO_LINE_SIZE, 2540 G4X_FIFO_LINE_SIZE,
2541}; 2541};
2542static struct intel_watermark_params g4x_cursor_wm_info = {
2543 I965_CURSOR_FIFO,
2544 I965_CURSOR_MAX_WM,
2545 I965_CURSOR_DFT_WM,
2546 2,
2547 G4X_FIFO_LINE_SIZE,
2548};
2549static struct intel_watermark_params i965_cursor_wm_info = {
2550 I965_CURSOR_FIFO,
2551 I965_CURSOR_MAX_WM,
2552 I965_CURSOR_DFT_WM,
2553 2,
2554 I915_FIFO_LINE_SIZE,
2555};
2542static struct intel_watermark_params i945_wm_info = { 2556static struct intel_watermark_params i945_wm_info = {
2543 I945_FIFO_SIZE, 2557 I945_FIFO_SIZE,
2544 I915_MAX_WM, 2558 I915_MAX_WM,
@@ -2925,7 +2939,18 @@ static void g4x_update_wm(struct drm_device *dev, int planea_clock,
2925 sr_entries = (((sr_latency_ns / line_time_us) + 1000) / 1000) * 2939 sr_entries = (((sr_latency_ns / line_time_us) + 1000) / 1000) *
2926 pixel_size * sr_hdisplay; 2940 pixel_size * sr_hdisplay;
2927 sr_entries = roundup(sr_entries / cacheline_size, 1); 2941 sr_entries = roundup(sr_entries / cacheline_size, 1);
2928 DRM_DEBUG("self-refresh entries: %d\n", sr_entries); 2942
2943 entries_required = (((sr_latency_ns / line_time_us) +
2944 1000) / 1000) * pixel_size * 64;
2945 entries_required = roundup(entries_required /
2946 g4x_cursor_wm_info.cacheline_size, 1);
2947 cursor_sr = entries_required + g4x_cursor_wm_info.guard_size;
2948
2949 if (cursor_sr > g4x_cursor_wm_info.max_wm)
2950 cursor_sr = g4x_cursor_wm_info.max_wm;
2951 DRM_DEBUG_KMS("self-refresh watermark: display plane %d "
2952 "cursor %d\n", sr_entries, cursor_sr);
2953
2929 I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN); 2954 I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN);
2930 } else { 2955 } else {
2931 /* Turn off self refresh if both pipes are enabled */ 2956 /* Turn off self refresh if both pipes are enabled */
@@ -2956,6 +2981,7 @@ static void i965_update_wm(struct drm_device *dev, int planea_clock,
2956 struct drm_i915_private *dev_priv = dev->dev_private; 2981 struct drm_i915_private *dev_priv = dev->dev_private;
2957 unsigned long line_time_us; 2982 unsigned long line_time_us;
2958 int sr_clock, sr_entries, srwm = 1; 2983 int sr_clock, sr_entries, srwm = 1;
2984 int cursor_sr = 16;
2959 2985
2960 /* Calc sr entries for one plane configs */ 2986 /* Calc sr entries for one plane configs */
2961 if (sr_hdisplay && (!planea_clock || !planeb_clock)) { 2987 if (sr_hdisplay && (!planea_clock || !planeb_clock)) {
@@ -2974,6 +3000,20 @@ static void i965_update_wm(struct drm_device *dev, int planea_clock,
2974 if (srwm < 0) 3000 if (srwm < 0)
2975 srwm = 1; 3001 srwm = 1;
2976 srwm &= 0x1ff; 3002 srwm &= 0x1ff;
3003
3004 sr_entries = (((sr_latency_ns / line_time_us) + 1000) / 1000) *
3005 pixel_size * 64;
3006 sr_entries = roundup(sr_entries /
3007 i965_cursor_wm_info.cacheline_size, 1);
3008 cursor_sr = i965_cursor_wm_info.fifo_size -
3009 (sr_entries + i965_cursor_wm_info.guard_size);
3010
3011 if (cursor_sr > i965_cursor_wm_info.max_wm)
3012 cursor_sr = i965_cursor_wm_info.max_wm;
3013
3014 DRM_DEBUG_KMS("self-refresh watermark: display plane %d "
3015 "cursor %d\n", srwm, cursor_sr);
3016
2977 if (IS_I965GM(dev)) 3017 if (IS_I965GM(dev))
2978 I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN); 3018 I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN);
2979 } else { 3019 } else {
@@ -2990,6 +3030,8 @@ static void i965_update_wm(struct drm_device *dev, int planea_clock,
2990 I915_WRITE(DSPFW1, (srwm << DSPFW_SR_SHIFT) | (8 << 16) | (8 << 8) | 3030 I915_WRITE(DSPFW1, (srwm << DSPFW_SR_SHIFT) | (8 << 16) | (8 << 8) |
2991 (8 << 0)); 3031 (8 << 0));
2992 I915_WRITE(DSPFW2, (8 << 8) | (8 << 0)); 3032 I915_WRITE(DSPFW2, (8 << 8) | (8 << 0));
3033 /* update cursor SR watermark */
3034 I915_WRITE(DSPFW3, (cursor_sr << DSPFW_CURSOR_SR_SHIFT));
2993} 3035}
2994 3036
2995static void i9xx_update_wm(struct drm_device *dev, int planea_clock, 3037static void i9xx_update_wm(struct drm_device *dev, int planea_clock,