Message ID | 20180517082330.32760-2-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 17/05/18 01:23, Chris Wilson wrote: > Not all HW supports XY blitter commands, so check before use. > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > --- > lib/i915/gem_submission.c | 16 ++++++++++++++++ > lib/i915/gem_submission.h | 3 +++ > tests/gem_linear_blits.c | 1 + > tests/gem_tiled_blits.c | 1 + > tests/gem_tiled_fence_blits.c | 1 + > 5 files changed, 22 insertions(+) > > diff --git a/lib/i915/gem_submission.c b/lib/i915/gem_submission.c > index 2fd460d5e..1d1adcf6f 100644 > --- a/lib/i915/gem_submission.c > +++ b/lib/i915/gem_submission.c > @@ -229,3 +229,19 @@ void gem_test_engine(int i915, unsigned int engine) > igt_assert(!is_wedged(i915)); > close(i915); > } > + > +bool gem_has_blitter(int i915) > +{ > + unsigned int blt; > + > + blt = 0; > + if (intel_gen(intel_get_drm_devid(i915)) >= 6) Looks like we have a "HAS_BLT_RING" macro we use in other places. Also, we have a gem_has_blt() function which is slightly different. Which is making things quite confusing for me... I wish I had a better name but I think we should add at least a comment to differentiate the two. With that: Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com> Thanks, Antonio > + blt = I915_EXEC_BLT; > + > + return gem_has_ring(i915, blt); > +} > + > +void gem_require_blitter(int i915) > +{ > + igt_require(gem_has_blitter(i915)); > +} > diff --git a/lib/i915/gem_submission.h b/lib/i915/gem_submission.h > index f94eabb20..f2b18d9dc 100644 > --- a/lib/i915/gem_submission.h > +++ b/lib/i915/gem_submission.h > @@ -33,6 +33,9 @@ bool gem_has_semaphores(int fd); > bool gem_has_execlists(int fd); > bool gem_has_guc_submission(int fd); > > +bool gem_has_blitter(int i915); > +void gem_require_blitter(int i915); > + > void gem_test_engine(int fd, unsigned int engine); > > int gem_reopen_driver(int fd); > diff --git a/tests/gem_linear_blits.c b/tests/gem_linear_blits.c > index 8297416c0..7d05fa865 100644 > --- a/tests/gem_linear_blits.c > +++ b/tests/gem_linear_blits.c > @@ -226,6 +226,7 @@ int main(int argc, char **argv) > igt_fixture { > fd = drm_open_driver(DRIVER_INTEL); > igt_require_gem(fd); > + gem_require_blitter(fd); > } > > igt_subtest("basic") > diff --git a/tests/gem_tiled_blits.c b/tests/gem_tiled_blits.c > index a81226a15..0d472e3a1 100644 > --- a/tests/gem_tiled_blits.c > +++ b/tests/gem_tiled_blits.c > @@ -203,6 +203,7 @@ int main(int argc, char **argv) > igt_fixture { > fd = drm_open_driver(DRIVER_INTEL); > igt_require_gem(fd); > + gem_require_blitter(fd); > > bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); > drm_intel_bufmgr_gem_enable_reuse(bufmgr); > diff --git a/tests/gem_tiled_fence_blits.c b/tests/gem_tiled_fence_blits.c > index 693e96cec..9ab58b5d6 100644 > --- a/tests/gem_tiled_fence_blits.c > +++ b/tests/gem_tiled_fence_blits.c > @@ -176,6 +176,7 @@ igt_main > igt_fixture { > fd = drm_open_driver(DRIVER_INTEL); > igt_require_gem(fd); > + gem_require_blitter(fd); > } > > igt_subtest("basic") { >
diff --git a/lib/i915/gem_submission.c b/lib/i915/gem_submission.c index 2fd460d5e..1d1adcf6f 100644 --- a/lib/i915/gem_submission.c +++ b/lib/i915/gem_submission.c @@ -229,3 +229,19 @@ void gem_test_engine(int i915, unsigned int engine) igt_assert(!is_wedged(i915)); close(i915); } + +bool gem_has_blitter(int i915) +{ + unsigned int blt; + + blt = 0; + if (intel_gen(intel_get_drm_devid(i915)) >= 6) + blt = I915_EXEC_BLT; + + return gem_has_ring(i915, blt); +} + +void gem_require_blitter(int i915) +{ + igt_require(gem_has_blitter(i915)); +} diff --git a/lib/i915/gem_submission.h b/lib/i915/gem_submission.h index f94eabb20..f2b18d9dc 100644 --- a/lib/i915/gem_submission.h +++ b/lib/i915/gem_submission.h @@ -33,6 +33,9 @@ bool gem_has_semaphores(int fd); bool gem_has_execlists(int fd); bool gem_has_guc_submission(int fd); +bool gem_has_blitter(int i915); +void gem_require_blitter(int i915); + void gem_test_engine(int fd, unsigned int engine); int gem_reopen_driver(int fd); diff --git a/tests/gem_linear_blits.c b/tests/gem_linear_blits.c index 8297416c0..7d05fa865 100644 --- a/tests/gem_linear_blits.c +++ b/tests/gem_linear_blits.c @@ -226,6 +226,7 @@ int main(int argc, char **argv) igt_fixture { fd = drm_open_driver(DRIVER_INTEL); igt_require_gem(fd); + gem_require_blitter(fd); } igt_subtest("basic") diff --git a/tests/gem_tiled_blits.c b/tests/gem_tiled_blits.c index a81226a15..0d472e3a1 100644 --- a/tests/gem_tiled_blits.c +++ b/tests/gem_tiled_blits.c @@ -203,6 +203,7 @@ int main(int argc, char **argv) igt_fixture { fd = drm_open_driver(DRIVER_INTEL); igt_require_gem(fd); + gem_require_blitter(fd); bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); drm_intel_bufmgr_gem_enable_reuse(bufmgr); diff --git a/tests/gem_tiled_fence_blits.c b/tests/gem_tiled_fence_blits.c index 693e96cec..9ab58b5d6 100644 --- a/tests/gem_tiled_fence_blits.c +++ b/tests/gem_tiled_fence_blits.c @@ -176,6 +176,7 @@ igt_main igt_fixture { fd = drm_open_driver(DRIVER_INTEL); igt_require_gem(fd); + gem_require_blitter(fd); } igt_subtest("basic") {
Not all HW supports XY blitter commands, so check before use. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- lib/i915/gem_submission.c | 16 ++++++++++++++++ lib/i915/gem_submission.h | 3 +++ tests/gem_linear_blits.c | 1 + tests/gem_tiled_blits.c | 1 + tests/gem_tiled_fence_blits.c | 1 + 5 files changed, 22 insertions(+)