[igt-dev] [PATCH i-g-t 36/77] tests/i915/gem_exec_gttfill: Convert to intel_ctx_t
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Mon Jun 14 19:25:56 UTC 2021
On Mon, Jun 14, 2021 at 11:36:51AM -0500, Jason Ekstrand wrote:
> Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
> ---
> tests/i915/gem_exec_gttfill.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/tests/i915/gem_exec_gttfill.c b/tests/i915/gem_exec_gttfill.c
> index e711576f5..a3c054e41 100644
> --- a/tests/i915/gem_exec_gttfill.c
> +++ b/tests/i915/gem_exec_gttfill.c
> @@ -106,7 +106,7 @@ static void submit(int fd, int gen,
> gem_sync(fd, obj.handle);
> }
>
> -static void fillgtt(int fd, unsigned ring, int timeout)
> +static void fillgtt(int fd, const intel_ctx_t *ctx, unsigned ring, int timeout)
> {
> const unsigned int gen = intel_gen(intel_get_drm_devid(fd));
> struct drm_i915_gem_execbuffer2 execbuf;
> @@ -126,7 +126,7 @@ static void fillgtt(int fd, unsigned ring, int timeout)
> if (ring == ALL_ENGINES) {
> struct intel_execution_engine2 *e;
>
> - __for_each_physical_engine(fd, e) {
> + for_each_ctx_engine(fd, ctx, e) {
> if (!gem_class_can_store_dword(fd, e->class))
> continue;
>
> @@ -155,6 +155,7 @@ static void fillgtt(int fd, unsigned ring, int timeout)
> execbuf.buffer_count = 1;
> if (gen < 6)
> execbuf.flags |= I915_EXEC_SECURE;
> + execbuf.rsvd1 = ctx->id;
>
> batches = calloc(count, sizeof(*batches));
> igt_assert(batches);
> @@ -209,29 +210,31 @@ static void fillgtt(int fd, unsigned ring, int timeout)
> igt_main
> {
> const struct intel_execution_engine2 *e;
> + const intel_ctx_t *ctx = NULL;
Init not necessary.
> int i915 = -1;
>
> igt_fixture {
> i915 = drm_open_driver(DRIVER_INTEL);
> igt_require_gem(i915);
> + ctx = intel_ctx_create_all_physical(i915);
> igt_fork_hang_detector(i915);
> }
>
> igt_subtest("basic") /* just enough to run a single pass */
> - fillgtt(i915, ALL_ENGINES, 1);
> + fillgtt(i915, ctx, ALL_ENGINES, 1);
>
> igt_subtest_with_dynamic("engines") {
> - __for_each_physical_engine(i915, e) {
> + for_each_ctx_engine(i915, ctx, e) {
> if (!gem_class_can_store_dword(i915, e->class))
> continue;
>
> igt_dynamic_f("%s", e->name)
> - fillgtt(i915, e->flags, 20);
> + fillgtt(i915, ctx, e->flags, 20);
> }
> }
>
> igt_subtest("all")
> - fillgtt(i915, ALL_ENGINES, 20);
> + fillgtt(i915, ctx, ALL_ENGINES, 20);
>
> igt_fixture {
> igt_stop_hang_detector();
Missing freeing the context.
With above nit:
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
--
Zbigniew
> --
> 2.31.1
>
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
More information about the igt-dev
mailing list