Commit 9518cb59 authored by Chris Wilson's avatar Chris Wilson

igt: Start marking up GEM tests that require an alive GPU to function

Signed-off-by: Chris Wilson's avatarChris Wilson <chris@chris-wilson.co.uk>
parent af0e1c58
......@@ -1480,6 +1480,17 @@ void gem_require_caching(int fd)
errno = 0;
}
void igt_require_gem(int fd)
{
int err;
err = 0;
if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE))
err = -errno;
igt_require_f(err == 0, "Unresponsive i915/GEM device\n");
}
bool gem_has_ring(int fd, unsigned ring)
{
struct drm_i915_gem_execbuffer2 execbuf;
......
......@@ -148,6 +148,7 @@ void gem_sw_finish(int fd, uint32_t handle);
bool gem_bo_busy(int fd, uint32_t handle);
/* feature test helpers */
void igt_require_gem(int fd);
bool gem_has_llc(int fd);
bool gem_has_bsd(int fd);
bool gem_has_blt(int fd);
......
......@@ -242,6 +242,7 @@ igt_main
int idx;
device = drm_open_driver(DRIVER_INTEL);
igt_require_gem(device);
sysfs = igt_sysfs_open(device, &idx);
igt_assert(sysfs != -1);
}
......
......@@ -125,6 +125,7 @@ igt_simple_main
bind_to_cpu(0);
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
gem_require_mmap_wc(fd);
igt_fork_hang_detector(fd);
......
......@@ -514,6 +514,7 @@ igt_main
igt_fixture {
fd = drm_open_driver_master(DRIVER_INTEL);
igt_require_gem(fd);
igt_require(can_store_dword_imm(fd));
}
......
......@@ -215,6 +215,7 @@ igt_main
int fd;
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
devid = intel_get_drm_devid(fd);
has_64bit_relocations = intel_gen(devid) >= 8;
......
......@@ -1833,6 +1833,7 @@ igt_main
allow_unlimited_files();
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
intel_detect_and_clear_missed_interrupts(fd);
devid = intel_get_drm_devid(fd);
gen = intel_gen(devid);
......
......@@ -247,6 +247,7 @@ igt_main
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
}
igt_subtest("basic") {
......
......@@ -94,6 +94,7 @@ static void can_test_ring(unsigned ring)
/* Dance to avoid dying with master open */
close(master);
igt_require_gem(fd);
gem_require_ring(fd, ring);
gem_require_store_dword(fd, ring);
close(fd);
......
......@@ -145,8 +145,10 @@ igt_main
igt_skip_on_simulation();
igt_fixture
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
}
for (e = intel_execution_engines; e->name; e++)
igt_subtest_f("%s%s", e->exec_id ? "" : "basic-", e->name)
......
......@@ -308,6 +308,7 @@ igt_main
unsigned engine;
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
memset(&create, 0, sizeof(create));
igt_require(__gem_context_create(fd, &create) == 0);
......
......@@ -158,6 +158,7 @@ igt_main
igt_fixture {
fd = drm_open_driver_render(DRIVER_INTEL);
igt_require_gem(fd);
handle = gem_create(fd, 4096);
......
......@@ -151,6 +151,8 @@ igt_main
const uint32_t bbe = MI_BATCH_BUFFER_END;
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
light = gem_create(fd, 4096);
gem_write(fd, light, 0, &bbe, sizeof(bbe));
......
......@@ -195,6 +195,7 @@ igt_main
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
}
igt_subtest("minor-normal") {
......
......@@ -182,6 +182,7 @@ igt_main
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
size = 1024 * 1024;
count = 3*gem_aperture_size(fd) / size / 4;
......
......@@ -199,8 +199,10 @@ igt_main
{
int fd = -1;
igt_fixture
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
}
igt_subtest("single") /* basic! */
single(fd);
......
......@@ -196,6 +196,7 @@ igt_main
igt_fixture {
fd = drm_open_driver_master(DRIVER_INTEL);
igt_require_gem(fd);
gem_require_mmap_wc(fd);
igt_require(has_async_execbuf(fd));
igt_fork_hang_detector(fd);
......
......@@ -153,6 +153,7 @@ igt_main
{
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
......
......@@ -106,6 +106,7 @@ igt_main
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
igt_fork_hang_detector(fd);
}
......
......@@ -204,6 +204,8 @@ igt_simple_main
int fd;
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
use_64bit_relocs = intel_gen(intel_get_drm_devid(fd)) >= 8;
max = 3 * gem_aperture_size(fd) / 4;
......
......@@ -152,6 +152,7 @@ igt_main
igt_fixture {
device = drm_open_driver(DRIVER_INTEL);
igt_require_gem(device);
igt_fork_hang_detector(device);
}
......
......@@ -172,6 +172,7 @@ static void run(int object_size)
int ring;
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
devid = intel_get_drm_devid(fd);
handle = gem_create(fd, 4096);
src = gem_create(fd, object_size);
......
......@@ -318,6 +318,7 @@ igt_main
igt_fixture {
i915 = drm_open_driver_master(DRIVER_INTEL);
igt_require_gem(i915);
igt_require(gem_has_exec_fence(i915));
gem_require_mmap_wc(i915);
......
......@@ -583,6 +583,7 @@ igt_main
igt_fixture {
igt_require(igt_setup_clflush());
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
gem_require_mmap_wc(fd);
gen = intel_gen(intel_get_drm_devid(fd));
igt_require(can_store_dword_imm(gen));
......
......@@ -223,6 +223,7 @@ igt_main
igt_fixture {
device = drm_open_driver(DRIVER_INTEL);
igt_require_gem(device);
igt_require(can_store_dword_imm(device));
igt_fork_hang_detector(device);
}
......
......@@ -394,6 +394,7 @@ igt_main
igt_fixture {
intel_register_access_init(intel_get_pci_device(), false);
device = drm_open_driver(DRIVER_INTEL);
igt_require_gem(device);
print_welcome(device);
}
......
......@@ -104,6 +104,7 @@ igt_simple_main
igt_skip_on_simulation();
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
memset(gem_exec, 0, sizeof(gem_exec));
for (n = 0; n < MAX_NUM_EXEC; n++)
......
......@@ -451,6 +451,7 @@ igt_main
const uint32_t bbe = MI_BATCH_BUFFER_END;
device = drm_open_driver(DRIVER_INTEL);
igt_require_gem(device);
print_welcome(device);
handle = gem_create(device, 4096);
......
......@@ -269,6 +269,7 @@ igt_main
igt_fixture {
fd = drm_open_driver_master(DRIVER_INTEL);
igt_require_gem(fd);
igt_fork_hang_detector(fd);
}
......
......@@ -84,6 +84,7 @@ igt_main
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
devid = intel_get_drm_devid(fd);
......
......@@ -424,6 +424,7 @@ igt_main
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
parser_version = command_parser_version(fd);
igt_require(parser_version != -1);
......
......@@ -556,8 +556,10 @@ igt_main
uint64_t size;
int fd = -1;
igt_fixture
igt_fixture {
fd = drm_open_driver_master(DRIVER_INTEL);
igt_require_gem(fd);
}
for (f = flags; f->name; f++) {
igt_hang_t hang;
......
......@@ -151,6 +151,7 @@ igt_main
allow_unlimited_files();
no.fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(no.fd);
igt_fork_hang_detector(no.fd);
......
......@@ -457,6 +457,7 @@ igt_main
igt_fixture {
fd = drm_open_driver_master(DRIVER_INTEL);
igt_require_gem(fd);
gem_require_mmap_wc(fd);
igt_fork_hang_detector(fd);
}
......
......@@ -220,6 +220,7 @@ igt_main
igt_fixture {
fd = drm_open_driver_master(DRIVER_INTEL);
igt_require_gem(fd);
igt_require(can_store_dword_imm(fd));
igt_fork_hang_detector(fd);
......
......@@ -259,6 +259,7 @@ igt_main
igt_fixture {
fd = drm_open_driver_master(DRIVER_INTEL);
igt_require_gem(fd);
igt_require(can_store_dword_imm(fd));
igt_fork_hang_detector(fd);
......
......@@ -547,6 +547,7 @@ igt_main
igt_fixture {
fd = drm_open_driver_master(DRIVER_INTEL);
igt_require_gem(fd);
igt_require(can_store_dword_imm(fd));
print_welcome(fd);
......
......@@ -221,6 +221,7 @@ igt_main
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
num_fences = gem_available_fences(fd);
igt_assert(num_fences > 4);
devid = intel_get_drm_devid(fd);
......
......@@ -160,6 +160,7 @@ igt_simple_main
/* check for an intel gpu before goint nuts. */
int fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
close(fd);
igt_skip_on_simulation();
......
......@@ -371,6 +371,7 @@ igt_main
size_t reloc_size;
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
devid = intel_get_drm_devid(fd);
/* Create giant reloc buffer area. */
......
......@@ -301,6 +301,7 @@ igt_main
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
/* disable reuse, otherwise the test fails */
//drm_intel_bufmgr_gem_enable_reuse(bufmgr);
......
......@@ -226,6 +226,7 @@ int main(int argc, char **argv)
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
igt_assert(fd >= 0);
}
......
......@@ -95,6 +95,7 @@ igt_simple_main
int fd;
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
intel_detect_and_clear_missed_interrupts(fd);
sync_loop(fd);
......
......@@ -261,6 +261,7 @@ igt_main
int gen;
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
igt_require(can_store_dword_imm(fd));
gen = intel_gen(intel_get_drm_devid(fd));
if (gen > 3 && gen < 6) { /* ctg and ilk need secure batches */
......
......@@ -481,6 +481,7 @@ igt_main
igt_fixture {
fd = drm_open_driver_master(DRIVER_INTEL);
igt_require_gem(fd);
igt_require(gem_has_softpin(fd));
}
......
......@@ -374,8 +374,10 @@ igt_main
{
int fd, sync;
igt_fixture
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
}
for (sync = 2; sync--; ) {
igt_subtest_f("cpu%s", sync ? "-sync":"")
......
......@@ -729,6 +729,7 @@ igt_main
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_require_gem(fd);
print_welcome(fd);
igt_fork_hang_detector(fd);
......
......@@ -1285,6 +1285,7 @@ int main(int argc, char **argv)
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_assert(fd >= 0);
igt_require_gem(fd);
size = sizeof(linear);
......
......@@ -231,8 +231,10 @@ igt_main
igt_skip_on_simulation();
igt_fixture
igt_fixture {
fd = drm_open_driver_master(DRIVER_INTEL);
igt_require_gem(fd);
}
igt_subtest_group {
const struct mode {
......
......@@ -740,6 +740,7 @@ igt_main
igt_require(has_prime_export(vgem));
i915 = drm_open_driver_master(DRIVER_INTEL);
igt_require_gem(i915);
igt_require(has_prime_import(i915));
gem_require_mmap_wc(i915);
gen = intel_gen(intel_get_drm_devid(i915));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment