tests/gem_exec_params: test all valid execution flags

The control subtest has been extended to check the execution flags for
all the rings that are present in the HW.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniele Ceraolo Spurio 2016-02-01 14:24:37 +00:00 committed by Daniel Vetter
parent 2629f3aeef
commit 0e388f409a

View File

@ -46,6 +46,30 @@
#define LOCAL_I915_EXEC_BSD_RING2 (2<<13) #define LOCAL_I915_EXEC_BSD_RING2 (2<<13)
#define LOCAL_I915_EXEC_RESOURCE_STREAMER (1<<15) #define LOCAL_I915_EXEC_RESOURCE_STREAMER (1<<15)
static bool has_ring(int fd, unsigned ring_exec_flags)
{
switch (ring_exec_flags & I915_EXEC_RING_MASK) {
case 0:
case I915_EXEC_RENDER:
return true;
case I915_EXEC_BSD:
if (ring_exec_flags & LOCAL_I915_EXEC_BSD_MASK)
return gem_has_bsd2(fd);
else
return gem_has_bsd(fd);
case I915_EXEC_BLT:
return gem_has_blt(fd);
case I915_EXEC_VEBOX:
return gem_has_vebox(fd);
}
igt_assert_f(0, "invalid exec flag 0x%x\n", ring_exec_flags);
return false;
}
struct drm_i915_gem_execbuffer2 execbuf; struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 gem_exec[1]; struct drm_i915_gem_exec_object2 gem_exec[1];
uint32_t batch[2] = {MI_BATCH_BUFFER_END}; uint32_t batch[2] = {MI_BATCH_BUFFER_END};
@ -54,6 +78,8 @@ int fd;
igt_main igt_main
{ {
const struct intel_execution_engine *e;
igt_fixture { igt_fixture {
fd = drm_open_driver(DRIVER_INTEL); fd = drm_open_driver(DRIVER_INTEL);
@ -85,13 +111,12 @@ igt_main
} }
igt_subtest("control") { igt_subtest("control") {
igt_assert(drmIoctl(fd, for (e = intel_execution_engines; e->name; e++) {
DRM_IOCTL_I915_GEM_EXECBUFFER2, if (has_ring(fd, e->exec_id | e->flags)) {
&execbuf) == 0); execbuf.flags = e->exec_id | e->flags;
execbuf.flags = I915_EXEC_RENDER; gem_execbuf(fd, &execbuf);
igt_assert(drmIoctl(fd, }
DRM_IOCTL_I915_GEM_EXECBUFFER2, }
&execbuf) == 0);
} }
#define RUN_FAIL(expected_errno) do { \ #define RUN_FAIL(expected_errno) do { \