summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-03-19 14:01:38 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2016-03-19 15:21:28 +0000
commite85613b47c3ca40eeecd436dab3d6c660298d559 (patch)
tree64bf3756ef4498a3d326ad8d565a6af8fedc8291
parentc2248efbca452d1c657ace1b51aa6308504d0c7f (diff)
igt/gem_concurrent_blit: dmabuf requires twice the number of files
In order to keep the dmabuf mmap around whilst we keep the object alive, we need a file descriptor for each. Check that the VFS supports that many fd. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--lib/igt_aux.h1
-rw-r--r--lib/intel_os.c13
-rw-r--r--tests/gem_concurrent_all.c31
3 files changed, 30 insertions, 15 deletions
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index eabeefd2..101fad12 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -97,6 +97,7 @@ uint64_t intel_get_total_swap_mb(void);
int __intel_check_memory(uint64_t count, uint64_t size, unsigned mode,
uint64_t *out_required, uint64_t *out_total);
void intel_require_memory(uint64_t count, uint64_t size, unsigned mode);
+void intel_require_files(uint64_t count);
#define CHECK_RAM 0x1
#define CHECK_SWAP 0x2
diff --git a/lib/intel_os.c b/lib/intel_os.c
index 90b30210..8fcf0d63 100644
--- a/lib/intel_os.c
+++ b/lib/intel_os.c
@@ -192,6 +192,19 @@ static uint64_t vfs_file_max(void)
return max;
}
+/**
+ * intel_require_files:
+ * @count: number of files that will be created
+ *
+ * Does the system support enough file descriptors for the test?
+ */
+void intel_require_files(uint64_t count)
+{
+ igt_require_f(count < vfs_file_max(),
+ "Estimated that we need %'llu files, but the VFS maximum is only %'llu\n",
+ (long long)count, (long long)vfs_file_max());
+}
+
int __intel_check_memory(uint64_t count, uint64_t size, unsigned mode,
uint64_t *out_required, uint64_t *out_total)
{
diff --git a/tests/gem_concurrent_all.c b/tests/gem_concurrent_all.c
index 1e400f1a..bbecab99 100644
--- a/tests/gem_concurrent_all.c
+++ b/tests/gem_concurrent_all.c
@@ -59,7 +59,7 @@ int pass;
struct create {
const char *name;
- void (*require)(const struct create *);
+ void (*require)(const struct create *, unsigned);
drm_intel_bo *(*create)(drm_intel_bufmgr *, uint64_t size);
};
@@ -141,7 +141,7 @@ create_normal_bo(drm_intel_bufmgr *bufmgr, uint64_t size)
return bo;
}
-static void can_create_normal(const struct create *create)
+static void can_create_normal(const struct create *create, unsigned count)
{
}
@@ -161,7 +161,7 @@ create_private_bo(drm_intel_bufmgr *bufmgr, uint64_t size)
return bo;
}
-static void can_create_private(const struct create *create)
+static void can_create_private(const struct create *create, unsigned count)
{
igt_require(0);
}
@@ -183,14 +183,14 @@ create_stolen_bo(drm_intel_bufmgr *bufmgr, uint64_t size)
return bo;
}
-static void can_create_stolen(const struct create *create)
+static void can_create_stolen(const struct create *create, unsigned count)
{
/* XXX check num_buffers against available stolen */
igt_require(0);
}
#endif
-static void create_cpu_require(const struct create *create)
+static void create_cpu_require(const struct create *create, unsigned count)
{
#if HAVE_CREATE_STOLEN
igt_require(create->create != create_stolen_bo);
@@ -203,9 +203,9 @@ unmapped_create_bo(const struct buffers *b)
return b->create->create(b->bufmgr, 4*b->npixels);
}
-static void create_snoop_require(const struct create *create)
+static void create_snoop_require(const struct create *create, unsigned count)
{
- create_cpu_require(create);
+ create_cpu_require(create, count);
igt_require(!gem_has_llc(fd));
}
@@ -221,7 +221,7 @@ snoop_create_bo(const struct buffers *b)
return bo;
}
-static void create_userptr_require(const struct create *create)
+static void create_userptr_require(const struct create *create, unsigned count)
{
static int has_userptr = -1;
if (has_userptr < 0) {
@@ -313,7 +313,7 @@ userptr_release_bo(drm_intel_bo *bo)
drm_intel_bo_unreference(bo);
}
-static void create_dmabuf_require(const struct create *create)
+static void create_dmabuf_require(const struct create *create, unsigned count)
{
static int has_dmabuf = -1;
if (has_dmabuf < 0) {
@@ -338,6 +338,7 @@ static void create_dmabuf_require(const struct create *create)
close(args.fd);
}
igt_require(has_dmabuf);
+ intel_require_files(2*count);
}
struct dmabuf {
@@ -504,7 +505,7 @@ static void wc_require(void)
}
static void
-wc_create_require(const struct create *create)
+wc_create_require(const struct create *create, unsigned count)
{
wc_require();
}
@@ -635,7 +636,7 @@ gpu_cmp_bo(struct buffers *b, drm_intel_bo *bo, uint32_t val)
struct access_mode {
const char *name;
- void (*require)(const struct create *);
+ void (*require)(const struct create *, unsigned);
drm_intel_bo *(*create_bo)(const struct buffers *b);
void (*set_bo)(struct buffers *b, drm_intel_bo *bo, uint32_t val);
void (*cmp_bo)(struct buffers *b, drm_intel_bo *bo, uint32_t val);
@@ -1517,7 +1518,7 @@ run_modes(const char *style,
igt_subtest_group {
igt_fixture {
if (mode->require)
- mode->require(create);
+ mode->require(create, num);
}
for (const struct wrap *w = wrappers; w->suffix; w++) {
@@ -1541,9 +1542,6 @@ num_buffers(char *buf, int buflen,
unsigned size = 4*s->width*s->height;
unsigned n;
- if (c->require)
- c->require(c);
-
if (max == 0)
n = MIN_BUFFERS;
else
@@ -1552,6 +1550,9 @@ num_buffers(char *buf, int buflen,
igt_require(n);
igt_require(set_max_map_count(2*n));
+ if (c->require)
+ c->require(c, n);
+
igt_debug("%s: using 2x%d buffers, each %s\n",
name, n, s->name);