diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2013-08-07 06:29:12 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-08-08 08:11:12 -0400 |
commit | 240264f49edbe02eb96b472ae1c518cc413f9d01 (patch) | |
tree | 74038aeb63b6d4a6dcb390deebad635702487ef3 /drivers | |
parent | 158ae64f820939473012dacfc0ae1ec782b45b60 (diff) |
drm/i915: Pull some watermarks state into a separate structure
There is a bunch of global state that needs to be considered when
checking watermarks for validity. Move most of that to a new
structure intel_wm_config, to avoid having to pass around so
many variables.
One notable thing left out is the DDB partitioning information,
since we often anyway need to check the same watermarks against
both 1/2 and 5/6 DDB partitioning layouts.
v2: s/pipes_active/num_pipes_active
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/i915/intel_pm.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index a4c3c5497941..550f787a3b4a 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -2188,6 +2188,14 @@ struct hsw_wm_values { | |||
2188 | bool enable_fbc_wm; | 2188 | bool enable_fbc_wm; |
2189 | }; | 2189 | }; |
2190 | 2190 | ||
2191 | /* used in computing the new watermarks state */ | ||
2192 | struct intel_wm_config { | ||
2193 | unsigned int num_pipes_active; | ||
2194 | bool sprites_enabled; | ||
2195 | bool sprites_scaled; | ||
2196 | bool fbc_wm_enabled; | ||
2197 | }; | ||
2198 | |||
2191 | /* | 2199 | /* |
2192 | * For both WM_PIPE and WM_LP. | 2200 | * For both WM_PIPE and WM_LP. |
2193 | * mem_value must be in 0.1us units. | 2201 | * mem_value must be in 0.1us units. |
@@ -2281,8 +2289,7 @@ static unsigned int ilk_display_fifo_size(const struct drm_device *dev) | |||
2281 | /* Calculate the maximum primary/sprite plane watermark */ | 2289 | /* Calculate the maximum primary/sprite plane watermark */ |
2282 | static unsigned int ilk_plane_wm_max(const struct drm_device *dev, | 2290 | static unsigned int ilk_plane_wm_max(const struct drm_device *dev, |
2283 | int level, | 2291 | int level, |
2284 | unsigned int num_pipes_active, | 2292 | const struct intel_wm_config *config, |
2285 | bool sprite_enabled, | ||
2286 | enum intel_ddb_partitioning ddb_partitioning, | 2293 | enum intel_ddb_partitioning ddb_partitioning, |
2287 | bool is_sprite) | 2294 | bool is_sprite) |
2288 | { | 2295 | { |
@@ -2290,11 +2297,11 @@ static unsigned int ilk_plane_wm_max(const struct drm_device *dev, | |||
2290 | unsigned int max; | 2297 | unsigned int max; |
2291 | 2298 | ||
2292 | /* if sprites aren't enabled, sprites get nothing */ | 2299 | /* if sprites aren't enabled, sprites get nothing */ |
2293 | if (is_sprite && !sprite_enabled) | 2300 | if (is_sprite && !config->sprites_enabled) |
2294 | return 0; | 2301 | return 0; |
2295 | 2302 | ||
2296 | /* HSW allows LP1+ watermarks even with multiple pipes */ | 2303 | /* HSW allows LP1+ watermarks even with multiple pipes */ |
2297 | if (level == 0 || num_pipes_active > 1) { | 2304 | if (level == 0 || config->num_pipes_active > 1) { |
2298 | fifo_size /= INTEL_INFO(dev)->num_pipes; | 2305 | fifo_size /= INTEL_INFO(dev)->num_pipes; |
2299 | 2306 | ||
2300 | /* | 2307 | /* |
@@ -2306,7 +2313,7 @@ static unsigned int ilk_plane_wm_max(const struct drm_device *dev, | |||
2306 | fifo_size /= 2; | 2313 | fifo_size /= 2; |
2307 | } | 2314 | } |
2308 | 2315 | ||
2309 | if (sprite_enabled) { | 2316 | if (config->sprites_enabled) { |
2310 | /* level 0 is always calculated with 1:1 split */ | 2317 | /* level 0 is always calculated with 1:1 split */ |
2311 | if (level > 0 && ddb_partitioning == INTEL_DDB_PART_5_6) { | 2318 | if (level > 0 && ddb_partitioning == INTEL_DDB_PART_5_6) { |
2312 | if (is_sprite) | 2319 | if (is_sprite) |
@@ -2333,10 +2340,11 @@ static unsigned int ilk_plane_wm_max(const struct drm_device *dev, | |||
2333 | 2340 | ||
2334 | /* Calculate the maximum cursor plane watermark */ | 2341 | /* Calculate the maximum cursor plane watermark */ |
2335 | static unsigned int ilk_cursor_wm_max(const struct drm_device *dev, | 2342 | static unsigned int ilk_cursor_wm_max(const struct drm_device *dev, |
2336 | int level, unsigned int num_pipes_active) | 2343 | int level, |
2344 | const struct intel_wm_config *config) | ||
2337 | { | 2345 | { |
2338 | /* HSW LP1+ watermarks w/ multiple pipes */ | 2346 | /* HSW LP1+ watermarks w/ multiple pipes */ |
2339 | if (level > 0 && num_pipes_active > 1) | 2347 | if (level > 0 && config->num_pipes_active > 1) |
2340 | return 64; | 2348 | return 64; |
2341 | 2349 | ||
2342 | /* otherwise just report max that registers can hold */ | 2350 | /* otherwise just report max that registers can hold */ |
@@ -2355,16 +2363,13 @@ static unsigned int ilk_fbc_wm_max(void) | |||
2355 | 2363 | ||
2356 | static void ilk_wm_max(struct drm_device *dev, | 2364 | static void ilk_wm_max(struct drm_device *dev, |
2357 | int level, | 2365 | int level, |
2358 | unsigned int num_pipes_active, | 2366 | const struct intel_wm_config *config, |
2359 | bool sprite_enabled, | ||
2360 | enum intel_ddb_partitioning ddb_partitioning, | 2367 | enum intel_ddb_partitioning ddb_partitioning, |
2361 | struct hsw_wm_maximums *max) | 2368 | struct hsw_wm_maximums *max) |
2362 | { | 2369 | { |
2363 | max->pri = ilk_plane_wm_max(dev, level, num_pipes_active, | 2370 | max->pri = ilk_plane_wm_max(dev, level, config, ddb_partitioning, false); |
2364 | sprite_enabled, ddb_partitioning, false); | 2371 | max->spr = ilk_plane_wm_max(dev, level, config, ddb_partitioning, true); |
2365 | max->spr = ilk_plane_wm_max(dev, level, num_pipes_active, | 2372 | max->cur = ilk_cursor_wm_max(dev, level, config); |
2366 | sprite_enabled, ddb_partitioning, true); | ||
2367 | max->cur = ilk_cursor_wm_max(dev, level, num_pipes_active); | ||
2368 | max->fbc = ilk_fbc_wm_max(); | 2373 | max->fbc = ilk_fbc_wm_max(); |
2369 | } | 2374 | } |
2370 | 2375 | ||
@@ -2614,7 +2619,7 @@ static void hsw_compute_wm_parameters(struct drm_device *dev, | |||
2614 | struct drm_crtc *crtc; | 2619 | struct drm_crtc *crtc; |
2615 | struct drm_plane *plane; | 2620 | struct drm_plane *plane; |
2616 | enum pipe pipe; | 2621 | enum pipe pipe; |
2617 | int pipes_active = 0, sprites_enabled = 0; | 2622 | struct intel_wm_config config = {}; |
2618 | 2623 | ||
2619 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 2624 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
2620 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 2625 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
@@ -2627,7 +2632,7 @@ static void hsw_compute_wm_parameters(struct drm_device *dev, | |||
2627 | if (!p->active) | 2632 | if (!p->active) |
2628 | continue; | 2633 | continue; |
2629 | 2634 | ||
2630 | pipes_active++; | 2635 | config.num_pipes_active++; |
2631 | 2636 | ||
2632 | p->pipe_htotal = intel_crtc->config.adjusted_mode.htotal; | 2637 | p->pipe_htotal = intel_crtc->config.adjusted_mode.htotal; |
2633 | p->pixel_rate = ilk_pipe_pixel_rate(dev, crtc); | 2638 | p->pixel_rate = ilk_pipe_pixel_rate(dev, crtc); |
@@ -2649,17 +2654,14 @@ static void hsw_compute_wm_parameters(struct drm_device *dev, | |||
2649 | p->spr_bytes_per_pixel = intel_plane->wm.bytes_per_pixel; | 2654 | p->spr_bytes_per_pixel = intel_plane->wm.bytes_per_pixel; |
2650 | p->spr_horiz_pixels = intel_plane->wm.horiz_pixels; | 2655 | p->spr_horiz_pixels = intel_plane->wm.horiz_pixels; |
2651 | 2656 | ||
2652 | if (p->sprite_enabled) | 2657 | config.sprites_enabled |= p->sprite_enabled; |
2653 | sprites_enabled++; | ||
2654 | } | 2658 | } |
2655 | 2659 | ||
2656 | ilk_wm_max(dev, 1, pipes_active, sprites_enabled, | 2660 | ilk_wm_max(dev, 1, &config, INTEL_DDB_PART_1_2, lp_max_1_2); |
2657 | INTEL_DDB_PART_1_2, lp_max_1_2); | ||
2658 | 2661 | ||
2659 | /* 5/6 split only in single pipe config on IVB+ */ | 2662 | /* 5/6 split only in single pipe config on IVB+ */ |
2660 | if (INTEL_INFO(dev)->gen >= 7 && pipes_active <= 1) | 2663 | if (INTEL_INFO(dev)->gen >= 7 && config.num_pipes_active <= 1) |
2661 | ilk_wm_max(dev, 1, pipes_active, sprites_enabled, | 2664 | ilk_wm_max(dev, 1, &config, INTEL_DDB_PART_5_6, lp_max_5_6); |
2662 | INTEL_DDB_PART_5_6, lp_max_5_6); | ||
2663 | else | 2665 | else |
2664 | *lp_max_5_6 = *lp_max_1_2; | 2666 | *lp_max_5_6 = *lp_max_1_2; |
2665 | } | 2667 | } |