tests: use drmtest_skip to check for rings

To simplify things add a set of gem_check_<ring> functions which take
care of this. Since I've opted for static inlines drmtest.h grew a few
more header includes which was a neat opportunity to dump a few redundant
#defines.

This kills all the skipped_all hand-rolled logic we have.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniel Vetter
2013-08-12 11:03:29 +02:00
parent 7553ad6e10
commit 7847ea2965
15 changed files with 47 additions and 39 deletions
+32 -1
View File
@@ -37,6 +37,8 @@
#include "xf86drm.h"
#include "xf86drmMode.h"
#include "intel_batchbuffer.h"
#include "intel_chipset.h"
#include "intel_gpu_tools.h"
drm_intel_bo * gem_handle_to_libdrm_bo(drm_intel_bufmgr *bufmgr, int fd,
const char *name, uint32_t handle);
@@ -54,7 +56,7 @@ bool gem_has_bsd(int fd);
bool gem_has_blt(int fd);
bool gem_has_vebox(int fd);
int gem_get_num_rings(int fd);
void gem_check_caching(int fd);
void gem_set_caching(int fd, uint32_t handle, int caching);
uint32_t gem_get_caching(int fd, uint32_t handle);
uint32_t gem_flink(int fd, uint32_t handle);
@@ -106,6 +108,35 @@ void drmtest_success(void);
void drmtest_fail(int exitcode) __attribute__((noreturn));
int drmtest_retval(void);
/* check functions which auto-skip tests by calling drmtest_skip() */
void gem_check_caching(int fd);
static inline bool gem_check_vebox(int fd)
{
if (gem_has_vebox(fd))
return true;
drmtest_skip();
return false;
}
static inline bool gem_check_bsd(int fd)
{
if (HAS_BSD_RING(intel_get_drm_devid(fd)))
return true;
drmtest_skip();
return false;
}
static inline bool gem_check_blt(int fd)
{
if (HAS_BLT_RING(intel_get_drm_devid(fd)))
return true;
drmtest_skip();
return false;
}
/* helpers to automatically reduce test runtime in simulation */
bool drmtest_run_in_simulation(void);
#define SLOW_QUICK(slow,quick) (drmtest_run_in_simulation() ? (quick) : (slow))