summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSushmita Susheelendra <ssusheel@codeaurora.org>2017-02-16 15:04:13 -0700
committerSushmita Susheelendra <ssusheel@codeaurora.org>2017-06-02 15:48:46 -0600
commitd9b394c7c2011a61a3485bd33f237066a05d1991 (patch)
tree7feba5a85319e7debcd6ef5b2a2899ba1278f0b9 /include
parent1f1dbe35f74c1ff687079997cfa433961d48835d (diff)
drm/msm: Fix drm_mm bottom_up search
The bottom up search of drm_mm hole nodes is currently broken. It does not correctly look for the first hole (smallest address) that fits the allocation from the bottom up. Use an RB tree to record hole nodes with their address as key, so that the hole with the smallest address that satisfies the request can be looked up. Change-Id: Ie3020cb4e8b6db13a35d0fe5caaa8781cb6ced9f Signed-off-by: Sushmita Susheelendra <ssusheel@codeaurora.org>
Diffstat (limited to 'include')
-rw-r--r--include/drm/drm_mm.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index debbbecbde1b..6649b6d8c437 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -49,6 +49,7 @@ enum drm_mm_search_flags {
DRM_MM_SEARCH_DEFAULT = 0,
DRM_MM_SEARCH_BEST = 1 << 0,
DRM_MM_SEARCH_BELOW = 1 << 1,
+ DRM_MM_SEARCH_BOTTOM_UP = 1 << 2,
};
enum drm_mm_allocator_flags {
@@ -63,6 +64,7 @@ struct drm_mm_node {
struct list_head node_list;
struct list_head hole_stack;
struct rb_node rb;
+ struct rb_node hole_node;
unsigned hole_follows : 1;
unsigned scanned_block : 1;
unsigned scanned_prev_free : 1;
@@ -84,6 +86,7 @@ struct drm_mm {
struct drm_mm_node head_node;
/* Keep an interval_tree for fast lookup of drm_mm_nodes by address. */
struct rb_root interval_tree;
+ struct rb_root holes_tree;
unsigned int scan_check_range : 1;
unsigned scan_alignment;