diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2019-04-17 20:59:32 +0300 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2019-04-18 21:13:45 +0300 |
commit | e3647eb9e9200b4eac974eaa2fed5abf8e621b76 (patch) | |
tree | 0f4388d572ea51d3b38053f9c925147cf00f7030 /tests/i915/gem_render_copy.c | |
parent | c211f23a785124f44ab1d217805c1f1fb11f1f13 (diff) |
tests/i915/gem_render_copy: Don't leak bos between subtests
Unref the bos after one subtest is done. The next subtest
will allocate its own bos.
v2: Add scratch_buf_fini() and reverse the onion (Chris)
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/i915/gem_render_copy.c')
-rw-r--r-- | tests/i915/gem_render_copy.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/i915/gem_render_copy.c b/tests/i915/gem_render_copy.c index 8d62a0f4..b5d1f45f 100644 --- a/tests/i915/gem_render_copy.c +++ b/tests/i915/gem_render_copy.c @@ -459,6 +459,11 @@ static void scratch_buf_init(data_t *data, struct igt_buf *buf, igt_assert(igt_buf_height(buf) == height); } +static void scratch_buf_fini(struct igt_buf *buf) +{ + drm_intel_bo_unreference(buf->bo); +} + static void scratch_buf_check(data_t *data, struct igt_buf *buf, @@ -662,6 +667,13 @@ static void test(data_t *data, uint32_t tiling, uint64_t ccs_modifier) if (ccs_modifier) scratch_buf_aux_check(data, &ccs); + + scratch_buf_fini(&ref); + if (ccs_modifier) + scratch_buf_fini(&ccs); + scratch_buf_fini(&dst); + for (int i = 0; i < num_src; i++) + scratch_buf_fini(&src[i].buf); } static int opt_handler(int opt, int opt_index, void *data) |