[igt-dev] [PATCH i-g-t v2 8/8] i915_pm_rpm: Extend gem-mmap-type test with D3Cold
Anshuman Gupta
anshuman.gupta at intel.com
Fri Apr 29 08:54:25 UTC 2022
Added d3cold dynamic subtest to gem-mmap-type with device class
memory region. It test both D3Cold-{VRAM_SR, Off} by using
d3cold_sr_lmem_threshold i915_params debugfs.
v2:
- Two different subtest d3cold-off and d3cold-vrsr. [Rodrigo]
Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta at intel.com>
---
tests/i915/i915_pm_rpm.c | 44 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 42 insertions(+), 2 deletions(-)
diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
index 97a84359b..8ca6ba2c8 100644
--- a/tests/i915/i915_pm_rpm.c
+++ b/tests/i915/i915_pm_rpm.c
@@ -1121,11 +1121,12 @@ static struct pci_device *setup_d3cold_and_get_root_port(void)
}
static void gem_mmap_args(const struct mmap_offset *t,
- struct drm_i915_gem_memory_class_instance *mem_regions)
+ struct drm_i915_gem_memory_class_instance *mem_regions, bool d3cold)
{
int i;
uint32_t handle;
int buf_size = 8192;
+ struct pci_device *root;
uint8_t *gem_buf;
/* Create, map and set data while the device is active. */
@@ -1143,17 +1144,29 @@ static void gem_mmap_args(const struct mmap_offset *t,
for (i = 0; i < buf_size; i++)
igt_assert(gem_buf[i] == (i & 0xFF));
+ if (d3cold)
+ root = setup_d3cold_and_get_root_port();
+
/* Now suspend, read and modify. */
disable_all_screens_and_wait(&ms_data);
+ if (d3cold)
+ igt_assert(wait_for_d3cold(root));
+
for (i = 0; i < buf_size; i++)
igt_assert(gem_buf[i] == (i & 0xFF));
igt_assert(wait_for_suspended());
+ if (d3cold)
+ igt_assert(wait_for_d3cold(root));
+
for (i = 0; i < buf_size; i++)
gem_buf[i] = (~i & 0xFF);
igt_assert(wait_for_suspended());
+ if (d3cold)
+ igt_assert(wait_for_d3cold(root));
+
/* Now resume and see if it's still there. */
enable_one_screen_and_wait(&ms_data);
for (i = 0; i < buf_size; i++)
@@ -1165,12 +1178,18 @@ static void gem_mmap_args(const struct mmap_offset *t,
* suspended. */
disable_all_screens_and_wait(&ms_data);
+ if (d3cold)
+ igt_assert(wait_for_d3cold(root));
+
gem_buf = __gem_mmap_offset(drm_fd, handle, 0, buf_size,
PROT_READ | PROT_WRITE, t->type);
igt_require(gem_buf);
igt_assert(wait_for_suspended());
+ if (d3cold)
+ igt_assert(wait_for_d3cold(root));
+
for (i = 0; i < buf_size; i++)
gem_buf[i] = i & 0xFF;
@@ -1179,6 +1198,9 @@ static void gem_mmap_args(const struct mmap_offset *t,
igt_assert(wait_for_suspended());
+ if (d3cold)
+ igt_assert(wait_for_d3cold(root));
+
/* Resume and check if it's still there. */
enable_one_screen_and_wait(&ms_data);
for (i = 0; i < buf_size; i++)
@@ -2172,10 +2194,28 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
/* GEM */
igt_subtest_with_dynamic("gem-mmap-type") {
+ int lmem_threshold;
+
for_each_mmap_offset_type(drm_fd, t) {
for_each_memory_region(r, drm_fd) {
igt_dynamic_f("%s-%s", t->name, r->name)
- gem_mmap_args(t, &r->ci);
+ gem_mmap_args(t, &r->ci, false);
+
+ if (r->ci.memory_class == I915_MEMORY_CLASS_SYSTEM)
+ continue;
+
+ lmem_threshold = get_d3cold_sr_lmem_threshold(debugfs);
+ igt_dynamic_f("%s-%s-%s", t->name, "d3cold-off", r->name) {
+ set_d3cold_sr_lmem_threshold(debugfs, 300);
+ gem_mmap_args(t, &r->ci, true);
+ set_d3cold_sr_lmem_threshold(debugfs, lmem_threshold);
+ }
+
+ igt_dynamic_f("%s-%s-%s", t->name, "d3cold-vrsr", r->name) {
+ set_d3cold_sr_lmem_threshold(debugfs, 0);
+ gem_mmap_args(t, &r->ci, true);
+ set_d3cold_sr_lmem_threshold(debugfs, lmem_threshold);
+ }
}
}
}
--
2.26.2
More information about the igt-dev
mailing list