Commit 7847ea29 authored by Daniel Vetter's avatar Daniel Vetter

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's avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 7553ad6e
......@@ -51,8 +51,6 @@
#include "drm_fourcc.h"
#endif
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
/*
* Mode setting with the kernel interfaces is a bit of a chore.
* First you have to find the connector in question and make sure the
......
......@@ -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))
......
......@@ -40,8 +40,6 @@
#include "i915_drm.h"
#include "drmtest.h"
#define MI_BATCH_BUFFER_END (0xA<<23)
/*
* Testcase: Minmal bo_create and batchbuffer exec
*
......
......@@ -55,7 +55,6 @@
#define LOCAL_I915_EXEC_VEBOX (4<<0)
#define BATCH_SIZE (1024*1024)
bool skipped_all = true;
static int exec(int fd, uint32_t handle, int split,
uint64_t *gtt_ofs, unsigned ring_id)
......@@ -104,7 +103,6 @@ static void run_on_ring(int fd, unsigned ring_id, const char *ring_name)
int i;
sprintf(buf, "testing %s cs tlb coherency: ", ring_name);
skipped_all = false;
/* Shut up gcc, too stupid. */
batch_ptr_old = NULL;
......@@ -149,13 +147,11 @@ static void run_on_ring(int fd, unsigned ring_id, const char *ring_name)
int main(int argc, char **argv)
{
int fd;
uint32_t devid;
drmtest_subtest_init(argc, argv);
drmtest_skip_on_simulation();
fd = drm_open_any();
devid = intel_get_drm_devid(fd);
if (!drmtest_only_list_subtests()) {
/* This test is very sensitive to residual gtt_mm noise from previous
......@@ -168,18 +164,18 @@ int main(int argc, char **argv)
run_on_ring(fd, I915_EXEC_RENDER, "render");
drmtest_subtest_block("bsd")
if (HAS_BSD_RING(devid))
if (gem_check_bsd(fd))
run_on_ring(fd, I915_EXEC_BSD, "bsd");
drmtest_subtest_block("blt")
if (HAS_BLT_RING(devid))
if (gem_check_blt(fd))
run_on_ring(fd, I915_EXEC_BLT, "blt");
drmtest_subtest_block("vebox")
if (gem_has_vebox(fd))
if (gem_check_vebox(fd))
run_on_ring(fd, LOCAL_I915_EXEC_VEBOX, "vebox");
close(fd);
return skipped_all ? 77 : 0;
return drmtest_retval();
}
......@@ -104,7 +104,6 @@ static int exec(int fd, uint32_t handle, int ring, int ctx_id)
return ret;
}
#define MI_BATCH_BUFFER_END (0xA<<23)
int main(int argc, char *argv[])
{
uint32_t handle;
......
......@@ -115,7 +115,6 @@ static int exec(int fd, uint32_t handle, int ring, int ctx_id)
return ret;
}
#define MI_BATCH_BUFFER_END (0xA<<23)
int main(int argc, char *argv[])
{
uint32_t handle;
......
......@@ -167,7 +167,7 @@ int main(int argc, char **argv)
}
drmtest_subtest_block("bsd") {
if (HAS_BSD_RING(devid)) {
if (gem_check_bsd(fd)) {
sleep(2);
printf("running dummy loop on bsd\n");
dummy_reloc_loop(I915_EXEC_BSD);
......@@ -176,7 +176,7 @@ int main(int argc, char **argv)
}
drmtest_subtest_block("blt") {
if (HAS_BLT_RING(devid)) {
if (gem_check_blt(fd)) {
sleep(2);
printf("running dummy loop on blt\n");
dummy_reloc_loop(I915_EXEC_BLT);
......@@ -185,7 +185,7 @@ int main(int argc, char **argv)
}
drmtest_subtest_block("vebox") {
if (gem_has_vebox(fd)) {
if (gem_check_vebox(fd)) {
sleep(2);
printf("running dummy loop on vebox\n");
dummy_reloc_loop(LOCAL_I915_EXEC_VEBOX);
......@@ -208,5 +208,5 @@ int main(int argc, char **argv)
close(fd);
return 0;
return drmtest_retval();
}
......@@ -49,7 +49,6 @@
#include "i915_drm.h"
#include "drmtest.h"
#define MI_BATCH_BUFFER_END (0xA<<23)
#define BATCH_SIZE (1024*1024)
static int exec(int fd, uint32_t handle, uint32_t reloc_ofs)
......
......@@ -40,7 +40,6 @@
#include "i915_drm.h"
#include "drmtest.h"
#define MI_BATCH_BUFFER_END (0xA<<23)
#define BATCH_SIZE (1024*1024)
#define LOCAL_I915_EXEC_NO_RELOC (1<<11)
......
......@@ -44,7 +44,6 @@
#include "intel_gpu_tools.h"
#define LOCAL_I915_EXEC_VEBOX (4<<0)
bool skipped_all = true;
static double elapsed(const struct timeval *start,
const struct timeval *end,
......@@ -94,8 +93,6 @@ static void loop(int fd, uint32_t handle, unsigned ring_id, const char *ring_nam
{
int count;
skipped_all = false;
for (count = 1; count <= SLOW_QUICK(1<<17, 1<<4); count <<= 1) {
struct timeval start, end;
......@@ -113,13 +110,11 @@ int main(int argc, char **argv)
{
uint32_t batch[2] = {MI_BATCH_BUFFER_END};
uint32_t handle;
uint32_t devid;
int fd;
drmtest_subtest_init(argc, argv);
fd = drm_open_any();
devid = intel_get_drm_devid(fd);
handle = gem_create(fd, 4096);
gem_write(fd, handle, 0, batch, sizeof(batch));
......@@ -128,20 +123,20 @@ int main(int argc, char **argv)
loop(fd, handle, I915_EXEC_RENDER, "render");
drmtest_subtest_block("bsd")
if (HAS_BSD_RING(devid))
if (gem_check_blt(fd))
loop(fd, handle, I915_EXEC_BSD, "bsd");
drmtest_subtest_block("blt")
if (HAS_BLT_RING(devid))
if (gem_check_blt(fd))
loop(fd, handle, I915_EXEC_BLT, "blt");
drmtest_subtest_block("vebox")
if (gem_has_vebox(fd))
if (gem_check_vebox(fd))
loop(fd, handle, LOCAL_I915_EXEC_VEBOX, "vebox");
gem_close(fd, handle);
close(fd);
return skipped_all ? 77 : 0;
return drmtest_retval();
}
......@@ -40,7 +40,6 @@
#include "i915_drm.h"
#include "drmtest.h"
#define MI_BATCH_BUFFER_END (0xA<<23)
#define BATCH_SIZE (1024*1024)
#define LOCAL_I915_EXEC_HANDLE_LUT (1<<12)
......
......@@ -49,7 +49,6 @@
#define BLT_WRITE_RGB (1<<20)
#define BLT_SRC_TILED (1<<15)
#define BLT_DST_TILED (1<<11)
#define MI_BATCH_BUFFER_END (0xA<<23)
static void do_gem_write(int fd, uint32_t handle, void *buf, int len, int loops)
{
......
......@@ -151,11 +151,11 @@ static int has_ring(int ring)
{
switch (ring) {
case I915_EXEC_RENDER: /* test only makes sense with separate blitter */
return HAS_BLT_RING(intel_get_drm_devid(fd));
return gem_check_blt(fd);
case I915_EXEC_BSD:
return HAS_BSD_RING(intel_get_drm_devid(fd));
return gem_check_bsd(fd);
case LOCAL_I915_EXEC_VEBOX:
return gem_has_vebox(fd);
return gem_check_vebox(fd);
default:
return 0;
}
......
......@@ -51,8 +51,6 @@
#define BO_SIZE (16*1024)
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
static char counter;
volatile int pls_die = 0;
......
......@@ -86,8 +86,6 @@ int plane_width, plane_height;
static const uint32_t SPRITE_COLOR_KEY = 0x00aaaaaa;
uint32_t *fb_ptr;
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
/*
* Mode setting with the kernel interfaces is a bit of a chore.
* First you have to find the connector in question and make sure the
......
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