diff options
author | Damien Lespiau <damien.lespiau@intel.com> | 2014-10-15 23:13:30 +0100 |
---|---|---|
committer | Damien Lespiau <damien.lespiau@intel.com> | 2014-10-26 16:32:21 +0000 |
commit | cba3088619745f509a10d1339db2cd279913e051 (patch) | |
tree | d2e7e67c55d5b5b421c192b39a33bbe13b9ea776 | |
parent | 7296e09ee7f17e6d564e52cf64ee900670849429 (diff) |
skl_ddb_allocation: Respect the minimum number of blocks
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
-rw-r--r-- | tests/skl_ddb_allocation.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/skl_ddb_allocation.c b/tests/skl_ddb_allocation.c index ca6b892c..4d8e6d18 100644 --- a/tests/skl_ddb_allocation.c +++ b/tests/skl_ddb_allocation.c @@ -224,6 +224,7 @@ skl_allocate_pipe_ddb(struct drm_crtc *crtc, enum pipe pipe = intel_crtc->pipe; struct skl_ddb_entry alloc; uint16_t alloc_size, start, cursor_blocks; + uint16_t minimum[I915_MAX_PLANES]; unsigned int total_data_rate; int plane; @@ -242,9 +243,21 @@ skl_allocate_pipe_ddb(struct drm_crtc *crtc, alloc_size -= cursor_blocks; alloc.end -= cursor_blocks; + /* 1. Allocate the mininum required blocks for each active plane */ + for_each_plane(pipe, plane) { + const struct intel_plane_wm_parameters *p; + + p = ¶ms->plane[plane]; + if (!p->enabled) + continue; + + minimum[plane] = 8; + alloc_size -= minimum[plane]; + } + /* - * Each active plane get a portion of the remaining space, in - * proportion to the amount of data they need to fetch from memory. + * 2. Distribute the remaining space in proportion to the amount of + * data each plane needs to fetch from memory. * * FIXME: we may not allocate every single block here. */ @@ -266,8 +279,9 @@ skl_allocate_pipe_ddb(struct drm_crtc *crtc, * promote the expression to 64 bits to avoid overflowing, the * result is < available as data_rate / total_data_rate < 1 */ - plane_blocks = div_u64((uint64_t)alloc_size * data_rate, - total_data_rate); + plane_blocks = minimum[plane]; + plane_blocks += div_u64((uint64_t)alloc_size * data_rate, + total_data_rate); ddb->plane[pipe][plane].start = start; ddb->plane[pipe][plane].end = start + plane_blocks; |