[igt-dev] [PATCH i-g-t v2 7/8] i915_pm_rpm: Extend gem_execbuf test with D3Cold
Anshuman Gupta
anshuman.gupta at intel.com
Fri Apr 29 08:54:24 UTC 2022
Added d3cold dynamic subtest to gem_execbuf 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 | 36 ++++++++++++++++++++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
index 1ef76f562..97a84359b 100644
--- a/tests/i915/i915_pm_rpm.c
+++ b/tests/i915/i915_pm_rpm.c
@@ -1342,10 +1342,11 @@ static void submit_blt_cmd(uint32_t dst_handle, int dst_size,
}
/* Make sure we can submit a batch buffer and verify its result. */
-static void gem_execbuf_subtest(struct drm_i915_gem_memory_class_instance *mem_regions)
+static void gem_execbuf_subtest(struct drm_i915_gem_memory_class_instance *mem_regions, bool d3cold)
{
int x, y;
uint32_t handle;
+ struct pci_device *root;
int bpp = 4;
int pitch = 128 * bpp;
int dst_size = 128 * 128 * bpp; /* 128x128 square */
@@ -1367,6 +1368,9 @@ static void gem_execbuf_subtest(struct drm_i915_gem_memory_class_instance *mem_r
memset(cpu_buf, 0, dst_size);
gem_write(drm_fd, handle, 0, cpu_buf, dst_size);
+ if (d3cold)
+ root = setup_d3cold_and_get_root_port();
+
/* Now suspend and try it. */
disable_all_screens_and_wait(&ms_data);
@@ -1375,8 +1379,15 @@ static void gem_execbuf_subtest(struct drm_i915_gem_memory_class_instance *mem_r
&presumed_offset);
igt_assert(wait_for_suspended());
+ if (d3cold)
+ igt_assert(wait_for_d3cold(root));
+
gem_read(drm_fd, handle, 0, cpu_buf, dst_size);
igt_assert(wait_for_suspended());
+
+ if (d3cold)
+ igt_assert(wait_for_d3cold(root));
+
for (y = 0; y < 128; y++) {
for (x = 0; x < 128; x++) {
uint32_t px = cpu_buf[y * 128 + x];
@@ -1415,6 +1426,9 @@ static void gem_execbuf_subtest(struct drm_i915_gem_memory_class_instance *mem_r
disable_all_screens_and_wait(&ms_data);
+ if (d3cold)
+ igt_assert(wait_for_d3cold(root));
+
memset(cpu_buf, 0, dst_size);
gem_read(drm_fd, handle, 0, cpu_buf, dst_size);
for (y = 0; y < 128; y++) {
@@ -2169,9 +2183,27 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
igt_subtest("gem-pread")
gem_pread_subtest();
igt_subtest_with_dynamic("gem-execbuf") {
+ int lmem_threshold;
+
for_each_memory_region(r, drm_fd) {
igt_dynamic_f("%s", r->name)
- gem_execbuf_subtest(&r->ci);
+ gem_execbuf_subtest(&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", "d3cold-off", r->name) {
+ set_d3cold_sr_lmem_threshold(debugfs, 300);
+ gem_execbuf_subtest(&r->ci, true);
+ set_d3cold_sr_lmem_threshold(debugfs, lmem_threshold);
+ }
+
+ igt_dynamic_f("%s-%s", "d3cold-vrsr", r->name) {
+ set_d3cold_sr_lmem_threshold(debugfs, 0);
+ gem_execbuf_subtest(&r->ci, true);
+ set_d3cold_sr_lmem_threshold(debugfs, lmem_threshold);
+ }
}
}
igt_subtest("gem-idle")
--
2.26.2
More information about the igt-dev
mailing list