summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/selftests
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-12-22 08:36:36 +0000
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-12-28 13:23:06 +0100
commit3fa489dabea9a1cb0656e2da90354f7c4e53f890 (patch)
treeb5780d24e226c04ca8810b3d8aeda15cfa4daf63 /drivers/gpu/drm/selftests
parentf29051f12f33078b81ac710bee9ebd7a85ee1849 (diff)
downloadblackbird-op-linux-3fa489dabea9a1cb0656e2da90354f7c4e53f890.tar.gz
blackbird-op-linux-3fa489dabea9a1cb0656e2da90354f7c4e53f890.zip
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
Diffstat (limited to 'drivers/gpu/drm/selftests')
-rw-r--r--drivers/gpu/drm/selftests/test-drm_mm.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/gpu/drm/selftests/test-drm_mm.c b/drivers/gpu/drm/selftests/test-drm_mm.c
index 1bbfc24342c5..f609e4f1eeaf 100644
--- a/drivers/gpu/drm/selftests/test-drm_mm.c
+++ b/drivers/gpu/drm/selftests/test-drm_mm.c
@@ -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;
OpenPOWER on IntegriCloud