diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2013-08-07 06:29:50 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-08-08 08:11:12 -0400 |
commit | c35426d2bc25b242ee2a9a7a1d62634be1e86bb0 (patch) | |
tree | 7b04d86f674263931fad06d3fa659043fd386e29 /drivers | |
parent | 240264f49edbe02eb96b472ae1c518cc413f9d01 (diff) |
drm/i915: Split plane watermark parameters into a separate struct
Give a name to the plane watermark related data we have currently
stored under intel_plane->wm.
We also observe that this data is more or less the same that we have
in the hsw_pipe_wm_parameters structure, so use it there as well.
v2: Make pahole happier
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_drv.h | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_pm.c | 57 |
2 files changed, 35 insertions, 36 deletions
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 7df662bab280..3ea8e5fe4407 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -331,6 +331,13 @@ struct intel_crtc { | |||
331 | bool pch_fifo_underrun_disabled; | 331 | bool pch_fifo_underrun_disabled; |
332 | }; | 332 | }; |
333 | 333 | ||
334 | struct intel_plane_wm_parameters { | ||
335 | uint32_t horiz_pixels; | ||
336 | uint8_t bytes_per_pixel; | ||
337 | bool enabled; | ||
338 | bool scaled; | ||
339 | }; | ||
340 | |||
334 | struct intel_plane { | 341 | struct intel_plane { |
335 | struct drm_plane base; | 342 | struct drm_plane base; |
336 | int plane; | 343 | int plane; |
@@ -349,12 +356,7 @@ struct intel_plane { | |||
349 | * as the other pieces of the struct may not reflect the values we want | 356 | * as the other pieces of the struct may not reflect the values we want |
350 | * for the watermark calculations. Currently only Haswell uses this. | 357 | * for the watermark calculations. Currently only Haswell uses this. |
351 | */ | 358 | */ |
352 | struct { | 359 | struct intel_plane_wm_parameters wm; |
353 | bool enabled; | ||
354 | bool scaled; | ||
355 | uint8_t bytes_per_pixel; | ||
356 | uint32_t horiz_pixels; | ||
357 | } wm; | ||
358 | 360 | ||
359 | void (*update_plane)(struct drm_plane *plane, | 361 | void (*update_plane)(struct drm_plane *plane, |
360 | struct drm_framebuffer *fb, | 362 | struct drm_framebuffer *fb, |
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 | ||
2163 | struct hsw_pipe_wm_parameters { | 2163 | struct 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 | ||
2176 | struct hsw_wm_maximums { | 2172 | struct 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, | |||
2256 | static uint32_t ilk_compute_cur_wm(struct hsw_pipe_wm_parameters *params, | 2251 | static 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, | |||
2270 | static uint32_t ilk_compute_fbc_wm(struct hsw_pipe_wm_parameters *params, | 2265 | static 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 | ||
2281 | static unsigned int ilk_display_fifo_size(const struct drm_device *dev) | 2276 | static 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 = ¶ms[pipe]; | 2649 | p = ¶ms[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); |