drm: Apply tight eviction scanning to color_adjust
Using mm->color_adjust makes the eviction scanner much tricker since we don't know the actual neighbours of the target hole until after it is created (after scanning is complete). To work out whether we need to evict the neighbours because they impact upon the hole, we have to then check the hole afterwards - requiring an extra step in the user of the eviction scanner when they apply color_adjust. v2: Massage kerneldoc. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-34-chris@chris-wilson.co.uk
This commit is contained in:

committed by
Daniel Vetter

parent
f29051f12f
commit
3fa489dabe
@@ -1162,6 +1162,7 @@ static bool evict_nodes(struct drm_mm_scan *scan,
|
||||
struct evict_node *nodes,
|
||||
unsigned int *order,
|
||||
unsigned int count,
|
||||
bool use_color,
|
||||
struct list_head *evict_list)
|
||||
{
|
||||
struct evict_node *e, *en;
|
||||
@@ -1186,6 +1187,21 @@ static bool evict_nodes(struct drm_mm_scan *scan,
|
||||
list_for_each_entry(e, evict_list, link)
|
||||
drm_mm_remove_node(&e->node);
|
||||
|
||||
if (use_color) {
|
||||
struct drm_mm_node *node;
|
||||
|
||||
while ((node = drm_mm_scan_color_evict(scan))) {
|
||||
e = container_of(node, typeof(*e), node);
|
||||
drm_mm_remove_node(&e->node);
|
||||
list_add(&e->link, evict_list);
|
||||
}
|
||||
} else {
|
||||
if (drm_mm_scan_color_evict(scan)) {
|
||||
pr_err("drm_mm_scan_color_evict unexpectedly reported overlapping nodes!\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1299,7 +1315,7 @@ static int evict_something(struct drm_mm *mm,
|
||||
range_start, range_end,
|
||||
mode->create_flags);
|
||||
if (!evict_nodes(&scan,
|
||||
nodes, order, count,
|
||||
nodes, order, count, false,
|
||||
&evict_list))
|
||||
return -EINVAL;
|
||||
|
||||
@@ -1878,7 +1894,7 @@ static int evict_color(struct drm_mm *mm,
|
||||
range_start, range_end,
|
||||
mode->create_flags);
|
||||
if (!evict_nodes(&scan,
|
||||
nodes, order, count,
|
||||
nodes, order, count, true,
|
||||
&evict_list))
|
||||
return -EINVAL;
|
||||
|
||||
|
Reference in New Issue
Block a user