From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Andi Shyti <andi.shyti@intel.com>,
IGT dev <igt-dev@lists.freedesktop.org>
Cc: Andi Shyti <andi@etezian.org>
Subject: Re: [igt-dev] [PATCH v16 6/8] lib: igt_gt: make gem_engine_can_store_dword() check engine class
Date: Fri, 29 Mar 2019 12:22:46 +0000 [thread overview]
Message-ID: <5962ecab-4406-96a1-c279-0efba329356e@linux.intel.com> (raw)
In-Reply-To: <20190328192206.1591-7-andi.shyti@intel.com>
On 28/03/2019 19:22, Andi Shyti wrote:
> Engines referred by class and instance are getting more populare,
Italian typo. ;)
> gem_engine_can_store_dword() should handle the situation.
>
> Signed-off-by: Andi Shyti <andi.shyti@intel.com>
> ---
> lib/igt_gt.c | 46 +++++++++++++++++++++++++++++++++++++++-------
> lib/igt_gt.h | 6 ++++--
> 2 files changed, 43 insertions(+), 9 deletions(-)
>
> diff --git a/lib/igt_gt.c b/lib/igt_gt.c
> index 5999524326d0..630aa421ffb3 100644
> --- a/lib/igt_gt.c
> +++ b/lib/igt_gt.c
> @@ -41,6 +41,7 @@
> #include "intel_reg.h"
> #include "intel_chipset.h"
> #include "igt_dummyload.h"
> +#include "i915/gem_engine_topology.h"
>
> /**
> * SECTION:igt_gt
> @@ -556,27 +557,58 @@ const struct intel_execution_engine intel_execution_engines[] = {
> { NULL, 0, 0 }
> };
>
> -bool gem_can_store_dword(int fd, unsigned int engine)
> +static bool __gem_can_store_dword(const int gen, const struct intel_device_info *info)
> {
> - uint16_t devid = intel_get_drm_devid(fd);
> - const struct intel_device_info *info = intel_get_device_info(devid);
> - const int gen = ffs(info->gen);
> -
> if (gen <= 2) /* requires physical addresses */
> return false;
>
> if (gen == 3 && (info->is_grantsdale || info->is_alviso))
> return false; /* only supports physical addresses */
>
> + if (info->is_broadwater)
> + return false; /* Not sure yet... */
> +
> + return true;
> +}
> +
> +bool gem_can_store_dword(int fd, uint64_t engine)
Yeah eb->flags is u64, although we don't need it all here. Okay, I don't mind.
> +{
> + uint16_t devid = intel_get_drm_devid(fd);
> + const struct intel_device_info *info = intel_get_device_info(devid);
> + const int gen = ffs(info->gen);
> +
> + if (!__gem_can_store_dword(gen, info))
> + return false;
> +
> if (gen == 6 && ((engine & 0x3f) == I915_EXEC_BSD))
> return false; /* kills the machine! */
>
> - if (info->is_broadwater)
> - return false; /* Not sure yet... */
> + return true;
> +}
> +
> +bool gem_class_can_store_dword(int fd, uint64_t class)
But for class we definitely do not need 64 bits. u16 or unsigned int.
> +{
> + uint16_t devid = intel_get_drm_devid(fd);
> + const struct intel_device_info *info = intel_get_device_info(devid);
> + const int gen = ffs(info->gen);
> +
> + if (!__gem_can_store_dword(gen, info))
> + return false;
> +
> + if (gen == 6 && class == I915_ENGINE_CLASS_VIDEO)
> + return false;
>
> return true;
> }
>
> +bool gem_engine_can_store_dword(int fd, const struct intel_execution_engine2 *e)
> +{
> + if (!gem_has_engine_topology(fd))
> + return gem_can_store_dword(fd, e->flags);
> +
> + return gem_class_can_store_dword(fd, e->class);
> +}
Couldn't you always use class?
It could be refactored with a eb_flags_to_class helper if you would like this solution. Then it wouldn't need to call gem_has_engine_topology I think.
bool gem_class_can_store_dword(int fd, uint64_t class)
{
uint16_t devid = intel_get_drm_devid(fd);
const struct intel_device_info *info = intel_get_device_info(devid);
const int gen = ffs(info->gen);
if (!__gem_can_store_dword(gen, info))
return false;
if (gen == 6 && class == I915_ENGINE_CLASS_VIDEO)
return false;
return true;
}
bool gem_can_store_dword(int fd, uint64_t engine)
{
u16 class = eb_engine_to_class(engine);
return gem_class_can_store_dword(class);
}
bool gem_engine_can_store_dword(int fd, const struct intel_execution_engine2 *e)
{
return gem_class_can_store_dword(fd, e->class);
}
Unless I missed something fundamental..
Let me see the next patches first..
Regards,
Tvrtko
> +
> 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 52b2f1ea95a5..f3f07e895733 100644
> --- a/lib/igt_gt.h
> +++ b/lib/igt_gt.h
> @@ -89,8 +89,6 @@ extern const struct intel_execution_engine {
> 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);
> -
> extern const struct intel_execution_engine2 {
> const char *name;
> int class;
> @@ -99,6 +97,10 @@ extern const struct intel_execution_engine2 {
> bool is_virtual;
> } intel_execution_engines2[];
>
> +bool gem_can_store_dword(int fd, uint64_t);
> +bool gem_class_can_store_dword(int fd, uint64_t class);
> +bool gem_engine_can_store_dword(int fd, const struct intel_execution_engine2 *e);
> +
> unsigned int
> gem_class_instance_to_eb_flags(int gem_fd,
> enum drm_i915_gem_engine_class class,
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-03-29 12:22 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-28 19:21 [igt-dev] [RFC v16 0/8] new engine discovery interface Andi Shyti
2019-03-28 19:21 ` [igt-dev] [PATCH v16 1/8] lib/igt_gt: remove unnecessary argument Andi Shyti
2019-03-29 11:34 ` Tvrtko Ursulin
2019-03-28 19:22 ` [igt-dev] [PATCH v16 2/8] lib: ioctl_wrappers: reach engines by index as well Andi Shyti
2019-03-29 11:36 ` Tvrtko Ursulin
2019-03-29 11:59 ` Andi Shyti
2019-03-28 19:22 ` [igt-dev] [PATCH v16 3/8] include/drm-uapi: import i915_drm.h header file Andi Shyti
2019-03-28 19:22 ` [igt-dev] [PATCH v16 4/8] lib/i915: add gem_engine_topology library and for_each loop definition Andi Shyti
2019-03-29 11:34 ` Tvrtko Ursulin
2019-03-29 12:05 ` Andi Shyti
2019-03-28 19:22 ` [igt-dev] [PATCH v16 5/8] tests: gem_exec_basic: add engine discovery test Andi Shyti
2019-03-29 11:39 ` Tvrtko Ursulin
2019-03-29 12:06 ` Andi Shyti
2019-03-29 12:41 ` Tvrtko Ursulin
2019-03-29 23:36 ` Chris Wilson
2019-03-31 17:36 ` Andi Shyti
2019-03-31 17:42 ` Chris Wilson
2019-03-31 20:19 ` Andi Shyti
2019-03-28 19:22 ` [igt-dev] [PATCH v16 6/8] lib: igt_gt: make gem_engine_can_store_dword() check engine class Andi Shyti
2019-03-29 12:22 ` Tvrtko Ursulin [this message]
2019-03-29 12:43 ` Andi Shyti
2019-03-28 19:22 ` [igt-dev] [PATCH v16 7/8] lib: igt_dummyload: use for_each_context_engine() Andi Shyti
2019-03-29 12:33 ` Tvrtko Ursulin
2019-03-28 19:22 ` [igt-dev] [PATCH v16 8/8] test: perf_pmu: use the gem_engine_topology library Andi Shyti
2019-03-29 12:40 ` Tvrtko Ursulin
2019-03-29 12:47 ` Andi Shyti
2019-03-29 12:56 ` Tvrtko Ursulin
2019-03-28 20:15 ` [igt-dev] ✓ Fi.CI.BAT: success for new engine discovery interface Patchwork
2019-03-29 7:40 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5962ecab-4406-96a1-c279-0efba329356e@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=andi.shyti@intel.com \
--cc=andi@etezian.org \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox