diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-12-22 11:36:11 +0300 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-12-27 14:36:42 +0300 |
commit | 06df8ac682e6a00e6e32d105208953ca5323cc82 (patch) | |
tree | 240edb03bf62727c923b45a624be4e0da2240987 /drivers/gpu/drm/selftests/test-drm_mm.c | |
parent | 393b50f30566ba596bcd3e94ce6d59af4f184025 (diff) | |
download | linux-06df8ac682e6a00e6e32d105208953ca5323cc82.tar.xz |
drm: kselftest for drm_mm_debug()
Simple test to just exercise calling the debug dumper on the drm_mm.
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-9-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/selftests/test-drm_mm.c')
-rw-r--r-- | drivers/gpu/drm/selftests/test-drm_mm.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/gpu/drm/selftests/test-drm_mm.c b/drivers/gpu/drm/selftests/test-drm_mm.c index 87ad147670da..434320061d9e 100644 --- a/drivers/gpu/drm/selftests/test-drm_mm.c +++ b/drivers/gpu/drm/selftests/test-drm_mm.c @@ -141,6 +141,41 @@ out: return ret; } +static int igt_debug(void *ignored) +{ + struct drm_mm mm; + struct drm_mm_node nodes[2]; + int ret; + + /* Create a small drm_mm with a couple of nodes and a few holes, and + * check that the debug iterator doesn't explode over a trivial drm_mm. + */ + + drm_mm_init(&mm, 0, 4096); + + memset(nodes, 0, sizeof(nodes)); + nodes[0].start = 512; + nodes[0].size = 1024; + ret = drm_mm_reserve_node(&mm, &nodes[0]); + if (ret) { + pr_err("failed to reserve node[0] {start=%lld, size=%lld)\n", + nodes[0].start, nodes[0].size); + return ret; + } + + nodes[1].size = 1024; + nodes[1].start = 4096 - 512 - nodes[1].size; + ret = drm_mm_reserve_node(&mm, &nodes[1]); + if (ret) { + pr_err("failed to reserve node[1] {start=%lld, size=%lld)\n", + nodes[1].start, nodes[1].size); + return ret; + } + + drm_mm_debug_table(&mm, __func__); + return 0; +} + #include "drm_selftest.c" static int __init test_drm_mm_init(void) |