summaryrefslogtreecommitdiff
path: root/tests/i915
diff options
context:
space:
mode:
authorMichał Winiarski <michal.winiarski@intel.com>2019-03-12 13:48:13 +0100
committerMichał Winiarski <michal.winiarski@intel.com>2019-03-20 10:36:36 +0100
commit8ae86621d6fff60b6e20c6b0f9b336785c935b0f (patch)
tree12d83d267f5dafb16bcef5edec173ff57cf4dfbd /tests/i915
parent1bbe0b11a40cbb8433a3863745b7023e54c36ae3 (diff)
lib/igt_device: Move intel_get_pci_device under igt_device
It allows us to make things a little bit more generic. Also, we now require fd rather than doing guesswork when it comes to pci address. v2: Use readlinkat rather than string concat, move stuff around, provide a version that does not assert. (Chris) v3: Print addr on failure, avoid assignment in conditionals. (Chris) Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/i915')
-rw-r--r--tests/i915/gem_concurrent_all.c12
-rw-r--r--tests/i915/gem_cpu_reloc.c4
-rw-r--r--tests/i915/gem_exec_latency.c3
-rw-r--r--tests/i915/gem_exec_parse.c4
-rw-r--r--tests/i915/gem_mmap.c4
-rw-r--r--tests/i915/gem_mmap_gtt.c10
-rw-r--r--tests/i915/gem_pwrite.c4
-rw-r--r--tests/i915/gem_shrink.c2
-rw-r--r--tests/i915/i915_pm_lpsp.c3
-rw-r--r--tests/i915/i915_pm_rpm.c4
10 files changed, 27 insertions, 23 deletions
diff --git a/tests/i915/gem_concurrent_all.c b/tests/i915/gem_concurrent_all.c
index 6049372d1..f719b0a19 100644
--- a/tests/i915/gem_concurrent_all.c
+++ b/tests/i915/gem_concurrent_all.c
@@ -1850,7 +1850,7 @@ igt_main
c->name, s->name, "small");
igt_subtest_group {
igt_fixture {
- count = num_buffers(gem_mappable_aperture_size()/4,
+ count = num_buffers(gem_mappable_aperture_size(fd)/4,
s, c, CHECK_RAM);
}
run_modes(name, c, modes, s, count);
@@ -1861,7 +1861,7 @@ igt_main
c->name, s->name, "thrash");
igt_subtest_group {
igt_fixture {
- count = num_buffers(gem_mappable_aperture_size(),
+ count = num_buffers(gem_mappable_aperture_size(fd),
s, c, CHECK_RAM);
}
run_modes(name, c, modes, s, count);
@@ -1893,7 +1893,7 @@ igt_main
c->name, s->name, "shrink");
igt_subtest_group {
igt_fixture {
- count = num_buffers(gem_mappable_aperture_size(),
+ count = num_buffers(gem_mappable_aperture_size(fd),
s, c, CHECK_RAM);
igt_fork_shrink_helper(fd);
@@ -1909,8 +1909,8 @@ igt_main
c->name, s->name, "swap");
igt_subtest_group {
igt_fixture {
- if (intel_get_avail_ram_mb() > gem_mappable_aperture_size()/(1024*1024)) {
- pin_sz = intel_get_avail_ram_mb() - gem_mappable_aperture_size()/(1024*1024);
+ if (intel_get_avail_ram_mb() > gem_mappable_aperture_size(fd)/(1024*1024)) {
+ pin_sz = intel_get_avail_ram_mb() - gem_mappable_aperture_size(fd)/(1024*1024);
igt_debug("Pinning %lld MiB\n", (long long)pin_sz);
pin_sz *= 1024 * 1024;
@@ -1924,7 +1924,7 @@ igt_main
igt_require(pinned);
}
- count = num_buffers(gem_mappable_aperture_size(),
+ count = num_buffers(gem_mappable_aperture_size(fd),
s, c, CHECK_RAM | CHECK_SWAP);
}
run_modes(name, c, modes, s, count);
diff --git a/tests/i915/gem_cpu_reloc.c b/tests/i915/gem_cpu_reloc.c
index 470998628..17c2fe115 100644
--- a/tests/i915/gem_cpu_reloc.c
+++ b/tests/i915/gem_cpu_reloc.c
@@ -283,7 +283,7 @@ igt_main
run_test(i915, 1);
igt_subtest("full") {
- uint64_t aper_size = gem_mappable_aperture_size();
+ uint64_t aper_size = gem_mappable_aperture_size(i915);
unsigned long count = aper_size / 4096 + 1;
intel_require_memory(count, 4096, CHECK_RAM);
@@ -292,7 +292,7 @@ igt_main
}
igt_subtest("forked") {
- uint64_t aper_size = gem_mappable_aperture_size();
+ uint64_t aper_size = gem_mappable_aperture_size(i915);
unsigned long count = aper_size / 4096 + 1;
int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
diff --git a/tests/i915/gem_exec_latency.c b/tests/i915/gem_exec_latency.c
index 6dd191ece..f308e0851 100644
--- a/tests/i915/gem_exec_latency.c
+++ b/tests/i915/gem_exec_latency.c
@@ -40,6 +40,7 @@
#include "drm.h"
+#include "igt_device.h"
#include "igt_sysfs.h"
#include "igt_vgem.h"
#include "igt_dummyload.h"
@@ -679,7 +680,7 @@ igt_main
if (ring_size > 1024)
ring_size = 1024;
- intel_register_access_init(intel_get_pci_device(), false, device);
+ intel_register_access_init(igt_device_get_pci_device(device), false, device);
rcs_clock = clockrate(device, RCS_TIMESTAMP);
igt_info("RCS timestamp clock: %.0fKHz, %.1fns\n",
rcs_clock / 1e3, 1e9 / rcs_clock);
diff --git a/tests/i915/gem_exec_parse.c b/tests/i915/gem_exec_parse.c
index 62e8d0a51..d3b848e2a 100644
--- a/tests/i915/gem_exec_parse.c
+++ b/tests/i915/gem_exec_parse.c
@@ -30,6 +30,8 @@
#include <drm.h>
+#include "igt_device.h"
+
#ifndef I915_PARAM_CMD_PARSER_VERSION
#define I915_PARAM_CMD_PARSER_VERSION 28
#endif
@@ -530,7 +532,7 @@ igt_main
#undef REG
igt_fixture {
- intel_register_access_init(intel_get_pci_device(), 0, fd);
+ intel_register_access_init(igt_device_get_pci_device(fd), 0, fd);
}
for (int i = 0; i < ARRAY_SIZE(lris); i++) {
diff --git a/tests/i915/gem_mmap.c b/tests/i915/gem_mmap.c
index 6aaa3e8c9..05a40d8ae 100644
--- a/tests/i915/gem_mmap.c
+++ b/tests/i915/gem_mmap.c
@@ -53,10 +53,10 @@ test_huge_bo(int huge)
switch (huge) {
case -1:
- huge_object_size = gem_mappable_aperture_size() / 2;
+ huge_object_size = gem_mappable_aperture_size(fd) / 2;
break;
case 0:
- huge_object_size = gem_mappable_aperture_size() + PAGE_SIZE;
+ huge_object_size = gem_mappable_aperture_size(fd) + PAGE_SIZE;
break;
case 1:
huge_object_size = gem_aperture_size(fd) + PAGE_SIZE;
diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c
index 8d304808e..e6244fd03 100644
--- a/tests/i915/gem_mmap_gtt.c
+++ b/tests/i915/gem_mmap_gtt.c
@@ -527,7 +527,7 @@ test_huge_bo(int fd, int huge, int tiling)
switch (huge) {
case -1:
- size = gem_mappable_aperture_size() / 2;
+ size = gem_mappable_aperture_size(fd) / 2;
/* Power of two fence size, natural fence
* alignment, and the guard page at the end
@@ -542,7 +542,7 @@ test_huge_bo(int fd, int huge, int tiling)
size /= 2;
break;
case 0:
- size = gem_mappable_aperture_size() + PAGE_SIZE;
+ size = gem_mappable_aperture_size(fd) + PAGE_SIZE;
break;
default:
size = gem_global_aperture_size(fd) + PAGE_SIZE;
@@ -623,13 +623,13 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b, int ncpus)
switch (huge) {
case -2:
- huge_object_size = gem_mappable_aperture_size() / 4;
+ huge_object_size = gem_mappable_aperture_size(fd) / 4;
break;
case -1:
- huge_object_size = gem_mappable_aperture_size() / 2;
+ huge_object_size = gem_mappable_aperture_size(fd) / 2;
break;
case 0:
- huge_object_size = gem_mappable_aperture_size() + PAGE_SIZE;
+ huge_object_size = gem_mappable_aperture_size(fd) + PAGE_SIZE;
break;
case 1:
huge_object_size = gem_global_aperture_size(fd) + PAGE_SIZE;
diff --git a/tests/i915/gem_pwrite.c b/tests/i915/gem_pwrite.c
index 696bd316a..5cae121a7 100644
--- a/tests/i915/gem_pwrite.c
+++ b/tests/i915/gem_pwrite.c
@@ -89,7 +89,7 @@ static void test_big_cpu(int fd, int scale, unsigned flags)
switch (scale) {
case 0:
- size = gem_mappable_aperture_size() + 4096;
+ size = gem_mappable_aperture_size(fd) + 4096;
break;
case 1:
size = gem_global_aperture_size(fd) + 4096;
@@ -151,7 +151,7 @@ static void test_big_gtt(int fd, int scale, unsigned flags)
igt_require(gem_mmap__has_wc(fd));
switch (scale) {
case 0:
- size = gem_mappable_aperture_size() + 4096;
+ size = gem_mappable_aperture_size(fd) + 4096;
break;
case 1:
size = gem_global_aperture_size(fd) + 4096;
diff --git a/tests/i915/gem_shrink.c b/tests/i915/gem_shrink.c
index c8e05814e..73b6be725 100644
--- a/tests/i915/gem_shrink.c
+++ b/tests/i915/gem_shrink.c
@@ -409,7 +409,7 @@ igt_main
* we expect the shrinker to start purging objects,
* and possibly fail.
*/
- alloc_size = gem_mappable_aperture_size() / 2;
+ alloc_size = gem_mappable_aperture_size(fd) / 2;
num_processes = 1 + (mem_size / (alloc_size >> 20));
igt_info("Using %d processes and %'lluMiB per process\n",
diff --git a/tests/i915/i915_pm_lpsp.c b/tests/i915/i915_pm_lpsp.c
index b319dbe9a..4e7ce399d 100644
--- a/tests/i915/i915_pm_lpsp.c
+++ b/tests/i915/i915_pm_lpsp.c
@@ -30,6 +30,7 @@
#include <fcntl.h>
#include <unistd.h>
+#include "igt_device.h"
static bool supports_lpsp(uint32_t devid)
{
@@ -210,7 +211,7 @@ igt_main
igt_require(supports_lpsp(devid));
- intel_register_access_init(intel_get_pci_device(), 0, drm_fd);
+ intel_register_access_init(igt_device_get_pci_device(drm_fd), 0, drm_fd);
kmstest_set_vt_graphics_mode();
}
diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
index 03de609cb..18adaf6b5 100644
--- a/tests/i915/i915_pm_rpm.c
+++ b/tests/i915/i915_pm_rpm.c
@@ -1368,7 +1368,7 @@ static void gem_evict_pwrite_subtest(void)
unsigned int num_trash_bos, n;
uint32_t buf;
- num_trash_bos = gem_mappable_aperture_size() / (1024*1024) + 1;
+ num_trash_bos = gem_mappable_aperture_size(drm_fd) / (1024*1024) + 1;
trash_bos = malloc(num_trash_bos * sizeof(*trash_bos));
igt_assert(trash_bos);
@@ -1412,7 +1412,7 @@ static bool device_in_pci_d3(void)
uint16_t val;
int rc;
- rc = pci_device_cfg_read_u16(intel_get_pci_device(), &val, 0xd4);
+ rc = pci_device_cfg_read_u16(igt_device_get_pci_device(drm_fd), &val, 0xd4);
igt_assert_eq(rc, 0);
igt_debug("%s: PCI D3 state=%d\n", __func__, val & 0x3);