[igt-dev] [PATCH i-g-t] test/gem_exec_suspend: Enable the test for discrete GPUs
Petri Latvala
petri.latvala at intel.com
Mon Sep 6 06:25:01 UTC 2021
On Fri, Sep 03, 2021 at 04:03:48PM +0200, Thomas Hellström wrote:
> Discrete GPUs don't support gem_set_caching() and uses a single,
> kernel provided mapping mode, FIXED. Adjust the test accordingly.
>
> This makes the test run on DG1.
>
> Signed-off-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>
> ---
> tests/i915/gem_exec_suspend.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/tests/i915/gem_exec_suspend.c b/tests/i915/gem_exec_suspend.c
> index dbe0c8a7..5f17e600 100644
> --- a/tests/i915/gem_exec_suspend.c
> +++ b/tests/i915/gem_exec_suspend.c
> @@ -114,7 +114,8 @@ static void run_test(int fd, const intel_ctx_t *ctx,
>
> memset(obj, 0, sizeof(obj));
> obj[0].handle = gem_create(fd, 4096);
> - gem_set_caching(fd, obj[0].handle, !!(flags & CACHED));
> + if (!gem_has_lmem(fd))
> + gem_set_caching(fd, obj[0].handle, !!(flags & CACHED));
> obj[0].flags |= EXEC_OBJECT_WRITE;
> obj[1].handle = gem_create(fd, 4096);
> gem_write(fd, obj[1].handle, 0, &bbe, sizeof(bbe));
> @@ -293,6 +294,7 @@ igt_main
> const struct intel_execution_engine2 *e;
> igt_hang_t hang;
> const intel_ctx_t *ctx;
> + bool has_lmem;
> int fd;
>
> igt_fixture {
> @@ -302,6 +304,7 @@ igt_main
> ctx = intel_ctx_create_all_physical(fd);
>
> igt_fork_hang_detector(fd);
> + has_lmem = gem_has_lmem(fd);
> }
>
> igt_subtest("basic")
> @@ -318,6 +321,18 @@ igt_main
> run_test(fd, ctx, ALL_ENGINES, HIBERNATE);
>
> for (m = modes; m->suffix; m++) {
> + if (has_lmem) {
> + igt_subtest_with_dynamic_f("fixed%s", m->suffix) {
You can't do
if (something_that_depends_on_the_running_system)
igt_subtest_of_any_kind(...)
Instead you need to do
igt_subtest_of_any_kind(...) {
igt_require(something_that_depends_on_the_running_system);
...
}
--
Petri Latvala
> + for_each_ctx_engine(fd, ctx, e) {
> + if (!gem_class_can_store_dword(fd, e->class))
> + continue;
> + igt_dynamic_f("%s", e->name)
> + run_test(fd, ctx, e->flags, m->mode);
> + }
> + }
> + continue;
> + }
> +
> igt_subtest_with_dynamic_f("uncached%s", m->suffix) {
> for_each_ctx_engine(fd, ctx, e) {
> if (!gem_class_can_store_dword(fd, e->class))
> --
> 2.31.1
>
More information about the igt-dev
mailing list