aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_pm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/intel_pm.c')
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c57
1 files changed, 27 insertions, 30 deletions
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 550f787a3b4a..ed772fecbb07 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2162,15 +2162,11 @@ static uint32_t ilk_wm_fbc(uint32_t pri_val, uint32_t horiz_pixels,
2162 2162
2163struct hsw_pipe_wm_parameters { 2163struct hsw_pipe_wm_parameters {
2164 bool active; 2164 bool active;
2165 bool sprite_enabled;
2166 uint8_t pri_bytes_per_pixel;
2167 uint8_t spr_bytes_per_pixel;
2168 uint8_t cur_bytes_per_pixel;
2169 uint32_t pri_horiz_pixels;
2170 uint32_t spr_horiz_pixels;
2171 uint32_t cur_horiz_pixels;
2172 uint32_t pipe_htotal; 2165 uint32_t pipe_htotal;
2173 uint32_t pixel_rate; 2166 uint32_t pixel_rate;
2167 struct intel_plane_wm_parameters pri;
2168 struct intel_plane_wm_parameters spr;
2169 struct intel_plane_wm_parameters cur;
2174}; 2170};
2175 2171
2176struct hsw_wm_maximums { 2172struct hsw_wm_maximums {
@@ -2206,12 +2202,11 @@ static uint32_t ilk_compute_pri_wm(struct hsw_pipe_wm_parameters *params,
2206{ 2202{
2207 uint32_t method1, method2; 2203 uint32_t method1, method2;
2208 2204
2209 /* TODO: for now, assume the primary plane is always enabled. */ 2205 if (!params->active || !params->pri.enabled)
2210 if (!params->active)
2211 return 0; 2206 return 0;
2212 2207
2213 method1 = ilk_wm_method1(params->pixel_rate, 2208 method1 = ilk_wm_method1(params->pixel_rate,
2214 params->pri_bytes_per_pixel, 2209 params->pri.bytes_per_pixel,
2215 mem_value); 2210 mem_value);
2216 2211
2217 if (!is_lp) 2212 if (!is_lp)
@@ -2219,8 +2214,8 @@ static uint32_t ilk_compute_pri_wm(struct hsw_pipe_wm_parameters *params,
2219 2214
2220 method2 = ilk_wm_method2(params->pixel_rate, 2215 method2 = ilk_wm_method2(params->pixel_rate,
2221 params->pipe_htotal, 2216 params->pipe_htotal,
2222 params->pri_horiz_pixels, 2217 params->pri.horiz_pixels,
2223 params->pri_bytes_per_pixel, 2218 params->pri.bytes_per_pixel,
2224 mem_value); 2219 mem_value);
2225 2220
2226 return min(method1, method2); 2221 return min(method1, method2);
@@ -2235,16 +2230,16 @@ static uint32_t ilk_compute_spr_wm(struct hsw_pipe_wm_parameters *params,
2235{ 2230{
2236 uint32_t method1, method2; 2231 uint32_t method1, method2;
2237 2232
2238 if (!params->active || !params->sprite_enabled) 2233 if (!params->active || !params->spr.enabled)
2239 return 0; 2234 return 0;
2240 2235
2241 method1 = ilk_wm_method1(params->pixel_rate, 2236 method1 = ilk_wm_method1(params->pixel_rate,
2242 params->spr_bytes_per_pixel, 2237 params->spr.bytes_per_pixel,
2243 mem_value); 2238 mem_value);
2244 method2 = ilk_wm_method2(params->pixel_rate, 2239 method2 = ilk_wm_method2(params->pixel_rate,
2245 params->pipe_htotal, 2240 params->pipe_htotal,
2246 params->spr_horiz_pixels, 2241 params->spr.horiz_pixels,
2247 params->spr_bytes_per_pixel, 2242 params->spr.bytes_per_pixel,
2248 mem_value); 2243 mem_value);
2249 return min(method1, method2); 2244 return min(method1, method2);
2250} 2245}
@@ -2256,13 +2251,13 @@ static uint32_t ilk_compute_spr_wm(struct hsw_pipe_wm_parameters *params,
2256static uint32_t ilk_compute_cur_wm(struct hsw_pipe_wm_parameters *params, 2251static uint32_t ilk_compute_cur_wm(struct hsw_pipe_wm_parameters *params,
2257 uint32_t mem_value) 2252 uint32_t mem_value)
2258{ 2253{
2259 if (!params->active) 2254 if (!params->active || !params->cur.enabled)
2260 return 0; 2255 return 0;
2261 2256
2262 return ilk_wm_method2(params->pixel_rate, 2257 return ilk_wm_method2(params->pixel_rate,
2263 params->pipe_htotal, 2258 params->pipe_htotal,
2264 params->cur_horiz_pixels, 2259 params->cur.horiz_pixels,
2265 params->cur_bytes_per_pixel, 2260 params->cur.bytes_per_pixel,
2266 mem_value); 2261 mem_value);
2267} 2262}
2268 2263
@@ -2270,12 +2265,12 @@ static uint32_t ilk_compute_cur_wm(struct hsw_pipe_wm_parameters *params,
2270static uint32_t ilk_compute_fbc_wm(struct hsw_pipe_wm_parameters *params, 2265static uint32_t ilk_compute_fbc_wm(struct hsw_pipe_wm_parameters *params,
2271 uint32_t pri_val) 2266 uint32_t pri_val)
2272{ 2267{
2273 if (!params->active) 2268 if (!params->active || !params->pri.enabled)
2274 return 0; 2269 return 0;
2275 2270
2276 return ilk_wm_fbc(pri_val, 2271 return ilk_wm_fbc(pri_val,
2277 params->pri_horiz_pixels, 2272 params->pri.horiz_pixels,
2278 params->pri_bytes_per_pixel); 2273 params->pri.bytes_per_pixel);
2279} 2274}
2280 2275
2281static unsigned int ilk_display_fifo_size(const struct drm_device *dev) 2276static unsigned int ilk_display_fifo_size(const struct drm_device *dev)
@@ -2636,11 +2631,14 @@ static void hsw_compute_wm_parameters(struct drm_device *dev,
2636 2631
2637 p->pipe_htotal = intel_crtc->config.adjusted_mode.htotal; 2632 p->pipe_htotal = intel_crtc->config.adjusted_mode.htotal;
2638 p->pixel_rate = ilk_pipe_pixel_rate(dev, crtc); 2633 p->pixel_rate = ilk_pipe_pixel_rate(dev, crtc);
2639 p->pri_bytes_per_pixel = crtc->fb->bits_per_pixel / 8; 2634 p->pri.bytes_per_pixel = crtc->fb->bits_per_pixel / 8;
2640 p->cur_bytes_per_pixel = 4; 2635 p->cur.bytes_per_pixel = 4;
2641 p->pri_horiz_pixels = 2636 p->pri.horiz_pixels =
2642 intel_crtc->config.requested_mode.hdisplay; 2637 intel_crtc->config.requested_mode.hdisplay;
2643 p->cur_horiz_pixels = 64; 2638 p->cur.horiz_pixels = 64;
2639 /* TODO: for now, assume primary and cursor planes are always enabled. */
2640 p->pri.enabled = true;
2641 p->cur.enabled = true;
2644 } 2642 }
2645 2643
2646 list_for_each_entry(plane, &dev->mode_config.plane_list, head) { 2644 list_for_each_entry(plane, &dev->mode_config.plane_list, head) {
@@ -2650,11 +2648,10 @@ static void hsw_compute_wm_parameters(struct drm_device *dev,
2650 pipe = intel_plane->pipe; 2648 pipe = intel_plane->pipe;
2651 p = &params[pipe]; 2649 p = &params[pipe];
2652 2650
2653 p->sprite_enabled = intel_plane->wm.enabled; 2651 p->spr = intel_plane->wm;
2654 p->spr_bytes_per_pixel = intel_plane->wm.bytes_per_pixel;
2655 p->spr_horiz_pixels = intel_plane->wm.horiz_pixels;
2656 2652
2657 config.sprites_enabled |= p->sprite_enabled; 2653 config.sprites_enabled |= p->spr.enabled;
2654 config.sprites_scaled |= p->spr.scaled;
2658 } 2655 }
2659 2656
2660 ilk_wm_max(dev, 1, &config, INTEL_DDB_PART_1_2, lp_max_1_2); 2657 ilk_wm_max(dev, 1, &config, INTEL_DDB_PART_1_2, lp_max_1_2);