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>
This commit is contained in:
Chris Wilson 2016-03-19 14:01:38 +00:00
parent c2248efbca
commit e85613b47c
3 changed files with 30 additions and 15 deletions

View File

@ -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

View File

@ -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)
{

View File

@ -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);