Re: [igt-dev] [PATCH v19 4/6] lib: igt_gt: make gem_engine_can_store_dword() check engine class

Tvrtko Ursulin
2019-04-08T16:25:16Z

On 08/04/2019 17:15, Andi Shyti wrote:
> Engines referred by class and instance are getting more populare,
> gem_engine_can_store_dword() should handle the situation.
>
> Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Signed-off-by: Andi Shyti <andi.shyti@intel.com>
> ---
> lib/igt_gt.c | 11 ++++++++---
> lib/igt_gt.h | 1 +
> 2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/lib/igt_gt.c b/lib/igt_gt.c
> index 8cd58f7afbfd..5d0a8e8060a7 100644
> --- a/lib/igt_gt.c
> +++ b/lib/igt_gt.c
> @@ -557,7 +557,7 @@ const struct intel_execution_engine intel_execution_engines[] = {
> { NULL, 0, 0 }
> };
>
> -bool gem_can_store_dword(int fd, unsigned int engine)
> +bool gem_class_can_store_dword(int fd, int class)
> {
> uint16_t devid = intel_get_drm_devid(fd);
> const struct intel_device_info *info = intel_get_device_info(devid);
> @@ -569,8 +569,8 @@ bool gem_can_store_dword(int fd, unsigned int engine)
> if (gen == 3 && (info->is_grantsdale || info->is_alviso))
> return false; /* only supports physical addresses */
>
> - if (gen == 6 && ((engine & 0x3f) == I915_EXEC_BSD))
> - return false; /* kills the machine! */
> + if (gen == 6 && class == I915_ENGINE_CLASS_VIDEO)
> + return false;
>
> if (info->is_broadwater)
> return false; /* Not sure yet... */
> @@ -578,6 +578,11 @@ bool gem_can_store_dword(int fd, unsigned int engine)
> return true;
> }
>
> +bool gem_can_store_dword(int fd, unsigned int engine)
> +{
> + return gem_class_can_store_dword(fd, gem_eb_to_class(engine));
> +}
> +
> const struct intel_execution_engine2 intel_execution_engines2[] = {
> { "rcs0", I915_ENGINE_CLASS_RENDER, 0 },
> { "bcs0", I915_ENGINE_CLASS_COPY, 0 },
> diff --git a/lib/igt_gt.h b/lib/igt_gt.h
> index b13062ef7d33..af4cc38a1ef7 100644
> --- a/lib/igt_gt.h
> +++ b/lib/igt_gt.h
> @@ -90,6 +90,7 @@ bool gem_ring_is_physical_engine(int fd, unsigned int ring);
> bool gem_ring_has_physical_engine(int fd, unsigned int ring);
>
> bool gem_can_store_dword(int fd, unsigned int engine);
> +bool gem_class_can_store_dword(int fd, int class);
>
> extern const struct intel_execution_engine2 {
> const char *name;
>

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko