summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Kempczyński <zbigniew.kempczynski@intel.com>2020-09-11 10:07:25 +0200
committerChris Wilson <chris@chris-wilson.co.uk>2020-09-16 14:27:30 +0100
commit70f4572b2b08dc077f34b61020424a66c08aa9cb (patch)
treeebee2024e3d179f13a39dc1b4cfd1a658bfb6af3
parent7906d212bfcba8710fa1330032b8b299be4d842c (diff)
tests/api_intel_bb: test flags are cleared on bb reset
Current intel_bb implementation keeps objects in the bb cache so subsequent executions pass these objects also to execbuf. Check flags are cleaned after reset. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Dominik Grzegorzek <dominik.grzegorzek@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--tests/i915/api_intel_bb.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/tests/i915/api_intel_bb.c b/tests/i915/api_intel_bb.c
index d0c182fd..1fe245a5 100644
--- a/tests/i915/api_intel_bb.c
+++ b/tests/i915/api_intel_bb.c
@@ -206,6 +206,86 @@ static void check_canonical(struct buf_ops *bops)
intel_bb_destroy(ibb);
}
+/*
+ * Check flags are cleared after intel_bb_reset(ibb, false);
+ */
+static void reset_flags(struct buf_ops *bops)
+{
+ int i915 = buf_ops_get_fd(bops);
+ struct intel_bb *ibb;
+ struct intel_buf *src, *mid, *dst;
+ struct drm_i915_gem_exec_object2 *obj;
+ const uint32_t width = 512;
+ const uint32_t height = 512;
+
+ ibb = intel_bb_create(i915, PAGE_SIZE);
+ if (debug_bb)
+ intel_bb_set_debug(ibb, true);
+
+ src = intel_buf_create(bops, width, height, 32, 0,
+ I915_TILING_NONE, I915_COMPRESSION_NONE);
+ mid = intel_buf_create(bops, width, height, 32, 0,
+ I915_TILING_NONE, I915_COMPRESSION_NONE);
+ dst = intel_buf_create(bops, width, height, 32, 0,
+ I915_TILING_NONE, I915_COMPRESSION_NONE);
+
+ intel_bb_add_intel_buf(ibb, src, false);
+ intel_bb_add_intel_buf(ibb, mid, true);
+
+ /* Check src has no EXEC_OBJECT_WRITE */
+ obj = intel_bb_find_object(ibb, src->handle);
+ igt_assert(obj);
+ igt_assert((obj->flags & EXEC_OBJECT_WRITE) == 0);
+
+ /* Check mid has EXEC_OBJECT_WRITE */
+ obj = intel_bb_find_object(ibb, mid->handle);
+ igt_assert(obj);
+ igt_assert(obj->flags & EXEC_OBJECT_WRITE);
+
+ intel_bb_out(ibb, 0);
+ intel_bb_flush_blit(ibb);
+
+ /* Check src has zeroed flags */
+ obj = intel_bb_find_object(ibb, src->handle);
+ igt_assert(obj);
+ igt_assert((obj->flags & EXEC_OBJECT_WRITE) == 0);
+
+ /* Check mid has zeroed flags */
+ obj = intel_bb_find_object(ibb, mid->handle);
+ igt_assert(obj);
+ igt_assert((obj->flags & EXEC_OBJECT_WRITE) == 0);
+
+ intel_bb_emit_blt_copy(ibb,
+ mid, 0, 0, mid->surface[0].stride,
+ dst, 0, 0, dst->surface[0].stride,
+ intel_buf_width(dst),
+ intel_buf_height(dst),
+ dst->bpp);
+
+ /* Check mid has no EXEC_OBJECT_WRITE */
+ obj = intel_bb_find_object(ibb, mid->handle);
+ igt_assert(obj);
+ igt_assert((obj->flags & EXEC_OBJECT_WRITE) == 0);
+
+ /* Check mid has no EXEC_OBJECT_WRITE */
+ obj = intel_bb_find_object(ibb, dst->handle);
+ igt_assert(obj);
+ igt_assert(obj->flags & EXEC_OBJECT_WRITE);
+
+ intel_bb_flush_blit(ibb);
+
+ /* Check mid has no EXEC_OBJECT_WRITE */
+ obj = intel_bb_find_object(ibb, dst->handle);
+ igt_assert(obj);
+ igt_assert((obj->flags & EXEC_OBJECT_WRITE) == 0);
+
+ intel_buf_destroy(src);
+ intel_buf_destroy(mid);
+ intel_buf_destroy(dst);
+ intel_bb_destroy(ibb);
+}
+
+
#define MI_FLUSH_DW (0x26<<23)
#define BCS_SWCTRL 0x22200
#define BCS_SRC_Y (1 << 0)
@@ -717,6 +797,9 @@ igt_main_args("dpi", NULL, help_str, opt_handler, NULL)
igt_subtest("check-canonical")
check_canonical(bops);
+ igt_subtest("reset-flags")
+ reset_flags(bops);
+
igt_subtest("blit-noreloc-keep-cache")
blit(bops, NORELOC, KEEP_CACHE);