mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-18 21:36:27 +00:00
tests/gem_storedw_batches_loop: Add testcase to check secure dispatch
v2: Use the mrb_exec function since otherwise we can't pass flags. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
195f04c300
commit
0a587e24b7
@ -45,6 +45,7 @@ TESTS_progs_M = \
|
|||||||
gem_reloc_vs_gpu \
|
gem_reloc_vs_gpu \
|
||||||
gem_ringfill \
|
gem_ringfill \
|
||||||
gem_set_tiling_vs_blt \
|
gem_set_tiling_vs_blt \
|
||||||
|
gem_storedw_batches_loop \
|
||||||
gem_suspend \
|
gem_suspend \
|
||||||
gem_tiled_blits \
|
gem_tiled_blits \
|
||||||
gem_tiled_partial_pwrite_pread \
|
gem_tiled_partial_pwrite_pread \
|
||||||
@ -90,7 +91,6 @@ TESTS_progs = \
|
|||||||
gem_seqno_wrap \
|
gem_seqno_wrap \
|
||||||
gem_set_tiling_vs_gtt \
|
gem_set_tiling_vs_gtt \
|
||||||
gem_set_tiling_vs_pwrite \
|
gem_set_tiling_vs_pwrite \
|
||||||
gem_storedw_batches_loop \
|
|
||||||
gem_storedw_loop_blt \
|
gem_storedw_loop_blt \
|
||||||
gem_storedw_loop_bsd \
|
gem_storedw_loop_bsd \
|
||||||
gem_storedw_loop_render \
|
gem_storedw_loop_render \
|
||||||
|
@ -45,9 +45,11 @@ static drm_intel_bufmgr *bufmgr;
|
|||||||
static drm_intel_bo *target_bo;
|
static drm_intel_bo *target_bo;
|
||||||
static int has_ppgtt = 0;
|
static int has_ppgtt = 0;
|
||||||
|
|
||||||
|
#define SECURE_DISPATCH (1<<0)
|
||||||
|
|
||||||
/* Like the store dword test, but we create new command buffers each time */
|
/* Like the store dword test, but we create new command buffers each time */
|
||||||
static void
|
static void
|
||||||
store_dword_loop(int divider)
|
store_dword_loop(int divider, unsigned flags)
|
||||||
{
|
{
|
||||||
int cmd, i, val = 0, ret;
|
int cmd, i, val = 0, ret;
|
||||||
uint32_t *buf;
|
uint32_t *buf;
|
||||||
@ -66,6 +68,9 @@ store_dword_loop(int divider)
|
|||||||
igt_fail(-1);
|
igt_fail(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Upload through cpu mmaps to make sure we don't have a gtt
|
||||||
|
* mapping which could paper over secure batch submission
|
||||||
|
* failing to bind that. */
|
||||||
drm_intel_bo_map(cmd_bo, 1);
|
drm_intel_bo_map(cmd_bo, 1);
|
||||||
buf = cmd_bo->virtual;
|
buf = cmd_bo->virtual;
|
||||||
|
|
||||||
@ -99,7 +104,10 @@ store_dword_loop(int divider)
|
|||||||
igt_fail(-1);
|
igt_fail(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = drm_intel_bo_exec(cmd_bo, 6 * 4, NULL, 0, 0);
|
#define LOCAL_I915_EXEC_SECURE (1<<9)
|
||||||
|
ret = drm_intel_bo_mrb_exec(cmd_bo, 6 * 4, NULL, 0, 0,
|
||||||
|
I915_EXEC_BLT |
|
||||||
|
(flags & SECURE_DISPATCH ? LOCAL_I915_EXEC_SECURE : 0));
|
||||||
if (ret) {
|
if (ret) {
|
||||||
fprintf(stderr, "bo exec failed: %d\n", ret);
|
fprintf(stderr, "bo exec failed: %d\n", ret);
|
||||||
igt_fail(-1);
|
igt_fail(-1);
|
||||||
@ -131,55 +139,58 @@ cont:
|
|||||||
printf("completed %d writes successfully\n", i);
|
printf("completed %d writes successfully\n", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int fd;
|
||||||
|
int devid;
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int fd;
|
igt_subtest_init(argc, argv);
|
||||||
int devid;
|
|
||||||
|
|
||||||
igt_skip_on_simulation();
|
igt_skip_on_simulation();
|
||||||
|
|
||||||
if (argc != 1) {
|
igt_fixture {
|
||||||
fprintf(stderr, "usage: %s\n", argv[0]);
|
fd = drm_open_any();
|
||||||
igt_fail(-1);
|
devid = intel_get_drm_devid(fd);
|
||||||
|
|
||||||
|
has_ppgtt = gem_uses_aliasing_ppgtt(fd);
|
||||||
|
|
||||||
|
/* storedw needs gtt address on gen4+/g33 and snoopable memory.
|
||||||
|
* Strictly speaking we could implement this now ... */
|
||||||
|
igt_require(intel_gen(devid) >= 6);
|
||||||
|
|
||||||
|
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
|
||||||
|
if (!bufmgr) {
|
||||||
|
fprintf(stderr, "failed to init libdrm\n");
|
||||||
|
igt_fail(-1);
|
||||||
|
}
|
||||||
|
// drm_intel_bufmgr_gem_enable_reuse(bufmgr);
|
||||||
|
|
||||||
|
target_bo = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
|
||||||
|
if (!target_bo) {
|
||||||
|
fprintf(stderr, "failed to alloc target buffer\n");
|
||||||
|
igt_fail(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = drm_open_any();
|
igt_subtest("normal") {
|
||||||
devid = intel_get_drm_devid(fd);
|
store_dword_loop(1, 0);
|
||||||
|
store_dword_loop(2, 0);
|
||||||
has_ppgtt = gem_uses_aliasing_ppgtt(fd);
|
store_dword_loop(3, 0);
|
||||||
|
store_dword_loop(5, 0);
|
||||||
if (IS_GEN2(devid) || IS_GEN3(devid) || IS_GEN4(devid) || IS_GEN5(devid)) {
|
|
||||||
|
|
||||||
fprintf(stderr, "MI_STORE_DATA can only use GTT address on gen4+/g33 and"
|
|
||||||
"needs snoopable mem on pre-gen6\n");
|
|
||||||
return 77;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
igt_subtest("secure-dispatch") {
|
||||||
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
|
store_dword_loop(1, SECURE_DISPATCH);
|
||||||
if (!bufmgr) {
|
store_dword_loop(2, SECURE_DISPATCH);
|
||||||
fprintf(stderr, "failed to init libdrm\n");
|
store_dword_loop(3, SECURE_DISPATCH);
|
||||||
igt_fail(-1);
|
store_dword_loop(5, SECURE_DISPATCH);
|
||||||
}
|
|
||||||
// drm_intel_bufmgr_gem_enable_reuse(bufmgr);
|
|
||||||
|
|
||||||
target_bo = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
|
|
||||||
if (!target_bo) {
|
|
||||||
fprintf(stderr, "failed to alloc target buffer\n");
|
|
||||||
igt_fail(-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
store_dword_loop(1);
|
igt_fixture {
|
||||||
store_dword_loop(2);
|
drm_intel_bo_unreference(target_bo);
|
||||||
if (!igt_run_in_simulation()) {
|
drm_intel_bufmgr_destroy(bufmgr);
|
||||||
store_dword_loop(3);
|
|
||||||
store_dword_loop(5);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
drm_intel_bo_unreference(target_bo);
|
|
||||||
drm_intel_bufmgr_destroy(bufmgr);
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user