#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
#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);
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);
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))
#include "i915_drm.h"
#include "drmtest.h"
-#define MI_BATCH_BUFFER_END (0xA<<23)
-
/*
* Testcase: Minmal bo_create and batchbuffer exec
*
#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)
int i;
sprintf(buf, "testing %s cs tlb coherency: ", ring_name);
- skipped_all = false;
/* Shut up gcc, too stupid. */
batch_ptr_old = NULL;
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
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();
}
return ret;
}
-#define MI_BATCH_BUFFER_END (0xA<<23)
int main(int argc, char *argv[])
{
uint32_t handle;
return ret;
}
-#define MI_BATCH_BUFFER_END (0xA<<23)
int main(int argc, char *argv[])
{
uint32_t handle;
}
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);
}
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);
}
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);
close(fd);
- return 0;
+ return drmtest_retval();
}
#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)
#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)
#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,
{
int count;
- skipped_all = false;
-
for (count = 1; count <= SLOW_QUICK(1<<17, 1<<4); count <<= 1) {
struct timeval start, end;
{
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));
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();
}
#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)
#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)
{
{
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;
}
#define BO_SIZE (16*1024)
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
static char counter;
volatile int pls_die = 0;
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