tests: Use gem_available_fences()

lib/drmtest.c provides gem_available_fences(). Use it where
appropriate.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Ville Syrjälä 2013-04-09 15:25:38 +03:00 committed by Daniel Vetter
parent e37eb35e19
commit 1d1f68316f
3 changed files with 6 additions and 18 deletions

View File

@ -169,19 +169,15 @@ static int run_test(int threads_per_fence, void *f, int tiling,
int surfaces_per_thread) int surfaces_per_thread)
{ {
struct test t; struct test t;
drm_i915_getparam_t gp;
pthread_t *threads; pthread_t *threads;
int n, num_fences, num_threads; int n, num_fences, num_threads;
int ret;
t.fd = drm_open_any(); t.fd = drm_open_any();
t.tiling = tiling; t.tiling = tiling;
t.num_surfaces = surfaces_per_thread; t.num_surfaces = surfaces_per_thread;
gp.param = I915_PARAM_NUM_FENCES_AVAIL; num_fences = gem_available_fences(t.fd);
gp.value = &num_fences; assert (num_fences > 0);
ret = ioctl(t.fd, DRM_IOCTL_I915_GETPARAM, &gp);
assert (ret == 0);
num_threads = threads_per_fence * num_fences; num_threads = threads_per_fence * num_fences;

View File

@ -88,13 +88,9 @@ batch_create (int fd)
static int get_num_fences(int fd) static int get_num_fences(int fd)
{ {
drm_i915_getparam_t gp; int val;
int ret, val;
gp.param = I915_PARAM_NUM_FENCES_AVAIL; val = gem_available_fences(fd);
gp.value = &val;
ret = drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
assert (ret == 0);
printf ("total %d fences\n", val); printf ("total %d fences\n", val);
assert(val > 4); assert(val > 4);

View File

@ -605,13 +605,9 @@ static void copy_tiles(unsigned *permutation)
static int get_num_fences(void) static int get_num_fences(void)
{ {
drm_i915_getparam_t gp; int val;
int ret, val;
gp.param = I915_PARAM_NUM_FENCES_AVAIL; val = gem_available_fences(drm_fd);
gp.value = &val;
ret = drmIoctl(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp);
assert (ret == 0);
printf ("total %d fences\n", val); printf ("total %d fences\n", val);
assert(val > 4); assert(val > 4);