Stop depending on context mutation (v3)
Subsystems (2)
PATCH 28/89 tests/i915/gem_exec_fair: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_exec_fair.c | 112 +++++++++++++++++++++---------------- 1 file changed, 65 insertions(+), 47 deletions(-)
tests/i915/gem_exec_fair.c +65 -47
@@ -224,7 +224,7 @@ static void delay(int i915, }static struct drm_i915_gem_exec_object2 -delay_create (int i915,uint32_t ctx, +delay_create (int i915,const intel_ctx_t *ctx,const struct intel_execution_engine2 *e,uint64_t target_ns) {
@@ -235,7 +235,7 @@ delay_create(int i915, uint32_t ctx,struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&obj), .buffer_count =1 , - .rsvd1 = ctx, + .rsvd1 = ctx->id, .flags = e->flags, };
@@ -325,7 +325,8 @@ static void tslog(int i915, }static struct drm_i915_gem_exec_object2 -tslog_create (int i915,uint32_t ctx,const struct intel_execution_engine2 *e) +tslog_create (int i915,const intel_ctx_t *ctx, +const struct intel_execution_engine2 *e) {struct drm_i915_gem_exec_object2 obj = { .handle =batch_create (i915),
@@ -334,7 +335,7 @@ tslog_create(int i915, uint32_t ctx, const struct intel_execution_engine2 *e)struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&obj), .buffer_count =1 , - .rsvd1 = ctx, + .rsvd1 = ctx->id, .flags = e->flags, };
@@ -361,7 +362,8 @@ static int cmp_u32(const void *A, const void *B) }static uint32_t -read_ctx_timestamp (int i915,const struct intel_execution_engine2 *e) +read_ctx_timestamp (int i915,const intel_ctx_t *ctx, +const struct intel_execution_engine2 *e) {struct drm_i915_gem_relocation_entry reloc;struct drm_i915_gem_exec_object2 obj = {
@@ -373,6 +375,7 @@ read_ctx_timestamp(int i915, const struct intel_execution_engine2 *e)struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&obj), .buffer_count =1 , + .rsvd1 = ctx->id, .flags = e->flags, };const int use_64b =intel_gen (intel_get_drm_devid (i915)) >=8 ;
@@ -414,23 +417,31 @@ read_ctx_timestamp(int i915, const struct intel_execution_engine2 *e)return ts; } -static bool has_ctx_timestamp (int i915,const struct intel_execution_engine2 *e) +static bool has_ctx_timestamp (int i915,const intel_ctx_cfg_t *cfg, +const struct intel_execution_engine2 *e) {const int gen =intel_gen (intel_get_drm_devid (i915)); +const intel_ctx_t *tmp_ctx; +uint32_t timestamp;if (gen ==8 && e->class ==I915_ENGINE_CLASS_VIDEO )return false;/* looks fubar */ -return read_ctx_timestamp (i915, e); + tmp_ctx =intel_ctx_create (i915, cfg); + timestamp =read_ctx_timestamp (i915, tmp_ctx, e); +intel_ctx_destroy (i915, tmp_ctx); + +return timestamp; }static struct intel_execution_engine2 -pick_random_engine (int i915,const struct intel_execution_engine2 *not) +pick_random_engine (int i915,const intel_ctx_cfg_t *cfg, +const struct intel_execution_engine2 *not) {const struct intel_execution_engine2 *e;unsigned int count =0 ; -__for_each_physical_engine (i915, e) { +for_each_ctx_cfg_engine (i915, cfg, e) {if (e->flags == not->flags)continue ;if (!gem_class_has_mutable_submission (i915, e->class))
@@ -441,7 +452,7 @@ pick_random_engine(int i915, const struct intel_execution_engine2 *not)return *not; count =rand () % count; -__for_each_physical_engine (i915, e) { +for_each_ctx_cfg_engine (i915, cfg, e) {if (e->flags == not->flags)continue ;if (!gem_class_has_mutable_submission (i915, e->class))
@@ -453,7 +464,7 @@ pick_random_engine(int i915, const struct intel_execution_engine2 *not)return *e; } -static void fair_child(int i915, uint32_t ctx, +static void fair_child(int i915, const intel_ctx_t *ctx, const struct intel_execution_engine2 *e, uint64_t frame_ns, int timeline,
@@ -494,7 +505,7 @@ static void fair_child(int i915, uint32_t ctx,srandom (getpid ());if (flags &F_PING ) - ping =pick_random_engine (i915, e); + ping =pick_random_engine (i915, &ctx->cfg, e); obj[0 ] =tslog_create (i915, ctx, &ping);/* Synchronize with other children/parent upon construction */
@@ -514,7 +525,7 @@ static void fair_child(int i915, uint32_t ctx,struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (obj), .buffer_count =3 , - .rsvd1 = ctx, + .rsvd1 = ctx->id, .rsvd2 =-1 , .flags = aux_flags, };
@@ -636,7 +647,7 @@ static void timeline_advance(int timeline, int delay_ns)sw_sync_timeline_inc (timeline,1 ); } -static void fairness (int i915, +static void fairness (int i915,const intel_ctx_cfg_t *cfg,const struct intel_execution_engine2 *e,int duration,unsigned int flags) {
@@ -649,7 +660,7 @@ static void fairness(int i915,int parent[2 ]; } lnk; -igt_require (has_ctx_timestamp (i915, e)); +igt_require (has_ctx_timestamp (i915, cfg, e));igt_require (gem_class_has_mutable_submission (i915, e->class));if (flags & (F_ISOLATE |F_PING ))igt_require (intel_gen (intel_get_drm_devid (i915)) >=8 );
@@ -713,12 +724,12 @@ static void fairness(int i915,if (flags &F_PING ) {/* fill the others with light bg load */ struct intel_execution_engine2 *ping; -__for_each_physical_engine (i915, ping) { +for_each_ctx_cfg_engine (i915, cfg, ping) {if (ping->flags == e->flags)continue ; igt_fork(child, 1) { -uint32_t ctx =gem_context_clone_with_engines (i915,0 ); +const intel_ctx_t *ctx =intel_ctx_create (i915, cfg); fair_child(i915, ctx, ping, child_ns / 8,
@@ -727,7 +738,7 @@ static void fairness(int i915, &result[nchild], NULL, NULL, -1, -1); -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx); } } }
@@ -735,26 +746,24 @@ static void fairness(int i915,getrusage (RUSAGE_CHILDREN , &old_usage);igt_nsec_elapsed (memset (&tv,0 ,sizeof (tv))); igt_fork(child, nchild) { -uint32_t ctx; +const intel_ctx_t *ctx;if (flags &F_ISOLATE ) { -int clone, dmabuf =-1 ; +int dmabuf =-1 ;if (common) dmabuf =prime_handle_to_fd (i915, common); - clone =gem_reopen_driver (i915); -gem_context_copy_engines (i915,0 , clone,0 ); - i915 = clone; + i915 =gem_reopen_driver (i915);if (dmabuf !=-1 ) common =prime_fd_to_handle (i915, dmabuf); } - ctx =gem_context_clone_with_engines (i915,0 ); + ctx =intel_ctx_create (i915, cfg);if (flags &F_VIP && child ==0 ) { -gem_context_set_priority (i915, ctx,1023 ); +gem_context_set_priority (i915, ctx->id,1023 ); flags |=F_FLOW ; }if (flags &F_RRUL && child ==0 )
@@ -766,7 +775,7 @@ static void fairness(int i915, &result[child], &iqr[child], lnk.child[1], lnk.parent[0]); -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx); } {
@@ -911,7 +920,7 @@ static void fairness(int i915, } static void deadline_child(int i915, - uint32_t ctx, + const intel_ctx_t *ctx, const struct intel_execution_engine2 *e, uint32_t handle, int timeline,
@@ -931,7 +940,7 @@ static void deadline_child(int i915, .buffers_ptr = to_user_pointer(obj), .buffer_count = ARRAY_SIZE(obj), .flags = I915_EXEC_FENCE_OUT | e->flags, - .rsvd1 = ctx, + .rsvd1 = ctx->id, };unsigned int seq =1 ;int prev =-1 , next =-1 ;
@@ -976,11 +985,12 @@ static void deadline_child(int i915,close (prev); } -static struct intel_execution_engine2 pick_default (int i915) +static struct intel_execution_engine2 +pick_default (int i915,const intel_ctx_cfg_t *cfg) {const struct intel_execution_engine2 *e; -__for_each_physical_engine (i915, e) { +for_each_ctx_cfg_engine (i915, cfg, e) {if (!e->flags)return *e; }
@@ -988,11 +998,12 @@ static struct intel_execution_engine2 pick_default(int i915)return (struct intel_execution_engine2 ){}; } -static struct intel_execution_engine2 pick_engine (int i915,const char *name) +static struct intel_execution_engine2 +pick_engine (int i915,const intel_ctx_cfg_t *cfg,const char *name) {const struct intel_execution_engine2 *e; -__for_each_physical_engine (i915, e) { +for_each_ctx_cfg_engine (i915, cfg, e) {if (!strcmp (e->name, name))return *e; }
@@ -1029,15 +1040,16 @@ static uint64_t time_get_mono_ns(void)return tv.tv_sec *NSEC64 + tv.tv_nsec; } -static void deadline (int i915,int duration,unsigned int flags) +static void deadline (int i915,const intel_ctx_cfg_t *cfg, +int duration,unsigned int flags) {const int64_t frame_ns =33670 *1000 ;/* 29.7fps */ const int64_t parent_ns =400 *1000 ;const int64_t switch_ns =50 *1000 ;const int64_t overhead_ns =/* estimate timeslicing overhead */ (frame_ns /1000 /1000 +2 ) * switch_ns + parent_ns; -struct intel_execution_engine2 pe =pick_default (i915); -struct intel_execution_engine2 ve =pick_engine (i915,"vcs0" ); +struct intel_execution_engine2 pe =pick_default (i915, cfg); +struct intel_execution_engine2 ve =pick_engine (i915, cfg,"vcs0" );struct drm_i915_gem_exec_fence *fences =calloc (sizeof (*fences),32 );struct drm_i915_gem_exec_object2 *obj =calloc (sizeof (*obj),32 );struct drm_i915_gem_execbuffer2 execbuf = {
@@ -1048,14 +1060,15 @@ static void deadline(int i915, int duration, unsigned int flags)I915_EXEC_FENCE_ARRAY |I915_EXEC_FENCE_OUT }; +const intel_ctx_t *delay_ctx;int *ctl;igt_require (has_syncobj (i915));igt_require (has_fence_array (i915));igt_require (has_mi_math (i915, &pe)); -igt_require (has_ctx_timestamp (i915, &pe)); +igt_require (has_ctx_timestamp (i915, cfg, &pe));igt_require (has_mi_math (i915, &ve)); -igt_require (has_ctx_timestamp (i915, &ve)); +igt_require (has_ctx_timestamp (i915, cfg, &ve));igt_assert (obj && fences);if (flags &DL_PRIO )igt_require (gem_scheduler_has_preemption (i915));
@@ -1063,9 +1076,10 @@ static void deadline(int i915, int duration, unsigned int flags) ctl =mmap (NULL ,4096 ,PROT_WRITE ,MAP_SHARED |MAP_ANON ,-1 ,0 );igt_assert (ctl !=MAP_FAILED ); - obj[0 ] =delay_create (i915,0 , &pe, parent_ns); + delay_ctx =intel_ctx_create (i915, cfg); + obj[0 ] =delay_create (i915, delay_ctx, &pe, parent_ns);if (flags &DL_PRIO ) -gem_context_set_priority (i915,0 ,1023 ); +gem_context_set_priority (i915, delay_ctx->id,1023 );if (intel_gen (intel_get_drm_devid (i915)) <8 ) execbuf.flags |=I915_EXEC_SECURE ;for (int n =1 ; n <=5 ; n++) {
@@ -1092,7 +1106,7 @@ static void deadline(int i915, int duration, unsigned int flags) *ctl =0 ; igt_fork(child, num_children) { -uint32_t ctx =gem_context_clone_with_engines (i915,0 ); +const intel_ctx_t *ctx =intel_ctx_create (i915, cfg); deadline_child(i915, ctx, &ve, obj[child + 1].handle, timeline, child_ns,
@@ -1100,7 +1114,7 @@ static void deadline(int i915, int duration, unsigned int flags) link[child].parent[0 ], ctl, flags); -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx); }for (int i =0 ; i < num_children; i++)
@@ -1174,6 +1188,7 @@ static void deadline(int i915, int duration, unsigned int flags)gem_quiescent_gpu (i915); } +intel_ctx_destroy (i915, delay_ctx);gem_close (i915, obj[0 ].handle);free (obj);free (fences);
@@ -1281,6 +1296,7 @@ igt_main {} };const struct intel_execution_engine2 *e; +intel_ctx_cfg_t cfg;int i915 =-1 ; igt_fixture {
@@ -1296,6 +1312,8 @@ igt_mainigt_require (gem_scheduler_enabled (i915));igt_require (gem_scheduler_has_ctx_priority (i915)); + cfg =intel_ctx_cfg_all_physical (i915); +igt_info ("CS timestamp frequency: %d\n" ,read_timestamp_frequency (i915));igt_require (has_mi_math (i915,NULL ));
@@ -1309,7 +1327,7 @@ igt_maincontinue ; igt_subtest_with_dynamic_f("basic-%s", f->name) { -__for_each_physical_engine (i915, e) { +for_each_ctx_cfg_engine (i915, &cfg, e) {if (!has_mi_math (i915, e))continue ;
@@ -1320,19 +1338,19 @@ igt_maincontinue ; igt_dynamic_f("%s", e->name) -fairness (i915, e,1 , f->flags); +fairness (i915, &cfg, e,1 , f->flags); } } } igt_subtest("basic-deadline") -deadline (i915,2 ,0 ); +deadline (i915, &cfg,2 ,0 ); igt_subtest("deadline-prio") -deadline (i915,2 ,DL_PRIO ); +deadline (i915, &cfg,2 ,DL_PRIO );for (typeof (*fair) *f = fair; f->name; f++) { igt_subtest_with_dynamic_f("fair-%s", f->name) { -__for_each_physical_engine (i915, e) { +for_each_ctx_cfg_engine (i915, &cfg, e) {if (!has_mi_math (i915, e))continue ;
@@ -1343,7 +1361,7 @@ igt_maincontinue ; igt_dynamic_f("%s", e->name) -fairness (i915, e,5 , f->flags); +fairness (i915, &cfg, e,5 , f->flags); } } }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 29/89 tests/i915/gem_spin_batch: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_spin_batch.c | 81 +++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 35 deletions(-)
tests/i915/gem_spin_batch.c +46 -35
@@ -34,7 +34,7 @@ "'%s' != '%s' (%lld not within %d%% tolerance of %lld)\n",\#x , #ref, (long long)x, tolerance, (long long)ref) -static void spin (int fd, +static void spin (int fd,const intel_ctx_t *ctx_id,unsigned int engine,unsigned int flags,unsigned int timeout_sec)
@@ -46,10 +46,12 @@ static void spin(int fd,struct timespec itv = { };uint64_t elapsed; - spin = __igt_spin_new(fd, .engine = engine, .flags = flags); + spin = __igt_spin_new(fd, .ctx = ctx_id, .engine = engine, + .flags = flags);while ((elapsed =igt_nsec_elapsed (&tv)) >>30 < timeout_sec) {igt_spin_t *next = - __igt_spin_new(fd, .engine = engine, .flags = flags); + __igt_spin_new(fd, .ctx = ctx_id, .engine = engine, + .flags = flags);igt_spin_set_timeout (spin, timeout_100ms -igt_nsec_elapsed (&itv));
@@ -75,21 +77,25 @@ static void spin(int fd,#define RESUBMIT_NEW_CTX (1 << 0)#define RESUBMIT_ALL_ENGINES (1 << 1) -static void spin_resubmit (int fd,unsigned int engine,unsigned int flags) +static void spin_resubmit (int fd,const intel_ctx_t *ctx, +unsigned int engine,unsigned int flags) { +const intel_ctx_t *new_ctx =NULL ;igt_spin_t *spin;if (flags &RESUBMIT_NEW_CTX )igt_require (gem_has_contexts (fd)); - spin = __igt_spin_new(fd, .engine = engine); -if (flags &RESUBMIT_NEW_CTX ) - spin->execbuf.rsvd1 =gem_context_clone_with_engines (fd,0 ); + spin = __igt_spin_new(fd, .ctx = ctx, .engine = engine); +if (flags &RESUBMIT_NEW_CTX ) { + new_ctx =intel_ctx_create (fd, &ctx->cfg); + spin->execbuf.rsvd1 = new_ctx->id; + }if (flags &RESUBMIT_ALL_ENGINES ) {const struct intel_execution_engine2 *other; -for_each_context_engine (fd, spin->execbuf.rsvd1, other) { +for_each_ctx_engine (fd, ctx, other) { spin->execbuf.flags &= ~0x3f ; spin->execbuf.flags |= other->flags;gem_execbuf (fd, &spin->execbuf);
@@ -100,8 +106,8 @@ static void spin_resubmit(int fd, unsigned int engine, unsigned int flags)igt_spin_end (spin);gem_sync (fd, spin->handle); -if (spin->execbuf.rsvd1) -gem_context_destroy (fd, spin->execbuf.rsvd1); +if (flags &RESUBMIT_NEW_CTX ) +intel_ctx_destroy (fd, new_ctx);igt_spin_free (fd, spin); }
@@ -112,45 +118,44 @@ static void spin_exit_handler(int sig) }static void -spin_on_all_engines (int fd,unsigned long flags,unsigned int timeout_sec) +spin_on_all_engines (int fd,const intel_ctx_t *ctx, +unsigned long flags,unsigned int timeout_sec) {const struct intel_execution_engine2 *e2; -__for_each_physical_engine (fd, e2) { +for_each_ctx_engine (fd, ctx, e2) { igt_fork(child, 1) {igt_install_exit_handler (spin_exit_handler); -spin (fd, e2->flags, flags, timeout_sec); +spin (fd, ctx, e2->flags, flags, timeout_sec); } }igt_waitchildren (); } -static void spin_all (int i915,unsigned int flags) +static void spin_all (int i915,const intel_ctx_t *ctx,unsigned int flags) #define PARALLEL_SPIN_NEW_CTX BIT(0) {const struct intel_execution_engine2 *e; +intel_ctx_cfg_t cfg = ctx->cfg;struct igt_spin *spin, *n;IGT_LIST_HEAD (list); -__for_each_physical_engine (i915, e) { -uint32_t ctx; - +for_each_ctx_cfg_engine (i915, &cfg, e) {if (!gem_class_can_store_dword (i915, e->class))continue ; - ctx =0 ;if (flags &PARALLEL_SPIN_NEW_CTX ) - ctx =gem_context_clone_with_engines (i915,0 ); + ctx =intel_ctx_create (i915, &cfg);/* Prevent preemption so only one is allowed on each engine */ spin = igt_spin_new(i915, - .ctx_id = ctx, + .ctx = ctx, .engine = e->flags, .flags = (IGT_SPIN_POLL_RUN |IGT_SPIN_NO_PREEMPTION )); -if (ctx) -gem_context_destroy (i915, ctx); +if (flags &PARALLEL_SPIN_NEW_CTX ) +intel_ctx_destroy (i915, ctx);igt_spin_busywait_until_started (spin);igt_list_move (&spin->link, &list);
@@ -187,11 +192,14 @@ igt_main {const struct intel_execution_engine2 *e2;const struct intel_execution_ring *e; +const intel_ctx_t *ctx =NULL ;int fd =-1 ; igt_fixture { fd =drm_open_driver (DRIVER_INTEL );igt_require_gem (fd); + ctx =intel_ctx_create_all_physical (fd); +igt_fork_hang_detector (fd); }
@@ -202,53 +210,56 @@ igt_main igt_dynamic_f("%s", e->name) test_each_legacy_ring("legacy") -spin (fd,eb_ring (e),0 ,3 ); +spin (fd,intel_ctx_0 (fd),eb_ring (e),0 ,3 ); test_each_legacy_ring("legacy-resubmit") -spin_resubmit (fd,eb_ring (e),0 ); +spin_resubmit (fd,intel_ctx_0 (fd),eb_ring (e),0 ); test_each_legacy_ring("legacy-resubmit-new") -spin_resubmit (fd,eb_ring (e),RESUBMIT_NEW_CTX ); +spin_resubmit (fd,intel_ctx_0 (fd),eb_ring (e),RESUBMIT_NEW_CTX );#undef test_each_legcy_ring igt_subtest("spin-all") -spin_all (fd,0 ); +spin_all (fd, ctx,0 ); igt_subtest("spin-all-new") -spin_all (fd,PARALLEL_SPIN_NEW_CTX ); +spin_all (fd, ctx,PARALLEL_SPIN_NEW_CTX );#define test_each_engine (test) \ igt_subtest_with_dynamic(test) \ - __for_each_physical_engine(fd, e2) \ + for_each_ctx_engine(fd, ctx, e2) \ igt_dynamic_f("%s", e2->name) test_each_engine("engines") -spin (fd, e2->flags,0 ,3 ); +spin (fd, ctx, e2->flags,0 ,3 ); test_each_engine("resubmit") -spin_resubmit (fd, e2->flags,0 ); +spin_resubmit (fd, ctx, e2->flags,0 ); test_each_engine("resubmit-new") -spin_resubmit (fd, e2->flags,RESUBMIT_NEW_CTX ); +spin_resubmit (fd, ctx, e2->flags, +RESUBMIT_NEW_CTX ); test_each_engine("resubmit-all") -spin_resubmit (fd, e2->flags,RESUBMIT_ALL_ENGINES ); +spin_resubmit (fd, ctx, e2->flags, +RESUBMIT_ALL_ENGINES ); test_each_engine("resubmit-new-all") -spin_resubmit (fd, e2->flags, +spin_resubmit (fd, ctx, e2->flags,RESUBMIT_NEW_CTX |RESUBMIT_ALL_ENGINES );#undef test_each_engine igt_subtest("spin-each") -spin_on_all_engines (fd,0 ,3 ); +spin_on_all_engines (fd, ctx,0 ,3 ); igt_subtest("user-each") {igt_require (has_userptr (fd)); -spin_on_all_engines (fd,IGT_SPIN_USERPTR ,3 ); +spin_on_all_engines (fd, ctx,IGT_SPIN_USERPTR ,3 ); } igt_fixture {igt_stop_hang_detector (); +intel_ctx_destroy (fd, ctx);close (fd); } }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 30/89 tests/i915/gem_exec_store: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_exec_store.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-)
tests/i915/gem_exec_store.c +22 -14
@@ -36,7 +36,8 @@#define ENGINE_MASK (I915_EXEC_RING_MASK | I915_EXEC_BSD_MASK) -static void store_dword (int fd,const struct intel_execution_engine2 *e) +static void store_dword (int fd,const intel_ctx_t *ctx, +const struct intel_execution_engine2 *e) {const unsigned int gen =intel_gen (intel_get_drm_devid (fd));struct drm_i915_gem_exec_object2 obj[2 ];
@@ -52,6 +53,7 @@ static void store_dword(int fd, const struct intel_execution_engine2 *e) execbuf.flags = e->flags;if (gen >3 && gen <6 ) execbuf.flags |=I915_EXEC_SECURE ; + execbuf.rsvd1 = ctx->id;memset (obj,0 ,sizeof (obj)); obj[0 ].handle =gem_create (fd,4096 );
@@ -93,7 +95,8 @@ static void store_dword(int fd, const struct intel_execution_engine2 *e) }#define PAGES 1 -static void store_cachelines (int fd,const struct intel_execution_engine2 *e, +static void store_cachelines (int fd,const intel_ctx_t *ctx, +const struct intel_execution_engine2 *e,unsigned int flags) {const unsigned int gen =intel_gen (intel_get_drm_devid (fd));
@@ -113,6 +116,7 @@ static void store_cachelines(int fd, const struct intel_execution_engine2 *e, execbuf.flags = e->flags;if (gen >3 && gen <6 ) execbuf.flags |=I915_EXEC_SECURE ; + execbuf.rsvd1 = ctx->id; obj =calloc (execbuf.buffer_count,sizeof (*obj));igt_assert (obj);
@@ -170,7 +174,7 @@ static void store_cachelines(int fd, const struct intel_execution_engine2 *e,igt_assert_eq (intel_detect_and_clear_missed_interrupts (fd),0 ); } -static void store_all (int fd) +static void store_all (int fd,const intel_ctx_t *ctx) {const unsigned int gen =intel_gen (intel_get_drm_devid (fd));struct drm_i915_gem_exec_object2 obj[2 ];
@@ -185,7 +189,7 @@ static void store_all(int fd)int i, j; nengine =0 ; -__for_each_physical_engine (fd, engine) { +for_each_ctx_engine (fd, ctx, engine) {if (!gem_class_can_store_dword (fd, engine->class))continue ; nengine++;
@@ -206,6 +210,7 @@ static void store_all(int fd) execbuf.buffer_count =2 ;if (gen <6 ) execbuf.flags |=I915_EXEC_SECURE ; + execbuf.rsvd1 = ctx->id;memset (obj,0 ,sizeof (obj)); obj[0 ].handle =gem_create (fd, nengine*sizeof (uint32_t ));
@@ -231,7 +236,7 @@ static void store_all(int fd) nengine =0 ;intel_detect_and_clear_missed_interrupts (fd); -__for_each_physical_engine (fd, engine) { +for_each_ctx_engine (fd, ctx, engine) {if (!gem_class_can_store_dword (fd, engine->class))continue ;
@@ -322,14 +327,15 @@ static int print_welcome(int fd)return ffs (info->gen); } -#define test_each_engine (T , i915, e) \ - igt_subtest_with_dynamic(T) __for_each_physical_engine(i915, e) \ +#define test_each_engine (T , i915, ctx, e) \ + igt_subtest_with_dynamic(T) for_each_ctx_engine(i915, ctx, e) \ for_each_if(gem_class_can_store_dword(i915, (e)->class)) \ igt_dynamic_f("%s", (e)->name) igt_main {const struct intel_execution_engine2 *e; +const intel_ctx_t *ctx =NULL ;int fd; igt_fixture {
@@ -342,24 +348,26 @@ igt_mainigt_device_set_master (fd);igt_require_gem (fd); + ctx =intel_ctx_create_all_physical (fd);igt_fork_hang_detector (fd); } igt_subtest("basic") -store_all (fd); +store_all (fd, ctx); - test_each_engine("dword", fd, e) -store_dword (fd, e); + test_each_engine("dword", fd, ctx, e) +store_dword (fd, ctx, e); - test_each_engine("cachelines", fd, e) -store_cachelines (fd, e,0 ); + test_each_engine("cachelines", fd, ctx, e) +store_cachelines (fd, ctx, e,0 ); - test_each_engine("pages", fd, e) -store_cachelines (fd, e,PAGES ); + test_each_engine("pages", fd, ctx, e) +store_cachelines (fd, ctx, e,PAGES ); igt_fixture {igt_stop_hang_detector (); +intel_ctx_destroy (fd, ctx);close (fd); } }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 31/89 tests/amdgpu/amd_prime: Convert to intel_ctx_t
In reply to Jason EkstrandWritten totally blind but I'm pretty sure it's right.
--- tests/amdgpu/amd_prime.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
tests/amdgpu/amd_prime.c +7 -3
@@ -172,6 +172,7 @@ static void unplug(struct cork *c)static void i915_to_amd (int i915,int amd,amdgpu_device_handle device) {const uint32_t bbe =MI_BATCH_BUFFER_END ; +intel_ctx_cfg_t cfg;struct drm_i915_gem_exec_object2 obj[2 ];struct drm_i915_gem_execbuffer2 execbuf;const struct intel_execution_engine2 *e;
@@ -180,8 +181,10 @@ static void i915_to_amd(int i915, int amd, amdgpu_device_handle device)unsigned long count;struct cork c; + cfg =intel_ctx_cfg_all_physical (i915); + nengine =0 ; -__for_each_physical_engine (i915, e) +for_each_ctx_cfg_engine (i915, &cfg, e) engines[nengine++] = e->flags;igt_require (nengine);
@@ -198,14 +201,15 @@ static void i915_to_amd(int i915, int amd, amdgpu_device_handle device) count =0 ; igt_until_timeout(5) { - execbuf.rsvd1 =gem_context_clone_with_engines (i915,0 ); +const intel_ctx_t *ctx =intel_ctx_create (i915, &cfg); + execbuf.rsvd1 = ctx->id;for (unsigned n =0 ; n < nengine; n++) { execbuf.flags = engines[n];gem_execbuf (i915, &execbuf); } -gem_context_destroy (i915, execbuf.rsvd1); +intel_ctx_destroy (i915, ctx); count++;if (!gem_uses_full_ppgtt (i915))
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 32/89 tests/i915/i915_hangman: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/i915_hangman.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-)
tests/i915/i915_hangman.c +22 -15
@@ -204,7 +204,7 @@ static void check_error_state(const char *expected_ring_name,igt_assert (found); } -static void test_error_state_capture (unsigned ring_id, +static void test_error_state_capture (const intel_ctx_t *ctx,unsigned ring_id,const char *ring_name) {uint32_t *batch;
@@ -213,7 +213,7 @@ static void test_error_state_capture(unsigned ring_id,clear_error_state (); - hang =igt_hang_ctx (device,0 , ring_id,HANG_ALLOW_CAPTURE ); + hang =igt_hang_ctx (device, ctx->id, ring_id,HANG_ALLOW_CAPTURE ); offset = hang.spin->obj[IGT_SPIN_BATCH ].offset; batch =gem_mmap__cpu (device, hang.spin->handle,0 ,4096 ,PROT_READ );
@@ -226,32 +226,34 @@ static void test_error_state_capture(unsigned ring_id, } static void -test_engine_hang(const struct intel_execution_engine2 *e, unsigned int flags) +test_engine_hang(const intel_ctx_t *ctx, + const struct intel_execution_engine2 *e, unsigned int flags) { const struct intel_execution_engine2 *other; + const intel_ctx_t *tmp_ctx; igt_spin_t *spin, *next; IGT_LIST_HEAD(list); - uint32_t ctx; igt_skip_on(flags & IGT_SPIN_INVALID_CS && gem_has_cmdparser(device, e->flags)); /* Fill all the other engines with background load */ - __for_each_physical_engine(device, other) { + for_each_ctx_engine(device, ctx, other) { if (other->flags == e->flags) continue; - ctx = gem_context_clone_with_engines(device, 0); - spin = __igt_spin_new(device, ctx, + tmp_ctx = intel_ctx_create(device, &ctx->cfg); + spin = __igt_spin_new(device, .ctx = tmp_ctx, .engine = other->flags, .flags = IGT_SPIN_FENCE_OUT); - gem_context_destroy(device, ctx); + intel_ctx_destroy(device, tmp_ctx); igt_list_move(&spin->link, &list); } /* And on the target engine, we hang */ spin = igt_spin_new(device, + .ctx = ctx, .engine = e->flags, .flags = (IGT_SPIN_FENCE_OUT | IGT_SPIN_NO_PREEMPTION |
@@ -310,13 +312,16 @@ static void hangcheck_unterminated(void) igt_main {const struct intel_execution_engine2 *e; +const intel_ctx_t *ctx =NULL ;igt_hang_t hang = {}; igt_fixture { device =drm_open_driver (DRIVER_INTEL );igt_require_gem (device); - hang =igt_allow_hang (device,0 ,HANG_ALLOW_CAPTURE ); + ctx =intel_ctx_create_all_physical (device); + + hang =igt_allow_hang (device, ctx->id,HANG_ALLOW_CAPTURE ); sysfs =igt_sysfs_open (device);igt_assert (sysfs !=-1 );
@@ -328,9 +333,9 @@ igt_maintest_error_state_basic (); igt_subtest_with_dynamic("error-state-capture") { -__for_each_physical_engine (device, e) { +for_each_ctx_engine (device, ctx, e) { igt_dynamic_f("%s", e->name) -test_error_state_capture (e->flags, e->name); +test_error_state_capture (ctx, e->flags, e->name); } }
@@ -346,9 +351,9 @@ igt_mainioctl (device,DRM_IOCTL_I915_GETPARAM , &gp);igt_require (has_gpu_reset >1 ); -__for_each_physical_engine (device, e) { +for_each_ctx_engine (device, ctx, e) { igt_dynamic_f("%s", e->name) -test_engine_hang (e,0 ); +test_engine_hang (ctx, e,0 ); } }
@@ -363,9 +368,9 @@ igt_mainioctl (device,DRM_IOCTL_I915_GETPARAM , &gp);igt_require (has_gpu_reset >1 ); -__for_each_physical_engine (device, e) { +for_each_ctx_engine (device, ctx, e) { igt_dynamic_f("%s", e->name) -test_engine_hang (e,IGT_SPIN_INVALID_CS ); +test_engine_hang (ctx, e,IGT_SPIN_INVALID_CS ); } }
@@ -374,5 +379,7 @@ igt_main igt_fixture {igt_disallow_hang (device, hang); +intel_ctx_destroy (device, ctx); +close (device); } }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 33/89 tests/i915/gem_ringfill: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_ringfill.c | 48 +++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 20 deletions(-)
tests/i915/gem_ringfill.c +28 -20
@@ -93,7 +93,7 @@ static void fill_ring(int fd, } } -static void setup_execbuf(int fd, +static void setup_execbuf(int fd, const intel_ctx_t *ctx, struct drm_i915_gem_execbuffer2 *execbuf, struct drm_i915_gem_exec_object2 *obj, struct drm_i915_gem_relocation_entry *reloc,
@@ -114,6 +114,8 @@ static void setup_execbuf(int fd,if (gen >3 && gen <6 ) execbuf->flags |=I915_EXEC_SECURE ; + execbuf->rsvd1 = ctx->id; + obj[0 ].handle =gem_create (fd,4096 );gem_write (fd, obj[0 ].handle,0 , &bbe,sizeof (bbe)); execbuf->buffer_count =1 ;
@@ -167,7 +169,8 @@ static void setup_execbuf(int fd,check_bo (fd, obj[0 ].handle); } -static void run_test (int fd,unsigned ring,unsigned flags,unsigned timeout) +static void run_test (int fd,const intel_ctx_t *ctx,unsigned ring, +unsigned flags,unsigned timeout) {struct drm_i915_gem_exec_object2 obj[2 ];struct drm_i915_gem_relocation_entry reloc[1024 ];
@@ -175,15 +178,15 @@ static void run_test(int fd, unsigned ring, unsigned flags, unsigned timeout)igt_hang_t hang;if (flags & (SUSPEND |HIBERNATE )) { -run_test (fd, ring,0 ,0 ); +run_test (fd, ctx, ring,0 ,0 );gem_quiescent_gpu (fd); } -setup_execbuf (fd, &execbuf, obj, reloc, ring); +setup_execbuf (fd, ctx, &execbuf, obj, reloc, ring);memset (&hang,0 ,sizeof (hang));if (flags &HANG ) - hang =igt_hang_ring (fd, ring & ~(3 <<13 )); + hang =igt_hang_ctx (fd, ctx->id, ring & ~(3 <<13 ),0 );if (flags & (CHILD |FORKED |BOMB )) {int nchild;
@@ -197,16 +200,19 @@ static void run_test(int fd, unsigned ring, unsigned flags, unsigned timeout)igt_debug ("Forking %d children\n" , nchild); igt_fork(child, nchild) { +const intel_ctx_t *child_ctx =NULL ;if (flags &NEWFD ) {int this; this =gem_reopen_driver (fd); -gem_context_copy_engines (fd,0 , this,0 ); + child_ctx =intel_ctx_create (fd, &ctx->cfg); fd = this; -setup_execbuf (fd, &execbuf, obj, reloc, ring); +setup_execbuf (fd, child_ctx, &execbuf, obj, reloc, ring); }fill_ring (fd, &execbuf, flags, timeout); +if (child_ctx) +intel_ctx_destroy (fd, child_ctx); }if (flags &SUSPEND )
@@ -234,7 +240,7 @@ static void run_test(int fd, unsigned ring, unsigned flags, unsigned timeout)if (flags & (SUSPEND |HIBERNATE )) {gem_quiescent_gpu (fd); -run_test (fd, ring,0 ,0 ); +run_test (fd, ctx, ring,0 ,0 ); } }
@@ -285,6 +291,7 @@ igt_main { NULL } }, *m;bool master = false; +const intel_ctx_t *ctx;int fd =-1 ; igt_fixture {
@@ -304,22 +311,20 @@ igt_main ring_size =gem_measure_ring_inflight (fd,ALL_ENGINES ,0 );igt_info ("Ring size: %d batches\n" , ring_size);igt_require (ring_size); + + ctx =intel_ctx_create_all_physical (fd); }/* Legacy path for selecting "rings". */ for (m = modes; m->suffix; m++) { igt_subtest_with_dynamic_f("legacy-%s", m->suffix) { -const struct intel_execution_ring *e; -igt_skip_on (m->flags &NEWFD && master); -for (e = intel_execution_rings; e->name; e++) { -if (!gem_has_ring (fd,eb_ring (e))) -continue ; - +for_each_ring (e, fd) { igt_dynamic_f("%s", e->name) {igt_require (gem_can_store_dword (fd,eb_ring (e))); -run_test (fd,eb_ring (e), +run_test (fd,intel_ctx_0 (fd), +eb_ring (e), m->flags, m->timeout);gem_quiescent_gpu (fd);
@@ -334,12 +339,13 @@ igt_mainconst struct intel_execution_engine2 *e;igt_skip_on (m->flags &NEWFD && master); -__for_each_physical_engine (fd, e) { +for_each_ctx_engine (fd, ctx, e) {if (!gem_class_can_store_dword (fd, e->class))continue ; igt_dynamic_f("%s", e->name) { -run_test (fd, e->flags, +run_test (fd, ctx, + e->flags, m->flags, m->timeout);gem_quiescent_gpu (fd);
@@ -351,17 +357,19 @@ igt_main igt_subtest("basic-all") {const 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 ; igt_fork(child, 1) -run_test (fd, e->flags,0 ,1 ); +run_test (fd, ctx, e->flags,0 ,1 ); }igt_waitchildren (); } -igt_fixture + igt_fixture { +intel_ctx_destroy (fd, ctx);close (fd); + } }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 34/89 tests/prime_busy: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/prime_busy.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
tests/prime_busy.c +12 -7
@@ -39,7 +39,7 @@ static bool prime_busy(struct pollfd *pfd, bool excl)#define HANG 0x4#define POLL 0x8 -static void busy (int fd,unsigned ring,unsigned flags) +static void busy (int fd,const intel_ctx_t *ctx,unsigned ring,unsigned flags) {const int gen =intel_gen (intel_get_drm_devid (fd));const uint32_t _bbe =MI_BATCH_BUFFER_END ;
@@ -62,6 +62,7 @@ static void busy(int fd, unsigned ring, unsigned flags) execbuf.flags = ring;if (gen <6 ) execbuf.flags |=I915_EXEC_SECURE ; + execbuf.rsvd1 = ctx->id;memset (obj,0 ,sizeof (obj)); obj[SCRATCH ].handle =gem_create (fd,4096 );
@@ -185,7 +186,7 @@ static void busy(int fd, unsigned ring, unsigned flags)close (pfd[SCRATCH ].fd); } -static void test_mode (int fd,unsigned int flags) +static void test_mode (int fd,const intel_ctx_t *ctx,unsigned int flags) {const struct intel_execution_engine2 *e;igt_hang_t hang = {};
@@ -195,7 +196,7 @@ static void test_mode(int fd, unsigned int flags)else hang =igt_allow_hang (fd,0 ,0 ); -__for_each_physical_engine (fd, e) { +for_each_ctx_engine (fd, ctx, e) {if (!gem_class_can_store_dword (fd, e->class))continue ;
@@ -203,7 +204,7 @@ static void test_mode(int fd, unsigned int flags)continue ; igt_dynamic_f("%s", e->name) -busy (fd, e->flags, flags); +busy (fd, ctx, e->flags, flags); }if ((flags &HANG ) ==0 )
@@ -214,11 +215,13 @@ static void test_mode(int fd, unsigned int flags) igt_main { +const intel_ctx_t *ctx;int fd =-1 ; igt_fixture { fd =drm_open_driver_master (DRIVER_INTEL );igt_require_gem (fd); + ctx =intel_ctx_create_all_physical (fd); } igt_subtest_group {
@@ -237,13 +240,15 @@ igt_mainfor (const struct mode *m = modes; m->name; m++) { igt_subtest_with_dynamic(m->name) -test_mode (fd, m->flags); +test_mode (fd, ctx, m->flags); igt_subtest_with_dynamic_f("%s-wait", m->name) -test_mode (fd, m->flags |POLL ); +test_mode (fd, ctx, m->flags |POLL ); } } -igt_fixture + igt_fixture { +intel_ctx_destroy (fd, ctx);close (fd); + } }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 35/89 tests/prime_vgem: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/prime_vgem.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-)
tests/prime_vgem.c +21 -14
@@ -558,7 +558,7 @@ static bool prime_busy(int fd, bool excl)return poll (&pfd,1 ,0 ) ==0 ; } -static void work (int i915,int dmabuf,unsigned ring) +static void work (int i915,int dmabuf,const intel_ctx_t *ctx,unsigned ring) {const int SCRATCH =0 ;const int BATCH =1 ;
@@ -577,6 +577,7 @@ static void work(int i915, int dmabuf, unsigned ring) execbuf.flags = ring;if (gen <6 ) execbuf.flags |=I915_EXEC_SECURE ; + execbuf.rsvd1 = ctx->id;memset (obj,0 ,sizeof (obj)); obj[SCRATCH ].handle =prime_fd_to_handle (i915, dmabuf);
@@ -653,7 +654,7 @@ static void work(int i915, int dmabuf, unsigned ring)igt_assert (read_busy && write_busy); } -static void test_busy (int i915,int vgem,unsigned ring) +static void test_busy (int i915,int vgem,const intel_ctx_t *ctx,unsigned ring) {struct vgem_bo scratch;struct timespec tv;
@@ -667,7 +668,7 @@ static void test_busy(int i915, int vgem, unsigned ring)vgem_create (vgem, &scratch); dmabuf =prime_handle_to_fd (vgem, scratch.handle); -work (i915, dmabuf, ring); +work (i915, dmabuf, ctx, ring);/* Calling busy in a loop should be enough to flush the rendering */ memset (&tv,0 ,sizeof (tv));
@@ -683,7 +684,7 @@ static void test_busy(int i915, int vgem, unsigned ring)close (dmabuf); } -static void test_wait (int i915,int vgem,unsigned ring) +static void test_wait (int i915,int vgem,const intel_ctx_t *ctx,unsigned ring) {struct vgem_bo scratch;struct pollfd pfd;
@@ -696,7 +697,7 @@ static void test_wait(int i915, int vgem, unsigned ring)vgem_create (vgem, &scratch); pfd.fd =prime_handle_to_fd (vgem, scratch.handle); -work (i915, pfd.fd, ring); +work (i915, pfd.fd, ctx, ring); pfd.events =POLLIN ;igt_assert_eq (poll (&pfd,1 ,10000 ),1 );
@@ -710,7 +711,7 @@ static void test_wait(int i915, int vgem, unsigned ring)close (pfd.fd); } -static void test_sync (int i915,int vgem,unsigned ring) +static void test_sync (int i915,int vgem,const intel_ctx_t *ctx,unsigned ring) {struct vgem_bo scratch;uint32_t *ptr;
@@ -727,7 +728,7 @@ static void test_sync(int i915, int vgem, unsigned ring)igt_assert (ptr !=MAP_FAILED );gem_close (vgem, scratch.handle); -work (i915, dmabuf, ring); +work (i915, dmabuf, ctx, ring);prime_sync_start (dmabuf, false);for (i =0 ; i <1024 ; i++)
@@ -738,7 +739,7 @@ static void test_sync(int i915, int vgem, unsigned ring)munmap (ptr, scratch.size); } -static void test_fence_wait (int i915,int vgem,unsigned ring) +static void test_fence_wait (int i915,int vgem,const intel_ctx_t *ctx,unsigned ring) {struct vgem_bo scratch;uint32_t fence;
@@ -759,7 +760,7 @@ static void test_fence_wait(int i915, int vgem, unsigned ring)igt_assert (ptr !=MAP_FAILED ); igt_fork(child, 1) -work (i915, dmabuf, ring); +work (i915, dmabuf, ctx, ring);sleep (1 );
@@ -799,7 +800,7 @@ static void test_fence_hang(int i915, int vgem, unsigned flags)igt_assert (ptr !=MAP_FAILED );gem_close (vgem, scratch.handle); -work (i915, dmabuf,0 ); +work (i915, dmabuf,0 ,0 );/* The work should have been cancelled */
@@ -1041,12 +1042,15 @@ static void test_flip(int i915, int vgem, unsigned hang) }static void test_each_engine (const char *name,int vgem,int i915, -void (*fn)(int i915,int vgem,unsigned int flags)) +void (*fn)(int i915,int vgem, +const intel_ctx_t *ctx, +unsigned int flags)) {const struct intel_execution_engine2 *e; +const intel_ctx_t *ctx =intel_ctx_create_all_physical (i915);igt_subtest_with_dynamic (name) { -__for_each_physical_engine (i915, e) { +for_each_ctx_engine (i915, ctx, e) {if (!gem_class_can_store_dword (i915, e->class))continue ;
@@ -1055,10 +1059,12 @@ static void test_each_engine(const char *name, int vgem, int i915, igt_dynamic_f("%s", e->name) {gem_quiescent_gpu (i915); -fn (i915, vgem, e->flags); +fn (i915, vgem, ctx, e->flags); } } } + +intel_ctx_destroy (i915, ctx); } igt_main
@@ -1109,7 +1115,8 @@ igt_main {static const struct {const char *name; -void (*fn)(int i915,int vgem,unsigned int engine); +void (*fn)(int i915,int vgem,const intel_ctx_t *ctx, +unsigned int engine); } tests[] = { {"sync" , test_sync }, {"busy" , test_busy },
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 36/89 tests/gem_exec_whisper: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_exec_whisper.c | 83 +++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 29 deletions(-)
tests/i915/gem_exec_whisper.c +54 -29
@@ -28,12 +28,14 @@*/ #include "i915/gem.h" +#include "i915/gem_vm.h" #include "igt.h" #include "igt_debugfs.h" #include "igt_rapl.h" #include "igt_gt.h" #include "igt_rand.h" #include "igt_sysfs.h" +#include "intel_ctx.h" #define ENGINE_MASK (I915_EXEC_RING_MASK | I915_EXEC_BSD_MASK)
@@ -81,13 +83,14 @@ static void verify_reloc(int fd, uint32_t handle,#define BASIC 0x400struct hang { +const intel_ctx_t *ctx;struct drm_i915_gem_exec_object2 obj;struct drm_i915_gem_relocation_entry reloc;struct drm_i915_gem_execbuffer2 execbuf;int fd; }; -static void init_hang (struct hang *h,int fd) +static void init_hang (struct hang *h,int fd,const intel_ctx_cfg_t *cfg) {uint32_t *batch;int i, gen;
@@ -97,6 +100,13 @@ static void init_hang(struct hang *h, int fd) gen =intel_gen (intel_get_drm_devid (h->fd)); +if (gem_has_contexts (fd)) { + h->ctx =intel_ctx_create (h->fd, cfg); + h->execbuf.rsvd1 = h->ctx->id; + }else { + h->ctx =NULL ; + } +memset (&h->execbuf,0 ,sizeof (h->execbuf)); h->execbuf.buffers_ptr =to_user_pointer (&h->obj); h->execbuf.buffer_count =1 ;
@@ -156,6 +166,7 @@ static void submit_hang(struct hang *h, unsigned *engines, int nengine, unsignedstatic void fini_hang (struct hang *h) { +intel_ctx_destroy (h->fd, h->ctx);close (h->fd); }
@@ -165,7 +176,8 @@ static void ctx_set_random_priority(int fd, uint32_t ctx)gem_context_set_priority (fd, ctx, prio); } -static void whisper (int fd,unsigned engine,unsigned flags) +static void whisper (int fd,const intel_ctx_t *ctx, +unsigned engine,unsigned flags) {const uint32_t bbe =MI_BATCH_BUFFER_END ;const unsigned int gen =intel_gen (intel_get_drm_devid (fd));
@@ -179,7 +191,8 @@ static void whisper(int fd, unsigned engine, unsigned flags)const struct intel_execution_engine2 *e;struct hang hang;int fds[64 ]; -uint32_t contexts[64 ]; +intel_ctx_cfg_t local_cfg; +const intel_ctx_t *contexts[64 ];unsigned nengine;uint32_t batch[16 ];unsigned int relocations =0 ;
@@ -203,7 +216,7 @@ static void whisper(int fd, unsigned engine, unsigned flags) nengine =0 ;if (engine ==ALL_ENGINES ) { -__for_each_physical_engine (fd, e) { +for_each_ctx_engine (fd, ctx, e) {if (gem_class_can_store_dword (fd, e->class)) engines[nengine++] = e->flags; }
@@ -220,10 +233,10 @@ static void whisper(int fd, unsigned engine, unsigned flags)gem_require_contexts (fd);if (flags &QUEUES ) -igt_require (gem_has_queues (fd)); +igt_require (gem_has_vm (fd));if (flags &HANG ) -init_hang (&hang, fd); +init_hang (&hang, fd, &ctx->cfg); nchild =1 ;if (flags &FORKED )
@@ -272,6 +285,7 @@ static void whisper(int fd, unsigned engine, unsigned flags) execbuf.flags |=I915_EXEC_NO_RELOC ;if (gen <6 ) execbuf.flags |=I915_EXEC_SECURE ; + execbuf.rsvd1 = ctx->id;igt_require (__gem_execbuf (fd, &execbuf) ==0 ); scratch = tmp[0 ]; store = tmp[1 ];
@@ -293,18 +307,20 @@ static void whisper(int fd, unsigned engine, unsigned flags)igt_assert (loc ==sizeof (uint32_t ) * i); batch[++i] =MI_BATCH_BUFFER_END ; -if (flags &CONTEXTS ) { -for (n =0 ; n <64 ; n++) - contexts[n] =gem_context_clone_with_engines (fd,0 ); - } -if (flags &QUEUES ) { -for (n =0 ; n <64 ; n++) - contexts[n] =gem_queue_create (fd); - }if (flags &FDS ) {for (n =0 ; n <64 ; n++) { fds[n] =gem_reopen_driver (fd); -gem_context_copy_engines (fd,0 , fds[n],0 ); + } + } +if (flags & (CONTEXTS |QUEUES |FDS )) { + local_cfg = ctx->cfg; +if (flags &QUEUES ) { +igt_assert (!(flags &FDS )); + local_cfg.vm =gem_vm_create (fd); + } +for (n =0 ; n <64 ; n++) { +int this_fd = (flags &FDS ) ? fds[n] : fd; + contexts[n] =intel_ctx_create (this_fd, &local_cfg); } }
@@ -413,8 +429,8 @@ static void whisper(int fd, unsigned engine, unsigned flags) execbuf.flags &= ~ENGINE_MASK ; execbuf.flags |= engines[rand () % nengine]; } -if (flags & (CONTEXTS |QUEUES )) { - execbuf.rsvd1 = contexts[rand () %64 ]; +if (flags & (CONTEXTS |QUEUES |FDS )) { + execbuf.rsvd1 = contexts[rand () %64 ]->id;if (flags &PRIORITY )ctx_set_random_priority (this_fd, execbuf.rsvd1); }
@@ -442,7 +458,7 @@ static void whisper(int fd, unsigned engine, unsigned flags) } } execbuf.flags &= ~ENGINE_MASK ; - execbuf.rsvd1 =0 ; + execbuf.rsvd1 = ctx->id; execbuf.buffers_ptr =to_user_pointer (&tmp); tmp[0 ] = tmp[1 ];
@@ -492,16 +508,22 @@ static void whisper(int fd, unsigned engine, unsigned flags)gem_close (fd, scratch.handle);gem_close (fd, store.handle); +if (flags & (CONTEXTS |QUEUES |FDS )) { +for (n =0 ; n <64 ; n++) { +int this_fd = (flags &FDS ) ? fds[n] : fd; +intel_ctx_destroy (this_fd, contexts[n]); + } +if (local_cfg.vm) { +igt_assert (!(flags &FDS )); +gem_vm_destroy (fd, local_cfg.vm); + } + } +for (n =0 ; n <QLEN ; n++) +gem_close (fd, batches[n].handle);if (flags &FDS ) {for (n =0 ; n <64 ; n++)close (fds[n]); } -if (flags & (CONTEXTS |QUEUES )) { -for (n =0 ; n <64 ; n++) -gem_context_destroy (fd, contexts[n]); - } -for (n =0 ; n <QLEN ; n++) -gem_close (fd, batches[n].handle); }igt_waitchildren ();
@@ -554,6 +576,7 @@ igt_main { NULL } };const struct intel_execution_engine2 *e; +const intel_ctx_t *ctx;int fd =-1 ; igt_fixture {
@@ -561,6 +584,7 @@ igt_mainigt_require_gem (fd);igt_require (gem_can_store_dword (fd,0 ));gem_submission_print_method (fd); + ctx =intel_ctx_create_all_physical (fd);igt_fork_hang_detector (fd); }
@@ -568,10 +592,10 @@ igt_mainfor (const struct mode *m = modes; m->name; m++) {igt_subtest_f ("%s%s" , m->flags & BASIC ? "basic-" : "", m->name) -whisper (fd,ALL_ENGINES , m->flags); +whisper (fd, ctx,ALL_ENGINES , m->flags);igt_subtest_f ("%s%s-all" , m->flags & BASIC ? "basic-" : "", m->name) -whisper (fd,ALL_ENGINES , m->flags |ALL ); +whisper (fd, ctx,ALL_ENGINES , m->flags |ALL ); }for (const struct mode *m = modes; m->name; m++) {
@@ -579,12 +603,12 @@ igt_maincontinue ; igt_subtest_with_dynamic_f("%s", m->name) { -__for_each_physical_engine (fd, e) { +for_each_ctx_engine (fd, ctx, e) {if (!gem_class_can_store_dword (fd, e->class))continue ; igt_dynamic_f("%s", e->name) -whisper (fd, e->flags, m->flags); +whisper (fd, ctx, e->flags, m->flags); } } }
@@ -598,11 +622,12 @@ igt_mainif (m->flags &INTERRUPTIBLE )continue ; igt_subtest_f("hang-%s", m->name) -whisper (fd,ALL_ENGINES , m->flags |HANG ); +whisper (fd, ctx,ALL_ENGINES , m->flags |HANG ); } } igt_fixture { +intel_ctx_destroy (fd, ctx);close (fd); } }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 37/89 tests/i915/gem_ctx_exec: Stop cloning contexts in close_race
In reply to Jason EkstrandNothing in this subtest sets the set of engines on ctx0 so there's no point in cloning them.
--- tests/i915/gem_ctx_exec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
tests/i915/gem_ctx_exec.c +2 -3
@@ -350,7 +350,7 @@ static void close_race(int i915)igt_assert (contexts !=MAP_FAILED );for (int child =0 ; child < ncpus; child++) - contexts[child] =gem_context_clone_with_engines (i915,0 ); + contexts[child] =gem_context_create (i915); igt_fork(child, ncpus) { spin = __igt_spin_new(i915, .flags = IGT_SPIN_POLL_RUN);
@@ -404,8 +404,7 @@ static void close_race(int i915)*/ for (int child =0 ; child < ncpus; child++) {gem_context_destroy (i915, contexts[child]); - contexts[child] = -gem_context_clone_with_engines (i915,0 ); + contexts[child] =gem_context_create (i915); }usleep (1000 +hars_petruska_f54_1_random_unsafe () %2000 ); }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 38/89 tests/i915/gem_ctx_exec: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_ctx_exec.c | 51 ++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 20 deletions(-)
tests/i915/gem_ctx_exec.c +31 -20
@@ -267,7 +267,7 @@ static void nohangcheck_hostile(int i915)const struct intel_execution_engine2 *e;igt_hang_t hang;int fence =-1 ; -uint32_t ctx; +const intel_ctx_t *ctx;int err =0 ;int dir;
@@ -281,12 +281,12 @@ static void nohangcheck_hostile(int i915) dir =igt_params_open (i915);igt_require (dir !=-1 ); - ctx =gem_context_create (i915); - hang =igt_allow_hang (i915, ctx,0 ); + ctx =intel_ctx_create_all_physical (i915); + hang =igt_allow_hang (i915, ctx->id,0 );igt_require (__enable_hangcheck (dir, false)); -____for_each_physical_engine (i915, ctx, e) { +for_each_ctx_engine (i915, ctx, e) {igt_spin_t *spin;int new;
@@ -294,7 +294,7 @@ static void nohangcheck_hostile(int i915)gem_engine_property_printf (i915, e->name,"preempt_timeout_ms" ,"%d" ,50 ); - spin =__igt_spin_new (i915, ctx, + spin = __igt_spin_new(i915, .ctx = ctx, .engine = e->flags, .flags = (IGT_SPIN_NO_PREEMPTION |IGT_SPIN_FENCE_OUT ));
@@ -315,7 +315,7 @@ static void nohangcheck_hostile(int i915) fence = tmp; } } -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx);igt_assert (fence !=-1 );if (sync_fence_wait (fence,MSEC_PER_SEC )) {/* 640ms preempt-timeout */
@@ -340,30 +340,38 @@ static void nohangcheck_hostile(int i915)static void close_race (int i915) {const int ncpus =sysconf (_SC_NPROCESSORS_ONLN); -uint32_t *contexts; +const intel_ctx_t *base_ctx; +const intel_ctx_t **ctx; +uint32_t *ctx_id;igt_spin_t *spin;/* Check we can execute a polling spinner */ - igt_spin_free(i915, igt_spin_new(i915, .flags = IGT_SPIN_POLL_RUN)); + base_ctx =intel_ctx_create (i915,NULL ); + igt_spin_free(i915, igt_spin_new(i915, .ctx = base_ctx, + .flags =IGT_SPIN_POLL_RUN )); - contexts =mmap (NULL ,4096 ,PROT_WRITE ,MAP_SHARED |MAP_ANON ,-1 ,0 ); -igt_assert (contexts !=MAP_FAILED ); + ctx =calloc (ncpus,sizeof (*ctx)); + ctx_id =mmap (NULL ,4096 ,PROT_WRITE ,MAP_SHARED |MAP_ANON ,-1 ,0 ); +igt_assert (ctx_id !=MAP_FAILED ); -for (int child =0 ; child < ncpus; child++) - contexts[child] =gem_context_create (i915); +for (int child =0 ; child < ncpus; child++) { + ctx[child] =intel_ctx_create (i915,NULL ); + ctx_id[child] = ctx[child]->id; + } igt_fork(child, ncpus) { - spin = __igt_spin_new(i915, .flags = IGT_SPIN_POLL_RUN); + spin = __igt_spin_new(i915, .ctx = base_ctx, + .flags =IGT_SPIN_POLL_RUN );igt_spin_end (spin);gem_sync (i915, spin->handle); -while (!READ_ONCE (contexts[ncpus])) { +while (!READ_ONCE (ctx_id[ncpus])) {int64_t timeout =1 ;igt_spin_reset (spin);igt_assert (!igt_spin_has_started (spin)); - spin->execbuf.rsvd1 =READ_ONCE (contexts[child]); + spin->execbuf.rsvd1 =READ_ONCE (ctx_id[child]);if (__gem_execbuf (i915, &spin->execbuf))continue ;
@@ -403,19 +411,22 @@ static void close_race(int i915)* and the kernel's context/request handling. */ for (int child =0 ; child < ncpus; child++) { -gem_context_destroy (i915, contexts[child]); - contexts[child] =gem_context_create (i915); +intel_ctx_destroy (i915, ctx[child]); + ctx[child] =intel_ctx_create (i915,NULL ); + ctx_id[child] = ctx[child]->id; }usleep (1000 +hars_petruska_f54_1_random_unsafe () %2000 ); } - contexts[ncpus] =1 ; + ctx_id[ncpus] =1 ;igt_waitchildren (); +intel_ctx_destroy (i915, base_ctx);for (int child =0 ; child < ncpus; child++) -gem_context_destroy (i915, contexts[child]); +intel_ctx_destroy (i915, ctx[child]); -munmap (contexts,4096 ); +free (ctx); +munmap (ctx_id,4096 ); } igt_main
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 39/89 tests/i915/gem_exec_suspend: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_exec_suspend.c | 52 +++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 23 deletions(-)
tests/i915/gem_exec_suspend.c +29 -23
@@ -50,7 +50,8 @@#define CACHED (1<<8)#define HANG (2<<8) -static void run_test (int fd,unsigned engine,unsigned flags); +static void run_test (int fd,const intel_ctx_t *ctx, +unsigned engine,unsigned flags);static void check_bo (int fd,uint32_t handle) {
@@ -65,12 +66,13 @@ static void check_bo(int fd, uint32_t handle)munmap (map,4096 ); } -static void test_all (int fd,unsigned flags) +static void test_all (int fd,const intel_ctx_t *ctx,unsigned flags) { -run_test (fd,ALL_ENGINES , flags & ~0xff ); +run_test (fd, ctx,ALL_ENGINES , flags & ~0xff ); } -static void run_test (int fd,unsigned engine,unsigned flags) +static void run_test (int fd,const intel_ctx_t *ctx, +unsigned engine,unsigned flags) {const unsigned int gen =intel_gen (intel_get_drm_devid (fd));const uint32_t bbe =MI_BATCH_BUFFER_END ;
@@ -85,7 +87,7 @@ static void run_test(int fd, unsigned engine, unsigned flags)if (engine ==ALL_ENGINES ) {const 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)) engines[nengine++] = e->flags; }
@@ -96,7 +98,7 @@ static void run_test(int fd, unsigned engine, unsigned flags)/* Before suspending, check normal operation */ if (mode (flags) !=NOSLEEP ) -test_all (fd, flags); +test_all (fd, ctx, flags);gem_quiescent_gpu (fd);
@@ -106,6 +108,7 @@ static void run_test(int fd, unsigned engine, unsigned flags) execbuf.flags =1 <<11 ;if (gen <6 ) execbuf.flags |=I915_EXEC_SECURE ; + execbuf.rsvd1 = ctx->id;memset (obj,0 ,sizeof (obj)); obj[0 ].handle =gem_create (fd,4096 );
@@ -202,7 +205,7 @@ static void run_test(int fd, unsigned engine, unsigned flags)/* After resume, make sure it still works */ if (mode (flags) !=NOSLEEP ) -test_all (fd, flags); +test_all (fd, ctx, flags); }struct battery_sample {
@@ -229,7 +232,8 @@ static double d_time(const struct battery_sample *after, (after->tv.tv_nsec - before->tv.tv_nsec) * 1e-9); /* s */ } -static void power_test (int i915,unsigned engine,unsigned flags) +static void power_test (int i915,const intel_ctx_t *ctx, +unsigned engine,unsigned flags) {struct battery_sample before, after;char *status;
@@ -249,7 +253,7 @@ static void power_test(int i915, unsigned engine, unsigned flags)igt_set_autoresume_delay (5 *60 );/* 5 minutes; longer == more stable */ igt_assert (get_power (dir, &before)); -run_test (i915, engine, flags); +run_test (i915, ctx, engine, flags);igt_assert (get_power (dir, &after));igt_set_autoresume_delay (0 );
@@ -273,45 +277,47 @@ igt_main }, *m;const struct intel_execution_engine2 *e;igt_hang_t hang; +const intel_ctx_t *ctx;int fd; igt_fixture { fd =drm_open_driver_master (DRIVER_INTEL );igt_require_gem (fd);igt_require (gem_can_store_dword (fd,0 )); + ctx =intel_ctx_create_all_physical (fd);igt_fork_hang_detector (fd); } igt_subtest("basic") -run_test (fd,ALL_ENGINES ,NOSLEEP ); +run_test (fd, ctx,ALL_ENGINES ,NOSLEEP ); igt_subtest("basic-S0") -run_test (fd,ALL_ENGINES ,IDLE ); +run_test (fd, ctx,ALL_ENGINES ,IDLE ); igt_subtest("basic-S3-devices") -run_test (fd,ALL_ENGINES ,SUSPEND_DEVICES ); +run_test (fd, ctx,ALL_ENGINES ,SUSPEND_DEVICES ); igt_subtest("basic-S3") -run_test (fd,ALL_ENGINES ,SUSPEND ); +run_test (fd, ctx,ALL_ENGINES ,SUSPEND ); igt_subtest("basic-S4-devices") -run_test (fd,ALL_ENGINES ,HIBERNATE_DEVICES ); +run_test (fd, ctx,ALL_ENGINES ,HIBERNATE_DEVICES ); igt_subtest("basic-S4") -run_test (fd,ALL_ENGINES ,HIBERNATE ); +run_test (fd, ctx,ALL_ENGINES ,HIBERNATE );for (m = modes; m->suffix; m++) { igt_subtest_with_dynamic_f("uncached%s", m->suffix) { -__for_each_physical_engine (fd, e) { +for_each_ctx_engine (fd, ctx, e) {if (!gem_class_can_store_dword (fd, e->class))continue ; igt_dynamic_f("%s", e->name) -run_test (fd, e->flags, m->mode |UNCACHED ); +run_test (fd, ctx, e->flags, m->mode |UNCACHED ); } } igt_subtest_with_dynamic_f("cached%s", m->suffix) { -__for_each_physical_engine (fd, e) { +for_each_ctx_engine (fd, ctx, e) {if (!gem_class_can_store_dword (fd, e->class))continue ; igt_dynamic_f("%s", e->name) -run_test (fd, e->flags, m->mode |CACHED ); +run_test (fd, ctx, e->flags, m->mode |CACHED ); } } }
@@ -322,14 +328,14 @@ igt_main } igt_subtest("hang-S3") -run_test (fd,0 ,SUSPEND |HANG ); +run_test (fd,intel_ctx_0 (fd),0 ,SUSPEND |HANG ); igt_subtest("hang-S4") -run_test (fd,0 ,HIBERNATE |HANG ); +run_test (fd,intel_ctx_0 (fd),0 ,HIBERNATE |HANG ); igt_subtest("power-S0") -power_test (fd,0 ,IDLE ); +power_test (fd,intel_ctx_0 (fd),0 ,IDLE ); igt_subtest("power-S3") -power_test (fd,0 ,SUSPEND ); +power_test (fd,intel_ctx_0 (fd),0 ,SUSPEND ); igt_fixture {igt_disallow_hang (fd, hang);
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 40/89 tests/i915/gem_sync: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_sync.c | 159 ++++++++++++++++++++++++------------------ 1 file changed, 90 insertions(+), 69 deletions(-)
tests/i915/gem_sync.c +90 -69
@@ -96,38 +96,33 @@ filter_engines_can_store_dword(int fd, struct intel_engine_data *ied) ied->nengines = count; } -static struct intel_engine_data list_store_engines (int fd,unsigned ring) +static struct intel_engine_data +list_engines (int fd,const intel_ctx_t *ctx,unsigned ring) {struct intel_engine_data ied = { };if (ring ==ALL_ENGINES ) { - ied =intel_init_engine_list (fd,0 ); -filter_engines_can_store_dword (fd, &ied); + ied =intel_engine_list_for_ctx_cfg (fd, &ctx->cfg); + }else if (ctx->cfg.num_engines) { +igt_assert (ring < ctx->cfg.num_engines); + ied.engines[ied.nengines].flags = ring; +strcpy (ied.engines[ied.nengines].name," " ); + ied.nengines++; }else { -if (gem_has_ring (fd, ring) &&gem_can_store_dword (fd, ring)) { - ied.engines[ied.nengines].flags = ring; -strcpy (ied.engines[ied.nengines].name," " ); - ied.nengines++; - } +igt_assert (gem_has_ring (fd, ring)); + ied.engines[ied.nengines].flags = ring; +strcpy (ied.engines[ied.nengines].name," " ); + ied.nengines++; }return ied; } -static struct intel_engine_data list_engines (int fd,unsigned ring) +static struct intel_engine_data +list_store_engines (int fd,const intel_ctx_t *ctx,unsigned ring) { -struct intel_engine_data ied = { }; - -if (ring ==ALL_ENGINES ) { - ied =intel_init_engine_list (fd,0 ); - }else { -if (gem_has_ring (fd, ring)) { - ied.engines[ied.nengines].flags = ring; -strcpy (ied.engines[ied.nengines].name," " ); - ied.nengines++; - } - } - +struct intel_engine_data ied =list_engines (fd, ctx, ring); +filter_engines_can_store_dword (fd, &ied);return ied; }
@@ -149,11 +144,12 @@ static void xchg_engine(void *array, unsigned i, unsigned j) }static void -sync_ring (int fd,unsigned ring,int num_children,int timeout) +sync_ring (int fd,const intel_ctx_t *ctx, +unsigned ring,int num_children,int timeout) {struct intel_engine_data ied; - ied =list_engines (fd, ring); + ied =list_engines (fd, ctx, ring);igt_require (ied.nengines); num_children *= ied.nengines;
@@ -173,6 +169,7 @@ sync_ring(int fd, unsigned ring, int num_children, int timeout) execbuf.buffers_ptr =to_user_pointer (&object); execbuf.buffer_count =1 ; execbuf.flags =ied_flags (&ied, child); + execbuf.rsvd1 = ctx->id;gem_execbuf (fd, &execbuf);gem_sync (fd, object.handle);
@@ -195,7 +192,8 @@ sync_ring(int fd, unsigned ring, int num_children, int timeout) }static void -idle_ring (int fd,unsigned int ring,int num_children,int timeout) +idle_ring (int fd,const intel_ctx_t *ctx,unsigned int ring, +int num_children,int timeout) {const uint32_t bbe =MI_BATCH_BUFFER_END ;struct drm_i915_gem_exec_object2 object;
@@ -213,6 +211,7 @@ idle_ring(int fd, unsigned int ring, int num_children, int timeout) execbuf.buffers_ptr =to_user_pointer (&object); execbuf.buffer_count =1 ; execbuf.flags = ring; + execbuf.rsvd1 = ctx->id;gem_execbuf (fd, &execbuf);gem_sync (fd, object.handle);
@@ -234,11 +233,12 @@ idle_ring(int fd, unsigned int ring, int num_children, int timeout) }static void -wakeup_ring (int fd,unsigned ring,int timeout,int wlen) +wakeup_ring (int fd,const intel_ctx_t *ctx,unsigned ring, +int timeout,int wlen) {struct intel_engine_data ied; - ied =list_store_engines (fd, ring); + ied =list_store_engines (fd, ctx, ring);igt_require (ied.nengines);intel_detect_and_clear_missed_interrupts (fd);
@@ -258,8 +258,10 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen) execbuf.buffers_ptr =to_user_pointer (&object); execbuf.buffer_count =1 ; execbuf.flags =ied_flags (&ied, child); + execbuf.rsvd1 = ctx->id; spin = __igt_spin_new(fd, + .ctx = ctx, .engine = execbuf.flags, .flags = (IGT_SPIN_POLL_RUN |IGT_SPIN_FAST ));
@@ -326,12 +328,12 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen)igt_assert_eq (intel_detect_and_clear_missed_interrupts (fd),0 ); } -static void active_ring (int fd,unsigned int ring, +static void active_ring (int fd,const intel_ctx_t *ctx,unsigned int ring,int num_children,int timeout) {struct intel_engine_data ied; - ied =list_store_engines (fd, ring); + ied =list_store_engines (fd, ctx, ring);igt_require (ied.nengines);intel_detect_and_clear_missed_interrupts (fd);
@@ -341,10 +343,12 @@ static void active_ring(int fd, unsigned int ring,igt_spin_t *spin[2 ]; spin[0] = __igt_spin_new(fd, + .ctx = ctx, .engine = ied_flags(&ied, child), .flags =IGT_SPIN_FAST ); spin[1] = __igt_spin_new(fd, + .ctx = ctx, .engine = ied_flags(&ied, child), .flags =IGT_SPIN_FAST );
@@ -376,11 +380,12 @@ static void active_ring(int fd, unsigned int ring, }static void -active_wakeup_ring (int fd,unsigned ring,int timeout,int wlen) +active_wakeup_ring (int fd,const intel_ctx_t *ctx,unsigned ring, +int timeout,int wlen) {struct intel_engine_data ied; - ied =list_store_engines (fd, ring); + ied =list_store_engines (fd, ctx, ring);igt_require (ied.nengines);intel_detect_and_clear_missed_interrupts (fd);
@@ -400,6 +405,7 @@ active_wakeup_ring(int fd, unsigned ring, int timeout, int wlen) execbuf.buffers_ptr =to_user_pointer (&object); execbuf.buffer_count =1 ; execbuf.flags =ied_flags (&ied, child); + execbuf.rsvd1 = ctx->id; spin[0] = __igt_spin_new(fd, .engine = execbuf.flags,
@@ -490,12 +496,13 @@ active_wakeup_ring(int fd, unsigned ring, int timeout, int wlen) }static void -store_ring (int fd,unsigned ring,int num_children,int timeout) +store_ring (int fd,const intel_ctx_t *ctx,unsigned ring, +int num_children,int timeout) {const unsigned int gen =intel_gen (intel_get_drm_devid (fd));struct intel_engine_data ied; - ied =list_store_engines (fd, ring); + ied =list_store_engines (fd, ctx, ring);igt_require (ied.nengines); num_children *= ied.nengines;
@@ -516,6 +523,7 @@ store_ring(int fd, unsigned ring, int num_children, int timeout) execbuf.flags |=I915_EXEC_HANDLE_LUT ;if (gen <6 ) execbuf.flags |=I915_EXEC_SECURE ; + execbuf.rsvd1 = ctx->id;memset (object,0 ,sizeof (object)); object[0 ].handle =gem_create (fd,4096 );
@@ -586,14 +594,15 @@ store_ring(int fd, unsigned ring, int num_children, int timeout) }static void -switch_ring (int fd,unsigned ring,int num_children,int timeout) +switch_ring (int fd,const intel_ctx_t *ctx,unsigned ring, +int num_children,int timeout) {const unsigned int gen =intel_gen (intel_get_drm_devid (fd));struct intel_engine_data ied;gem_require_contexts (fd); - ied =list_store_engines (fd, ring); + ied =list_store_engines (fd, ctx, ring);igt_require (ied.nengines); num_children *= ied.nengines;
@@ -603,6 +612,7 @@ switch_ring(int fd, unsigned ring, int num_children, int timeout)struct drm_i915_gem_exec_object2 object[2 ];struct drm_i915_gem_relocation_entry reloc[1024 ];struct drm_i915_gem_execbuffer2 execbuf; +const intel_ctx_t *ctx; } contexts[2 ];double elapsed, baseline;unsigned long cycles;
@@ -620,7 +630,9 @@ switch_ring(int fd, unsigned ring, int num_children, int timeout) c->execbuf.flags |=I915_EXEC_HANDLE_LUT ;if (gen <6 ) c->execbuf.flags |=I915_EXEC_SECURE ; - c->execbuf.rsvd1 =gem_context_create (fd); + + c->ctx =intel_ctx_create (fd, &ctx->cfg); + c->execbuf.rsvd1 = c->ctx->id;memset (c->object,0 ,sizeof (c->object)); c->object[0 ].handle =gem_create (fd,4096 );
@@ -716,7 +728,7 @@ switch_ring(int fd, unsigned ring, int num_children, int timeout)for (int i =0 ; i <ARRAY_SIZE (contexts); i++) {gem_close (fd, contexts[i].object[1 ].handle);gem_close (fd, contexts[i].object[0 ].handle); -gem_context_destroy (fd, contexts[i].execbuf.rsvd1); +intel_ctx_destroy (fd, contexts[i].ctx); } }igt_waitchildren_timeout (timeout+10 ,NULL );
@@ -765,7 +777,8 @@ static void *waiter(void *arg) }static void -__store_many (int fd,unsigned ring,int timeout,unsigned long *cycles) +__store_many (int fd,const intel_ctx_t *ctx,unsigned ring, +int timeout,unsigned long *cycles) {const unsigned int gen =intel_gen (intel_get_drm_devid (fd));const uint32_t bbe =MI_BATCH_BUFFER_END ;
@@ -784,6 +797,7 @@ __store_many(int fd, unsigned ring, int timeout, unsigned long *cycles) execbuf.flags |=I915_EXEC_HANDLE_LUT ;if (gen <6 ) execbuf.flags |=I915_EXEC_SECURE ; + execbuf.rsvd1 = ctx->id;memset (object,0 ,sizeof (object)); object[0 ].handle =gem_create (fd,4096 );
@@ -893,7 +907,8 @@ __store_many(int fd, unsigned ring, int timeout, unsigned long *cycles) }static void -store_many (int fd,unsigned int ring,int num_children,int timeout) +store_many (int fd,const intel_ctx_t *ctx,unsigned int ring, +int num_children,int timeout) {struct intel_engine_data ied;unsigned long *shared;
@@ -901,14 +916,14 @@ store_many(int fd, unsigned int ring, int num_children, int timeout) shared =mmap (NULL ,4096 ,PROT_WRITE ,MAP_SHARED |MAP_ANON ,-1 ,0 );igt_assert (shared !=MAP_FAILED ); - ied =list_store_engines (fd, ring); + ied =list_store_engines (fd, ctx, ring);igt_require (ied.nengines);intel_detect_and_clear_missed_interrupts (fd);for (int n =0 ; n < ied.nengines; n++) { igt_fork(child, 1) -__store_many (fd, +__store_many (fd, ctx,ied_flags (&ied, n), timeout, &shared[n]);
@@ -924,11 +939,11 @@ store_many(int fd, unsigned int ring, int num_children, int timeout) }static void -sync_all (int fd,int num_children,int timeout) +sync_all (int fd,const intel_ctx_t *ctx,int num_children,int timeout) {struct intel_engine_data ied; - ied =list_engines (fd,ALL_ENGINES ); + ied =list_engines (fd, ctx,ALL_ENGINES );igt_require (ied.nengines);intel_detect_and_clear_missed_interrupts (fd);
@@ -946,6 +961,7 @@ sync_all(int fd, int num_children, int timeout)memset (&execbuf,0 ,sizeof (execbuf)); execbuf.buffers_ptr =to_user_pointer (&object); execbuf.buffer_count =1 ; + execbuf.rsvd1 = ctx->id;gem_execbuf (fd, &execbuf);gem_sync (fd, object.handle);
@@ -970,12 +986,12 @@ sync_all(int fd, int num_children, int timeout) }static void -store_all (int fd,int num_children,int timeout) +store_all (int fd,const intel_ctx_t *ctx,int num_children,int timeout) {const unsigned int gen =intel_gen (intel_get_drm_devid (fd));struct intel_engine_data ied; - ied =list_store_engines (fd,ALL_ENGINES ); + ied =list_store_engines (fd, ctx,ALL_ENGINES );igt_require (ied.nengines);intel_detect_and_clear_missed_interrupts (fd);
@@ -994,6 +1010,7 @@ store_all(int fd, int num_children, int timeout) execbuf.flags |=I915_EXEC_HANDLE_LUT ;if (gen <6 ) execbuf.flags |=I915_EXEC_SECURE ; + execbuf.rsvd1 = ctx->id;memset (object,0 ,sizeof (object)); object[0 ].handle =gem_create (fd,4096 );
@@ -1069,20 +1086,21 @@ store_all(int fd, int num_children, int timeout) }static void -preempt (int fd,unsigned ring,int num_children,int timeout) +preempt (int fd,const intel_ctx_t *ctx,unsigned ring, +int num_children,int timeout) {struct intel_engine_data ied; -uint32_t ctx[2 ]; +const intel_ctx_t *tmp_ctx[2 ]; - ied =list_engines (fd,ALL_ENGINES ); + ied =list_engines (fd, ctx,ALL_ENGINES );igt_require (ied.nengines); num_children *= ied.nengines; - ctx[0 ] =gem_context_create (fd); -gem_context_set_priority (fd, ctx[0 ],MIN_PRIO ); + tmp_ctx[0 ] =intel_ctx_create (fd, &ctx->cfg); +gem_context_set_priority (fd, tmp_ctx[0 ]->id,MIN_PRIO ); - ctx[1 ] =gem_context_create (fd); -gem_context_set_priority (fd, ctx[1 ],MAX_PRIO ); + tmp_ctx[1 ] =intel_ctx_create (fd, &ctx->cfg); +gem_context_set_priority (fd, tmp_ctx[1 ]->id,MAX_PRIO );intel_detect_and_clear_missed_interrupts (fd); igt_fork(child, num_children) {
@@ -1100,7 +1118,7 @@ preempt(int fd, unsigned ring, int num_children, int timeout) execbuf.buffers_ptr =to_user_pointer (&object); execbuf.buffer_count =1 ; execbuf.flags =ied_flags (&ied, child); - execbuf.rsvd1 = ctx[1 ]; + execbuf.rsvd1 = tmp_ctx[1 ]->id;gem_execbuf (fd, &execbuf);gem_sync (fd, object.handle);
@@ -1109,7 +1127,7 @@ preempt(int fd, unsigned ring, int num_children, int timeout) do { igt_spin_t *spin = __igt_spin_new(fd, - .ctx_id = ctx[0], + .ctx = tmp_ctx[0], .engine = execbuf.flags); do {
@@ -1128,8 +1146,8 @@ preempt(int fd, unsigned ring, int num_children, int timeout)igt_waitchildren_timeout (timeout+10 ,NULL );igt_assert_eq (intel_detect_and_clear_missed_interrupts (fd),0 ); -gem_context_destroy (fd, ctx[1 ]); -gem_context_destroy (fd, ctx[0 ]); +intel_ctx_destroy (fd, tmp_ctx[1 ]); +intel_ctx_destroy (fd, tmp_ctx[0 ]); } igt_main
@@ -1137,7 +1155,7 @@ igt_mainconst int ncpus =sysconf (_SC_NPROCESSORS_ONLN); const struct { const char *name; - void (*func)(int fd, unsigned int engine, + void (*func)(int fd, const intel_ctx_t *ctx, unsigned int engine, int num_children, int timeout); int num_children; int timeout;
@@ -1172,6 +1190,7 @@ igt_main#define for_each_test (t,T ) for(typeof(*T) *t = T; t->name; t++)const struct intel_execution_engine2 *e; +const intel_ctx_t *ctx;int fd =-1 ; igt_fixture {
@@ -1179,6 +1198,7 @@ igt_mainigt_require_gem (fd);gem_submission_print_method (fd);gem_scheduler_print_capability (fd); + ctx =intel_ctx_create_all_physical (fd);igt_fork_hang_detector (fd); }
@@ -1188,7 +1208,7 @@ igt_main igt_subtest_with_dynamic_f("%s", t->name) {for (const struct intel_execution_ring *l = intel_execution_rings; l->name; l++) { igt_dynamic_f("%s", l->name) { - t->func (fd,eb_ring (l), + t->func (fd,intel_ctx_0 (fd),eb_ring (l), t->num_children, t->timeout); } }
@@ -1196,30 +1216,30 @@ igt_main } igt_subtest("basic-all") -sync_all (fd,1 ,2 ); +sync_all (fd, ctx,1 ,2 ); igt_subtest("basic-store-all") -store_all (fd,1 ,2 ); +store_all (fd, ctx,1 ,2 ); igt_subtest("all") -sync_all (fd,1 ,20 ); +sync_all (fd, ctx,1 ,20 ); igt_subtest("store-all") -store_all (fd,1 ,20 ); +store_all (fd, ctx,1 ,20 ); igt_subtest("forked-all") -sync_all (fd, ncpus,20 ); +sync_all (fd, ctx, ncpus,20 ); igt_subtest("forked-store-all") -store_all (fd, ncpus,20 ); +store_all (fd, ctx, ncpus,20 );for_each_test (t, all) {igt_subtest_f ("%s" , t->name) - t->func(fd, ALL_ENGINES, t->num_children, t->timeout); + t->func(fd, ctx, ALL_ENGINES, t->num_children, t->timeout); }/* New way of selecting engines. */ for_each_test (t, individual) { igt_subtest_with_dynamic_f("%s", t->name) { -__for_each_physical_engine (fd, e) { +for_each_ctx_engine (fd, ctx, e) { igt_dynamic_f("%s", e->name) { - t->func (fd, e->flags, + t->func (fd, ctx, e->flags, t->num_children, t->timeout); } }
@@ -1234,17 +1254,18 @@ igt_main } igt_subtest("preempt-all") -preempt (fd,ALL_ENGINES ,1 ,20 ); +preempt (fd, ctx,ALL_ENGINES ,1 ,20 ); igt_subtest_with_dynamic("preempt") { -__for_each_physical_engine (fd, e) { +for_each_ctx_engine (fd, ctx, e) { igt_dynamic_f("%s", e->name) -preempt (fd, e->flags, ncpus,20 ); +preempt (fd, ctx, e->flags, ncpus,20 ); } } } igt_fixture {igt_stop_hang_detector (); +intel_ctx_destroy (fd, ctx);close (fd); } }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 41/89 tests/i915/gem_userptr_blits: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_userptr_blits.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
tests/i915/gem_userptr_blits.c +15 -10
@@ -583,7 +583,7 @@ static void test_nohangcheck_hostile(int i915) {const struct intel_execution_engine2 *e;igt_hang_t hang; -uint32_t ctx; +const intel_ctx_t *ctx;int fence =-1 ;int err =0 ;int dir;
@@ -598,11 +598,11 @@ static void test_nohangcheck_hostile(int i915) dir =igt_params_open (i915);igt_require (dir !=-1 ); - ctx =gem_context_create (i915); - hang =igt_allow_hang (i915, ctx,0 ); + ctx =intel_ctx_create_all_physical (i915); + hang =igt_allow_hang (i915, ctx->id,0 );igt_require (__enable_hangcheck (dir, false)); -____for_each_physical_engine (i915, ctx, e) { +for_each_ctx_engine (i915, ctx, e) {igt_spin_t *spin;int new;
@@ -610,7 +610,7 @@ static void test_nohangcheck_hostile(int i915)gem_engine_property_printf (i915, e->name,"preempt_timeout_ms" ,"%d" ,50 ); - spin =__igt_spin_new (i915, ctx, + spin = __igt_spin_new(i915, .ctx = ctx, .engine = e->flags, .flags = (IGT_SPIN_NO_PREEMPTION | IGT_SPIN_USERPTR |
@@ -632,7 +632,7 @@ static void test_nohangcheck_hostile(int i915) fence = tmp; } } -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx);igt_assert (fence !=-1 );if (sync_fence_wait (fence,MSEC_PER_SEC )) {/* 640ms preempt-timeout */
@@ -1209,7 +1209,8 @@ static int test_dmabuf(void)return 0 ; } -static void store_dword_rand (int i915,unsigned int engine, +static void store_dword_rand (int i915,const intel_ctx_t *ctx, +unsigned int engine,uint32_t target,uint64_t sz,int count) {
@@ -1241,6 +1242,7 @@ static void store_dword_rand(int i915, unsigned int engine, exec.flags = engine;if (gen <6 ) exec.flags |=I915_EXEC_SECURE ; + exec.rsvd1 = ctx->id; i =0 ;for (int n =0 ; n < count; n++) {
@@ -1358,17 +1360,19 @@ static void test_readonly(int i915) igt_fork(child, 1) {const struct intel_execution_engine2 *e; +const intel_ctx_t *ctx;char *orig; orig =g_compute_checksum_for_data (G_CHECKSUM_SHA1 , pages, sz);gem_userptr (i915, space, total, true, userptr_flags, &rhandle); -__for_each_physical_engine (i915, e) { + ctx =intel_ctx_create_all_physical (i915); +for_each_ctx_engine (i915, ctx, e) {char *ref, *result;/* First tweak the backing store through the write */ -store_dword_rand (i915, e->flags, whandle, sz,64 ); +store_dword_rand (i915, ctx, e->flags, whandle, sz,64 );gem_sync (i915, whandle); ref =g_compute_checksum_for_data (G_CHECKSUM_SHA1 , pages, sz);
@@ -1377,7 +1381,7 @@ static void test_readonly(int i915)igt_assert (strcmp (ref, orig));/* Now try the same through the read-only handle */ -store_dword_rand (i915, e->flags, rhandle, total,64 ); +store_dword_rand (i915, ctx, e->flags, rhandle, total,64 );gem_sync (i915, rhandle); result =g_compute_checksum_for_data (G_CHECKSUM_SHA1 , pages, sz);
@@ -1393,6 +1397,7 @@ static void test_readonly(int i915)g_free (orig); orig = ref; } +intel_ctx_destroy (i915, ctx);gem_close (i915, rhandle);
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 42/89 tests/i915/gem_wait: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_wait.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
tests/i915/gem_wait.c +13 -7
@@ -74,13 +74,15 @@ static void invalid_buf(int fd)#define timespec_isset (x) ((x)->tv_sec | (x)->tv_nsec) -static void basic (int fd,unsigned engine,unsigned flags) +static void basic (int fd,const intel_ctx_t *ctx,unsigned engine, +unsigned flags) {IGT_CORK_HANDLE (cork);uint32_t plug = flags & (WRITE |AWAIT ) ?igt_cork_plug (&cork, fd) :0 ;igt_spin_t *spin = igt_spin_new(fd, + .ctx = ctx, .engine = engine, .dependency = plug, .flags = (flags &HANG ) ?IGT_SPIN_NO_PREEMPTION :0 );
@@ -146,21 +148,22 @@ static void basic(int fd, unsigned engine, unsigned flags)igt_spin_free (fd, spin); } -static void test_all_engines (const char *name,int i915,unsigned int test) +static void test_all_engines (const char *name,int i915,const intel_ctx_t *ctx, +unsigned int test) {const struct intel_execution_engine2 *e;igt_subtest_with_dynamic (name) { igt_dynamic("all") {gem_quiescent_gpu (i915); -basic (i915,ALL_ENGINES , test); +basic (i915, ctx,ALL_ENGINES , test);gem_quiescent_gpu (i915); } -__for_each_physical_engine (i915, e) { +for_each_ctx_engine (i915, ctx, e) { igt_dynamic_f("%s", e->name) {gem_quiescent_gpu (i915); -basic (i915, e->flags, test); +basic (i915, ctx, e->flags, test);gem_quiescent_gpu (i915); } }
@@ -169,11 +172,13 @@ static void test_all_engines(const char *name, int i915, unsigned int test) igt_main { +const intel_ctx_t *ctx =NULL ;int fd =-1 ; igt_fixture { fd =drm_open_driver_master (DRIVER_INTEL );igt_require_gem (fd); + ctx =intel_ctx_create_all_physical (fd); }igt_subtest ("invalid-flags" )
@@ -201,7 +206,7 @@ igt_main } for (const typeof(*tests) *t = tests; t->name; t++) -test_all_engines (t->name, fd, t->flags); +test_all_engines (t->name, fd, ctx, t->flags); igt_fixture {igt_stop_signal_helper ();
@@ -228,7 +233,7 @@ igt_main } for (const typeof(*tests) *t = tests; t->name; t++) -test_all_engines (t->name, fd, t->flags); +test_all_engines (t->name, fd, ctx, t->flags); igt_fixture {igt_stop_signal_helper ();
@@ -237,6 +242,7 @@ igt_main } igt_fixture { +intel_ctx_destroy (fd, ctx);close (fd); } }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 43/89 tests/i915/gem_request_retire: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_request_retire.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
tests/i915/gem_request_retire.c +10 -7
@@ -62,24 +62,26 @@ static void test_retire_vma_not_inactive(int fd) {struct intel_execution_engine2 *e; - +const intel_ctx_t *ctx;igt_spin_t *bg =NULL ; -__for_each_physical_engine (fd, e) { + ctx =intel_ctx_create_all_physical (fd); + +for_each_ctx_engine (fd, ctx, e) {igt_spin_t *spin; -uint32_t ctx; +const intel_ctx_t *spin_ctx;if (!bg) { - bg = igt_spin_new(fd, .engine = e->flags); + bg = igt_spin_new(fd, .ctx = ctx, .engine = e->flags);continue ; } - ctx =gem_context_clone_with_engines (fd,0 ); - spin =igt_spin_new (fd, ctx, + spin_ctx =intel_ctx_create (fd, &ctx->cfg); + spin = igt_spin_new(fd, .ctx = spin_ctx, .engine = e->flags, .dependency = bg->handle, .flags =IGT_SPIN_SOFTDEP ); -gem_context_destroy (fd, ctx); +intel_ctx_destroy (fd, spin_ctx);igt_spin_end (spin);gem_sync (fd, spin->handle);
@@ -88,6 +90,7 @@ test_retire_vma_not_inactive(int fd)igt_drop_caches_set (fd,DROP_RETIRE );igt_spin_free (fd, bg); +intel_ctx_destroy (fd, ctx); }int fd;
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 44/89 tests/i915/gem_ctx_shared: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_ctx_shared.c | 262 ++++++++++++++++++++---------------- 1 file changed, 145 insertions(+), 117 deletions(-)
tests/i915/gem_ctx_shared.c +145 -117
@@ -39,6 +39,7 @@#include "i915/gem.h" #include "i915/gem_engine_topology.h" +#include "i915/gem_vm.h" #include "igt.h" #include "igt_rand.h" #include "igt_vgem.h"
@@ -108,11 +109,13 @@ static void create_shared_gtt(int i915, unsigned int flags)gem_close (i915, obj.handle); } -static void disjoint_timelines (int i915) +static void disjoint_timelines (int i915,const intel_ctx_cfg_t *cfg) {IGT_CORK_HANDLE (cork); +intel_ctx_cfg_t vm_cfg; +const intel_ctx_t *ctx[2 ];igt_spin_t *spin[2 ]; -uint32_t plug, child; +uint32_t plug;igt_require (gem_has_execlists (i915));
@@ -121,11 +124,15 @@ static void disjoint_timelines(int i915)* distinct timelines. A request queued to one context should be * independent of any shared contexts. */ - child =gem_context_clone (i915,0 ,I915_CONTEXT_CLONE_VM ,0 ); + vm_cfg = *cfg; + vm_cfg.vm =gem_vm_create (i915); + ctx[0 ] =intel_ctx_create (i915, &vm_cfg); + ctx[1 ] =intel_ctx_create (i915, &vm_cfg); + plug =igt_cork_plug (&cork, i915); - spin[0] = __igt_spin_new(i915, .ctx_id = 0, .dependency = plug); - spin[1] = __igt_spin_new(i915, .ctx_id = child); + spin[0] = __igt_spin_new(i915, .ctx = ctx[0], .dependency = plug); + spin[1] = __igt_spin_new(i915, .ctx = ctx[1]);/* Wait for the second spinner, will hang if stuck behind the first */ igt_spin_end (spin[1 ]);
@@ -135,6 +142,10 @@ static void disjoint_timelines(int i915)igt_spin_free (i915, spin[1 ]);igt_spin_free (i915, spin[0 ]); + +intel_ctx_destroy (i915, ctx[0 ]); +intel_ctx_destroy (i915, ctx[1 ]); +gem_vm_destroy (i915, vm_cfg.vm); }static void exhaust_shared_gtt (int i915,unsigned int flags)
@@ -184,7 +195,8 @@ static void exhaust_shared_gtt(int i915, unsigned int flags)igt_waitchildren (); } -static void exec_shared_gtt (int i915,unsigned int ring) +static void exec_shared_gtt (int i915,const intel_ctx_cfg_t *cfg, +unsigned int ring) {const unsigned int gen =intel_gen (intel_get_drm_devid (i915));const uint32_t bbe =MI_BATCH_BUFFER_END ;
@@ -194,14 +206,18 @@ static void exec_shared_gtt(int i915, unsigned int ring) .buffer_count = 1, .flags = ring, }; -uint32_t clone; +intel_ctx_cfg_t vm_cfg; +const intel_ctx_t *ctx[2 ];uint32_t scratch, *s;uint32_t batch, cs[16 ];uint64_t offset;int timeline;int i; - clone =gem_context_clone (i915,0 ,I915_CONTEXT_CLONE_VM ,0 ); + vm_cfg = *cfg; + vm_cfg.vm =gem_vm_create (i915); + ctx[0 ] =intel_ctx_create (i915, &vm_cfg); + ctx[1 ] =intel_ctx_create (i915, &vm_cfg);/* Find a hole big enough for both objects later */ scratch =gem_create (i915,16384 );
@@ -209,9 +225,9 @@ static void exec_shared_gtt(int i915, unsigned int ring) obj.handle = scratch;gem_execbuf (i915, &execbuf); obj.flags |=EXEC_OBJECT_PINNED ;/* reuse this address */ - execbuf.rsvd1 = clone;/* and bind the second context image */ + execbuf.rsvd1 = ctx[1 ]->id;/* and bind the second context image */ gem_execbuf (i915, &execbuf); - execbuf.rsvd1 =0 ; + execbuf.rsvd1 = ctx[0 ]->id;gem_close (i915, scratch); timeline =sw_sync_timeline_create ();
@@ -255,7 +271,7 @@ static void exec_shared_gtt(int i915, unsigned int ring) obj.handle = batch; obj.offset +=8192 ;/* make sure we don't cause an eviction! */ - execbuf.rsvd1 = clone; + execbuf.rsvd1 = ctx[1 ]->id;if (gen >3 && gen <6 ) execbuf.flags |=I915_EXEC_SECURE ;gem_execbuf (i915, &execbuf);
@@ -287,10 +303,13 @@ static void exec_shared_gtt(int i915, unsigned int ring)munmap (s,4096 );gem_close (i915, scratch); -gem_context_destroy (i915, clone); +intel_ctx_destroy (i915, ctx[0 ]); +intel_ctx_destroy (i915, ctx[1 ]); +gem_vm_destroy (i915, vm_cfg.vm); } -static int nop_sync (int i915,uint32_t ctx,unsigned int ring,int64_t timeout) +static int nop_sync (int i915,const intel_ctx_t *ctx,unsigned int ring, +int64_t timeout) {const uint32_t bbe =MI_BATCH_BUFFER_END ;struct drm_i915_gem_exec_object2 obj = {
@@ -300,7 +319,7 @@ static int nop_sync(int i915, uint32_t ctx, unsigned int ring, int64_t timeout) .buffers_ptr = to_user_pointer(&obj), .buffer_count = 1, .flags = ring, - .rsvd1 = ctx, + .rsvd1 = ctx->id, };int err;
@@ -316,22 +335,24 @@ static bool has_single_timeline(int i915) {uint32_t ctx =0 ; -__gem_context_clone (i915,0 ,0 , -I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE , - &ctx); +__gem_context_create_ext (i915, +I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE , +0 ,/* extensions */ &ctx);if (ctx)gem_context_destroy (i915, ctx);return ctx !=0 ; } -static void single_timeline (int i915) +static void single_timeline (int i915,const intel_ctx_cfg_t *cfg) {const struct intel_execution_engine2 *e;struct sync_fence_info rings[64 ];struct sync_file_info sync_file_info = { .num_fences =1 , }; +intel_ctx_cfg_t st_cfg; +const intel_ctx_t *ctx;igt_spin_t *spin;int n;
@@ -346,11 +367,12 @@ static void single_timeline(int i915)* to, it reports the same timeline name and fence context. However, * the fence context is not reported through the sync_fence_info. */ - spin->execbuf.rsvd1 = -gem_context_clone (i915,0 ,0 , -I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE ); + st_cfg = *cfg; + st_cfg.flags |=I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE ; + ctx =intel_ctx_create (i915, &st_cfg); + spin->execbuf.rsvd1 = ctx->id; n =0 ; -____for_each_physical_engine (i915, spin->execbuf.rsvd1, e) { +for_each_ctx_engine (i915, ctx, e) { spin->execbuf.flags = e->flags |I915_EXEC_FENCE_OUT ;gem_execbuf_wr (i915, &spin->execbuf);
@@ -369,32 +391,35 @@ static void single_timeline(int i915)igt_assert (!strcmp (rings[0 ].driver_name, rings[i].driver_name));igt_assert (!strcmp (rings[0 ].obj_name, rings[i].obj_name)); } +intel_ctx_destroy (i915, ctx); } -static void exec_single_timeline (int i915,unsigned int engine) +static void exec_single_timeline (int i915,const intel_ctx_cfg_t *cfg, +unsigned int engine) {const struct intel_execution_engine2 *e;igt_spin_t *spin; -uint32_t ctx; +intel_ctx_cfg_t st_cfg; +const intel_ctx_t *ctx;/* * On an ordinary context, a blockage on one engine doesn't prevent * execution on an other. */ - ctx =0 ; + ctx =intel_ctx_create (i915, cfg); spin =NULL ; -__for_each_physical_engine (i915, e) { +for_each_ctx_cfg_engine (i915, cfg, e) {if (e->flags == engine)continue ;if (spin ==NULL ) { - spin = __igt_spin_new(i915, .ctx_id = ctx, .engine = e->flags); + spin = __igt_spin_new(i915, .ctx = ctx, .engine = e->flags); }else {struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr = spin->execbuf.buffers_ptr, .buffer_count = spin->execbuf.buffer_count, .flags = e->flags, - .rsvd1 = ctx, + .rsvd1 = ctx->id, };gem_execbuf (i915, &execbuf); }
@@ -402,27 +427,29 @@ static void exec_single_timeline(int i915, unsigned int engine)igt_require (spin);igt_assert_eq (nop_sync (i915, ctx, engine,NSEC_PER_SEC ),0 );igt_spin_free (i915, spin); +intel_ctx_destroy (i915, ctx);/* * But if we create a context with just a single shared timeline, * then it will block waiting for the earlier requests on the * other engines. */ - ctx =gem_context_clone (i915,0 ,0 , -I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE ); + st_cfg = *cfg; + st_cfg.flags |=I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE ; + ctx =intel_ctx_create (i915, &st_cfg); spin =NULL ; -__for_each_physical_engine (i915, e) { +for_each_ctx_cfg_engine (i915, cfg, e) {if (e->flags == engine)continue ;if (spin ==NULL ) { - spin = __igt_spin_new(i915, .ctx_id = ctx, .engine = e->flags); + spin = __igt_spin_new(i915, .ctx = ctx, .engine = e->flags); }else {struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr = spin->execbuf.buffers_ptr, .buffer_count = spin->execbuf.buffer_count, .flags = e->flags, - .rsvd1 = ctx, + .rsvd1 = ctx->id, };gem_execbuf (i915, &execbuf); }
@@ -430,9 +457,10 @@ static void exec_single_timeline(int i915, unsigned int engine)igt_assert (spin);igt_assert_eq (nop_sync (i915, ctx, engine,NSEC_PER_SEC ), -ETIME );igt_spin_free (i915, spin); +intel_ctx_destroy (i915, ctx); } -static void store_dword (int i915,uint32_t ctx,unsigned ring, +static void store_dword (int i915,const intel_ctx_t *ctx,unsigned ring,uint32_t target,uint32_t offset,uint32_t value,uint32_t cork,unsigned write_domain) {
@@ -449,7 +477,7 @@ static void store_dword(int i915, uint32_t ctx, unsigned ring, execbuf.flags = ring;if (gen <6 ) execbuf.flags |=I915_EXEC_SECURE ; - execbuf.rsvd1 = ctx; + execbuf.rsvd1 = ctx->id;memset (obj,0 ,sizeof (obj)); obj[0 ].handle = cork;
@@ -490,31 +518,30 @@ static void store_dword(int i915, uint32_t ctx, unsigned ring,gem_close (i915, obj[2 ].handle); } -static uint32_t create_highest_priority (int i915) +static const intel_ctx_t * +create_highest_priority (int i915,const intel_ctx_cfg_t *cfg) { -uint32_t ctx =gem_context_clone_with_engines (i915,0 ); +const intel_ctx_t *ctx =intel_ctx_create (i915, cfg);/* * If there is no priority support, all contexts will have equal * priority (and therefore the max user priority), so no context * can overtake us, and we effectively can form a plug. */ -__gem_context_set_priority (i915, ctx,MAX_PRIO ); +__gem_context_set_priority (i915, ctx->id,MAX_PRIO );return ctx; } -static void unplug_show_queue (int i915,struct igt_cork *c,unsigned int engine) +static void unplug_show_queue (int i915,struct igt_cork *c, +const intel_ctx_cfg_t *cfg,unsigned int engine) {igt_spin_t *spin[MAX_ELSP_QLEN ];for (int n =0 ; n <ARRAY_SIZE (spin); n++) { -const struct igt_spin_factory opts = { - .ctx_id =create_highest_priority (i915), - .engine = engine, - }; - spin[n] =__igt_spin_factory (i915, &opts); -gem_context_destroy (i915, opts.ctx_id); +const intel_ctx_t *ctx =create_highest_priority (i915, cfg); + spin[n] = __igt_spin_new(i915, .ctx = ctx, .engine = engine); +intel_ctx_destroy (i915, ctx); }igt_cork_unplug (c);/* batches will now be queued on the engine */
@@ -525,7 +552,8 @@ static void unplug_show_queue(int i915, struct igt_cork *c, unsigned int engine) }static uint32_t store_timestamp (int i915, -uint32_t ctx,unsigned ring, +const intel_ctx_t *ctx, +unsigned ring,unsigned mmio_base,int fence,int offset)
@@ -548,7 +576,7 @@ static uint32_t store_timestamp(int i915, .buffers_ptr = to_user_pointer(&obj), .buffer_count = 1, .flags = ring | I915_EXEC_FENCE_IN, - .rsvd1 = ctx, + .rsvd1 = ctx->id, .rsvd2 = fence };uint32_t batch[] = {
@@ -576,7 +604,7 @@ static void kick_tasklets(void)sched_yield (); } -static void independent (int i915, +static void independent (int i915,const intel_ctx_cfg_t *cfg,const struct intel_execution_engine2 *e,unsigned flags) {
@@ -591,22 +619,19 @@ static void independent(int i915,igt_require_f (mmio_base,"mmio base not known\n" );for (int n =0 ; n <ARRAY_SIZE (spin); n++) { -const struct igt_spin_factory opts = { - .ctx_id =create_highest_priority (i915), - .engine = e->flags, - }; - spin[n] =__igt_spin_factory (i915, &opts); -gem_context_destroy (i915, opts.ctx_id); +const intel_ctx_t *ctx =create_highest_priority (i915, cfg); + spin[n] = __igt_spin_new(i915, .ctx = ctx, .engine = e->flags); +intel_ctx_destroy (i915, ctx); } fence =igt_cork_plug (&cork, i915);for (int i =0 ; i <ARRAY_SIZE (priorities); i++) { -uint32_t ctx =gem_queue_create (i915); -gem_context_set_priority (i915, ctx, priorities[i]); +const intel_ctx_t *ctx =create_highest_priority (i915, cfg); +gem_context_set_priority (i915, ctx->id, priorities[i]); handle[i] =store_timestamp (i915, ctx, e->flags, mmio_base, fence,TIMESTAMP ); -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx); }close (fence);kick_tasklets ();/* XXX try to hide cmdparser delays XXX */
@@ -635,20 +660,21 @@ static void independent(int i915,igt_assert ((int32_t )(handle[HI ] - handle[LO ]) <0 ); } -static void reorder(int i915, unsigned ring, unsigned flags) +static void reorder (int i915,const intel_ctx_cfg_t *cfg, + unsigned ring, unsigned flags)#define EQUAL 1 {IGT_CORK_HANDLE (cork);uint32_t scratch;uint32_t *ptr; -uint32_t ctx[2 ]; +const intel_ctx_t *ctx[2 ];uint32_t plug; - ctx[LO ] =gem_queue_create (i915); -gem_context_set_priority (i915, ctx[LO ],MIN_PRIO ); + ctx[LO ] =intel_ctx_create (i915, cfg); +gem_context_set_priority (i915, ctx[LO ]->id,MIN_PRIO ); - ctx[HI ] =gem_queue_create (i915); -gem_context_set_priority (i915, ctx[HI ], flags &EQUAL ?MIN_PRIO :0 ); + ctx[HI ] =intel_ctx_create (i915, cfg); +gem_context_set_priority (i915, ctx[HI ]->id, flags &EQUAL ?MIN_PRIO :0 ); scratch =gem_create (i915,4096 ); plug =igt_cork_plug (&cork, i915);
@@ -656,43 +682,43 @@ static void reorder(int i915, unsigned ring, unsigned flags)/* We expect the high priority context to be executed first, and * so the final result will be value from the low priority context. */ -store_dword (i915, ctx[LO ], ring, scratch,0 , ctx[LO ], plug,0 ); -store_dword (i915, ctx[HI ], ring, scratch,0 , ctx[HI ], plug,0 ); +store_dword (i915, ctx[LO ], ring, scratch,0 , ctx[LO ]->id, plug,0 ); +store_dword (i915, ctx[HI ], ring, scratch,0 , ctx[HI ]->id, plug,0 ); -unplug_show_queue (i915, &cork, ring); +unplug_show_queue (i915, &cork, cfg, ring);gem_close (i915, plug); -gem_context_destroy (i915, ctx[LO ]); -gem_context_destroy (i915, ctx[HI ]); - ptr =gem_mmap__device_coherent (i915, scratch,0 ,4096 ,PROT_READ );gem_set_domain (i915, scratch,/* no write hazard lies! */ I915_GEM_DOMAIN_GTT ,I915_GEM_DOMAIN_GTT );gem_close (i915, scratch);if (flags &EQUAL )/* equal priority, result will be fifo */ -igt_assert_eq_u32 (ptr[0 ], ctx[HI ]); +igt_assert_eq_u32 (ptr[0 ], ctx[HI ]->id);else -igt_assert_eq_u32 (ptr[0 ], ctx[LO ]); +igt_assert_eq_u32 (ptr[0 ], ctx[LO ]->id);munmap (ptr,4096 ); + +intel_ctx_destroy (i915, ctx[LO ]); +intel_ctx_destroy (i915, ctx[HI ]); } -static void promotion (int i915,unsigned ring) +static void promotion (int i915,const intel_ctx_cfg_t *cfg,unsigned ring) {IGT_CORK_HANDLE (cork);uint32_t result, dep;uint32_t *ptr; -uint32_t ctx[3 ]; +const intel_ctx_t *ctx[3 ];uint32_t plug; - ctx[LO ] =gem_queue_create (i915); -gem_context_set_priority (i915, ctx[LO ],MIN_PRIO ); + ctx[LO ] =intel_ctx_create (i915, cfg); +gem_context_set_priority (i915, ctx[LO ]->id,MIN_PRIO ); - ctx[HI ] =gem_queue_create (i915); -gem_context_set_priority (i915, ctx[HI ],0 ); + ctx[HI ] =intel_ctx_create (i915, cfg); +gem_context_set_priority (i915, ctx[HI ]->id,0 ); - ctx[NOISE ] =gem_queue_create (i915); -gem_context_set_priority (i915, ctx[NOISE ],MIN_PRIO /2 ); + ctx[NOISE ] =intel_ctx_create (i915, cfg); +gem_context_set_priority (i915, ctx[NOISE ]->id,MIN_PRIO /2 ); result =gem_create (i915,4096 ); dep =gem_create (i915,4096 );
@@ -704,28 +730,24 @@ static void promotion(int i915, unsigned ring)* fifo would be NOISE, LO, HI. * strict priority would be HI, NOISE, LO */ -store_dword (i915, ctx[NOISE ], ring, result,0 , ctx[NOISE ], plug,0 ); -store_dword (i915, ctx[LO ], ring, result,0 , ctx[LO ], plug,0 ); +store_dword (i915, ctx[NOISE ], ring, result,0 , ctx[NOISE ]->id, plug,0 ); +store_dword (i915, ctx[LO ], ring, result,0 , ctx[LO ]->id, plug,0 );/* link LO <-> HI via a dependency on another buffer */ -store_dword (i915, ctx[LO ], ring, dep,0 , ctx[LO ],0 ,I915_GEM_DOMAIN_INSTRUCTION ); -store_dword (i915, ctx[HI ], ring, dep,0 , ctx[HI ],0 ,0 ); +store_dword (i915, ctx[LO ], ring, dep,0 , ctx[LO ]->id,0 ,I915_GEM_DOMAIN_INSTRUCTION ); +store_dword (i915, ctx[HI ], ring, dep,0 , ctx[HI ]->id,0 ,0 ); -store_dword (i915, ctx[HI ], ring, result,0 , ctx[HI ],0 ,0 ); +store_dword (i915, ctx[HI ], ring, result,0 , ctx[HI ]->id,0 ,0 ); -unplug_show_queue (i915, &cork, ring); +unplug_show_queue (i915, &cork, cfg, ring);gem_close (i915, plug); -gem_context_destroy (i915, ctx[NOISE ]); -gem_context_destroy (i915, ctx[LO ]); -gem_context_destroy (i915, ctx[HI ]); - ptr =gem_mmap__device_coherent (i915, dep,0 ,4096 ,PROT_READ );gem_set_domain (i915, dep,/* no write hazard lies! */ I915_GEM_DOMAIN_GTT ,I915_GEM_DOMAIN_GTT );gem_close (i915, dep); -igt_assert_eq_u32 (ptr[0 ], ctx[HI ]); +igt_assert_eq_u32 (ptr[0 ], ctx[HI ]->id);munmap (ptr,4096 ); ptr =gem_mmap__device_coherent (i915, result,0 ,4096 ,PROT_READ );
@@ -733,11 +755,16 @@ static void promotion(int i915, unsigned ring) I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);gem_close (i915, result); -igt_assert_eq_u32 (ptr[0 ], ctx[NOISE ]); +igt_assert_eq_u32 (ptr[0 ], ctx[NOISE ]->id);munmap (ptr,4096 ); + +intel_ctx_destroy (i915, ctx[NOISE ]); +intel_ctx_destroy (i915, ctx[LO ]); +intel_ctx_destroy (i915, ctx[HI ]); } -static void smoketest (int i915,unsigned ring,unsigned timeout) +static void smoketest (int i915,const intel_ctx_cfg_t *cfg, +unsigned ring,unsigned timeout) {const int ncpus =sysconf (_SC_NPROCESSORS_ONLN);unsigned engines[I915_EXEC_RING_MASK +1 ];
@@ -750,7 +777,7 @@ static void smoketest(int i915, unsigned ring, unsigned timeout)if (ring ==-1 ) {const struct intel_execution_engine2 *e; -__for_each_physical_engine (i915, e) +for_each_ctx_cfg_engine (i915, cfg, e) engines[nengine++] = e->flags; }else { engines[nengine++] = ring;
@@ -760,16 +787,16 @@ static void smoketest(int i915, unsigned ring, unsigned timeout) scratch =gem_create (i915,4096 ); igt_fork(child, ncpus) {unsigned long count =0 ; -uint32_t ctx; +const intel_ctx_t *ctx;hars_petruska_f54_1_random_perturb (child); - ctx =gem_queue_create (i915); + ctx =intel_ctx_create (i915, cfg);igt_until_timeout (timeout) {int prio; prio =hars_petruska_f54_1_random_unsafe_max (MAX_PRIO -MIN_PRIO ) +MIN_PRIO ; -gem_context_set_priority (i915, ctx, prio); +gem_context_set_priority (i915, ctx->id, prio); engine = engines[hars_petruska_f54_1_random_unsafe_max (nengine)]; store_dword(i915, ctx, engine, scratch,
@@ -780,7 +807,7 @@ static void smoketest(int i915, unsigned ring, unsigned timeout)8 *child +4 , count++, 0, 0); } -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx); }igt_waitchildren ();
@@ -802,19 +829,21 @@ static void smoketest(int i915, unsigned ring, unsigned timeout)munmap (ptr,4096 ); } -#define for_each_queue (e, i915) \ - __for_each_physical_engine(i915, e) \ +#define for_each_queue (e, i915, cfg) \ + for_each_ctx_cfg_engine(i915, cfg, e) \ for_each_if(gem_class_can_store_dword(i915, (e)->class)) \ igt_dynamic_f("%s", e->name) igt_main {const struct intel_execution_engine2 *e; +intel_ctx_cfg_t cfg;int i915 =-1 ; igt_fixture { i915 =drm_open_driver (DRIVER_INTEL );igt_require_gem (i915); + cfg =intel_ctx_cfg_all_physical (i915); } igt_subtest_group {
@@ -830,20 +859,20 @@ igt_maincreate_shared_gtt (i915,DETACHED ); igt_subtest("disjoint-timelines") -disjoint_timelines (i915); +disjoint_timelines (i915, &cfg); igt_subtest("single-timeline") -single_timeline (i915); +single_timeline (i915, &cfg); igt_subtest_with_dynamic("exec-shared-gtt") { -for_each_queue (e, i915) -exec_shared_gtt (i915, e->flags); +for_each_queue (e, i915, &cfg) +exec_shared_gtt (i915, &cfg, e->flags); } igt_subtest_with_dynamic("exec-single-timeline") {igt_require (has_single_timeline (i915)); -for_each_queue (e, i915) -exec_single_timeline (i915, e->flags); +for_each_queue (e, i915, &cfg) +exec_single_timeline (i915, &cfg, e->flags); }/*
@@ -855,38 +884,37 @@ igt_main*/ igt_subtest_group { igt_fixture { -igt_require (gem_has_queues (i915));igt_require (gem_scheduler_enabled (i915));igt_require (gem_scheduler_has_ctx_priority (i915)); } igt_subtest_with_dynamic("Q-independent") { -for_each_queue (e, i915) -independent (i915, e,0 ); +for_each_queue (e, i915, &cfg) +independent (i915, &cfg, e,0 ); } igt_subtest_with_dynamic("Q-in-order") { -for_each_queue (e, i915) -reorder (i915, e->flags,EQUAL ); +for_each_queue (e, i915, &cfg) +reorder (i915, &cfg, e->flags,EQUAL ); } igt_subtest_with_dynamic("Q-out-order") { -for_each_queue (e, i915) -reorder (i915, e->flags,0 ); +for_each_queue (e, i915, &cfg) +reorder (i915, &cfg, e->flags,0 ); } igt_subtest_with_dynamic("Q-promotion") { -for_each_queue (e, i915) -promotion (i915, e->flags); +for_each_queue (e, i915, &cfg) +promotion (i915, &cfg, e->flags); } igt_subtest_with_dynamic("Q-smoketest") { -for_each_queue (e, i915) -smoketest (i915, e->flags,5 ); +for_each_queue (e, i915, &cfg) +smoketest (i915, &cfg, e->flags,5 ); } igt_subtest("Q-smoketest-all") -smoketest (i915,-1 ,30 ); +smoketest (i915, &cfg,-1 ,30 ); }igt_subtest ("exhaust-shared-gtt" )
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 45/89 tests/i915/gem_ctx_shared: Stop cloning contexts
In reply to Jason EkstrandInstead use either GET/SET_CONTEXT_PARAM or a create ext.
--- tests/i915/gem_ctx_shared.c | 77 ++++++++++++++++++++++++++++++------- 1 file changed, 63 insertions(+), 14 deletions(-)
tests/i915/gem_ctx_shared.c +63 -14
@@ -62,6 +62,48 @@ static int priorities[] = {IGT_TEST_DESCRIPTION ("Test shared contexts." ); +static int __get_vm (int i915,uint32_t ctx,uint32_t *vm) +{ +struct drm_i915_gem_context_param p = { + .ctx_id = ctx, + .param =I915_CONTEXT_PARAM_VM , + }; +int err =__gem_context_get_param (i915, &p); +if (err) +return err; + +igt_assert (p.value >0 && p.value <UINT32_MAX ); + *vm = p.value; + +return 0 ; +} + +static uint32_t get_vm (int i915,uint32_t ctx) +{ +uint32_t vm; +igt_assert_eq (__get_vm (i915, ctx, &vm),0 ); +return vm; +} + +static void set_vm (int i915,uint32_t ctx,uint32_t vm) +{ +struct drm_i915_gem_context_param p = { + .ctx_id = ctx, + .param =I915_CONTEXT_PARAM_VM , + .value = vm + }; +gem_context_set_param (i915, &p); +} + +static void copy_vm (int i915,uint32_t dst,uint32_t src) +{ +uint32_t vm =get_vm (i915, src); +set_vm (i915, dst, vm); + +/* GETPARAM gets a reference to the VM which we have to drop */ +gem_vm_destroy (i915, vm); +} + static void create_shared_gtt(int i915, unsigned int flags)#define DETACHED 0x1 {
@@ -82,9 +124,9 @@ static void create_shared_gtt(int i915, unsigned int flags) child = flags &DETACHED ?gem_context_create (i915) :0 ; igt_until_timeout(2) { parent = flags &DETACHED ? child :0 ; - child =gem_context_clone (i915, - parent,I915_CONTEXT_CLONE_VM , -0 ); + child =gem_context_create (i915); +copy_vm (i915, child, parent); + execbuf.rsvd1 = child;gem_execbuf (i915, &execbuf);
@@ -98,9 +140,7 @@ static void create_shared_gtt(int i915, unsigned int flags) execbuf.rsvd1 = parent;igt_assert_eq (__gem_execbuf (i915, &execbuf), -ENOENT ); -igt_assert_eq (__gem_context_clone (i915, - parent,I915_CONTEXT_CLONE_VM , -0 , &parent), -ENOENT ); +igt_assert_eq (__get_vm (i915, parent, &parent), -ENOENT ); }if (flags &DETACHED )gem_context_destroy (i915, child);
@@ -151,8 +191,19 @@ static void disjoint_timelines(int i915, const intel_ctx_cfg_t *cfg) static void exhaust_shared_gtt(int i915, unsigned int flags)#define EXHAUST_LRC 0x1 { +struct drm_i915_gem_context_create_ext_setparam vm_create_ext = { + .base = { + .name =I915_CONTEXT_CREATE_EXT_SETPARAM , + }, + .param = { + .param =I915_CONTEXT_PARAM_VM , + }, + }; + i915 =gem_reopen_driver (i915); + vm_create_ext.param.value =gem_vm_create (i915); + igt_fork(pid, 1) {const uint32_t bbe =MI_BATCH_BUFFER_END ; struct drm_i915_gem_exec_object2 obj = {
@@ -162,23 +213,21 @@ static void exhaust_shared_gtt(int i915, unsigned int flags) .buffers_ptr = to_user_pointer(&obj), .buffer_count = 1, }; -uint32_t parent, child;unsigned long count =0 ;int err;gem_write (i915, obj.handle,0 , &bbe,sizeof (bbe)); - child =0 ;for (;;) { - parent = child; - err =__gem_context_clone (i915, - parent,I915_CONTEXT_CLONE_VM , -0 , &child); +uint32_t ctx; + err =__gem_context_create_ext (i915,0 , +to_user_pointer (&vm_create_ext), + &ctx);if (err)break ;if (flags &EXHAUST_LRC ) { - execbuf.rsvd1 = child; + execbuf.rsvd1 = ctx; err =__gem_execbuf (i915, &execbuf);if (err)break ;
@@ -848,7 +897,7 @@ igt_main igt_subtest_group { igt_fixture { -igt_require (gem_contexts_has_shared_gtt (i915)); +igt_require (gem_has_vm (i915));igt_fork_hang_detector (i915); }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 46/89 tests/i915/gem_create: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_create.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
tests/i915/gem_create.c +10 -4
@@ -245,20 +245,24 @@ static void always_clear(int i915, int timeout)static void busy_create (int i915,int timeout) {struct intel_execution_engine2 *e; +const intel_ctx_t *ctx;igt_spin_t *spin[I915_EXEC_RING_MASK +1 ];unsigned long count =0 ; + ctx =intel_ctx_create_all_physical (i915); +igt_fork_hang_detector (i915); -__for_each_physical_engine (i915, e) - spin[e->flags] = igt_spin_new(i915, .engine = e->flags); +for_each_ctx_engine (i915, ctx, e) + spin[e->flags] = igt_spin_new(i915, .ctx = ctx, + .engine = e->flags);igt_until_timeout (timeout) { -__for_each_physical_engine (i915, e) { +for_each_ctx_engine (i915, ctx, e) {uint32_t handle;igt_spin_t *next; handle =gem_create (i915,4096 ); - next = igt_spin_new(i915, + next = igt_spin_new(i915, .ctx = ctx, .engine = e->flags, .dependency = handle, .flags =IGT_SPIN_SOFTDEP );
@@ -271,6 +275,8 @@ static void busy_create(int i915, int timeout) } } +intel_ctx_destroy (i915, ctx); +igt_info ("Created %ld objects while busy\n" , count);gem_quiescent_gpu (i915);
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 47/89 tests/i915/gem_ctx_switch: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_ctx_switch.c | 115 ++++++++++++++++++++---------------- 1 file changed, 64 insertions(+), 51 deletions(-)
tests/i915/gem_ctx_switch.c +64 -51
@@ -42,6 +42,7 @@#include "drm.h" #include "i915/gem.h" #include "i915/gem_ring.h" +#include "i915/gem_vm.h" #include "igt.h" #define INTERRUPTIBLE 0x1
@@ -53,18 +54,18 @@ static double elapsed(const struct timespec *start, const struct timespec *end) (end->tv_nsec - start->tv_nsec)*1e-9); } -static int measure_qlen (int fd, +static int measure_qlen (int fd,const intel_ctx_cfg_t *cfg,struct drm_i915_gem_execbuffer2 *execbuf,const struct intel_engine_data *engines,int timeout) {const struct drm_i915_gem_exec_object2 *const obj = (struct drm_i915_gem_exec_object2 *)(uintptr_t )execbuf->buffers_ptr; -uint32_t ctx[64 ]; +const intel_ctx_t *ctx[64 ];int min =INT_MAX , max =0 ;for (int i =0 ; i <ARRAY_SIZE (ctx); i++) - ctx[i] =gem_context_clone_with_engines (fd,0 ); + ctx[i] =intel_ctx_create (fd, cfg);for (unsigned int n =0 ; n < engines->nengines; n++) {uint64_t saved = execbuf->flags;
@@ -74,14 +75,14 @@ static int measure_qlen(int fd, execbuf->flags |= engines->engines[n].flags;for (int i =0 ; i <ARRAY_SIZE (ctx); i++) { - execbuf->rsvd1 = ctx[i]; + execbuf->rsvd1 = ctx[i]->id;gem_execbuf (fd, execbuf); }gem_sync (fd, obj->handle);igt_nsec_elapsed (&tv);for (int i =0 ; i <ARRAY_SIZE (ctx); i++) { - execbuf->rsvd1 = ctx[i]; + execbuf->rsvd1 = ctx[i]->id;gem_execbuf (fd, execbuf); }gem_sync (fd, obj->handle);
@@ -101,13 +102,14 @@ static int measure_qlen(int fd, }for (int i =0 ; i <ARRAY_SIZE (ctx); i++) -gem_context_destroy (fd, ctx[i]); +intel_ctx_destroy (fd, ctx[i]);igt_debug ("Estimated qlen: {min:%d, max:%d}\n" , min, max);return min; } static void single(int fd, uint32_t handle, + const intel_ctx_cfg_t *base_cfg, const struct intel_execution_engine2 *e2, unsigned flags, const int ncpus,
@@ -116,7 +118,8 @@ static void single(int fd, uint32_t handle,struct drm_i915_gem_execbuffer2 execbuf;struct drm_i915_gem_exec_object2 obj;struct drm_i915_gem_relocation_entry reloc; -uint32_t contexts[64 ]; +intel_ctx_cfg_t cfg; +const intel_ctx_t *contexts[64 ];struct {double elapsed;unsigned long count;
@@ -126,12 +129,12 @@ static void single(int fd, uint32_t handle, shared =mmap (NULL ,4096 ,PROT_WRITE ,MAP_SHARED |MAP_ANON ,-1 ,0 );igt_assert (shared !=MAP_FAILED ); -for (n =0 ; n <64 ; n++) { -if (flags &QUEUE ) - contexts[n] =gem_queue_clone_with_engines (fd,0 ); -else - contexts[n] =gem_context_clone_with_engines (fd,0 ); - } + cfg = *base_cfg; +if (flags &QUEUE ) + cfg.vm =gem_vm_create (fd); + +for (n =0 ; n <64 ; n++) + contexts[n] =intel_ctx_create (fd, &cfg);memset (&obj,0 ,sizeof (obj)); obj.handle = handle;
@@ -150,7 +153,7 @@ static void single(int fd, uint32_t handle,memset (&execbuf,0 ,sizeof (execbuf)); execbuf.buffers_ptr =to_user_pointer (&obj); execbuf.buffer_count =1 ; - execbuf.rsvd1 = contexts[0 ]; + execbuf.rsvd1 = contexts[0 ]->id; execbuf.flags = e2->flags; execbuf.flags |=I915_EXEC_HANDLE_LUT ; execbuf.flags |=I915_EXEC_NO_RELOC ;
@@ -168,7 +171,7 @@ static void single(int fd, uint32_t handle,/* Warmup to bind all objects into each ctx before we begin */ for (int i =0 ; i <ARRAY_SIZE (contexts); i++) { - execbuf.rsvd1 = contexts[i]; + execbuf.rsvd1 = contexts[i]->id;gem_execbuf (fd, &execbuf); }gem_sync (fd, handle);
@@ -177,7 +180,7 @@ static void single(int fd, uint32_t handle, do { igt_while_interruptible(flags & INTERRUPTIBLE) { for (int loop = 0; loop < 64; loop++) { - execbuf.rsvd1 = contexts[loop % 64]; + execbuf.rsvd1 = contexts[loop % 64]->id; reloc.presumed_offset = -1; gem_execbuf(fd, &execbuf); }
@@ -214,28 +217,30 @@ static void single(int fd, uint32_t handle, }for (n =0 ; n <64 ; n++) -gem_context_destroy (fd, contexts[n]); +intel_ctx_destroy (fd, contexts[n]);munmap (shared,4096 ); } -static void all (int fd,uint32_t handle,unsigned flags,int timeout) +static void all (int fd,uint32_t handle,const intel_ctx_cfg_t *base_cfg, +unsigned flags,int timeout) {struct drm_i915_gem_execbuffer2 execbuf;struct drm_i915_gem_exec_object2 obj[2 ];struct intel_engine_data engines = { }; -uint32_t contexts[65 ]; +intel_ctx_cfg_t cfg; +const intel_ctx_t *contexts[65 ];int n, qlen; - engines =intel_init_engine_list (fd,0 ); + engines =intel_engine_list_for_ctx_cfg (fd, base_cfg);igt_require (engines.nengines); -for (n =0 ; n <ARRAY_SIZE (contexts); n++) { -if (flags &QUEUE ) - contexts[n] =gem_queue_clone_with_engines (fd,0 ); -else - contexts[n] =gem_context_clone_with_engines (fd,0 ); - } + cfg = *base_cfg; +if (flags &QUEUE ) + cfg.vm =gem_vm_create (fd); + +for (n =0 ; n <64 ; n++) + contexts[n] =intel_ctx_create (fd, &cfg);memset (obj,0 ,sizeof (obj)); obj[1 ].handle = handle;
@@ -243,13 +248,13 @@ static void all(int fd, uint32_t handle, unsigned flags, int timeout)memset (&execbuf,0 ,sizeof (execbuf)); execbuf.buffers_ptr =to_user_pointer (obj +1 ); execbuf.buffer_count =1 ; - execbuf.rsvd1 = contexts[0 ]; + execbuf.rsvd1 = contexts[0 ]->id; execbuf.flags |=I915_EXEC_HANDLE_LUT ; execbuf.flags |=I915_EXEC_NO_RELOC ;igt_require (__gem_execbuf (fd, &execbuf) ==0 );gem_sync (fd, handle); - qlen =measure_qlen (fd, &execbuf, &engines, timeout); + qlen =measure_qlen (fd, base_cfg, &execbuf, &engines, timeout);igt_info ("Using timing depth of %d batches\n" , qlen); execbuf.buffers_ptr =to_user_pointer (obj);
@@ -266,7 +271,7 @@ static void all(int fd, uint32_t handle, unsigned flags, int timeout)for (int loop =0 ; loop <ARRAY_SIZE (contexts); loop++) { - execbuf.rsvd1 = contexts[loop]; + execbuf.rsvd1 = contexts[loop]->id;gem_execbuf (fd, &execbuf); }gem_sync (fd, obj[0 ].handle);
@@ -275,7 +280,7 @@ static void all(int fd, uint32_t handle, unsigned flags, int timeout) do { for (int loop = 0; loop < qlen; loop++) { execbuf.rsvd1 = - contexts[loop % nctx]; + contexts[loop % nctx]->id; gem_execbuf(fd, &execbuf); } count += qlen;
@@ -299,7 +304,7 @@ static void all(int fd, uint32_t handle, unsigned flags, int timeout) }for (n =0 ; n <ARRAY_SIZE (contexts); n++) -gem_context_destroy (fd, contexts[n]); +intel_ctx_destroy (fd, contexts[n]); } igt_main
@@ -307,6 +312,8 @@ igt_mainconst int ncpus =sysconf (_SC_NPROCESSORS_ONLN);const struct intel_execution_engine2 *e2;const struct intel_execution_ring *e; +const intel_ctx_cfg_t legacy_cfg = {}; +intel_ctx_cfg_t engines_cfg; static const struct { const char *name; unsigned int flags;
@@ -314,8 +321,8 @@ igt_main } phases[] = { { "", 0, NULL }, { "-interruptible", INTERRUPTIBLE, NULL }, - { "-queue", QUEUE, gem_has_queues }, - { "-queue-interruptible", QUEUE | INTERRUPTIBLE, gem_has_queues }, + { "-queue", QUEUE, gem_has_vm }, + { "-queue-interruptible", QUEUE | INTERRUPTIBLE, gem_has_vm }, { } }; uint32_t light = 0, heavy;
@@ -329,6 +336,8 @@ igt_maingem_require_contexts (fd); + engines_cfg =intel_ctx_cfg_all_physical (fd); + light =gem_create (fd,4096 );gem_write (fd, light,0 , &bbe,sizeof (bbe));
@@ -357,24 +366,26 @@ igt_main } igt_subtest_f("legacy-%s%s", e->name, p->name) -single (fd, light, e2, p->flags,1 ,2 ); +single (fd, light, &legacy_cfg, e2, + p->flags,1 ,2 );igt_subtest_f ("legacy-%s-heavy%s" , e->name, p->name) -single (fd, heavy, e2, p->flags,1 ,2 ); +single (fd, heavy, &legacy_cfg, e2, + p->flags,1 ,2 );igt_subtest_f ("legacy-%s-forked%s" , e->name, p->name) -single (fd, light, e2, p->flags, ncpus, -20 ); +single (fd, light, &legacy_cfg, e2, + p->flags, ncpus,20 );igt_subtest_f ("legacy-%s-forked-heavy%s" , e->name, p->name) -single (fd, heavy, e2, p->flags, ncpus, -20 ); +single (fd, heavy, &legacy_cfg, e2, + p->flags, ncpus,20 ); } } }/* Must come after legacy subtests. */ -__for_each_physical_engine (fd, e2) { +for_each_ctx_cfg_engine (fd, &engines_cfg, e2) {for (typeof (*phases) *p = phases; p->name; p++) { igt_subtest_group { igt_fixture {
@@ -383,33 +394,35 @@ igt_main } igt_subtest_f("%s%s", e2->name, p->name) -single (fd, light, e2, p->flags,1 ,2 ); +single (fd, light, &engines_cfg, e2, + p->flags,1 ,2 ); igt_subtest_f("%s-heavy%s", e2->name, p->name) -single (fd, heavy, e2, p->flags,1 ,2 ); +single (fd, heavy, &engines_cfg, e2, + p->flags,1 ,2 ); igt_subtest_f("%s-forked%s", e2->name, p->name) -single (fd, light, e2, p->flags, ncpus, -20 ); +single (fd, light, &engines_cfg, e2, + p->flags, ncpus,20 );igt_subtest_f ("%s-forked-heavy%s" , e2->name, p->name) -single (fd, heavy, e2, p->flags, ncpus, -20 ); +single (fd, heavy, &engines_cfg, e2, + p->flags, ncpus,20 ); } } } igt_subtest("all-light") -all (fd, light,0 ,2 ); +all (fd, light, &engines_cfg,0 ,2 ); igt_subtest("all-heavy") -all (fd, heavy,0 ,2 ); +all (fd, heavy, &engines_cfg,0 ,2 ); igt_subtest_group { igt_fixture { -igt_require (gem_has_queues (fd)); +gem_require_vm (fd); } igt_subtest("queue-light") -all (fd, light,QUEUE ,2 ); +all (fd, light, &engines_cfg,QUEUE ,2 ); igt_subtest("queue-heavy") -all (fd, heavy,QUEUE ,2 ); +all (fd, heavy, &engines_cfg,QUEUE ,2 ); } igt_fixture {
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 48/89 tests/i915/gem_exec_parallel: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_exec_parallel.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)
tests/i915/gem_exec_parallel.c +19 -10
@@ -56,6 +56,7 @@ struct thread {unsigned flags;uint32_t *scratch;unsigned id; +const intel_ctx_t *ctx;unsigned engine;uint32_t used;int fd, gen, *go;
@@ -67,6 +68,7 @@ static void *thread(void *data)struct drm_i915_gem_exec_object2 obj[2 ];struct drm_i915_gem_relocation_entry reloc;struct drm_i915_gem_execbuffer2 execbuf; +const intel_ctx_t *tmp_ctx =NULL ;uint32_t batch[16 ];uint16_t used;int fd, i;
@@ -78,7 +80,6 @@ static void *thread(void *data)if (t->flags &FDS ) { fd =gem_reopen_driver (t->fd); -gem_context_copy_engines (t->fd,0 , fd,0 ); }else { fd = t->fd; }
@@ -121,8 +122,11 @@ static void *thread(void *data) execbuf.flags |=I915_EXEC_NO_RELOC ;if (t->gen <6 ) execbuf.flags |=I915_EXEC_SECURE ; -if (t->flags &CONTEXTS ) { - execbuf.rsvd1 =gem_context_clone_with_engines (fd,0 ); +if (t->flags & (CONTEXTS |FDS )) { + tmp_ctx =intel_ctx_create (fd, &t->ctx->cfg); + execbuf.rsvd1 = tmp_ctx->id; + }else { + execbuf.rsvd1 = t->ctx->id; } used =0 ;
@@ -141,8 +145,8 @@ static void *thread(void *data)gem_close (fd, obj[0 ].handle); } -if (t->flags &CONTEXTS ) -gem_context_destroy (fd, execbuf.rsvd1); +if (t->flags & (CONTEXTS |FDS )) +intel_ctx_destroy (fd, tmp_ctx);gem_close (fd, obj[1 ].handle);if (t->flags &FDS )close (fd);
@@ -196,7 +200,8 @@ static void handle_close(int fd, unsigned int flags, uint32_t handle, void *datagem_close (fd, handle); } -static void all (int fd,struct intel_execution_engine2 *engine,unsigned flags) +static void all (int fd,const intel_ctx_t *ctx, +struct intel_execution_engine2 *engine,unsigned flags) {const unsigned int gen =intel_gen (intel_get_drm_devid (fd));unsigned engines[I915_EXEC_RING_MASK +1 ], nengine;
@@ -219,7 +224,7 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) nengine =0 ;if (!engine) {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)) engines[nengine++] = e->flags; }
@@ -246,6 +251,7 @@ static void all(int fd, struct intel_execution_engine2 *engine, unsigned flags) threads[i].id = i; threads[i].fd = fd; threads[i].gen = gen; + threads[i].ctx = ctx; threads[i].engine = engines[i % nengine]; threads[i].flags = flags; threads[i].scratch = scratch;
@@ -287,11 +293,13 @@ igt_main { "userptr", USERPTR }, { NULL } }; +const intel_ctx_t *ctx =NULL ;int fd; igt_fixture { fd =drm_open_driver_master (DRIVER_INTEL );igt_require_gem (fd); + ctx =intel_ctx_create_all_physical (fd);igt_fork_hang_detector (fd); }
@@ -300,21 +308,22 @@ igt_mainfor (const struct mode *m = modes; m->name; m++)igt_dynamic (m->name) /* NULL value means all engines */ -all (fd,NULL , m->flags); +all (fd, ctx,NULL , m->flags); }for (const struct mode *m = modes; m->name; m++) { igt_subtest_with_dynamic(m->name) { -__for_each_physical_engine (fd, e) { +for_each_ctx_engine (fd, ctx, e) {if (gem_class_can_store_dword (fd, e->class)) igt_dynamic(e->name) -all (fd, e, m->flags); +all (fd, ctx, e, m->flags); } } } igt_fixture {igt_stop_hang_detector (); +intel_ctx_destroy (fd, ctx);close (fd); } }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 49/89 tests/i915/gem_exec_latency: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_exec_latency.c | 120 +++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 54 deletions(-)
tests/i915/gem_exec_latency.c +66 -54
@@ -58,9 +58,11 @@ static unsigned int ring_size;static double rcs_clock;static struct intel_mmio_data mmio_data; -static void poll_ring (int fd,const struct intel_execution_engine2 *e) +static void poll_ring (int fd,const intel_ctx_t *ctx, +const struct intel_execution_engine2 *e) {const struct igt_spin_factory opts = { + .ctx = ctx, .engine = e->flags, .flags =IGT_SPIN_POLL_RUN |IGT_SPIN_FAST , };
@@ -100,7 +102,7 @@ static void poll_ring(int fd, const struct intel_execution_engine2 *e) }#define TIMESTAMP (0x358) -static void latency_on_ring (int fd, +static void latency_on_ring (int fd,const intel_ctx_t *ctx,const struct intel_execution_engine2 *e,unsigned flags) {
@@ -127,6 +129,7 @@ static void latency_on_ring(int fd, execbuf.buffer_count =2 ; execbuf.flags = e->flags; execbuf.flags |=I915_EXEC_NO_RELOC |I915_EXEC_HANDLE_LUT ; + execbuf.rsvd1 = ctx->id;memset (obj,0 ,sizeof (obj)); obj[1 ].handle =gem_create (fd,4096 );
@@ -249,7 +252,7 @@ static void latency_on_ring(int fd,gem_close (fd, obj[2 ].handle); } -static void latency_from_ring (int fd, +static void latency_from_ring (int fd,const intel_ctx_t *base_ctx,const struct intel_execution_engine2 *e,unsigned flags) {
@@ -262,17 +265,17 @@ static void latency_from_ring(int fd,const unsigned int repeats = ring_size /2 ;const struct intel_execution_engine2 *other;uint32_t *map, *results; -uint32_t ctx[2 ] = {}; +const intel_ctx_t *ctx[2 ] = {base_ctx, base_ctx};int i, j;igt_require (mmio_base);if (flags &PREEMPT ) { - ctx[0 ] =gem_context_clone_with_engines (fd,0 ); -gem_context_set_priority (fd, ctx[0 ],-1023 ); + ctx[0 ] =intel_ctx_create (fd, &base_ctx->cfg); +gem_context_set_priority (fd, ctx[0 ]->id,-1023 ); - ctx[1 ] =gem_context_clone_with_engines (fd,0 ); -gem_context_set_priority (fd, ctx[1 ],1023 ); + ctx[1 ] =intel_ctx_create (fd, &base_ctx->cfg); +gem_context_set_priority (fd, ctx[1 ]->id,1023 ); }memset (&execbuf,0 ,sizeof (execbuf));
@@ -280,7 +283,7 @@ static void latency_from_ring(int fd, execbuf.buffer_count =2 ; execbuf.flags = e->flags; execbuf.flags |=I915_EXEC_NO_RELOC |I915_EXEC_HANDLE_LUT ; - execbuf.rsvd1 = ctx[1 ]; + execbuf.rsvd1 = ctx[1 ]->id;memset (obj,0 ,sizeof (obj)); obj[1 ].handle =gem_create (fd,4096 );
@@ -308,7 +311,7 @@ static void latency_from_ring(int fd, reloc.presumed_offset = obj[1 ].offset; reloc.target_handle = flags &CORK ?1 :0 ; -__for_each_physical_engine (fd, other) { +for_each_ctx_engine (fd, base_ctx, other) {igt_spin_t *spin =NULL ;IGT_CORK_HANDLE (c);
@@ -318,7 +321,7 @@ static void latency_from_ring(int fd,if (flags &PREEMPT ) spin = __igt_spin_new(fd, - .ctx_id = ctx[0], + .ctx = ctx[0], .engine = e->flags);if (flags &CORK ) {
@@ -402,12 +405,13 @@ static void latency_from_ring(int fd,gem_close (fd, obj[2 ].handle);if (flags &PREEMPT ) { -gem_context_destroy (fd, ctx[1 ]); -gem_context_destroy (fd, ctx[0 ]); +intel_ctx_destroy (fd, ctx[1 ]); +intel_ctx_destroy (fd, ctx[0 ]); } } -static void execution_latency (int i915,const struct intel_execution_engine2 *e) +static void execution_latency (int i915,const intel_ctx_t *ctx, +const struct intel_execution_engine2 *e) {struct drm_i915_gem_exec_object2 obj = { .handle =gem_create (i915,4095 ),
@@ -416,6 +420,7 @@ static void execution_latency(int i915, const struct intel_execution_engine2 *e) .buffers_ptr = to_user_pointer(&obj), .buffer_count = 1, .flags = e->flags | I915_EXEC_NO_RELOC | I915_EXEC_HANDLE_LUT, + .rsvd1 = ctx->id, };const uint32_t mmio_base =gem_engine_mmio_base (i915, e->name);const unsigned int cs_timestamp = mmio_base +0x358 ;
@@ -488,7 +493,8 @@ static void execution_latency(int i915, const struct intel_execution_engine2 *e)gem_close (i915, obj.handle); } -static void wakeup_latency (int i915,const struct intel_execution_engine2 *e) +static void wakeup_latency (int i915,const intel_ctx_t *ctx, +const struct intel_execution_engine2 *e) {struct drm_i915_gem_exec_object2 obj = { .handle =gem_create (i915,4095 ),
@@ -497,6 +503,7 @@ static void wakeup_latency(int i915, const struct intel_execution_engine2 *e) .buffers_ptr = to_user_pointer(&obj), .buffer_count = 1, .flags = e->flags | I915_EXEC_NO_RELOC | I915_EXEC_HANDLE_LUT, + .rsvd1 = ctx->id, };const uint32_t mmio_base =gem_engine_mmio_base (i915, e->name);const unsigned int cs_timestamp = mmio_base +0x358 ;
@@ -597,7 +604,8 @@ static bool __spin_wait(int fd, igt_spin_t *spin)* Test whether RT thread which hogs the CPU a lot can submit work with * reasonable latency. */ -static void rthog_latency_on_ring (int fd,const struct intel_execution_engine2 *e) +static void rthog_latency_on_ring (int fd,const intel_ctx_t *ctx, +const struct intel_execution_engine2 *e) {const char *passname[] = {"warmup" ,
@@ -613,6 +621,7 @@ static void rthog_latency_on_ring(int fd, const struct intel_execution_engine2 *#define NPASS ARRAY_SIZE(passname)#define MMAP_SZ (64 << 10)const struct igt_spin_factory opts = { + .ctx = ctx, .engine = e->flags, .flags =IGT_SPIN_POLL_RUN |IGT_SPIN_FAST , };
@@ -735,7 +744,7 @@ static void rthog_latency_on_ring(int fd, const struct intel_execution_engine2 *munmap (results,MMAP_SZ ); } -static void context_switch (int i915, +static void context_switch (int i915,const intel_ctx_t *ctx,const struct intel_execution_engine2 *e,unsigned int flags) {
@@ -745,17 +754,17 @@ static void context_switch(int i915,uint32_t *cs, *bbe, *results, v;const uint32_t mmio_base =gem_engine_mmio_base (i915, e->name);struct igt_mean mean; -uint32_t ctx[2 ]; +const intel_ctx_t *tmp_ctx[2 ];igt_require (mmio_base);igt_require (gem_class_has_mutable_submission (i915, e->class)); -for (int i =0 ; i <ARRAY_SIZE (ctx); i++) - ctx[i] =gem_context_clone_with_engines (i915,0 ); +for (int i =0 ; i <ARRAY_SIZE (tmp_ctx); i++) + tmp_ctx[i] =intel_ctx_create (i915, &ctx->cfg);if (flags &PREEMPT ) { -gem_context_set_priority (i915, ctx[0 ],-1023 ); -gem_context_set_priority (i915, ctx[1 ],+1023 ); +gem_context_set_priority (i915, tmp_ctx[0 ]->id,-1023 ); +gem_context_set_priority (i915, tmp_ctx[1 ]->id,+1023 ); }memset (obj,0 ,sizeof (obj));
@@ -815,14 +824,14 @@ static void context_switch(int i915, v =0 ;igt_mean_init (&mean); igt_until_timeout(5) { - eb.rsvd1 = ctx[0 ]; + eb.rsvd1 = tmp_ctx[0 ]->id; eb.batch_start_offset =0 ;gem_execbuf (i915, &eb);while (results[0 ] == v)igt_assert (gem_bo_busy (i915, obj[1 ].handle)); - eb.rsvd1 = ctx[1 ]; + eb.rsvd1 = tmp_ctx[1 ]->id; eb.batch_start_offset =64 *sizeof (*cs);gem_execbuf (i915, &eb);
@@ -843,8 +852,8 @@ static void context_switch(int i915,for (int i =0 ; i <ARRAY_SIZE (obj); i++)gem_close (i915, obj[i].handle); -for (int i =0 ; i <ARRAY_SIZE (ctx); i++) -gem_context_destroy (i915, ctx[i]); +for (int i =0 ; i <ARRAY_SIZE (tmp_ctx); i++) +intel_ctx_destroy (i915, tmp_ctx[i]); }static double clockrate (int i915,int reg)
@@ -879,20 +888,22 @@ static double clockrate(int i915, int reg)return (r_end - r_start) *1e9 / elapsed; } -#define test_each_engine (T , i915, e) \ - igt_subtest_with_dynamic(T) __for_each_physical_engine(i915, e) \ +#define test_each_engine (T , i915, ctx, e) \ + igt_subtest_with_dynamic(T) for_each_ctx_engine(i915, ctx, e) \ for_each_if(gem_class_can_store_dword(i915, (e)->class)) \ igt_dynamic_f("%s", (e)->name) igt_main {const struct intel_execution_engine2 *e; +const intel_ctx_t *ctx =NULL ;int device =-1 ; igt_fixture { device =drm_open_driver (DRIVER_INTEL );igt_require_gem (device);gem_require_mmap_wc (device); + ctx =intel_ctx_create_all_physical (device);gem_submission_print_method (device);
@@ -914,31 +925,31 @@ igt_mainigt_fixture igt_require(intel_gen(intel_get_drm_devid(device)) >= 7); - test_each_engine("rthog-submit", device, e) -rthog_latency_on_ring (device, e); + test_each_engine("rthog-submit", device, ctx, e) +rthog_latency_on_ring (device, ctx, e); - test_each_engine("dispatch", device, e) -latency_on_ring (device, e,0 ); - test_each_engine("dispatch-queued", device, e) -latency_on_ring (device, e,CORK ); + test_each_engine("dispatch", device, ctx, e) +latency_on_ring (device, ctx, e,0 ); + test_each_engine("dispatch-queued", device, ctx, e) +latency_on_ring (device, ctx, e,CORK ); - test_each_engine("live-dispatch", device, e) -latency_on_ring (device, e,LIVE ); - test_each_engine("live-dispatch-queued", device, e) -latency_on_ring (device, e,LIVE |CORK ); + test_each_engine("live-dispatch", device, ctx, e) +latency_on_ring (device, ctx, e,LIVE ); + test_each_engine("live-dispatch-queued", device, ctx, e) +latency_on_ring (device, ctx, e,LIVE |CORK ); - test_each_engine("poll", device, e) -poll_ring (device, e); + test_each_engine("poll", device, ctx, e) +poll_ring (device, ctx, e); - test_each_engine("synchronisation", device, e) -latency_from_ring (device, e,0 ); - test_each_engine("synchronisation-queued", device, e) -latency_from_ring (device, e,CORK ); + test_each_engine("synchronisation", device, ctx, e) +latency_from_ring (device, ctx, e,0 ); + test_each_engine("synchronisation-queued", device, ctx, e) +latency_from_ring (device, ctx, e,CORK ); - test_each_engine("execution-latency", device, e) -execution_latency (device, e); - test_each_engine("wakeup-latency", device, e) -wakeup_latency (device, e); + test_each_engine("execution-latency", device, ctx, e) +execution_latency (device, ctx, e); + test_each_engine("wakeup-latency", device, ctx, e) +wakeup_latency (device, ctx, e); igt_subtest_group { igt_fixture {
@@ -946,17 +957,18 @@ igt_mainigt_require (gem_scheduler_has_preemption (device)); } - test_each_engine("preemption", device, e) -latency_from_ring (device, e,PREEMPT ); - test_each_engine("context-switch", device, e) -context_switch (device, e,0 ); - test_each_engine("context-preempt", device, e) -context_switch (device, e,PREEMPT ); + test_each_engine("preemption", device, ctx, e) +latency_from_ring (device, ctx, e,PREEMPT ); + test_each_engine("context-switch", device, ctx, e) +context_switch (device, ctx, e,0 ); + test_each_engine("context-preempt", device, ctx, e) +context_switch (device, ctx, e,PREEMPT ); } } igt_fixture {intel_register_access_fini (&mmio_data); +intel_ctx_destroy (device, ctx);close (device); } }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 50/89 tests/i915/gem_watchdog: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_watchdog.c | 169 +++++++++++--------------------------- 1 file changed, 46 insertions(+), 123 deletions(-)
tests/i915/gem_watchdog.c +46 -123
@@ -30,36 +30,13 @@#include <sched.h> #include "i915/gem.h" +#include "i915/gem_vm.h" #include "igt.h" #include "igt_params.h" #include "sw_sync.h" #define EWATCHDOG EINTR -static struct drm_i915_query_engine_info *__engines__; - -static int __i915_query (int fd,struct drm_i915_query *q) -{ -if (igt_ioctl (fd,DRM_IOCTL_I915_QUERY , q)) -return -errno; -return 0 ; -} - -static int -__i915_query_items (int fd,struct drm_i915_query_item *items,uint32_t n_items) -{ -struct drm_i915_query q = { - .num_items = n_items, - .items_ptr =to_user_pointer (items), - }; -return __i915_query (fd, &q); -} - -#define i915_query_items (fd, items, n_items) do { \ - igt_assert_eq(__i915_query_items(fd, items, n_items), 0); \ - errno = 0; \ - } while (0) -static unsigned int default_timeout_wait_s;static const unsigned int watchdog_us =500 *1000 ;
@@ -127,56 +104,43 @@ static unsigned int spin_flags(void)return IGT_SPIN_POLL_RUN |IGT_SPIN_FENCE_OUT ; } -static void physical (int i915) +static void physical (int i915,const intel_ctx_t *ctx) {const unsigned int wait_us = default_timeout_wait_s *USEC_PER_SEC ; -unsigned int num_engines = __engines__->num_engines, i, count; +unsigned int num_engines, i, count;const struct intel_execution_engine2 *e; -unsigned int expect = num_engines; -igt_spin_t *spin[num_engines]; +igt_spin_t *spin[GEM_MAX_ENGINES ]; i =0 ; -__for_each_physical_engine (i915, e) { - spin[i] = igt_spin_new(i915, +for_each_ctx_engine (i915, ctx, e) { + spin[i] = igt_spin_new(i915, .ctx = ctx, .engine = e->flags, .flags =spin_flags ()); i++; } + num_engines = i; - count =wait_timeout (i915, spin, num_engines, wait_us, expect); + count =wait_timeout (i915, spin, num_engines, wait_us, num_engines);for (i =0 ; i < num_engines; i++)igt_spin_free (i915, spin[i]); -igt_assert_eq (count, expect); +igt_assert_eq (count, num_engines); }static struct i915_engine_class_instance * -list_engines (unsigned int class,unsigned int *out) +list_engines (const intel_ctx_cfg_t *cfg, +unsigned int class,unsigned int *out) {struct i915_engine_class_instance *ci; -unsigned int count =0 , size =64 , i; +unsigned int count =0 , i; - ci =malloc (size *sizeof (*ci)); + ci =malloc (cfg->num_engines *sizeof (*ci));igt_assert (ci); -for (i =0 ; i < __engines__->num_engines; i++) { -struct drm_i915_engine_info *engine = - (struct drm_i915_engine_info *)&__engines__->engines[i]; - -if (class != engine->engine.engine_class) -continue ; - -if (count == size) { - size *=2 ; - ci =realloc (ci, size *sizeof (*ci)); -igt_assert (ci); - } - - ci[count++] = (struct i915_engine_class_instance ){ - .engine_class = class, - .engine_instance = engine->engine.engine_instance, - }; +for (i =0 ; i < cfg->num_engines; i++) { +if (class == cfg->engines[i].engine_class) + ci[count++] = cfg->engines[i]; }if (!count) {
@@ -243,49 +207,27 @@ static void set_load_balancer(int i915, uint32_t ctx,igt_assert_eq (__set_load_balancer (i915, ctx, ci, count, ext),0 ); } -static void ctx_set_vm (int i915,uint32_t ctx,uint32_t vm) -{ -struct drm_i915_gem_context_param arg = { - .param =I915_CONTEXT_PARAM_VM , - .ctx_id = ctx, - .value = vm, - }; - -gem_context_set_param (i915, &arg); -} - -static uint32_t ctx_get_vm (int i915,uint32_t ctx) -{ -struct drm_i915_gem_context_param arg; - -memset (&arg,0 ,sizeof (arg)); - arg.param =I915_CONTEXT_PARAM_VM ; - arg.ctx_id = ctx; -gem_context_get_param (i915, &arg); -igt_assert (arg.value); - -return arg.value; -} - -static void virtual (int i915) +static void virtual (int i915,const intel_ctx_cfg_t *base_cfg) {const unsigned int wait_us = default_timeout_wait_s *USEC_PER_SEC ; -unsigned int num_engines = __engines__->num_engines, i, count; +unsigned int num_engines = base_cfg->num_engines, i, count;igt_spin_t *spin[num_engines];unsigned int expect = num_engines; -uint32_t ctx[num_engines]; -uint32_t vm; +intel_ctx_cfg_t cfg = *base_cfg; +const intel_ctx_t *ctx[num_engines];igt_require (gem_has_execlists (i915));igt_debug ("%u virtual engines\n" , num_engines);igt_require (num_engines); + cfg.vm =gem_vm_create (i915); + i =0 ;for (int class =0 ; class <32 ; class++) {struct i915_engine_class_instance *ci; - ci =list_engines (class, &count); + ci =list_engines (base_cfg, class, &count);if (!ci)continue ;
@@ -295,17 +237,12 @@ static void virtual(int i915)igt_assert (i < num_engines); - ctx[i] =gem_context_create (i915); + ctx[i] =intel_ctx_create (i915, &cfg); -if (!i) - vm =ctx_get_vm (i915, ctx[i]); -else -ctx_set_vm (i915, ctx[i], vm); - -set_load_balancer (i915, ctx[i], ci, count,NULL ); +set_load_balancer (i915, ctx[i]->id, ci, count,NULL ); spin[i] = igt_spin_new(i915, - .ctx_id = ctx[i], + .ctx = ctx[i], .flags =spin_flags ()); i++; }
@@ -316,8 +253,8 @@ static void virtual(int i915) count =wait_timeout (i915, spin, num_engines, wait_us, expect);for (i =0 ; i < num_engines && spin[i]; i++) { -gem_context_destroy (i915, ctx[i]);igt_spin_free (i915, spin[i]); +intel_ctx_destroy (i915, ctx[i]); }igt_assert_eq (count, expect);
@@ -498,17 +435,6 @@ delay_create(int i915, uint32_t ctx,return obj; } -static uint32_t vm_clone (int i915) -{ -uint32_t ctx =0 ; -__gem_context_clone (i915,0 , -I915_CONTEXT_CLONE_VM | -I915_CONTEXT_CLONE_ENGINES , -I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE , - &ctx); -return ctx; -} -static int __execbuf (int i915,struct drm_i915_gem_execbuffer2 *execbuf) {int err;
@@ -525,6 +451,7 @@ static int __execbuf(int i915, struct drm_i915_gem_execbuffer2 *execbuf)static uint32_t far_delay (int i915,unsigned long delay,unsigned int target, +const intel_ctx_t *ctx,const struct intel_execution_engine2 *e,int *fence) {struct drm_i915_gem_exec_object2 obj =delay_create (i915,0 , e, delay);
@@ -539,6 +466,7 @@ far_delay(int i915, unsigned long delay, unsigned int target, .buffer_count = 2, .flags = e->flags, }; +intel_ctx_cfg_t cfg = ctx->cfg;uint32_t handle =gem_create (i915,4096 );unsigned long count, submit;
@@ -551,23 +479,27 @@ far_delay(int i915, unsigned long delay, unsigned int target, submit *=NSEC_PER_SEC ; submit /=2 * delay; +if (gem_has_vm (i915)) + cfg.vm =gem_vm_create (i915); +/* * Submit a few long chains of individually short pieces of work * against a shared object. */ for (count =0 ; count < submit;) { - execbuf.rsvd1 =vm_clone (i915); +const intel_ctx_t *tmp_ctx =intel_ctx_create (i915, &cfg); + execbuf.rsvd1 = tmp_ctx->id;if (!execbuf.rsvd1)break ; batch[1 ] = obj;while (__execbuf (i915, &execbuf) ==0 ) count++; -gem_context_destroy (i915, execbuf.rsvd1); +intel_ctx_destroy (i915, tmp_ctx); } execbuf.flags |=I915_EXEC_FENCE_OUT ; - execbuf.rsvd1 =0 ; + execbuf.rsvd1 = ctx->id; batch[1 ] = batch[0 ]; batch[1 ].flags &= ~EXEC_OBJECT_WRITE ; batch[0 ].handle = handle;
@@ -583,11 +515,12 @@ far_delay(int i915, unsigned long delay, unsigned int target, }static void -far_fence (int i915,int timeout,const struct intel_execution_engine2 *e) +far_fence (int i915,int timeout,const intel_ctx_t *ctx, +const struct intel_execution_engine2 *e) {int fence =-1 ;uint32_t handle = -far_delay (i915,NSEC_PER_SEC /250 , timeout, e, &fence); +far_delay (i915,NSEC_PER_SEC /250 , timeout, ctx, e, &fence);gem_close (i915, handle);
@@ -626,10 +559,10 @@ far_fence(int i915, int timeout, const struct intel_execution_engine2 *e) igt_main {const struct intel_execution_engine2 *e; +const intel_ctx_t *ctx;int i915 =-1 ; igt_fixture { -struct drm_i915_query_item item;char *tmp; i915 =drm_open_driver_master (DRIVER_INTEL );
@@ -651,32 +584,22 @@ igt_main } i915 =gem_reopen_driver (i915);/* Apply modparam. */ - - __engines__ =malloc (4096 ); -igt_assert (__engines__); -memset (__engines__,0 ,4096 ); -memset (&item,0 ,sizeof (item)); - item.query_id =DRM_I915_QUERY_ENGINE_INFO ; - item.data_ptr =to_user_pointer (__engines__); - item.length =4096 ; -i915_query_items (i915, &item,1 ); -igt_assert (item.length >=0 ); -igt_assert (item.length <=4096 ); -igt_assert (__engines__->num_engines >0 ); + ctx =intel_ctx_create_all_physical (i915); } igt_subtest_group { igt_subtest("default-physical") -physical (i915); +physical (i915, ctx); igt_subtest("default-virtual") -virtual (i915); +virtual (i915, &ctx->cfg); } igt_subtest_with_dynamic("far-fence") { -__for_each_physical_engine (i915, e) { +for_each_ctx_engine (i915, ctx, e) { igt_dynamic_f("%s", e->name) -far_fence (i915, default_timeout_wait_s *3 , e); +far_fence (i915, default_timeout_wait_s *3 , + ctx, e); } }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 51/89 tests/i915/gem_shrink: Convert to intel_ctx_t
In reply to Jason EkstrandOnly one subtest actually needs to iterate over engines.
--- tests/i915/gem_shrink.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-)
tests/i915/gem_shrink.c +20 -17
@@ -37,8 +37,6 @@#define MADV_FREE 8#endif -static unsigned int engines[I915_EXEC_RING_MASK +1 ], nengine; -static void get_pages (int fd,uint64_t alloc) {uint32_t handle =gem_create (fd, alloc);
@@ -163,8 +161,10 @@ static void execbufN(int fd, uint64_t alloc)static void execbufX (int fd,uint64_t alloc) {const uint32_t bbe =MI_BATCH_BUFFER_END ; +const struct intel_execution_engine2 *e;struct drm_i915_gem_exec_object2 *obj;struct drm_i915_gem_execbuffer2 execbuf; +const intel_ctx_t *ctx;int count = alloc >>20 ;uint64_t obj_size;
@@ -174,23 +174,32 @@ static void execbufX(int fd, uint64_t alloc) obj[count].handle =gem_create (fd,4096 );gem_write (fd, obj[count].handle,0 , &bbe,sizeof (bbe)); -for (int i =1 ; i <= count; i++) { -int j = count - i; + ctx =intel_ctx_create_all_physical (fd); - obj[j+1 ].flags =0 ; +for (int i =1 ; i <= count;) { +for_each_ctx_engine (fd, ctx, e) { +int j = count - i; - obj[j].handle =gem_create (fd,1 <<20 ); - obj[j].flags =EXEC_OBJECT_WRITE ; + obj[j+1 ].flags =0 ; - execbuf.buffers_ptr =to_user_pointer (&obj[j]); - execbuf.buffer_count = i +1 ; - execbuf.flags = engines[j % nengine]; -gem_execbuf (fd, &execbuf); + obj[j].handle =gem_create (fd,1 <<20 ); + obj[j].flags =EXEC_OBJECT_WRITE ; + + execbuf.buffers_ptr =to_user_pointer (&obj[j]); + execbuf.buffer_count = i +1 ; + execbuf.flags = e->flags; + execbuf.rsvd1 = ctx->id; +gem_execbuf (fd, &execbuf); + + i++; + } }for (int i =0 ; i <= count; i++)gem_madvise (fd, obj[i].handle,I915_MADV_DONTNEED );munmap (obj, obj_size); + +intel_ctx_destroy (fd, ctx); }static void hang (int fd,uint64_t alloc)
@@ -428,7 +437,6 @@ igt_main igt_fixture {const int ncpus =sysconf (_SC_NPROCESSORS_ONLN);uint64_t mem_size =intel_get_total_ram_mb (); -const struct intel_execution_engine2 *e;int fd; fd =drm_open_driver (DRIVER_INTEL );
@@ -450,11 +458,6 @@ igt_mainintel_require_memory (num_processes, alloc_size,CHECK_SWAP |CHECK_RAM ); - nengine =0 ; -__for_each_physical_engine (fd, e) - engines[nengine++] = e->flags; -igt_require (nengine); -close (fd); }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 52/89 tests/i915/gem_exec_params: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_exec_params.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tests/i915/gem_exec_params.c +3 -1
@@ -298,8 +298,10 @@ static void test_larger_than_life_batch(int fd) {const struct intel_execution_engine2 *e;uint64_t size =1ULL <<32 ;/* batch_len is __u32 as per the ABI */ +const intel_ctx_t *ctx =intel_ctx_create_all_physical (fd);struct drm_i915_gem_exec_object2 exec = { .handle =batch_create_size (fd, size), + .rsvd1 = ctx->id, };struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&exec),
@@ -315,7 +317,7 @@ static void test_larger_than_life_batch(int fd)igt_require (size <gem_aperture_size (fd));intel_require_memory (2 , size,CHECK_RAM );/* batch + shadow */ -__for_each_physical_engine (fd, e) { +for_each_ctx_engine (fd, ctx, e) {/* Keep the batch_len implicit [0] */ execbuf.flags = e->flags;
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 53/89 tests/i915/gem_exec_gttfill: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_exec_gttfill.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
tests/i915/gem_exec_gttfill.c +9 -6
@@ -105,7 +105,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;
@@ -125,7 +125,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 ;
@@ -154,6 +154,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);
@@ -208,29 +209,31 @@ static void fillgtt(int fd, unsigned ring, int timeout) igt_main {const struct intel_execution_engine2 *e; +const intel_ctx_t *ctx =NULL ;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 ();
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 54/89 tests/i915/gem_exec_capture: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_exec_capture.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
tests/i915/gem_exec_capture.c +18 -12
@@ -60,7 +60,8 @@ static void check_error_state(int dir, struct drm_i915_gem_exec_object2 *obj)igt_assert (found); } -static void __capture1 (int fd,int dir,unsigned ring,uint32_t target) +static void __capture1 (int fd,int dir,const intel_ctx_t *ctx, +unsigned ring,uint32_t target) {const unsigned int gen =intel_gen (intel_get_drm_devid (fd));struct drm_i915_gem_exec_object2 obj[4 ];
@@ -147,6 +148,7 @@ static void __capture1(int fd, int dir, unsigned ring, uint32_t target) execbuf.flags = ring;if (gen >3 && gen <6 ) execbuf.flags |=I915_EXEC_SECURE ; + execbuf.rsvd1 = ctx->id;igt_assert (!READ_ONCE (*seqno));gem_execbuf (fd, &execbuf);
@@ -167,12 +169,12 @@ static void __capture1(int fd, int dir, unsigned ring, uint32_t target)gem_close (fd, obj[SCRATCH ].handle); } -static void capture (int fd,int dir,unsigned ring) +static void capture (int fd,int dir,const intel_ctx_t *ctx,unsigned ring) {uint32_t handle; handle =gem_create (fd,4096 ); -__capture1 (fd, dir, ring, handle); +__capture1 (fd, dir, ctx, ring, handle);gem_close (fd, handle); }
@@ -495,7 +497,8 @@ static void many(int fd, int dir, uint64_t size, unsigned int flags)free (offsets); } -static void prioinv (int fd,int dir,unsigned ring,const char *name) +static void prioinv (int fd,int dir,const intel_ctx_t *ctx, +unsigned ring,const char *name) {const uint32_t bbe =MI_BATCH_BUFFER_END ;struct drm_i915_gem_exec_object2 obj = {
@@ -505,6 +508,7 @@ static void prioinv(int fd, int dir, unsigned ring, const char *name) .buffers_ptr = to_user_pointer(&obj), .buffer_count = 1, .flags = ring, + .rsvd1 = ctx->id, };int64_t timeout =NSEC_PER_SEC ;/* 1s, feeling generous, blame debug */ uint64_t ram, gtt, size =4 <<20 ;
@@ -572,7 +576,7 @@ static void userptr(int fd, int dir)igt_assert (posix_memalign (&ptr,4096 ,4096 ) ==0 );igt_require (__gem_userptr (fd, ptr,4096 ,0 ,0 , &handle) ==0 ); -__capture1 (fd, dir,0 , handle); +__capture1 (fd, dir,intel_ctx_0 (fd),0 , handle);gem_close (fd, handle);free (ptr);
@@ -595,14 +599,15 @@ static size_t safer_strlen(const char *s)return s ?strlen (s) :0 ; } -#define test_each_engine (T , i915, e) \ - igt_subtest_with_dynamic(T) __for_each_physical_engine(i915, e) \ +#define test_each_engine (T , i915, ctx, e) \ + igt_subtest_with_dynamic(T) for_each_ctx_engine(i915, ctx, e) \ for_each_if(gem_class_can_store_dword(i915, (e)->class)) \ igt_dynamic_f("%s", (e)->name) igt_main {const struct intel_execution_engine2 *e; +const intel_ctx_t *ctx =NULL ;igt_hang_t hang;int fd =-1 ;int dir =-1 ;
@@ -619,15 +624,16 @@ igt_mainigt_require_gem (fd);gem_require_mmap_wc (fd);igt_require (has_capture (fd)); -igt_allow_hang (fd,0 ,HANG_ALLOW_CAPTURE ); + ctx =intel_ctx_create_all_physical (fd); +igt_allow_hang (fd, ctx->id,HANG_ALLOW_CAPTURE ); dir =igt_sysfs_open (fd);igt_require (igt_sysfs_set (dir,"error" ,"Begone!" ));igt_require (safer_strlen (igt_sysfs_get (dir,"error" )) >0 ); } - test_each_engine("capture", fd, e) -capture (fd, dir, e->flags); + test_each_engine("capture", fd, ctx, e) +capture (fd, dir, ctx, e->flags); igt_subtest_f("many-4K-zero") {igt_require (gem_can_store_dword (fd,0 ));
@@ -661,8 +667,8 @@ igt_mainuserptr (fd, dir); } - test_each_engine("pi", fd, e) -prioinv (fd, dir, e->flags, e->name); + test_each_engine("pi", fd, ctx, e) +prioinv (fd, dir, ctx, e->flags, e->name); igt_fixture {close (dir);
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 55/89 tests/i915/gem_exec_create: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_exec_create.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tests/i915/gem_exec_create.c +8 -1
@@ -60,16 +60,21 @@ static void all(int fd, unsigned flags, int timeout, int ncpus)struct drm_i915_gem_execbuffer2 execbuf;struct drm_i915_gem_exec_object2 obj;unsigned engines[I915_EXEC_RING_MASK +1 ], nengine; +const intel_ctx_t *ctx; nengine =0 ;if (flags &ENGINES ) {/* Modern API to iterate over *all* engines */ const struct intel_execution_engine2 *e; -__for_each_physical_engine (fd, e) + ctx =intel_ctx_create_all_physical (fd); + +for_each_ctx_engine (fd, ctx, e) engines[nengine++] = e->flags;/* Note: modifies engine map on context 0 */ }else { + ctx =intel_ctx_0 (fd); +for_each_physical_ring (e, fd) engines[nengine++] =eb_ring (e); }
@@ -84,6 +89,7 @@ static void all(int fd, unsigned flags, int timeout, int ncpus) execbuf.buffer_count =1 ; execbuf.flags |=I915_EXEC_HANDLE_LUT ; execbuf.flags |=I915_EXEC_NO_RELOC ; + execbuf.rsvd1 = ctx->id;if (__gem_execbuf (fd, &execbuf)) { execbuf.flags =0 ;gem_execbuf (fd, &execbuf);
@@ -131,6 +137,7 @@ static void all(int fd, unsigned flags, int timeout, int ncpus) }igt_waitchildren ();igt_assert_eq (intel_detect_and_clear_missed_interrupts (fd),0 ); +intel_ctx_destroy (fd, ctx); } igt_main
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 56/89 tests/i915/gem_exec_await: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_exec_await.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
tests/i915/gem_exec_await.c +14 -6
@@ -62,16 +62,19 @@ static void wide(int fd, int ring_size, int timeout, unsigned int flags)struct drm_i915_gem_exec_object2 exec[2 ];struct drm_i915_gem_relocation_entry reloc;struct drm_i915_gem_execbuffer2 execbuf; +const intel_ctx_t *ctx;uint32_t *cmd; } *exec;struct drm_i915_gem_exec_object2 *obj;struct drm_i915_gem_execbuffer2 execbuf; +const intel_ctx_t *ctx;unsigned engines[I915_EXEC_RING_MASK +1 ], nengine;unsigned long count;double time; + ctx =intel_ctx_create_all_physical (fd); nengine =0 ; -__for_each_physical_engine (fd, engine) { +for_each_ctx_engine (fd, ctx, engine) {if (!gem_class_has_mutable_submission (fd, engine->class))continue ;
@@ -105,7 +108,10 @@ static void wide(int fd, int ring_size, int timeout, unsigned int flags) I915_EXEC_HANDLE_LUT);if (flags &CONTEXTS ) { - exec[e].execbuf.rsvd1 =gem_context_create (fd); + exec[e].ctx =intel_ctx_create (fd, &ctx->cfg); + exec[e].execbuf.rsvd1 = exec[e].ctx->id; + }else { + exec[e].execbuf.rsvd1 = ctx->id; } exec[e].exec[0 ].handle =gem_create (fd,4096 );
@@ -150,9 +156,9 @@ static void wide(int fd, int ring_size, int timeout, unsigned int flags)int i;if (flags &CONTEXTS ) { -gem_context_destroy (fd, exec[e].execbuf.rsvd1); - exec[e].execbuf.rsvd1 = -gem_context_clone_with_engines (fd,0 ); +intel_ctx_destroy (fd, exec[e].ctx); + exec[e].ctx =intel_ctx_create (fd, &ctx->cfg); + exec[e].execbuf.rsvd1 = exec[e].ctx->id; } exec[e].reloc.presumed_offset = exec[e].exec[1 ].offset;
@@ -192,6 +198,7 @@ static void wide(int fd, int ring_size, int timeout, unsigned int flags) execbuf.flags = (engines[e] |I915_EXEC_NO_RELOC |I915_EXEC_HANDLE_LUT ); + execbuf.rsvd1 = ctx->id;gem_execbuf (fd, &execbuf); }clock_gettime (CLOCK_MONOTONIC , &now);
@@ -213,7 +220,7 @@ static void wide(int fd, int ring_size, int timeout, unsigned int flags)for (unsigned e =0 ; e < nengine; e++) {if (flags &CONTEXTS ) -gem_context_destroy (fd, exec[e].execbuf.rsvd1); +intel_ctx_destroy (fd, exec[e].ctx);for (unsigned n =0 ; n < ring_size; n++)gem_close (fd, exec[e].obj[n].handle);
@@ -222,6 +229,7 @@ static void wide(int fd, int ring_size, int timeout, unsigned int flags)munmap (exec[e].cmd,4096 );gem_close (fd, exec[e].exec[1 ].handle); } +intel_ctx_destroy (fd, ctx);free (exec); }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 57/89 tests/i915/gem_ctx_persistence: Drop the clone subtest
In reply to Jason Ekstrand--- tests/i915/gem_ctx_persistence.c | 30 ------------------------------ 1 file changed, 30 deletions(-)
tests/i915/gem_ctx_persistence.c +0 -30
@@ -147,33 +147,6 @@ static void test_idempotent(int i915)igt_assert_eq (p.value, expected); } -static void test_clone (int i915) -{ -struct drm_i915_gem_context_param p = { - .param =I915_CONTEXT_PARAM_PERSISTENCE , - }; -uint32_t ctx, clone; - -/* -* Check that persistence is inherited across a clone. -*/ -igt_require (__gem_context_create (i915, &ctx) ==0 ); - - p.ctx_id = ctx; - p.value =0 ; -gem_context_set_param (i915, &p); - - clone =gem_context_clone (i915, ctx,I915_CONTEXT_CLONE_FLAGS ,0 ); -gem_context_destroy (i915, ctx); - - p.ctx_id = clone; - p.value =-1 ; -gem_context_get_param (i915, &p); -igt_assert_eq (p.value,0 ); - -gem_context_destroy (i915, clone); -} -static void test_persistence (int i915,unsigned int engine) {igt_spin_t *spin;
@@ -1366,9 +1339,6 @@ igt_main igt_subtest("idempotent")test_idempotent (i915); - igt_subtest("clone") -test_clone (i915); - igt_subtest("file")test_nonpersistent_file (i915);
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 58/89 tests/i915/gem_ctx_persistence: Drop the engine replace subtests
In reply to Jason EkstrandWe're going to start disallowing non-trivial uses of setparam for engines precisely to make races like this impossible. It'll also make these test cases invalid.
--- tests/i915/gem_ctx_persistence.c | 210 ------------------------------- 1 file changed, 210 deletions(-)
tests/i915/gem_ctx_persistence.c +0 -210
@@ -1085,191 +1085,6 @@ static void many_contexts(int i915)gem_quiescent_gpu (i915); } -static void replace_engines (int i915,const struct intel_execution_engine2 *e) -{ - I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, 1) = { - .engines = {{ e->class, e->instance }} - }; -struct drm_i915_gem_context_param param = { - .ctx_id =gem_context_create (i915), - .param =I915_CONTEXT_PARAM_ENGINES , - .value =to_user_pointer (&engines), - .size =sizeof (engines), - }; -igt_spin_t *spin[2 ]; -int64_t timeout; - -/* -* Suppose the user tries to hide a hanging batch by replacing -* the set of engines on the context so that it's not visible -* at the time of closure? Then we must act when they replace -* the engines! -*/ - -gem_context_set_persistence (i915, param.ctx_id, false); - -gem_context_set_param (i915, ¶m); - spin[0 ] =igt_spin_new (i915, param.ctx_id); - -gem_context_set_param (i915, ¶m); - spin[1 ] =igt_spin_new (i915, param.ctx_id); - -gem_context_destroy (i915, param.ctx_id); - - timeout = reset_timeout_ms *NSEC_PER_MSEC ; -igt_assert_eq (gem_wait (i915, spin[1 ]->handle, &timeout),0 ); - - timeout = reset_timeout_ms *NSEC_PER_MSEC ; -igt_assert_eq (gem_wait (i915, spin[0 ]->handle, &timeout),0 ); - -igt_spin_free (i915, spin[1 ]); -igt_spin_free (i915, spin[0 ]); -gem_quiescent_gpu (i915); -} - -static void race_set_engines (int i915,int in,int out) -{ - I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, 1) = { - .engines = {} - }; -struct drm_i915_gem_context_param param = { - .param =I915_CONTEXT_PARAM_ENGINES , - .value =to_user_pointer (&engines), - .size =sizeof (engines), - }; -igt_spin_t *spin; - - spin =igt_spin_new (i915); -igt_spin_end (spin); - -while (read (in, ¶m.ctx_id,sizeof (param.ctx_id)) >0 ) { -if (!param.ctx_id) -break ; - -__gem_context_set_param (i915, ¶m); - - spin->execbuf.rsvd1 = param.ctx_id; -__gem_execbuf (i915, &spin->execbuf); - -write (out, ¶m.ctx_id,sizeof (param.ctx_id)); - } - -igt_spin_free (i915, spin); -} - -static void close_replace_race (int i915) -{ -const int ncpus =sysconf (_SC_NPROCESSORS_ONLN); -int fence =-1 ; -int out[2 ], in[2 ]; - -cleanup (i915); - -/* -* If we time the submission of a hanging batch to one set of engines -* and then simultaneously replace the engines in one thread, and -* close the context in another, it might be possible for the kernel -* to lose track of the old engines believing that the non-persisten -* context is already closed and the hanging requests cancelled. -* -* Our challenge is try and expose any such race condition. -*/ - -igt_assert (pipe (out) ==0 ); -igt_assert (pipe (in) ==0 ); - igt_fork(child, ncpus) { -close (out[1 ]); -close (in[0 ]); -race_set_engines (i915, out[0 ], in[1 ]); - } -for (int i =0 ; i < ncpus; i++) -close (out[0 ]); - - igt_until_timeout(5) { -igt_spin_t *spin; -uint32_t ctx; - - ctx =gem_context_clone_with_engines (i915,0 ); -gem_context_set_persistence (i915, ctx, false); - - spin = igt_spin_new(i915, ctx, .flags = IGT_SPIN_FENCE_OUT); -for (int i =0 ; i < ncpus; i++) -write (out[1 ], &ctx,sizeof (ctx)); - -gem_context_destroy (i915, ctx); -for (int i =0 ; i < ncpus; i++) -read (in[0 ], &ctx,sizeof (ctx)); - -if (fence <0 ) { - fence = spin->out_fence; - }else { -int tmp; - - tmp =sync_fence_merge (fence, spin->out_fence); -close (fence); -close (spin->out_fence); - - fence = tmp; - } - spin->out_fence =-1 ; - } -close (in[0 ]); - -for (int i =0 ; i < ncpus; i++) { -uint32_t end =0 ; - -write (out[1 ], &end,sizeof (end)); - } -close (out[1 ]); - -if (sync_fence_wait (fence,MSEC_PER_SEC /2 )) { -igt_debugfs_dump (i915,"i915_engine_info" ); -igt_assert (sync_fence_wait (fence,MSEC_PER_SEC /2 ) ==0 ); - } -close (fence); - -igt_waitchildren (); -gem_quiescent_gpu (i915); -} - -static void replace_engines_hostile (int i915, -const struct intel_execution_engine2 *e) -{ - I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, 1) = { - .engines = {{ e->class, e->instance }} - }; -struct drm_i915_gem_context_param param = { - .ctx_id =gem_context_create (i915), - .param =I915_CONTEXT_PARAM_ENGINES , - .value =to_user_pointer (&engines), - .size =sizeof (engines), - }; -int64_t timeout = reset_timeout_ms *NSEC_PER_MSEC ; -igt_spin_t *spin; - -/* -* Suppose the user tries to hide a hanging batch by replacing -* the set of engines on the context so that it's not visible -* at the time of closure? Then we must act when they replace -* the engines! -*/ - -gem_context_set_persistence (i915, param.ctx_id, false); - -gem_context_set_param (i915, ¶m); - spin =igt_spin_new (i915, param.ctx_id, - .flags = IGT_SPIN_NO_PREEMPTION); - - param.size =8 ; -gem_context_set_param (i915, ¶m); -gem_context_destroy (i915, param.ctx_id); - -igt_assert_eq (gem_wait (i915, spin->handle, &timeout),0 ); - -igt_spin_free (i915, spin); -gem_quiescent_gpu (i915); -} -static void do_test (void (*test)(int i915,unsigned int engine),int i915,unsigned int engine,const char *name)
@@ -1422,31 +1237,6 @@ igt_mainsmoketest (i915); } -/* Check interactions with set-engines */ - igt_subtest_group { -const struct intel_execution_engine2 *e; - -igt_fixture -gem_require_contexts (i915 ); - - igt_subtest_with_dynamic("replace") { -__for_each_physical_engine (i915, e) { - igt_dynamic_f("%s", e->name) -replace_engines (i915, e); - } - } - - igt_subtest_with_dynamic("replace-hostile") { -__for_each_physical_engine (i915, e) { - igt_dynamic_f("%s", e->name) -replace_engines_hostile (i915, e); - } - } - - igt_subtest("close-replace-race") -close_replace_race (i915); - } - igt_fixture {close (i915); }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 59/89 tests/i915/gem_ctx_persistence: Convert to intel_ctx_t
In reply to Jason Ekstrand--- lib/intel_ctx.c | 13 ++ lib/intel_ctx.h | 2 + tests/i915/gem_ctx_persistence.c | 223 ++++++++++++++++--------------- 3 files changed, 133 insertions(+), 105 deletions(-)
lib/intel_ctx.c +13 -0
@@ -102,6 +102,7 @@ __context_create_cfg(int fd, const intel_ctx_cfg_t *cfg, uint32_t *ctx_id)uint64_t ext_root =0 ;I915_DEFINE_CONTEXT_PARAM_ENGINES (engines,GEM_MAX_ENGINES );struct drm_i915_gem_context_create_ext_setparam engines_param, vm_param; +struct drm_i915_gem_context_create_ext_setparam persist_param;uint32_t i;if (cfg->vm) {
@@ -117,6 +118,18 @@ __context_create_cfg(int fd, const intel_ctx_cfg_t *cfg, uint32_t *ctx_id)add_user_ext (&ext_root, &vm_param.base); } +if (cfg->nopersist) { + persist_param = (struct drm_i915_gem_context_create_ext_setparam ) { + .base = { + .name =I915_CONTEXT_CREATE_EXT_SETPARAM , + }, + .param = { + .param =I915_CONTEXT_PARAM_PERSISTENCE , + }, + }; +add_user_ext (&ext_root, &persist_param.base); + } +if (cfg->num_engines) {memset (&engines,0 ,sizeof (engines));for (i =0 ; i < cfg->num_engines; i++)
lib/intel_ctx.h +2 -0
@@ -34,6 +34,7 @@* intel_ctx_cfg_t: * @flags: Context create flags * @vm: VM to inherit or 0 for using a per-context VM +* @nopersist: set I915_CONTEXT_PARAM_PERSISTENCE to 0 * @num_engines: Number of client-specified engines or 0 for legacy mode * @engines: Client-specified engines *
@@ -42,6 +43,7 @@typedef struct intel_ctx_cfg {uint32_t flags;uint32_t vm; +bool nopersist;unsigned int num_engines;struct i915_engine_class_instance engines[GEM_MAX_ENGINES ]; }intel_ctx_cfg_t ;
tests/i915/gem_ctx_persistence.c +118 -105
548 lines not on this page · raw message
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 60/89 tests/i915/module_load: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/i915_module_load.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tests/i915/i915_module_load.c +6 -1
@@ -64,6 +64,7 @@ static void store_all(int i915) .buffer_count = 2, };const struct intel_execution_engine2 *e; +const intel_ctx_t *ctx;int reloc_sz =sizeof (uint32_t );unsigned int nengine, value;void *cs;
@@ -88,7 +89,9 @@ static void store_all(int i915) nengine =0 ; cs =gem_mmap__device_coherent (i915, obj[1 ].handle,0 , sz,PROT_WRITE ); -__for_each_physical_engine (i915, e) { + + ctx =intel_ctx_create_all_physical (i915); +for_each_ctx_engine (i915, ctx, e) {uint64_t addr;igt_assert (reloc.presumed_offset !=-1 );
@@ -103,6 +106,7 @@ static void store_all(int i915)if (gen <6 ) execbuf.flags |=I915_EXEC_SECURE ; execbuf.flags |=I915_EXEC_NO_RELOC |I915_EXEC_HANDLE_LUT ; + execbuf.rsvd1 = ctx->id;memcpy (cs + execbuf.batch_start_offset, batch,sizeof (batch));memcpy (cs + reloc.offset, &addr, reloc_sz);
@@ -121,6 +125,7 @@ static void store_all(int i915)memset (engines,0xdeadbeef ,sizeof (engines));gem_read (i915, obj[0 ].handle,0 , engines, nengine *sizeof (engines[0 ]));gem_close (i915, obj[0 ].handle); +intel_ctx_destroy (i915, ctx);for (i =0 ; i < nengine; i++)igt_assert_eq_u32 (engines[i], i);
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 61/89 tests/i915/pm_rc6_residency: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/i915_pm_rc6_residency.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tests/i915/i915_pm_rc6_residency.c +5 -2
@@ -454,6 +454,7 @@ static void rc6_fence(int i915)const int tolerance =20 ;/* Some RC6 is better than none! */ const unsigned int gen =intel_gen (intel_get_drm_devid (i915));const struct intel_execution_engine2 *e; +const intel_ctx_t *ctx;struct power_sample sample[2 ];unsigned long slept;uint64_t rc6, ts[2 ];
@@ -483,14 +484,15 @@ static void rc6_fence(int i915)assert_within_epsilon (rc6, ts[1 ] - ts[0 ],5 );/* Submit but delay execution, we should be idle and conserving power */ -__for_each_physical_engine (i915, e) { + ctx =intel_ctx_create_all_physical (i915); +for_each_ctx_engine (i915, ctx, e) {igt_spin_t *spin;int timeline;int fence; timeline =sw_sync_timeline_create (); fence =sw_sync_timeline_create_fence (timeline,1 ); - spin = igt_spin_new(i915, + spin = igt_spin_new(i915, .ctx = ctx, .engine = e->flags, .fence = fence, .flags =IGT_SPIN_FENCE_IN );
@@ -518,6 +520,7 @@ static void rc6_fence(int i915)assert_within_epsilon (rc6, ts[1 ] - ts[0 ], tolerance);gem_quiescent_gpu (i915); } +intel_ctx_destroy (i915, ctx);rapl_close (&rapl);close (fd);
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 62/89 tests/i915/gem_cs_tlb: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_cs_tlb.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
tests/i915/gem_cs_tlb.c +7 -3
@@ -90,7 +90,8 @@ mmap_coherent(int fd, uint32_t handle, int size)return ptr; } -static void run_on_ring (int fd,unsigned ring_id,const char *ring_name) +static void run_on_ring (int fd,const intel_ctx_t *ctx, +unsigned ring_id,const char *ring_name) {struct drm_i915_gem_execbuffer2 execbuf;struct drm_i915_gem_exec_object2 execobj;
@@ -116,6 +117,7 @@ static void run_on_ring(int fd, unsigned ring_id, const char *ring_name)memset (&execbuf,0 ,sizeof (execbuf)); execbuf.buffers_ptr =to_user_pointer (&execobj); execbuf.buffer_count =1 ; + execbuf.rsvd1 = ctx->id; execbuf.flags = ring_id;/* Execute once to allocate a gtt-offset */
@@ -143,17 +145,19 @@ static void run_on_ring(int fd, unsigned ring_id, const char *ring_name) igt_main {const struct intel_execution_engine2 *e; +const intel_ctx_t *ctx =NULL ;int fd =-1 ; igt_fixture { fd =drm_open_driver (DRIVER_INTEL );igt_require_gem (fd); + ctx =intel_ctx_create_all_physical (fd); } igt_subtest_with_dynamic("engines") { -__for_each_physical_engine (fd, e) { +for_each_ctx_engine (fd, ctx, e) { igt_dynamic_f("%s", e->name) -run_on_ring (fd, e->flags, e->name); +run_on_ring (fd, ctx, e->flags, e->name); } }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 63/89 tests/core_hotplug: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/core_hotunplug.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tests/core_hotunplug.c +5 -1
@@ -258,6 +258,7 @@ static int local_i915_healthcheck(int i915, const char *prefix) .buffer_count = 1, };const struct intel_execution_engine2 *engine; +const intel_ctx_t *ctx;int fence =-1 , err =0 , status =1 ;local_debug ("%s%s\n" , prefix,"running i915 GPU healthcheck" );
@@ -269,7 +270,9 @@ static int local_i915_healthcheck(int i915, const char *prefix)gem_write (i915, obj.handle,0 , &bbe,sizeof (bbe));/* As soon as a fence is open, don't fail before closing it */ -__for_each_physical_engine (i915, engine) { + ctx =intel_ctx_create_all_physical (i915); +for_each_ctx_engine (i915, ctx, engine) { + execbuf.rsvd1 = ctx->id; execbuf.flags = engine->flags |I915_EXEC_FENCE_OUT ; err =__gem_execbuf_wr (i915, &execbuf); if (igt_warn_on_f(err < 0, "__gem_execbuf_wr() returned %d\n",
@@ -283,6 +286,7 @@ static int local_i915_healthcheck(int i915, const char *prefix)break ; } } +intel_ctx_destroy (i915, ctx);if (fence >=0 ) { status =sync_fence_wait (fence,-1 ); if (igt_warn_on_f(status < 0, "sync_fence_wait() returned %d\n",
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 64/89 tests/i915/gem_exec_balancer: Stop cloning engines
In reply to Jason EkstrandWe have the list of engines and bonding info in each case. Using clone is just being lazy for no good reason.
--- tests/i915/gem_exec_balancer.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
tests/i915/gem_exec_balancer.c +11 -10
@@ -826,8 +826,7 @@ static void bonded_slice(int i915) igt_fork(child, count + 1) { /* C: arbitrary background load */igt_list_del (&spin->link); - ctx =gem_context_clone (i915, ctx, -I915_CONTEXT_CLONE_ENGINES ,0 ); + ctx =load_balancer_create (i915, siblings, count);while (!READ_ONCE (*stop)) { spin = igt_spin_new(i915,
@@ -2279,7 +2278,8 @@ static int __execbuf(int i915, struct drm_i915_gem_execbuffer2 *execbuf)return err; } -static uint32_t *sema (int i915,uint32_t ctx) +static uint32_t *sema (int i915,struct i915_engine_class_instance *ci, +unsigned int count) {uint32_t *ctl;struct drm_i915_gem_exec_object2 batch = {
@@ -2290,7 +2290,7 @@ static uint32_t *sema(int i915, uint32_t ctx)struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&batch), .buffer_count =1 , - .rsvd1 =gem_context_clone_with_engines (i915, ctx), + .rsvd1 =load_balancer_create (i915, ci, count), };for (int n =1 ; n <=32 ; n++) {
@@ -2312,12 +2312,14 @@ static uint32_t *sema(int i915, uint32_t ctx)return ctl; } -static void __waits (int i915,int timeout,uint32_t ctx,unsigned int count) +static void __waits (int i915,int timeout, +struct i915_engine_class_instance *ci, +unsigned int count) {uint32_t *semaphores[count +1 ];for (int i =0 ; i <= count; i++) - semaphores[i] =sema (i915, ctx); + semaphores[i] =sema (i915, ci, count);igt_until_timeout (timeout) {int i =rand () % (count +1 );
@@ -2329,7 +2331,7 @@ static void __waits(int i915, int timeout, uint32_t ctx, unsigned int count)if ((*semaphores[i] +=rand () %32 ) >=32 ) { *semaphores[i] =0xffffffff ;munmap (semaphores[i],4096 ); - semaphores[i] =sema (i915, ctx); + semaphores[i] =sema (i915, ci, count); } }
@@ -2358,7 +2360,7 @@ static void waits(int i915, int timeout)if (count >1 ) {uint32_t ctx =load_balancer_create (i915, ci, count); -__waits (i915, timeout, ctx, count); +__waits (i915, timeout, ci, count);gem_context_destroy (i915, ctx); }
@@ -2442,8 +2444,7 @@ static void nop(int i915) .buffers_ptr = to_user_pointer(&batch), .buffer_count = 1, .flags = child + 1, - .rsvd1 = gem_context_clone(i915, ctx, - I915_CONTEXT_CLONE_ENGINES, 0), + .rsvd1 = load_balancer_create(i915, ci, count), };struct timespec tv = {};unsigned long nops;
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 65/89 tests/i915/gem_exec_balancer: Don't reset engines on a context
In reply to Jason EkstrandInstead of resetting the set of engines to break implicit dependencies, just use a new context. This does drop a theoretical bit of test coverage in the bonded chain tests because we can't drop the timeline easily. However, those tests also use the FENCE_SUBMIT pattern in a way that the set of engines is swapped out between the first and second half of the bonded pair. That seems pretty sketchy.
--- tests/i915/gem_exec_balancer.c | 163 +++++++++++++++++---------------- 1 file changed, 86 insertions(+), 77 deletions(-)
tests/i915/gem_exec_balancer.c +86 -77
@@ -27,6 +27,7 @@#include <sys/signal.h> #include "i915/gem.h" +#include "i915/gem_vm.h" #include "igt.h" #include "igt_gt.h" #include "igt_perf.h"
@@ -122,6 +123,21 @@ static bool has_perf_engines(int i915)return i915_perf_type_id (i915); } +static int __set_vm (int i915,uint32_t ctx,uint32_t vm) +{ +struct drm_i915_gem_context_param p = { + .ctx_id = ctx, + .param =I915_CONTEXT_PARAM_VM , + .value = vm + }; +return __gem_context_set_param (i915, &p); +} + +static void set_vm (int i915,uint32_t ctx,uint32_t vm) +{ +igt_assert_eq (__set_vm (i915, ctx, vm),0 ); +} +static int __set_engines (int i915,uint32_t ctx,const struct i915_engine_class_instance *ci,unsigned int count)
@@ -543,8 +559,6 @@ static void check_individual_engine(int i915,static void individual (int i915) { -uint32_t ctx; -/* * I915_CONTEXT_PARAM_ENGINE allows us to index into the user * supplied array from gem_execbuf(). Our check is to build the
@@ -553,8 +567,6 @@ static void individual(int i915)* was busy. */ - ctx =gem_context_create (i915); -for (int class =0 ; class <32 ; class++) {struct i915_engine_class_instance *ci;unsigned int count;
@@ -564,17 +576,20 @@ static void individual(int i915)continue ;for (int pass =0 ; pass < count; pass++) {/* approx. count! */ +uint32_t ctx; +igt_assert (sizeof (*ci) ==sizeof (int ));igt_permute_array (ci, count, igt_exchange_int); + ctx =gem_context_create (i915);set_load_balancer (i915, ctx, ci, count,NULL );for (unsigned int n =0 ; n < count; n++)check_individual_engine (i915, ctx, ci, n); +gem_context_destroy (i915, ctx); }free (ci); } -gem_context_destroy (i915, ctx);gem_quiescent_gpu (i915); }
@@ -583,7 +598,7 @@ static void bonded(int i915, unsigned int flags) {I915_DEFINE_CONTEXT_ENGINES_BOND (bonds[16 ],1 );struct i915_engine_class_instance *master_engines; -uint32_t master; +uint32_t vm;/* * I915_CONTEXT_PARAM_ENGINE provides an extension that allows us
@@ -591,7 +606,7 @@ static void bonded(int i915, unsigned int flags)* request submitted to another engine. */ - master =gem_queue_create (i915); + vm =gem_vm_create (i915);memset (bonds,0 ,sizeof (bonds));for (int n =0 ; n <ARRAY_SIZE (bonds); n++) {
@@ -604,7 +619,7 @@ static void bonded(int i915, unsigned int flags)for (int class =0 ; class <32 ; class++) {struct i915_engine_class_instance *siblings;unsigned int count, limit, *order; -uint32_t ctx; +uint32_t master, ctx;int n; siblings =list_engines (i915,1u << class, &count);
@@ -617,6 +632,8 @@ static void bonded(int i915, unsigned int flags) } master_engines =list_engines (i915, ~(1u << class), &limit); + master =gem_context_create_ext (i915,I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE ,0 ); +set_vm (i915, master, vm);set_engines (i915, master, master_engines, limit); limit =min (count, limit);
@@ -626,9 +643,9 @@ static void bonded(int i915, unsigned int flags) bonds[n].engines[0 ] = siblings[n]; } - ctx =gem_context_clone (i915, - master,I915_CONTEXT_CLONE_VM , -I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE ); + ctx =gem_context_create_ext (i915,I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE ,0 ); +set_vm (i915, master, vm); +set_engines (i915, master, master_engines, limit);set_load_balancer (i915, ctx, siblings, count, &bonds[limit -1 ]); order =malloc (sizeof (*order) *8 * limit);
@@ -710,12 +727,11 @@ static void bonded(int i915, unsigned int flags) }free (order); +gem_context_destroy (i915, master);gem_context_destroy (i915, ctx);free (master_engines);free (siblings); } - -gem_context_destroy (i915, master); }#define VIRTUAL_ENGINE (1u << 0)
@@ -760,7 +776,6 @@ static uint32_t create_semaphore_to_spinner(int i915, igt_spin_t *spin)static void bonded_slice (int i915) { -uint32_t ctx;int *stop;/*
@@ -773,13 +788,12 @@ static void bonded_slice(int i915) stop =mmap (0 ,4096 ,PROT_WRITE ,MAP_SHARED |MAP_ANON ,-1 ,0 );igt_assert (stop !=MAP_FAILED ); - ctx =gem_context_create (i915);/* NB timeline per engine */ -for (int class =0 ; class <32 ; class++) {struct i915_engine_class_instance *siblings;struct drm_i915_gem_exec_object2 obj[3 ] = {};struct drm_i915_gem_execbuffer2 eb = {};unsigned int count; +uint32_t ctx;igt_spin_t *spin; siblings =list_engines (i915,1u << class, &count);
@@ -803,6 +817,7 @@ static void bonded_slice(int i915)* XXX add explicit bonding options for A->B */ + ctx =gem_context_create (i915);/* NB timeline per engine */ set_load_balancer (i915, ctx, siblings, count,NULL ); spin = __igt_spin_new(i915,
@@ -864,13 +879,13 @@ static void bonded_slice(int i915)gem_close (i915, obj[2 ].handle);igt_spin_free (i915, spin); +gem_context_destroy (i915, ctx); } -gem_context_destroy (i915, ctx);munmap (stop,4096 ); } -static void __bonded_chain (int i915,uint32_t ctx, +static void __bonded_chain (int i915,const struct i915_engine_class_instance *siblings,unsigned int count) {
@@ -881,12 +896,14 @@ static void __bonded_chain(int i915, uint32_t ctx,struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&batch), .buffer_count =1 , - .rsvd1 = ctx, };igt_spin_t *spin;for (int i =0 ; i <ARRAY_SIZE (priorities); i++) { +uint32_t ctx;/* A: spin forever on engine 1 */ + + ctx =gem_context_create (i915);set_load_balancer (i915, ctx, siblings, count,NULL );if (priorities[i] <0 )gem_context_set_priority (i915, ctx, priorities[i]);
@@ -896,17 +913,13 @@ static void __bonded_chain(int i915, uint32_t ctx, .flags = (IGT_SPIN_POLL_RUN | IGT_SPIN_FENCE_OUT));igt_spin_busywait_until_started (spin); -gem_context_set_priority (i915, ctx,0 ); - -/* -* Note we replace the timelines between each execbuf, so -* that any pair of requests on the same engine could be -* re-ordered by the scheduler -- if the dependency tracking -* is subpar. -*/ /* B: waits for A on engine 2 */ +gem_context_destroy (i915, ctx); + ctx =gem_context_create (i915); +gem_context_set_priority (i915, ctx,0 );set_load_balancer (i915, ctx, siblings, count,NULL ); + execbuf.rsvd1 = ctx; execbuf.rsvd2 = spin->out_fence; execbuf.flags =I915_EXEC_FENCE_IN |I915_EXEC_FENCE_OUT ; execbuf.flags |=2 ;/* opposite engine to spinner */
@@ -915,7 +928,6 @@ static void __bonded_chain(int i915, uint32_t ctx,/* B': run in parallel with B on engine 1, i.e. not before A! */ if (priorities[i] >0 )gem_context_set_priority (i915, ctx, priorities[i]); -set_load_balancer (i915, ctx, siblings, count,NULL ); execbuf.flags =I915_EXEC_FENCE_SUBMIT |I915_EXEC_FENCE_OUT ; execbuf.flags |=1 ;/* same engine as spinner */ execbuf.rsvd2 >>=32 ;
@@ -937,6 +949,7 @@ static void __bonded_chain(int i915, uint32_t ctx,igt_assert_eq (sync_fence_status (execbuf.rsvd2 >>32 ),0 );igt_spin_free (i915, spin); +gem_context_destroy (i915, ctx);gem_sync (i915, batch.handle);igt_assert_eq (sync_fence_status (execbuf.rsvd2 &0xffffffff ),1 );
@@ -949,7 +962,7 @@ static void __bonded_chain(int i915, uint32_t ctx,gem_close (i915, batch.handle); } -static void __bonded_chain_inv (int i915,uint32_t ctx, +static void __bonded_chain_inv (int i915,const struct i915_engine_class_instance *siblings,unsigned int count) {
@@ -960,12 +973,14 @@ static void __bonded_chain_inv(int i915, uint32_t ctx,struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&batch), .buffer_count =1 , - .rsvd1 = ctx, };igt_spin_t *spin;for (int i =0 ; i <ARRAY_SIZE (priorities); i++) { +uint32_t ctx; +/* A: spin forever on engine 1 */ + ctx =gem_context_create (i915);set_load_balancer (i915, ctx, siblings, count,NULL );if (priorities[i] <0 )gem_context_set_priority (i915, ctx, priorities[i]);
@@ -975,17 +990,13 @@ static void __bonded_chain_inv(int i915, uint32_t ctx, .flags = (IGT_SPIN_POLL_RUN | IGT_SPIN_FENCE_OUT));igt_spin_busywait_until_started (spin); -gem_context_set_priority (i915, ctx,0 ); - -/* -* Note we replace the timelines between each execbuf, so -* that any pair of requests on the same engine could be -* re-ordered by the scheduler -- if the dependency tracking -* is subpar. -*/ /* B: waits for A on engine 1 */ +gem_context_destroy (i915, ctx); + ctx =gem_context_create (i915); +gem_context_set_priority (i915, ctx,0 );set_load_balancer (i915, ctx, siblings, count,NULL ); + execbuf.rsvd1 = ctx; execbuf.rsvd2 = spin->out_fence; execbuf.flags =I915_EXEC_FENCE_IN |I915_EXEC_FENCE_OUT ; execbuf.flags |=1 ;/* same engine as spinner */
@@ -994,7 +1005,6 @@ static void __bonded_chain_inv(int i915, uint32_t ctx,/* B': run in parallel with B on engine 2, i.e. not before A! */ if (priorities[i] >0 )gem_context_set_priority (i915, ctx, priorities[i]); -set_load_balancer (i915, ctx, siblings, count,NULL ); execbuf.flags =I915_EXEC_FENCE_SUBMIT |I915_EXEC_FENCE_OUT ; execbuf.flags |=2 ;/* opposite engine to spinner */ execbuf.rsvd2 >>=32 ;
@@ -1017,6 +1027,7 @@ static void __bonded_chain_inv(int i915, uint32_t ctx,igt_spin_free (i915, spin);gem_sync (i915, batch.handle); +gem_context_destroy (i915, ctx);igt_assert_eq (sync_fence_status (execbuf.rsvd2 &0xffffffff ),1 );igt_assert_eq (sync_fence_status (execbuf.rsvd2 >>32 ),1 );
@@ -1030,32 +1041,26 @@ static void __bonded_chain_inv(int i915, uint32_t ctx,static void bonded_chain (int i915) { -uint32_t ctx; -/* * Given batches A, B and B', where B and B' are a bonded pair, with * B' depending on B with a submit fence and B depending on A as * an ordinary fence; prove B' cannot complete before A. */ - ctx =gem_context_create (i915); -for (int class =0 ; class <32 ; class++) {struct i915_engine_class_instance *siblings;unsigned int count; siblings =list_engines (i915,1u << class, &count);if (count >1 ) { -__bonded_chain (i915, ctx, siblings, count); -__bonded_chain_inv (i915, ctx, siblings, count); +__bonded_chain (i915, siblings, count); +__bonded_chain_inv (i915, siblings, count); }free (siblings); } - -gem_context_destroy (i915, ctx); } -static void __bonded_sema (int i915,uint32_t ctx, +static void __bonded_sema (int i915,const struct i915_engine_class_instance *siblings,unsigned int count) {
@@ -1066,11 +1071,12 @@ static void __bonded_sema(int i915, uint32_t ctx,struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&batch), .buffer_count =1 , - .rsvd1 = ctx, };igt_spin_t *spin; for (int i = 0; i < ARRAY_SIZE(priorities); i++) { + uint32_t ctx; + /* A: spin forever on seperate render engine */ spin = igt_spin_new(i915, .flags = (IGT_SPIN_POLL_RUN |
@@ -1085,16 +1091,21 @@ static void __bonded_sema(int i915, uint32_t ctx,*/ /* B: waits for A (using a semaphore) on engine 1 */ + ctx =gem_context_create (i915);set_load_balancer (i915, ctx, siblings, count,NULL ); + execbuf.rsvd1 = ctx; execbuf.rsvd2 = spin->out_fence; execbuf.flags =I915_EXEC_FENCE_IN |I915_EXEC_FENCE_OUT ; execbuf.flags |=1 ;gem_execbuf_wr (i915, &execbuf);/* B': run in parallel with B on engine 2 */ +gem_context_destroy (i915, ctx); + ctx =gem_context_create (i915);if (priorities[i] >0 )gem_context_set_priority (i915, ctx, priorities[i]);set_load_balancer (i915, ctx, siblings, count,NULL ); + execbuf.rsvd1 = ctx; execbuf.flags =I915_EXEC_FENCE_SUBMIT |I915_EXEC_FENCE_OUT ; execbuf.flags |=2 ; execbuf.rsvd2 >>=32 ;
@@ -1117,6 +1128,7 @@ static void __bonded_sema(int i915, uint32_t ctx,igt_spin_free (i915, spin);gem_sync (i915, batch.handle); +gem_context_destroy (i915, ctx);igt_assert_eq (sync_fence_status (execbuf.rsvd2 &0xffffffff ),1 );igt_assert_eq (sync_fence_status (execbuf.rsvd2 >>32 ),1 );
@@ -1130,8 +1142,6 @@ static void __bonded_sema(int i915, uint32_t ctx,static void bonded_semaphore (int i915) { -uint32_t ctx; -/* * Given batches A, B and B', where B and B' are a bonded pair, with * B' depending on B with a submit fence and B depending on A as
@@ -1141,19 +1151,15 @@ static void bonded_semaphore(int i915)*/ igt_require (gem_scheduler_has_semaphores (i915)); - ctx =gem_context_create (i915); -for (int class =1 ; class <32 ; class++) {struct i915_engine_class_instance *siblings;unsigned int count; siblings =list_engines (i915,1u << class, &count);if (count >1 ) -__bonded_sema (i915, ctx, siblings, count); +__bonded_sema (i915, siblings, count);free (siblings); } - -gem_context_destroy (i915, ctx); } static void __bonded_pair(int i915,
@@ -1804,7 +1810,7 @@ static void indices(int i915)gem_quiescent_gpu (i915); } -static void __bonded_early (int i915,uint32_t ctx, +static void __bonded_early (int i915,const struct i915_engine_class_instance *siblings,unsigned int count,unsigned int flags)
@@ -1817,8 +1823,8 @@ static void __bonded_early(int i915, uint32_t ctx,struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&batch), .buffer_count =1 , - .rsvd1 = ctx, }; +uint32_t vm, ctx;igt_spin_t *spin;memset (bonds,0 ,sizeof (bonds));
@@ -1832,6 +1838,11 @@ static void __bonded_early(int i915, uint32_t ctx, bonds[n].engines[0 ] = siblings[(n +1 ) % count]; } +/* We share a VM so that the spin cancel will work without a reloc */ + vm =gem_vm_create (i915); + + ctx =gem_context_create (i915); +set_vm (i915, ctx, vm);set_load_balancer (i915, ctx, siblings, count, flags &VIRTUAL_ENGINE ? &bonds :NULL );
@@ -1842,6 +1853,7 @@ static void __bonded_early(int i915, uint32_t ctx, .flags = IGT_SPIN_NO_PREEMPTION);/* B: runs after A on engine 1 */ + execbuf.rsvd1 = ctx; execbuf.flags =I915_EXEC_FENCE_OUT ; execbuf.flags |= spin->execbuf.flags &63 ;gem_execbuf_wr (i915, &execbuf);
@@ -1859,9 +1871,14 @@ static void __bonded_early(int i915, uint32_t ctx,igt_debugfs_dump (i915,"i915_engine_info" ); -/* D: cancel the spinner from engine 2 (new timeline) */ -set_load_balancer (i915, ctx, siblings, count,NULL ); +/* D: cancel the spinner from engine 2 (new context) */ +gem_context_destroy (i915, ctx); + ctx =gem_context_create (i915); +set_vm (i915, ctx, vm); +set_load_balancer (i915, ctx, siblings, count, + flags &VIRTUAL_ENGINE ? &bonds :NULL ); batch.handle =create_semaphore_to_spinner (i915, spin); + execbuf.rsvd1 = ctx; execbuf.flags =0 ;if (!(flags &VIRTUAL_ENGINE )) execbuf.flags |=2 ;
@@ -1878,14 +1895,13 @@ static void __bonded_early(int i915, uint32_t ctx,close (execbuf.rsvd2);close (execbuf.rsvd2 >>32 ); +gem_context_destroy (i915, ctx);gem_close (i915, handle);igt_spin_free (i915, spin); }static void bonded_early (int i915) { -uint32_t ctx; -/* * Our goal is to start the bonded payloads at roughly the same time. * We do not want to start the secondary batch too early as it will
@@ -1901,21 +1917,17 @@ static void bonded_early(int i915)* hang. */ - ctx =gem_context_create (i915); -for (int class =0 ; class <32 ; class++) {struct i915_engine_class_instance *siblings;unsigned int count; siblings =list_engines (i915,1u << class, &count);if (count >1 ) { -__bonded_early (i915, ctx, siblings, count,0 ); -__bonded_early (i915, ctx, siblings, count,VIRTUAL_ENGINE ); +__bonded_early (i915, siblings, count,0 ); +__bonded_early (i915, siblings, count,VIRTUAL_ENGINE ); }free (siblings); } - -gem_context_destroy (i915, ctx); }static void busy (int i915)
@@ -2570,7 +2582,7 @@ static void ping(int i915, uint32_t ctx, unsigned int engine)static void semaphore (int i915) { -uint32_t block[2 ], scratch; +uint32_t scratch;igt_spin_t *spin[3 ];/*
@@ -2580,15 +2592,12 @@ static void semaphore(int i915)*/ igt_require (gem_scheduler_has_preemption (i915)); - block[0 ] =gem_context_create (i915); - block[1 ] =gem_context_create (i915); - scratch =gem_create (i915,4096 ); spin[2] = igt_spin_new(i915, .dependency = scratch);for (int class =1 ; class <32 ; class++) {struct i915_engine_class_instance *ci;unsigned int count; -uint32_t vip; +uint32_t block[2 ], vip; ci =list_engines (i915,1u << class, &count);if (!ci)
@@ -2601,6 +2610,7 @@ static void semaphore(int i915) count =ARRAY_SIZE (block);for (int i =0 ; i < count; i++) { + block[i] =gem_context_create (i915);set_load_balancer (i915, block[i], ci, count,NULL ); spin[i] = __igt_spin_new(i915, .ctx_id = block[i],
@@ -2616,17 +2626,16 @@ static void semaphore(int i915)ping (i915, vip,0 );gem_context_destroy (i915, vip); -for (int i =0 ; i < count; i++) +for (int i =0 ; i < count; i++) {igt_spin_free (i915, spin[i]); +gem_context_destroy (i915, block[i]); + }free (ci); }igt_spin_free (i915, spin[2 ]);gem_close (i915, scratch); -gem_context_destroy (i915, block[1 ]); -gem_context_destroy (i915, block[0 ]); -gem_quiescent_gpu (i915); }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 66/89 tests/i915/gem_exec_balancer: Stop munging ctx0 engines
In reply to Jason Ekstrand--- tests/i915/gem_exec_balancer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/i915/gem_exec_balancer.c +1 -1
@@ -3080,7 +3080,7 @@ static void noheartbeat(int i915)* heartbeat has already been disabled. */ -__for_each_physical_engine (i915, e) +for_each_physical_engine (i915, e)set_heartbeat (i915, e->name,0 );for (int class =0 ; class <32 ; class++) {
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 67/89 tests/i915/gem_exec_balancer: Drop bonded tests
In reply to Jason EkstrandSupport for combining bonding and balancing is being removed from i915 because it's not used by media.
--- tests/i915/gem_exec_balancer.c | 330 --------------------------------- 1 file changed, 330 deletions(-)
tests/i915/gem_exec_balancer.c +0 -330
@@ -123,21 +123,6 @@ static bool has_perf_engines(int i915)return i915_perf_type_id (i915); } -static int __set_vm (int i915,uint32_t ctx,uint32_t vm) -{ -struct drm_i915_gem_context_param p = { - .ctx_id = ctx, - .param =I915_CONTEXT_PARAM_VM , - .value = vm - }; -return __gem_context_set_param (i915, &p); -} - -static void set_vm (int i915,uint32_t ctx,uint32_t vm) -{ -igt_assert_eq (__set_vm (i915, ctx, vm),0 ); -} -static int __set_engines (int i915,uint32_t ctx,const struct i915_engine_class_instance *ci,unsigned int count)
@@ -484,31 +469,6 @@ static double measure_min_load(int pmu, unsigned int num, int period_us)return min / (double )d_t; } -static void measure_all_load (int pmu,double *v,unsigned int num,int period_us) -{ -uint64_t data[2 + num]; -uint64_t d_t, d_v[num]; - -kick_kthreads (); - -igt_assert_eq (read (pmu, data,sizeof (data)),sizeof (data)); -for (unsigned int n =0 ; n < num; n++) - d_v[n] = -data[2 + n]; - d_t = -data[1 ]; - -usleep (period_us); - -igt_assert_eq (read (pmu, data,sizeof (data)),sizeof (data)); - - d_t += data[1 ]; -for (unsigned int n =0 ; n < num; n++) { - d_v[n] += data[2 + n]; -igt_debug ("engine[%d]: %.1f%%\n" , - n, d_v[n] / (double )d_t *100 ); - v[n] = d_v[n] / (double )d_t; - } -} -static int add_pmu (int i915,int pmu,const struct i915_engine_class_instance *ci) {
@@ -593,147 +553,6 @@ static void individual(int i915)gem_quiescent_gpu (i915); } -static void bonded(int i915, unsigned int flags) -#define CORK 0x1 -{ -I915_DEFINE_CONTEXT_ENGINES_BOND (bonds[16 ],1 ); -struct i915_engine_class_instance *master_engines; -uint32_t vm; - -/* -* I915_CONTEXT_PARAM_ENGINE provides an extension that allows us -* to specify which engine(s) to pair with a parallel (EXEC_SUBMIT) -* request submitted to another engine. -*/ - - vm =gem_vm_create (i915); - -memset (bonds,0 ,sizeof (bonds)); -for (int n =0 ; n <ARRAY_SIZE (bonds); n++) { - bonds[n].base.name =I915_CONTEXT_ENGINES_EXT_BOND ; - bonds[n].base.next_extension = - n ?to_user_pointer (&bonds[n -1 ]) :0 ; - bonds[n].num_bonds =1 ; - } - -for (int class =0 ; class <32 ; class++) { -struct i915_engine_class_instance *siblings; -unsigned int count, limit, *order; -uint32_t master, ctx; -int n; - - siblings =list_engines (i915,1u << class, &count); -if (!siblings) -continue ; - -if (count <2 ) { -free (siblings); -continue ; - } - - master_engines =list_engines (i915, ~(1u << class), &limit); - master =gem_context_create_ext (i915,I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE ,0 ); -set_vm (i915, master, vm); -set_engines (i915, master, master_engines, limit); - - limit =min (count, limit); -igt_assert (limit <=ARRAY_SIZE (bonds)); -for (n =0 ; n < limit; n++) { - bonds[n].master = master_engines[n]; - bonds[n].engines[0 ] = siblings[n]; - } - - ctx =gem_context_create_ext (i915,I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE ,0 ); -set_vm (i915, master, vm); -set_engines (i915, master, master_engines, limit); -set_load_balancer (i915, ctx, siblings, count, &bonds[limit -1 ]); - - order =malloc (sizeof (*order) *8 * limit); -igt_assert (order); -for (n =0 ; n < limit; n++) - order[2 * limit - n -1 ] = order[n] = n % limit; -memcpy (order +2 * limit, order,2 * limit *sizeof (*order)); -memcpy (order +4 * limit, order,4 * limit *sizeof (*order)); -igt_permute_array (order +2 * limit,6 * limit, igt_exchange_int); - -for (n =0 ; n <8 * limit; n++) { -struct drm_i915_gem_execbuffer2 eb; -igt_spin_t *spin, *plug; -IGT_CORK_HANDLE (cork); -double v[limit]; -int pmu[limit +1 ]; -int bond = order[n]; - - pmu[0 ] =-1 ; -for (int i =0 ; i < limit; i++) - pmu[i] =add_pmu (i915, pmu[0 ], &siblings[i]); - pmu[limit] =add_pmu (i915, - pmu[0 ], &master_engines[bond]); - -igt_assert (siblings[bond].engine_class != - master_engines[bond].engine_class); - - plug =NULL ; -if (flags &CORK ) { - plug = __igt_spin_new(i915, - .ctx_id = master, - .engine = bond, - .dependency =igt_cork_plug (&cork, i915)); - } - - spin = __igt_spin_new(i915, - .ctx_id = master, - .engine = bond, - .flags =IGT_SPIN_FENCE_OUT ); - - eb = spin->execbuf; - eb.rsvd1 = ctx; - eb.rsvd2 = spin->out_fence; - eb.flags =I915_EXEC_FENCE_SUBMIT ; -gem_execbuf (i915, &eb); - -if (plug) { -igt_cork_unplug (&cork); -igt_spin_free (i915, plug); - } - -measure_all_load (pmu[0 ], v, limit +1 ,10000 ); -igt_spin_free (i915, spin); - -igt_assert_f (v[bond] >0.90 , -"engine %d (class:instance %s:%d) was found to be only %.1f%% busy\n" , - bond, -class_to_str (siblings[bond].engine_class), - siblings[bond].engine_instance, -100 * v[bond]); -for (int other =0 ; other < limit; other++) { -if (other == bond) -continue ; - -igt_assert_f (v[other] ==0 , -"engine %d (class:instance %s:%d) was not idle, and actually %.1f%% busy\n" , - other, -class_to_str (siblings[other].engine_class), - siblings[other].engine_instance, -100 * v[other]); - } -igt_assert_f (v[limit] >0.90 , -"master (class:instance %s:%d) was found to be only %.1f%% busy\n" , -class_to_str (master_engines[bond].engine_class), - master_engines[bond].engine_instance, -100 * v[limit]); - -close (pmu[0 ]); - } - -free (order); -gem_context_destroy (i915, master); -gem_context_destroy (i915, ctx); -free (master_engines); -free (siblings); - } -} -#define VIRTUAL_ENGINE (1u << 0)static unsigned int offset_in_page (void *addr)
@@ -1810,126 +1629,6 @@ static void indices(int i915)gem_quiescent_gpu (i915); } -static void __bonded_early (int i915, -const struct i915_engine_class_instance *siblings, -unsigned int count, -unsigned int flags) -{ -I915_DEFINE_CONTEXT_ENGINES_BOND (bonds[count],1 ); -uint32_t handle =batch_create (i915); -struct drm_i915_gem_exec_object2 batch = { - .handle = handle, - }; -struct drm_i915_gem_execbuffer2 execbuf = { - .buffers_ptr =to_user_pointer (&batch), - .buffer_count =1 , - }; -uint32_t vm, ctx; -igt_spin_t *spin; - -memset (bonds,0 ,sizeof (bonds)); -for (int n =0 ; n <ARRAY_SIZE (bonds); n++) { - bonds[n].base.name =I915_CONTEXT_ENGINES_EXT_BOND ; - bonds[n].base.next_extension = - n ?to_user_pointer (&bonds[n -1 ]) :0 ; - - bonds[n].master = siblings[n]; - bonds[n].num_bonds =1 ; - bonds[n].engines[0 ] = siblings[(n +1 ) % count]; - } - -/* We share a VM so that the spin cancel will work without a reloc */ - vm =gem_vm_create (i915); - - ctx =gem_context_create (i915); -set_vm (i915, ctx, vm); -set_load_balancer (i915, ctx, siblings, count, - flags &VIRTUAL_ENGINE ? &bonds :NULL ); - -/* A: spin forever on engine 1 */ - spin = igt_spin_new(i915, - .ctx_id = ctx, - .engine = (flags & VIRTUAL_ENGINE) ? 0 : 1, - .flags =IGT_SPIN_NO_PREEMPTION ); - -/* B: runs after A on engine 1 */ - execbuf.rsvd1 = ctx; - execbuf.flags =I915_EXEC_FENCE_OUT ; - execbuf.flags |= spin->execbuf.flags &63 ; -gem_execbuf_wr (i915, &execbuf); - -/* B': run in parallel with B on engine 2, i.e. not before A! */ - execbuf.flags =I915_EXEC_FENCE_SUBMIT |I915_EXEC_FENCE_OUT ; -if (!(flags &VIRTUAL_ENGINE )) - execbuf.flags |=2 ; - execbuf.rsvd2 >>=32 ; -gem_execbuf_wr (i915, &execbuf); - -/* C: prevent anything running on engine 2 after B' */ - spin->execbuf.flags = execbuf.flags &63 ; -gem_execbuf (i915, &spin->execbuf); - -igt_debugfs_dump (i915,"i915_engine_info" ); - -/* D: cancel the spinner from engine 2 (new context) */ -gem_context_destroy (i915, ctx); - ctx =gem_context_create (i915); -set_vm (i915, ctx, vm); -set_load_balancer (i915, ctx, siblings, count, - flags &VIRTUAL_ENGINE ? &bonds :NULL ); - batch.handle =create_semaphore_to_spinner (i915, spin); - execbuf.rsvd1 = ctx; - execbuf.flags =0 ; -if (!(flags &VIRTUAL_ENGINE )) - execbuf.flags |=2 ; -gem_execbuf (i915, &execbuf); -gem_close (i915, batch.handle); - -/* If C runs before D, we never cancel the spinner and so hang */ -gem_sync (i915, handle); - -/* Check the bonded pair completed successfully */ -igt_assert_eq (sync_fence_status (execbuf.rsvd2 &0xffffffff ),1 ); -igt_assert_eq (sync_fence_status (execbuf.rsvd2 >>32 ),1 ); - -close (execbuf.rsvd2); -close (execbuf.rsvd2 >>32 ); - -gem_context_destroy (i915, ctx); -gem_close (i915, handle); -igt_spin_free (i915, spin); -} - -static void bonded_early (int i915) -{ -/* -* Our goal is to start the bonded payloads at roughly the same time. -* We do not want to start the secondary batch too early as it will -* do nothing but hog the GPU until the first has a chance to execute. -* So if we were to arbitrary delay the first by running it after a -* spinner... -* -* By using a pair of spinners, we can create a bonded hog that when -* set in motion will fully utilize both engines [if the scheduling is -* incorrect]. We then use a third party submitted after the bonded -* pair to cancel the spinner from the GPU -- if it is unable to run, -* the spinner is never cancelled, and the bonded pair will cause a GPU -* hang. -*/ - -for (int class =0 ; class <32 ; class++) { -struct i915_engine_class_instance *siblings; -unsigned int count; - - siblings =list_engines (i915,1u << class, &count); -if (count >1 ) { -__bonded_early (i915, siblings, count,0 ); -__bonded_early (i915, siblings, count,VIRTUAL_ENGINE ); - } -free (siblings); - } -} -static void busy (int i915) {uint32_t scratch =gem_create (i915,4096 );
@@ -3170,22 +2869,6 @@ static bool has_load_balancer(int i915)return err ==0 ; } -static bool has_bonding (int i915) -{ - I915_DEFINE_CONTEXT_ENGINES_BOND(bonds, 0) = { - .base.name = I915_CONTEXT_ENGINES_EXT_BOND, - }; -struct i915_engine_class_instance ci = {}; -uint32_t ctx; -int err; - - ctx =gem_context_create (i915); - err =__set_load_balancer (i915, ctx, &ci,1 , &bonds); -gem_context_destroy (i915, ctx); - -return err ==0 ; -} - igt_main {int i915 =-1 ;
@@ -3257,19 +2940,6 @@ igt_main igt_subtest("smoke")smoketest (i915,20 ); - igt_subtest_group { -igt_fixture igt_require (has_bonding (i915 )); - - igt_subtest("bonded-imm") -bonded (i915,0 ); - - igt_subtest("bonded-cork") -bonded (i915,CORK ); - - igt_subtest("bonded-early") -bonded_early (i915); - } - igt_subtest("bonded-slice")bonded_slice (i915);
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 68/89 lib/intel_ctx: Add load balancing support
In reply to Jason EkstrandWe use the same convention as the load balancing tests and, when balancing is requested, we make a context with N+1 engines where the first one is the balanced engine and the others are physical engines.
--- lib/i915/gem_engine_topology.c | 27 ++++++++++++++---- lib/intel_ctx.c | 50 +++++++++++++++++++++++++++++++--- lib/intel_ctx.h | 2 ++ 3 files changed, 69 insertions(+), 10 deletions(-)
lib/i915/gem_engine_topology.c +21 -6
@@ -311,12 +311,27 @@ intel_engine_list_for_ctx_cfg(int fd, const intel_ctx_cfg_t *cfg)struct intel_engine_data engine_data = { };int i; - engine_data.nengines = cfg->num_engines; -for (i =0 ; i < cfg->num_engines; i++) -init_engine (&engine_data.engines[i], - cfg->engines[i].engine_class, - cfg->engines[i].engine_instance, - i); +if (cfg->load_balance) { + engine_data.nengines = cfg->num_engines +1 ; + +init_engine (&engine_data.engines[0 ], +I915_ENGINE_CLASS_INVALID , +I915_ENGINE_CLASS_INVALID_NONE , +0 ); + +for (i =0 ; i < cfg->num_engines; i++) +init_engine (&engine_data.engines[i +1 ], + cfg->engines[i].engine_class, + cfg->engines[i].engine_instance, + i +1 ); + }else { + engine_data.nengines = cfg->num_engines; +for (i =0 ; i < cfg->num_engines; i++) +init_engine (&engine_data.engines[i], + cfg->engines[i].engine_class, + cfg->engines[i].engine_instance, + i); + }return engine_data; }else {
lib/intel_ctx.c +46 -4
79 lines not on this page · raw message
lib/intel_ctx.h +2 -0
@@ -35,6 +35,7 @@* @flags: Context create flags * @vm: VM to inherit or 0 for using a per-context VM * @nopersist: set I915_CONTEXT_PARAM_PERSISTENCE to 0 +* @load_balance: True if the first engine should be a load balancing engine * @num_engines: Number of client-specified engines or 0 for legacy mode * @engines: Client-specified engines *
@@ -44,6 +45,7 @@ typedef struct intel_ctx_cfg {uint32_t flags;uint32_t vm;bool nopersist; +bool load_balance;unsigned int num_engines;struct i915_engine_class_instance engines[GEM_MAX_ENGINES ]; } intel_ctx_cfg_t;
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 68/89] lib/intel_ctx: Add load balancing support
Quoted 60 lines · Jason Ekstrand
We use the same convention as the load balancing tests and, when balancing is requested, we make a context with N+1 engines where the first one is the balanced engine and the others are physical engines.
--- lib/i915/gem_engine_topology.c | 27 ++++++++++++++---- lib/intel_ctx.c | 50 +++++++++++++++++++++++++++++++--- lib/intel_ctx.h | 2 ++ 3 files changed, 69 insertions(+), 10 deletions(-)lib/i915/gem_engine_topology.c +21
-6@@ -311,12 +311,27 @@ intel_engine_list_for_ctx_cfg(int fd, const intel_ctx_cfg_t *cfg)struct intel_engine_data engine_data = { };int i; - engine_data.nengines = cfg->num_engines; -for (i =0 ; i < cfg->num_engines; i++) -init_engine (&engine_data.engines[i], - cfg->engines[i].engine_class, - cfg->engines[i].engine_instance, - i); +if (cfg->load_balance) { + engine_data.nengines = cfg->num_engines +1 ; + +init_engine (&engine_data.engines[0 ], +I915_ENGINE_CLASS_INVALID , +I915_ENGINE_CLASS_INVALID_NONE , +0 ); + +for (i =0 ; i < cfg->num_engines; i++) +init_engine (&engine_data.engines[i +1 ], + cfg->engines[i].engine_class, + cfg->engines[i].engine_instance, + i +1 ); + }else { + engine_data.nengines = cfg->num_engines; +for (i =0 ; i < cfg->num_engines; i++) +init_engine (&engine_data.engines[i], + cfg->engines[i].engine_class, + cfg->engines[i].engine_instance, + i); + }return engine_data; }else {lib/intel_ctx.c +1
-0@@ -100,6 +100,7 @@ static int __context_create_cfg(int fd, const intel_ctx_cfg_t *cfg, uint32_t *ctx_id) { uint64_t ext_root = 0; +I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE (balance,GEM_MAX_ENGINES );I915_DEFINE_CONTEXT_PARAM_ENGINES (engines,GEM_MAX_ENGINES );struct drm_i915_gem_context_create_ext_setparam engines_param, vm_param;struct drm_i915_gem_context_create_ext_setparam persist_param;
lib/intel_ctx.c __context_create_cfg(int fd, const intel_ctx_cfg_t *cfg, uint32_t *ctx_id) · line 135
Quoted 4 lines
lib/intel_ctx.c +1
-0@@ -131,9 +132,39 @@ __context_create_cfg(int fd, const intel_ctx_cfg_t *cfg, uint32_t *ctx_id) }if (cfg->num_engines) { +unsigned num_logical_engines =0 ;
Can be left uninitialized.
lib/intel_ctx.c __context_create_cfg(int fd, const intel_ctx_cfg_t *cfg, uint32_t *ctx_id) · line 145
Quoted 12 lines
lib/intel_ctx.c +9
-2memset (&engines,0 ,sizeof (engines)); -for (i =0 ; i < cfg->num_engines; i++) - engines.engines[i] = cfg->engines[i]; + +if (cfg->load_balance) { +memset (&balance,0 ,sizeof (balance)); + +/* In this case, the first engine is the virtual +* balanced engine and the subsequent engines are +* the actual requested engines. +*/ +assert (cfg->num_engines +1 <=GEM_MAX_ENGINES );
Minor nit - use igt_assert() here.
Quoted 8 lines
lib/intel_ctx.c +8
-0+ num_logical_engines = cfg->num_engines +1 ; + + engines.engines[0 ].engine_class = +I915_ENGINE_CLASS_INVALID ; + engines.engines[0 ].engine_instance = +I915_ENGINE_CLASS_INVALID_NONE ; + + balance.num_siblings = cfg->num_engines;
lib/intel_ctx.c __context_create_cfg(int fd, const intel_ctx_cfg_t *cfg, uint32_t *ctx_id) · line 163
Quoted 10 lines
lib/intel_ctx.c +10
-0+for (i =0 ; i < cfg->num_engines; i++) { +igt_assert_eq (cfg->engines[0 ].engine_class, + cfg->engines[i].engine_class); + balance.engines[i] = cfg->engines[i]; + engines.engines[i +1 ] = cfg->engines[i]; + } + + engines.extensions =to_user_pointer (&balance); + }else { +assert (cfg->num_engines <=GEM_MAX_ENGINES );
Same.
Other things looks correct imo. With assert()->igt_assert() change
--
Zbigniew
Quoted 67 lines
lib/intel_ctx.c +17
-2+ num_logical_engines = cfg->num_engines; +for (i =0 ; i < cfg->num_engines; i++) + engines.engines[i] = cfg->engines[i]; + } engines_param = (struct drm_i915_gem_context_create_ext_setparam ) { .base = {@@ -141,11 +172,13 @@ __context_create_cfg(int fd, const intel_ctx_cfg_t *cfg, uint32_t *ctx_id) }, .param = { .param = I915_CONTEXT_PARAM_ENGINES, - .size = sizeof_param_engines(cfg->num_engines), + .size = sizeof_param_engines(num_logical_engines), .value = to_user_pointer(&engines), }, };add_user_ext (&ext_root, &engines_param.base); + }else { +igt_assert (!cfg->load_balance); }return __gem_context_create_ext (fd, cfg->flags, ext_root, ctx_id);@@ -276,7 +309,16 @@ void intel_ctx_destroy(int fd, const intel_ctx_t *ctx)*/ unsigned int intel_ctx_engine_class (const intel_ctx_t *ctx,unsigned int engine) { -if (ctx->cfg.num_engines) { +if (ctx->cfg.load_balance) { +if (engine ==0 ) { +/* This is our virtual engine */ +return ctx->cfg.engines[0 ].engine_class; + }else { +/* This is a physical engine */ +igt_assert (engine -1 < ctx->cfg.num_engines); +return ctx->cfg.engines[engine -1 ].engine_class; + } + }else if (ctx->cfg.num_engines) {igt_assert (engine < ctx->cfg.num_engines);return ctx->cfg.engines[engine].engine_class; }else {lib/intel_ctx.h +2
-0@@ -35,6 +35,7 @@* @flags: Context create flags * @vm: VM to inherit or 0 for using a per-context VM * @nopersist: set I915_CONTEXT_PARAM_PERSISTENCE to 0 +* @load_balance: True if the first engine should be a load balancing engine * @num_engines: Number of client-specified engines or 0 for legacy mode * @engines: Client-specified engines * @@ -44,6 +45,7 @@ typedef struct intel_ctx_cfg {uint32_t flags;uint32_t vm;bool nopersist; +bool load_balance;unsigned int num_engines;struct i915_engine_class_instance engines[GEM_MAX_ENGINES ]; } intel_ctx_cfg_t;Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 68/89] lib/intel_ctx: Add load balancing support
Quoted 64 lines · Zbigniew Kempczyński
Quoted 62 lines · Jason Ekstrand
We use the same convention as the load balancing tests and, when balancing is requested, we make a context with N+1 engines where the first one is the balanced engine and the others are physical engines.
--- lib/i915/gem_engine_topology.c | 27 ++++++++++++++---- lib/intel_ctx.c | 50 +++++++++++++++++++++++++++++++--- lib/intel_ctx.h | 2 ++ 3 files changed, 69 insertions(+), 10 deletions(-)lib/i915/gem_engine_topology.c +21
-6@@ -311,12 +311,27 @@ intel_engine_list_for_ctx_cfg(int fd, const intel_ctx_cfg_t *cfg)struct intel_engine_data engine_data = { };int i; - engine_data.nengines = cfg->num_engines; -for (i =0 ; i < cfg->num_engines; i++) -init_engine (&engine_data.engines[i], - cfg->engines[i].engine_class, - cfg->engines[i].engine_instance, - i); +if (cfg->load_balance) { + engine_data.nengines = cfg->num_engines +1 ; + +init_engine (&engine_data.engines[0 ], +I915_ENGINE_CLASS_INVALID , +I915_ENGINE_CLASS_INVALID_NONE , +0 ); + +for (i =0 ; i < cfg->num_engines; i++) +init_engine (&engine_data.engines[i +1 ], + cfg->engines[i].engine_class, + cfg->engines[i].engine_instance, + i +1 ); + }else { + engine_data.nengines = cfg->num_engines; +for (i =0 ; i < cfg->num_engines; i++) +init_engine (&engine_data.engines[i], + cfg->engines[i].engine_class, + cfg->engines[i].engine_instance, + i); + }return engine_data; }else {lib/intel_ctx.c +1
-0@@ -100,6 +100,7 @@ static int __context_create_cfg(int fd, const intel_ctx_cfg_t *cfg, uint32_t *ctx_id) { uint64_t ext_root = 0; +I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE (balance,GEM_MAX_ENGINES );I915_DEFINE_CONTEXT_PARAM_ENGINES (engines,GEM_MAX_ENGINES );struct drm_i915_gem_context_create_ext_setparam engines_param, vm_param;struct drm_i915_gem_context_create_ext_setparam persist_param;@@ -131,9 +132,39 @@ __context_create_cfg(int fd, const intel_ctx_cfg_t *cfg, uint32_t *ctx_id) }
Quoted 4 lines
lib/intel_ctx.c __context_create_cfg(int fd, const intel_ctx_cfg_t *cfg, uint32_t *ctx_id) · line 135
Quoted 2 lines
lib/intel_ctx.c +1
-0if (cfg->num_engines) { +unsigned num_logical_engines =0 ;Can be left uninitialized.
Done.
Quoted 6 lines
Quoted 6 lines
lib/intel_ctx.c +3
-2memset (&engines,0 ,sizeof (engines)); -for (i =0 ; i < cfg->num_engines; i++) - engines.engines[i] = cfg->engines[i]; + +if (cfg->load_balance) { +memset (&balance,0 ,sizeof (balance));
Quoted 8 lines
lib/intel_ctx.c __context_create_cfg(int fd, const intel_ctx_cfg_t *cfg, uint32_t *ctx_id) · line 145
Quoted 6 lines
lib/intel_ctx.c +6
-0+ +/* In this case, the first engine is the virtual +* balanced engine and the subsequent engines are +* the actual requested engines. +*/ +assert (cfg->num_engines +1 <=GEM_MAX_ENGINES );Minor nit - use
igt_assert()here.
Both fixed.
Quoted 21 lines
Quoted 8 lines
lib/intel_ctx.c +8
-0+ num_logical_engines = cfg->num_engines +1 ; + + engines.engines[0 ].engine_class = +I915_ENGINE_CLASS_INVALID ; + engines.engines[0 ].engine_instance = +I915_ENGINE_CLASS_INVALID_NONE ; + + balance.num_siblings = cfg->num_engines;lib/intel_ctx.c __context_create_cfg(int fd, const intel_ctx_cfg_t *cfg, uint32_t *ctx_id) · line 163
Quoted 10 lines
lib/intel_ctx.c +10
-0+for (i =0 ; i < cfg->num_engines; i++) { +igt_assert_eq (cfg->engines[0 ].engine_class, + cfg->engines[i].engine_class); + balance.engines[i] = cfg->engines[i]; + engines.engines[i +1 ] = cfg->engines[i]; + } + + engines.extensions =to_user_pointer (&balance); + }else { +assert (cfg->num_engines <=GEM_MAX_ENGINES );Same.
Quoted 3 lines
Other things looks correct imo. With assert()->igt_assert() change
Reviewed-by Zbigniew Kempczyński <[email protected]>
Thanks!
Quoted 67 lines
--
ZbigniewQuoted 63 lines
lib/intel_ctx.c +17
-2+ num_logical_engines = cfg->num_engines; +for (i =0 ; i < cfg->num_engines; i++) + engines.engines[i] = cfg->engines[i]; + } engines_param = (struct drm_i915_gem_context_create_ext_setparam ) { .base = {@@ -141,11 +172,13 @@ __context_create_cfg(int fd, const intel_ctx_cfg_t *cfg, uint32_t *ctx_id) }, .param = { .param = I915_CONTEXT_PARAM_ENGINES, - .size = sizeof_param_engines(cfg->num_engines), + .size = sizeof_param_engines(num_logical_engines), .value = to_user_pointer(&engines), }, };add_user_ext (&ext_root, &engines_param.base); + }else { +igt_assert (!cfg->load_balance); }return __gem_context_create_ext (fd, cfg->flags, ext_root, ctx_id);@@ -276,7 +309,16 @@ void intel_ctx_destroy(int fd, const intel_ctx_t *ctx)*/ unsigned int intel_ctx_engine_class (const intel_ctx_t *ctx,unsigned int engine) { -if (ctx->cfg.num_engines) { +if (ctx->cfg.load_balance) { +if (engine ==0 ) { +/* This is our virtual engine */ +return ctx->cfg.engines[0 ].engine_class; + }else { +/* This is a physical engine */ +igt_assert (engine -1 < ctx->cfg.num_engines); +return ctx->cfg.engines[engine -1 ].engine_class; + } + }else if (ctx->cfg.num_engines) {igt_assert (engine < ctx->cfg.num_engines);return ctx->cfg.engines[engine].engine_class; }else {lib/intel_ctx.h +2
-1@@ -35,6 +35,7 @@* @flags: Context create flags * @vm: VM to inherit or 0 for using a per-context VM * @nopersist: set I915_CONTEXT_PARAM_PERSISTENCE to 0 +* @load_balance: True if the first engine should be a load balancing engine * @num_engines: Number of client-specified engines or 0 for legacy mode * @engines: Client-specified engines * @@ -44,6 +45,7 @@ typedef struct intel_ctx_cfg {uint32_t flags;uint32_t vm;bool nopersist; +bool load_balance;unsigned int num_engines;struct i915_engine_class_instance engines[GEM_MAX_ENGINES ]; } intel_ctx_cfg_t; --2.31.1
Quoted 4 lines
Quoted 4 lines
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 69/89 tests/i915/gem_exec_balancer: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_exec_balancer.c | 451 ++++++++++++++------------------- 1 file changed, 192 insertions(+), 259 deletions(-)
tests/i915/gem_exec_balancer.c +192 -259
@@ -53,12 +53,6 @@ static size_t sizeof_load_balance(int count) engines[count]); } -static size_t sizeof_param_engines (int count) -{ -return offsetof(struct i915_context_param_engines , - engines[count]); -} -#define alloca0 (sz) ({ size_t sz__ = (sz); memset(alloca(sz__), 0, sz__); })static bool has_class_instance (int i915,uint16_t class,uint16_t instance)
@@ -123,83 +117,35 @@ static bool has_perf_engines(int i915)return i915_perf_type_id (i915); } -static int __set_engines (int i915,uint32_t ctx, -const struct i915_engine_class_instance *ci, -unsigned int count) -{ -struct i915_context_param_engines *engines = -alloca0 (sizeof_param_engines (count)); -struct drm_i915_gem_context_param p = { - .ctx_id = ctx, - .param =I915_CONTEXT_PARAM_ENGINES , - .size =sizeof_param_engines (count), - .value =to_user_pointer (engines) - }; - - engines->extensions =0 ; -memcpy (engines->engines, ci, count *sizeof (*ci)); - -return __gem_context_set_param (i915, &p); -} - -static void set_engines (int i915,uint32_t ctx, -const struct i915_engine_class_instance *ci, -unsigned int count) -{ -igt_assert_eq (__set_engines (i915, ctx, ci, count),0 ); -} - -static int __set_load_balancer (int i915,uint32_t ctx, -const struct i915_engine_class_instance *ci, -unsigned int count, -void *ext) +static intel_ctx_cfg_t +ctx_cfg_for_engines (const struct i915_engine_class_instance *ci, +unsigned int count) { -struct i915_context_engines_load_balance *balancer = -alloca0 (sizeof_load_balance (count)); -struct i915_context_param_engines *engines = -alloca0 (sizeof_param_engines (count +1 )); -struct drm_i915_gem_context_param p = { - .ctx_id = ctx, - .param =I915_CONTEXT_PARAM_ENGINES , - .size =sizeof_param_engines (count +1 ), - .value =to_user_pointer (engines) - }; - - balancer->base.name =I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE ; - balancer->base.next_extension =to_user_pointer (ext); - -igt_assert (count); - balancer->num_siblings = count; -memcpy (balancer->engines, ci, count *sizeof (*ci)); +intel_ctx_cfg_t cfg = { }; +unsigned int i; - engines->extensions =to_user_pointer (balancer); - engines->engines[0 ].engine_class = -I915_ENGINE_CLASS_INVALID ; - engines->engines[0 ].engine_instance = -I915_ENGINE_CLASS_INVALID_NONE ; -memcpy (engines->engines +1 , ci, count *sizeof (*ci)); +for (i =0 ; i < count; i++) + cfg.engines[i] = ci[i]; + cfg.num_engines = count; -return __gem_context_set_param (i915, &p); +return cfg; } -static void set_load_balancer (int i915,uint32_t ctx, -const struct i915_engine_class_instance *ci, -unsigned int count, -void *ext) +static const intel_ctx_t * +ctx_create_engines (int i915,const struct i915_engine_class_instance *ci, +unsigned int count) { -igt_assert_eq (__set_load_balancer (i915, ctx, ci, count, ext),0 ); +intel_ctx_cfg_t cfg =ctx_cfg_for_engines (ci, count); +return intel_ctx_create (i915, &cfg); } -static uint32_t load_balancer_create (int i915, -const struct i915_engine_class_instance *ci, -unsigned int count) +static const intel_ctx_t * +ctx_create_balanced (int i915,const struct i915_engine_class_instance *ci, +unsigned int count) { -uint32_t ctx; - - ctx =gem_context_create (i915); -set_load_balancer (i915, ctx, ci, count,NULL ); - -return ctx; +intel_ctx_cfg_t cfg =ctx_cfg_for_engines (ci, count); + cfg.load_balance = true; +return intel_ctx_create (i915, &cfg); }static uint32_t __batch_create (int i915,uint32_t offset)
@@ -494,7 +440,7 @@ static const char *class_to_str(int class) }static void check_individual_engine (int i915, -uint32_t ctx, +const intel_ctx_t *ctx,const struct i915_engine_class_instance *ci,int idx) {
@@ -506,7 +452,7 @@ static void check_individual_engine(int i915,I915_PMU_ENGINE_BUSY (ci[idx].engine_class, ci[idx].engine_instance)); - spin = igt_spin_new(i915, .ctx_id = ctx, .engine = idx + 1); + spin = igt_spin_new(i915, .ctx = ctx, .engine = idx + 1); load =measure_load (pmu,10000 );igt_spin_free (i915, spin);
@@ -536,15 +482,14 @@ static void individual(int i915)continue ;for (int pass =0 ; pass < count; pass++) {/* approx. count! */ -uint32_t ctx; +const intel_ctx_t *ctx;igt_assert (sizeof (*ci) ==sizeof (int ));igt_permute_array (ci, count, igt_exchange_int); - ctx =gem_context_create (i915); -set_load_balancer (i915, ctx, ci, count,NULL ); + ctx =ctx_create_balanced (i915, ci, count);for (unsigned int n =0 ; n < count; n++)check_individual_engine (i915, ctx, ci, n); -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx); }free (ci);
@@ -612,7 +557,7 @@ static void bonded_slice(int i915)struct drm_i915_gem_exec_object2 obj[3 ] = {};struct drm_i915_gem_execbuffer2 eb = {};unsigned int count; -uint32_t ctx; +const intel_ctx_t *ctx;igt_spin_t *spin; siblings =list_engines (i915,1u << class, &count);
@@ -636,11 +581,10 @@ static void bonded_slice(int i915)* XXX add explicit bonding options for A->B */ - ctx =gem_context_create (i915);/* NB timeline per engine */ -set_load_balancer (i915, ctx, siblings, count,NULL ); + ctx =ctx_create_balanced (i915, siblings, count); spin = __igt_spin_new(i915, - .ctx_id = ctx, + .ctx = ctx, .flags = (IGT_SPIN_NO_PREEMPTION |IGT_SPIN_POLL_RUN ));igt_spin_end (spin);/* we just want its address for later */
@@ -654,17 +598,17 @@ static void bonded_slice(int i915) obj[2 ].handle =create_semaphore_to_spinner (i915, spin); eb.buffers_ptr =to_user_pointer (obj); - eb.rsvd1 = ctx; + eb.rsvd1 = ctx->id; *stop =0 ; igt_fork(child, count + 1) { /* C: arbitrary background load */igt_list_del (&spin->link); - ctx =load_balancer_create (i915, siblings, count); + ctx =ctx_create_balanced (i915, siblings, count);while (!READ_ONCE (*stop)) { spin = igt_spin_new(i915, - .ctx_id = ctx, + .ctx = ctx, .engine = (1 + rand() % count), .flags =IGT_SPIN_POLL_RUN );igt_spin_busywait_until_started (spin);
@@ -672,7 +616,7 @@ static void bonded_slice(int i915)igt_spin_free (i915, spin); } -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx); } igt_until_timeout(5) {
@@ -698,7 +642,7 @@ static void bonded_slice(int i915)gem_close (i915, obj[2 ].handle);igt_spin_free (i915, spin); -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx); }munmap (stop,4096 );
@@ -719,26 +663,24 @@ static void __bonded_chain(int i915,igt_spin_t *spin;for (int i =0 ; i <ARRAY_SIZE (priorities); i++) { -uint32_t ctx; +const intel_ctx_t *ctx;/* A: spin forever on engine 1 */ - ctx =gem_context_create (i915); -set_load_balancer (i915, ctx, siblings, count,NULL ); + ctx =ctx_create_balanced (i915, siblings, count);if (priorities[i] <0 ) -gem_context_set_priority (i915, ctx, priorities[i]); +gem_context_set_priority (i915, ctx->id, priorities[i]); spin = igt_spin_new(i915, - .ctx_id = ctx, + .ctx = ctx, .engine = 1, .flags = (IGT_SPIN_POLL_RUN |IGT_SPIN_FENCE_OUT ));igt_spin_busywait_until_started (spin);/* B: waits for A on engine 2 */ -gem_context_destroy (i915, ctx); - ctx =gem_context_create (i915); -gem_context_set_priority (i915, ctx,0 ); -set_load_balancer (i915, ctx, siblings, count,NULL ); - execbuf.rsvd1 = ctx; +intel_ctx_destroy (i915, ctx); + ctx =ctx_create_balanced (i915, siblings, count); +gem_context_set_priority (i915, ctx->id,0 ); + execbuf.rsvd1 = ctx->id; execbuf.rsvd2 = spin->out_fence; execbuf.flags =I915_EXEC_FENCE_IN |I915_EXEC_FENCE_OUT ; execbuf.flags |=2 ;/* opposite engine to spinner */
@@ -746,12 +688,12 @@ static void __bonded_chain(int i915,/* B': run in parallel with B on engine 1, i.e. not before A! */ if (priorities[i] >0 ) -gem_context_set_priority (i915, ctx, priorities[i]); +gem_context_set_priority (i915, ctx->id, priorities[i]); execbuf.flags =I915_EXEC_FENCE_SUBMIT |I915_EXEC_FENCE_OUT ; execbuf.flags |=1 ;/* same engine as spinner */ execbuf.rsvd2 >>=32 ;gem_execbuf_wr (i915, &execbuf); -gem_context_set_priority (i915, ctx,0 ); +gem_context_set_priority (i915, ctx->id,0 );/* Wait for any magic timeslicing or preemptions... */ igt_assert_eq(sync_fence_wait(execbuf.rsvd2 >> 32, 1000),
@@ -768,7 +710,7 @@ static void __bonded_chain(int i915,igt_assert_eq (sync_fence_status (execbuf.rsvd2 >>32 ),0 );igt_spin_free (i915, spin); -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx);gem_sync (i915, batch.handle);igt_assert_eq (sync_fence_status (execbuf.rsvd2 &0xffffffff ),1 );
@@ -796,26 +738,24 @@ static void __bonded_chain_inv(int i915,igt_spin_t *spin;for (int i =0 ; i <ARRAY_SIZE (priorities); i++) { -uint32_t ctx; +const intel_ctx_t *ctx;/* A: spin forever on engine 1 */ - ctx =gem_context_create (i915); -set_load_balancer (i915, ctx, siblings, count,NULL ); + ctx =ctx_create_balanced (i915, siblings, count);if (priorities[i] <0 ) -gem_context_set_priority (i915, ctx, priorities[i]); +gem_context_set_priority (i915, ctx->id, priorities[i]); spin = igt_spin_new(i915, - .ctx_id = ctx, + .ctx = ctx, .engine = 1, .flags = (IGT_SPIN_POLL_RUN |IGT_SPIN_FENCE_OUT ));igt_spin_busywait_until_started (spin);/* B: waits for A on engine 1 */ -gem_context_destroy (i915, ctx); - ctx =gem_context_create (i915); -gem_context_set_priority (i915, ctx,0 ); -set_load_balancer (i915, ctx, siblings, count,NULL ); - execbuf.rsvd1 = ctx; +intel_ctx_destroy (i915, ctx); + ctx =ctx_create_balanced (i915, siblings, count); +gem_context_set_priority (i915, ctx->id,0 ); + execbuf.rsvd1 = ctx->id; execbuf.rsvd2 = spin->out_fence; execbuf.flags =I915_EXEC_FENCE_IN |I915_EXEC_FENCE_OUT ; execbuf.flags |=1 ;/* same engine as spinner */
@@ -823,12 +763,12 @@ static void __bonded_chain_inv(int i915,/* B': run in parallel with B on engine 2, i.e. not before A! */ if (priorities[i] >0 ) -gem_context_set_priority (i915, ctx, priorities[i]); +gem_context_set_priority (i915, ctx->id, priorities[i]); execbuf.flags =I915_EXEC_FENCE_SUBMIT |I915_EXEC_FENCE_OUT ; execbuf.flags |=2 ;/* opposite engine to spinner */ execbuf.rsvd2 >>=32 ;gem_execbuf_wr (i915, &execbuf); -gem_context_set_priority (i915, ctx,0 ); +gem_context_set_priority (i915, ctx->id,0 );/* Wait for any magic timeslicing or preemptions... */ igt_assert_eq(sync_fence_wait(execbuf.rsvd2 >> 32, 1000),
@@ -846,7 +786,7 @@ static void __bonded_chain_inv(int i915,igt_spin_free (i915, spin);gem_sync (i915, batch.handle); -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx);igt_assert_eq (sync_fence_status (execbuf.rsvd2 &0xffffffff ),1 );igt_assert_eq (sync_fence_status (execbuf.rsvd2 >>32 ),1 );
@@ -894,10 +834,10 @@ static void __bonded_sema(int i915,igt_spin_t *spin;for (int i =0 ; i <ARRAY_SIZE (priorities); i++) { -uint32_t ctx; +const intel_ctx_t *ctx;/* A: spin forever on seperate render engine */ - spin = igt_spin_new(i915, + spin = igt_spin_new(i915, .ctx = intel_ctx_0(i915), .flags = (IGT_SPIN_POLL_RUN |IGT_SPIN_FENCE_OUT ));igt_spin_busywait_until_started (spin);
@@ -910,26 +850,24 @@ static void __bonded_sema(int i915,*/ /* B: waits for A (using a semaphore) on engine 1 */ - ctx =gem_context_create (i915); -set_load_balancer (i915, ctx, siblings, count,NULL ); - execbuf.rsvd1 = ctx; + ctx =ctx_create_balanced (i915, siblings, count); + execbuf.rsvd1 = ctx->id; execbuf.rsvd2 = spin->out_fence; execbuf.flags =I915_EXEC_FENCE_IN |I915_EXEC_FENCE_OUT ; execbuf.flags |=1 ;gem_execbuf_wr (i915, &execbuf);/* B': run in parallel with B on engine 2 */ -gem_context_destroy (i915, ctx); - ctx =gem_context_create (i915); +intel_ctx_destroy (i915, ctx); + ctx =ctx_create_balanced (i915, siblings, count);if (priorities[i] >0 ) -gem_context_set_priority (i915, ctx, priorities[i]); -set_load_balancer (i915, ctx, siblings, count,NULL ); - execbuf.rsvd1 = ctx; +gem_context_set_priority (i915, ctx->id, priorities[i]); + execbuf.rsvd1 = ctx->id; execbuf.flags =I915_EXEC_FENCE_SUBMIT |I915_EXEC_FENCE_OUT ; execbuf.flags |=2 ; execbuf.rsvd2 >>=32 ;gem_execbuf_wr (i915, &execbuf); -gem_context_set_priority (i915, ctx,0 ); +gem_context_set_priority (i915, ctx->id,0 );/* Wait for any magic timeslicing or preemptions... */ igt_assert_eq(sync_fence_wait(execbuf.rsvd2 >> 32, 1000),
@@ -947,7 +885,7 @@ static void __bonded_sema(int i915,igt_spin_free (i915, spin);gem_sync (i915, batch.handle); -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx);igt_assert_eq (sync_fence_status (execbuf.rsvd2 &0xffffffff ),1 );igt_assert_eq (sync_fence_status (execbuf.rsvd2 >>32 ),1 );
@@ -1000,7 +938,7 @@ static void __bonded_pair(int i915,unsigned int spinner;igt_spin_t *a;int timeline; -uint32_t A ; +const intel_ctx_t *A ;srandom (getpid ());
@@ -1008,9 +946,8 @@ static void __bonded_pair(int i915,if (flags &B_HOSTILE ) spinner |=IGT_SPIN_NO_PREEMPTION ; -A =gem_context_create (i915); -set_load_balancer (i915,A , siblings, count,NULL ); - a = igt_spin_new(i915, A, .flags = spinner); +A =ctx_create_balanced (i915, siblings, count); + a = igt_spin_new(i915, .ctx = A, .flags = spinner);igt_spin_end (a);gem_sync (i915, a->handle);
@@ -1063,7 +1000,7 @@ static void __bonded_pair(int i915,close (timeline);igt_spin_free (i915, a); -gem_context_destroy (i915,A ); +intel_ctx_destroy (i915,A ); *out = cycles; }
@@ -1083,7 +1020,7 @@ static void __bonded_dual(int i915,unsigned int spinner;igt_spin_t *a, *b;int timeline; -uint32_t A ,B ; +const intel_ctx_t *A , *B ;srandom (getpid ());
@@ -1091,15 +1028,13 @@ static void __bonded_dual(int i915,if (flags &B_HOSTILE ) spinner |=IGT_SPIN_NO_PREEMPTION ; -A =gem_context_create (i915); -set_load_balancer (i915,A , siblings, count,NULL ); - a = igt_spin_new(i915, A, .flags = spinner); +A =ctx_create_balanced (i915, siblings, count); + a = igt_spin_new(i915, .ctx = A, .flags = spinner);igt_spin_end (a);gem_sync (i915, a->handle); -B =gem_context_create (i915); -set_load_balancer (i915,B , siblings, count,NULL ); - b = igt_spin_new(i915, B, .flags = spinner); +B =ctx_create_balanced (i915, siblings, count); + b = igt_spin_new(i915, .ctx = B, .flags = spinner);igt_spin_end (b);gem_sync (i915, b->handle);
@@ -1178,8 +1113,8 @@ static void __bonded_dual(int i915,igt_spin_free (i915, a);igt_spin_free (i915, b); -gem_context_destroy (i915,A ); -gem_context_destroy (i915,B ); +intel_ctx_destroy (i915,A ); +intel_ctx_destroy (i915,B ); *out = cycles; }
@@ -1285,6 +1220,7 @@ static void __bonded_sync(int i915, unsigned long *out) {const uint64_t A =0 <<12 ,B =1 <<12 ; +const intel_ctx_t *ctx =ctx_create_balanced (i915, siblings, count);struct drm_i915_gem_exec_object2 obj[2 ] = { { .handle =sync_to (i915,A ,B ), .offset =A ,
@@ -1297,7 +1233,7 @@ static void __bonded_sync(int i915,struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (obj), .buffer_count =2 , - .rsvd1 =gem_context_create (i915), + .rsvd1 = ctx->id, };unsigned long cycles =0 ;
@@ -1306,7 +1242,6 @@ static void __bonded_sync(int i915,if (!(flags &B_HOSTILE ))/* always non-preemptible */ goto out; -set_load_balancer (i915, execbuf.rsvd1, siblings, count,NULL );disable_preparser (i915, execbuf.rsvd1);srandom (getpid ());
@@ -1363,7 +1298,7 @@ out:close (timeline);gem_close (i915, obj[0 ].handle);gem_close (i915, obj[1 ].handle); -gem_context_destroy (i915, execbuf.rsvd1); +intel_ctx_destroy (i915, ctx); *out = cycles; }
@@ -1451,7 +1386,7 @@ bonded_runner(int i915,munmap (cycles,4096 ); } -static void __bonded_nohang (int i915,uint32_t ctx, +static void __bonded_nohang (int i915,const intel_ctx_t *ctx,const struct i915_engine_class_instance *siblings,unsigned int count,unsigned int flags)
@@ -1463,16 +1398,15 @@ static void __bonded_nohang(int i915, uint32_t ctx,struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&batch), .buffer_count =1 , - .rsvd1 = ctx, + .rsvd1 = ctx->id, };igt_spin_t *time, *spin; -uint32_t load; +const intel_ctx_t *load; - load =gem_context_create (i915); -gem_context_set_priority (i915, load,1023 ); -set_load_balancer (i915, load, siblings, count,NULL ); + load =ctx_create_balanced (i915, siblings, count); +gem_context_set_priority (i915, load->id,1023 ); - spin = igt_spin_new(i915, load, .engine = 1); + spin = igt_spin_new(i915, .ctx = load, .engine = 1);/* Master on engine 1, stuck behind a spinner */ execbuf.flags =1 |I915_EXEC_FENCE_OUT ;
@@ -1492,7 +1426,7 @@ static void __bonded_nohang(int i915, uint32_t ctx,if (flags &NOHANG ) {/* Keep replacing spin, so that it doesn't hang */ - next = igt_spin_new(i915, load, .engine = 1); + next = igt_spin_new(i915, .ctx = load, .engine = 1);igt_spin_free (i915, spin); spin = next; }
@@ -1510,13 +1444,13 @@ static void __bonded_nohang(int i915, uint32_t ctx,close (execbuf.rsvd2);close (execbuf.rsvd2 >>32 ); -gem_context_destroy (i915, load); +intel_ctx_destroy (i915, load);gem_close (i915, batch.handle); }static void bonded_nohang (int i915,unsigned int flags) { -uint32_t ctx; +const intel_ctx_t *ctx;/* * We try and trick ourselves into declaring a bonded request as
@@ -1525,7 +1459,7 @@ static void bonded_nohang(int i915, unsigned int flags)igt_require (gem_scheduler_has_semaphores (i915)); - ctx =gem_context_create (i915); + ctx =intel_ctx_create (i915,NULL );for (int class =1 ; class <32 ; class++) {struct i915_engine_class_instance *siblings;
@@ -1537,7 +1471,7 @@ static void bonded_nohang(int i915, unsigned int flags)free (siblings); } -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx); }static void indices (int i915)
@@ -1653,20 +1587,20 @@ static void busy(int i915)struct i915_engine_class_instance *ci;unsigned int count;igt_spin_t *spin[2 ]; -uint32_t ctx; +const intel_ctx_t *ctx; ci =list_engines (i915,1u << class, &count);if (!ci)continue ; - ctx =load_balancer_create (i915, ci, count); + ctx =ctx_create_balanced (i915, ci, count);free (ci); spin[0] = __igt_spin_new(i915, - .ctx_id = ctx, + .ctx = ctx, .flags =IGT_SPIN_POLL_RUN ); spin[1] = __igt_spin_new(i915, - .ctx_id = ctx, + .ctx = ctx, .dependency = scratch);igt_spin_busywait_until_started (spin[0 ]);
@@ -1690,7 +1624,7 @@ static void busy(int i915)igt_spin_free (i915, spin[1 ]);igt_spin_free (i915, spin[0 ]); -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx); }gem_close (i915, scratch);
@@ -1743,7 +1677,7 @@ static void full(int i915, unsigned int flags) pmu[0 ] =-1 ;for (unsigned int n =0 ; n < count; n++) { -uint32_t ctx; +const intel_ctx_t *ctx; pmu[n] =add_pmu (i915, pmu[0 ], &ci[n]);
@@ -1762,22 +1696,22 @@ static void full(int i915, unsigned int flags)* otherwise they will just sit in the single queue * and not run concurrently. */ - ctx =load_balancer_create (i915, ci, count); + ctx =ctx_create_balanced (i915, ci, count);if (spin ==NULL ) { - spin = __igt_spin_new(i915, .ctx_id = ctx); + spin = __igt_spin_new(i915, .ctx = ctx); }else {struct drm_i915_gem_execbuffer2 eb = { .buffers_ptr = spin->execbuf.buffers_ptr, .buffer_count = spin->execbuf.buffer_count, - .rsvd1 = ctx, + .rsvd1 = ctx->id, .rsvd2 = fence, .flags = flags &LATE ?I915_EXEC_FENCE_IN :0 , };gem_execbuf (i915, &eb); } -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx); }if (flags &LATE ) {
@@ -1804,17 +1738,17 @@ static void full(int i915, unsigned int flags) }static void __sliced (int i915, -uint32_t ctx,unsigned int count, +const intel_ctx_t *ctx,unsigned int count,unsigned int flags) {igt_spin_t *load[count];igt_spin_t *virtual; - virtual = igt_spin_new(i915, ctx, .engine = 0, + virtual = igt_spin_new(i915, .ctx = ctx, .engine = 0, .flags = (IGT_SPIN_FENCE_OUT |IGT_SPIN_POLL_RUN ));for (int i =0 ; i < count; i++) - load[i] =__igt_spin_new (i915, ctx, + load[i] = __igt_spin_new(i915, .ctx = ctx, .engine = i + 1, .fence = virtual->out_fence, .flags = flags);
@@ -1865,7 +1799,9 @@ static void sliced(int i915) } igt_fork(child, count) { -uint32_t ctx =load_balancer_create (i915, ci, count); +const intel_ctx_t *ctx; + + ctx =ctx_create_balanced (i915, ci, count);/* Independent load */ __sliced (i915, ctx, count,0 );
@@ -1873,7 +1809,7 @@ static void sliced(int i915)/* Dependent load */ __sliced (i915, ctx, count,IGT_SPIN_FENCE_IN ); -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx); }igt_waitchildren ();
@@ -1883,23 +1819,23 @@ static void sliced(int i915)gem_quiescent_gpu (i915); } -static void __hog (int i915,uint32_t ctx,unsigned int count) +static void __hog (int i915,const intel_ctx_t *ctx,unsigned int count) {int64_t timeout =50 *1000 *1000 ;/* 50ms */ igt_spin_t *virtual;igt_spin_t *hog; - virtual = igt_spin_new(i915, ctx, .engine = 0); + virtual = igt_spin_new(i915, .ctx = ctx, .engine = 0);for (int i =0 ; i < count; i++)gem_execbuf (i915, &virtual->execbuf);usleep (50 *1000 );/* 50ms, long enough to spread across all engines */ -gem_context_set_priority (i915, ctx,1023 ); - hog =__igt_spin_new (i915, ctx, +gem_context_set_priority (i915, ctx->id,1023 ); + hog = __igt_spin_new(i915, .ctx = ctx, .engine = 1 + (random() % count), .flags = (IGT_SPIN_POLL_RUN |IGT_SPIN_NO_PREEMPTION )); -gem_context_set_priority (i915, ctx,0 ); +gem_context_set_priority (i915, ctx->id,0 );/* No matter which engine we choose, we'll have interrupted someone */ igt_spin_busywait_until_started (hog);
@@ -1929,7 +1865,7 @@ static void hog(int i915)for (int class =0 ; class <32 ; class++) {struct i915_engine_class_instance *ci;unsigned int count; -uint32_t ctx; +const intel_ctx_t *ctx; ci =list_engines (i915,1u << class, &count);if (!ci)
@@ -1940,11 +1876,11 @@ static void hog(int i915)continue ; } - ctx =load_balancer_create (i915, ci, count); + ctx =ctx_create_balanced (i915, ci, count);__hog (i915, ctx, count); -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx);igt_waitchildren ();free (ci);
@@ -1992,6 +1928,7 @@ static int __execbuf(int i915, struct drm_i915_gem_execbuffer2 *execbuf)static uint32_t *sema (int i915,struct i915_engine_class_instance *ci,unsigned int count) { +const intel_ctx_t *ctx =ctx_create_balanced (i915, ci, count);uint32_t *ctl;struct drm_i915_gem_exec_object2 batch = { .handle =sema_create (i915,64 <<20 , &ctl),
@@ -2001,7 +1938,7 @@ static uint32_t *sema(int i915, struct i915_engine_class_instance *ci,struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&batch), .buffer_count =1 , - .rsvd1 =load_balancer_create (i915, ci, count), + .rsvd1 = ctx->id, };for (int n =1 ; n <=32 ; n++) {
@@ -2015,7 +1952,7 @@ static uint32_t *sema(int i915, struct i915_engine_class_instance *ci,gem_wait (i915, batch.handle, &poll); } -gem_context_destroy (i915, execbuf.rsvd1); +intel_ctx_destroy (i915, ctx);igt_assert (gem_bo_busy (i915, batch.handle));gem_close (i915, batch.handle);
@@ -2068,14 +2005,9 @@ static void waits(int i915, int timeout)if (!ci)continue ; -if (count >1 ) { -uint32_t ctx =load_balancer_create (i915, ci, count); - +if (count >1 )__waits (i915, timeout, ci, count); -gem_context_destroy (i915, ctx); - } -free (ci); }
@@ -2094,20 +2026,20 @@ static void nop(int i915)for (int class =0 ; class <32 ; class++) {struct i915_engine_class_instance *ci;unsigned int count; -uint32_t ctx; +const intel_ctx_t *ctx; ci =list_engines (i915,1u << class, &count);if (!ci)continue ; - ctx =load_balancer_create (i915, ci, count); + ctx =ctx_create_balanced (i915, ci, count);for (int n =0 ; n < count; n++) {struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&batch), .buffer_count =1 , .flags = n +1 , - .rsvd1 = ctx, + .rsvd1 = ctx->id, };struct timespec tv = {};unsigned long nops;
@@ -2130,7 +2062,7 @@ static void nop(int i915)struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&batch), .buffer_count =1 , - .rsvd1 = ctx, + .rsvd1 = ctx->id, };struct timespec tv = {};unsigned long nops;
@@ -2151,11 +2083,13 @@ static void nop(int i915) igt_fork(child, count) { +const intel_ctx_t *child_ctx = +ctx_create_balanced (i915, ci, count);struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&batch), .buffer_count =1 , .flags = child +1 , - .rsvd1 =load_balancer_create (i915, ci, count), + .rsvd1 = child_ctx->id, };struct timespec tv = {};unsigned long nops;
@@ -2190,12 +2124,12 @@ static void nop(int i915)igt_info ("[%d] %s:* %.3fus\n" , child,class_to_str (class), t); -gem_context_destroy (i915, execbuf.rsvd1); +intel_ctx_destroy (i915, child_ctx); }igt_waitchildren (); -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx);free (ci); }
@@ -2220,7 +2154,7 @@ static void sequential(int i915)unsigned int count;unsigned long nops;double t; -uint32_t *ctx; +const intel_ctx_t **ctx; ci =list_engines (i915,1u << class, &count);if (!ci || count <2 )
@@ -2228,7 +2162,7 @@ static void sequential(int i915) ctx =malloc (sizeof (*ctx) * count);for (int n =0 ; n < count; n++) - ctx[n] =load_balancer_create (i915, ci, count); + ctx[n] =ctx_create_balanced (i915, ci, count);gem_execbuf_wr (i915, &execbuf); execbuf.rsvd2 >>=32 ;
@@ -2239,7 +2173,7 @@ static void sequential(int i915)igt_nsec_elapsed (&tv); do { for (int n = 0; n < count; n++) { - execbuf.rsvd1 = ctx[n]; + execbuf.rsvd1 = ctx[n]->id; gem_execbuf_wr(i915, &execbuf); close(execbuf.rsvd2); execbuf.rsvd2 >>= 32;
@@ -2253,7 +2187,7 @@ static void sequential(int i915)close (execbuf.rsvd2);for (int n =0 ; n < count; n++) -gem_context_destroy (i915, ctx[n]); +intel_ctx_destroy (i915, ctx[n]);free (ctx); next:free (ci);
@@ -2263,7 +2197,7 @@ next:gem_quiescent_gpu (i915); } -static void ping (int i915,uint32_t ctx,unsigned int engine) +static void ping (int i915,const intel_ctx_t *ctx,unsigned int engine) {struct drm_i915_gem_exec_object2 obj = { .handle =batch_create (i915),
@@ -2272,7 +2206,7 @@ static void ping(int i915, uint32_t ctx, unsigned int engine) .buffers_ptr = to_user_pointer(&obj), .buffer_count = 1, .flags = engine, - .rsvd1 = ctx, + .rsvd1 = ctx->id, };gem_execbuf (i915, &execbuf);gem_sync (i915, obj.handle);
@@ -2296,7 +2230,7 @@ static void semaphore(int i915)for (int class =1 ; class <32 ; class++) {struct i915_engine_class_instance *ci;unsigned int count; -uint32_t block[2 ], vip; +const intel_ctx_t *block[2 ], *vip; ci =list_engines (i915,1u << class, &count);if (!ci)
@@ -2309,10 +2243,9 @@ static void semaphore(int i915) count =ARRAY_SIZE (block);for (int i =0 ; i < count; i++) { - block[i] =gem_context_create (i915); -set_load_balancer (i915, block[i], ci, count,NULL ); + block[i] =ctx_create_balanced (i915, ci, count); spin[i] = __igt_spin_new(i915, - .ctx_id = block[i], + .ctx = block[i], .dependency = scratch); }
@@ -2320,14 +2253,13 @@ static void semaphore(int i915)* Either we haven't blocked both engines with semaphores, * or we let the vip through. If not, we hang. */ - vip =gem_context_create (i915); -set_load_balancer (i915, vip, ci, count,NULL ); + vip =ctx_create_balanced (i915, ci, count);ping (i915, vip,0 ); -gem_context_destroy (i915, vip); +intel_ctx_destroy (i915, vip);for (int i =0 ; i < count; i++) {igt_spin_free (i915, spin[i]); -gem_context_destroy (i915, block[i]); +intel_ctx_destroy (i915, block[i]); }free (ci);
@@ -2366,7 +2298,7 @@ static void hangme(int i915)igt_spin_t *spin[2 ]; } *client;unsigned int count; -uint32_t bg; +const intel_ctx_t *bg;int fence; ci =list_engines (i915,1u << class, &count);
@@ -2383,12 +2315,12 @@ static void hangme(int i915) fence =igt_cork_plug (&cork, i915);for (int i =0 ; i < count; i++) { -uint32_t ctx =gem_context_create (i915); +const intel_ctx_t *ctx;struct client *c = &client[i];unsigned int flags; -set_unbannable (i915, ctx); -set_load_balancer (i915, ctx, ci, count,NULL ); + ctx =ctx_create_balanced (i915, ci, count); +set_unbannable (i915, ctx->id); flags =IGT_SPIN_FENCE_IN | IGT_SPIN_FENCE_OUT |
@@ -2396,31 +2328,30 @@ static void hangme(int i915)if (!gem_has_cmdparser (i915,ALL_ENGINES )) flags |=IGT_SPIN_INVALID_CS ;for (int j =0 ; j <ARRAY_SIZE (c->spin); j++) { - c->spin[j] =__igt_spin_new (i915, ctx, + c->spin[j] = __igt_spin_new(i915, .ctx = ctx, .fence = fence, .flags = flags); flags =IGT_SPIN_FENCE_OUT ; } -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx); }close (fence);igt_cork_unplug (&cork);/* queue all hangs en masse */ /* Apply some background context to speed up hang detection */ - bg =gem_context_create (i915); -set_engines (i915, bg, ci, count); -gem_context_set_priority (i915, bg,1023 ); + bg =ctx_create_engines (i915, ci, count); +gem_context_set_priority (i915, bg->id,1023 );for (int i =0 ; i < count; i++) {struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&batch), .buffer_count =1 , .flags = i, - .rsvd1 = bg, + .rsvd1 = bg->id, };gem_execbuf (i915, &execbuf); } -gem_context_destroy (i915, bg); +intel_ctx_destroy (i915, bg);for (int i =0 ; i < count; i++) {struct client *c = &client[i];
@@ -2456,8 +2387,8 @@ static void smoketest(int i915, int timeout)struct drm_i915_gem_exec_object2 batch[2 ] = { { .handle =__batch_create (i915,16380 ) } }; -unsigned int ncontext =0 ; -uint32_t *contexts =NULL ; +unsigned int nctx =0 ; +const intel_ctx_t **ctx =NULL ;uint32_t *handles =NULL ;igt_require_sw_sync ();
@@ -2472,35 +2403,35 @@ static void smoketest(int i915, int timeout)continue ; } - ncontext +=128 ; - contexts =realloc (contexts,sizeof (*contexts) * ncontext); -igt_assert (contexts); + nctx +=128 ; + ctx =realloc (ctx,sizeof (*ctx) * nctx); +igt_assert (ctx); -for (unsigned int n = ncontext -128 ; n < ncontext; n++) { - contexts[n] =load_balancer_create (i915, ci, count); -igt_assert (contexts[n]); +for (unsigned int n = nctx -128 ; n < nctx; n++) { + ctx[n] =ctx_create_balanced (i915, ci, count); +igt_assert (ctx[n]); }free (ci); } -if (!ncontext)/* suppress the fluctuating status of shard-icl */ +if (!nctx)/* suppress the fluctuating status of shard-icl */ return ; -igt_debug ("Created %d virtual engines (one per context)\n" , ncontext); - contexts =realloc (contexts,sizeof (*contexts) * ncontext *4 ); -igt_assert (contexts); -memcpy (contexts + ncontext, contexts, ncontext *sizeof (*contexts)); - ncontext *=2 ; -memcpy (contexts + ncontext, contexts, ncontext *sizeof (*contexts)); - ncontext *=2 ; +igt_debug ("Created %d virtual engines (one per context)\n" , nctx); + ctx =realloc (ctx,sizeof (*ctx) * nctx *4 ); +igt_assert (ctx); +memcpy (ctx + nctx, ctx, nctx *sizeof (*ctx)); + nctx *=2 ; +memcpy (ctx + nctx, ctx, nctx *sizeof (*ctx)); + nctx *=2 ; - handles =malloc (sizeof (*handles) * ncontext); + handles =malloc (sizeof (*handles) * nctx);igt_assert (handles); -for (unsigned int n =0 ; n < ncontext; n++) +for (unsigned int n =0 ; n < nctx; n++) handles[n] =gem_create (i915,4096 );igt_until_timeout (timeout) { -unsigned int count =1 + (rand () % (ncontext -1 )); +unsigned int count =1 + (rand () % (nctx -1 ));IGT_CORK_FENCE (cork);int fence =igt_cork_plug (&cork, i915);
@@ -2508,7 +2439,7 @@ static void smoketest(int i915, int timeout)struct drm_i915_gem_execbuffer2 eb = { .buffers_ptr =to_user_pointer (batch), .buffer_count =ARRAY_SIZE (batch), - .rsvd1 = contexts[n], + .rsvd1 = ctx[n]->id, .rsvd2 = fence, .flags =I915_EXEC_BATCH_FIRST |I915_EXEC_FENCE_IN , };
@@ -2524,16 +2455,16 @@ static void smoketest(int i915, int timeout)close (fence); } -for (unsigned int n =0 ; n < ncontext; n++) { +for (unsigned int n =0 ; n < nctx /4 ; n++) {gem_close (i915, handles[n]); -__gem_context_destroy (i915, contexts[n]); +intel_ctx_destroy (i915, ctx[n]); }free (handles); -free (contexts); +free (ctx);gem_close (i915, batch[0 ].handle); } -static uint32_t read_ctx_timestamp (int i915,uint32_t ctx) +static uint32_t read_ctx_timestamp (int i915,const intel_ctx_t *ctx) {struct drm_i915_gem_relocation_entry reloc;struct drm_i915_gem_exec_object2 obj = {
@@ -2545,7 +2476,7 @@ static uint32_t read_ctx_timestamp(int i915, uint32_t ctx)struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&obj), .buffer_count =1 , - .rsvd1 = ctx, + .rsvd1 = ctx->id, };uint32_t *map, *cs;uint32_t ts;
@@ -2617,7 +2548,7 @@ static void __fairslice(int i915, {const double timeslice_duration_ns =1e6 ;igt_spin_t *spin =NULL ; -uint32_t ctx[count +1 ]; +const intel_ctx_t *ctx[count +1 ];uint32_t ts[count +1 ];double threshold;
@@ -2626,14 +2557,14 @@ static void __fairslice(int i915,igt_assert (ARRAY_SIZE (ctx) >=3 );for (int i =0 ; i <ARRAY_SIZE (ctx); i++) { - ctx[i] =load_balancer_create (i915, ci, count); + ctx[i] =ctx_create_balanced (i915, ci, count);if (spin ==NULL ) { - spin = __igt_spin_new(i915, .ctx_id = ctx[i]); + spin = __igt_spin_new(i915, .ctx = ctx[i]); }else {struct drm_i915_gem_execbuffer2 eb = { .buffer_count =1 , .buffers_ptr =to_user_pointer (&spin->obj[IGT_SPIN_BATCH ]), - .rsvd1 = ctx[i], + .rsvd1 = ctx[i]->id, };gem_execbuf (i915, &eb); }
@@ -2649,7 +2580,7 @@ static void __fairslice(int i915, ts[i] =read_ctx_timestamp (i915, ctx[i]);for (int i =0 ; i <ARRAY_SIZE (ctx); i++) -gem_context_destroy (i915, ctx[i]); +intel_ctx_destroy (i915, ctx[i]);igt_spin_free (i915, spin);/*
@@ -2714,21 +2645,21 @@ static void __persistence(int i915, bool persistent) {igt_spin_t *spin; -uint32_t ctx; +const intel_ctx_t *ctx;/* * A nonpersistent context is terminated immediately upon closure, * any inflight request is cancelled. */ - ctx =load_balancer_create (i915, ci, count); + ctx =ctx_create_balanced (i915, ci, count);if (!persistent) -gem_context_set_persistence (i915, ctx, persistent); +gem_context_set_persistence (i915, ctx->id, persistent); - spin =igt_spin_new (i915, ctx, + spin = igt_spin_new(i915, .ctx = ctx, .flags =IGT_SPIN_FENCE_OUT |IGT_SPIN_POLL_RUN );igt_spin_busywait_until_started (spin); -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx);igt_assert_eq (wait_for_status (spin->out_fence,500 ), -EIO );igt_spin_free (i915, spin);
@@ -2858,13 +2789,15 @@ static bool has_context_engines(int i915)static bool has_load_balancer (int i915) { -struct i915_engine_class_instance ci = {}; -uint32_t ctx; +const intel_ctx_cfg_t cfg = { + .load_balance = true, + .num_engines =1 , + }; +const intel_ctx_t *ctx =NULL ;int err; - ctx =gem_context_create (i915); - err =__set_load_balancer (i915, ctx, &ci,1 ,NULL ); -gem_context_destroy (i915, ctx); + err =__intel_ctx_create (i915, &cfg, &ctx); +intel_ctx_destroy (i915, ctx);return err ==0 ; }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 70/89 tests/i915/gem_exec_endless: Stop munging ctx0 engines
In reply to Jason Ekstrand--- tests/i915/gem_exec_endless.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/i915/gem_exec_endless.c +1 -1
@@ -308,7 +308,7 @@ static void endless_dispatch(int i915, const struct intel_execution_engine2 *e) }#define test_each_engine (T , i915, e) \ - igt_subtest_with_dynamic(T) __for_each_physical_engine(i915, e) \ + igt_subtest_with_dynamic(T) for_each_physical_engine(i915, e) \ for_each_if(gem_class_can_store_dword(i915, (e)->class)) \ igt_dynamic_f("%s", (e)->name)
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 71/89 lib/i915: Use for_each_physical_ring for submission tests
In reply to Jason EkstrandThis does make the assumption that ctx0 has the default set of engines but, now that we've converted everything to intel_ctx_t, this assumption should be ok.
--- lib/i915/gem_submission.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
lib/i915/gem_submission.c +5 -8
@@ -32,6 +32,7 @@#include "i915/gem.h" #include "i915/gem_engine_topology.h" +#include "i915/gem_ring.h" #include "i915/gem_submission.h" #include "igt_core.h"
@@ -199,10 +200,8 @@ void gem_test_engine(int i915, unsigned int engine)gem_write (i915, obj.handle,0 , &bbe,sizeof (bbe));if (engine ==ALL_ENGINES ) { -const struct intel_execution_engine2 *e2; - -__for_each_physical_engine (i915, e2) { - execbuf.flags = e2->flags; +for_each_physical_ring (e, i915) { + execbuf.flags =eb_ring (e);gem_execbuf (i915, &execbuf); } }else {
@@ -381,11 +380,9 @@ unsigned int gem_submission_measure(int i915, unsigned int engine)fcntl (i915,F_SETFL ,fcntl (i915,F_GETFL ) |O_NONBLOCK );if (engine ==ALL_ENGINES ) { -struct intel_execution_engine2 *e; - size =-1 ; -__for_each_physical_engine (i915, e) { -unsigned int this =__measure_ringsize (i915, e->flags); +for_each_physical_ring (e, i915) { +unsigned int this =__measure_ringsize (i915,eb_ring (e));if (this < size) size = this; }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 72/89 tests/i915/gem_ctx_engines: Rework execute-one*
In reply to Jason EkstrandInstead of switching out the set of engines constantly, create a new context for every set of engines. This means, among other things, that there's no point in testing whether or not the context is in a "default" because there's no more resetting it.
--- tests/i915/gem_ctx_engines.c | 79 +++++++++++++----------------------- 1 file changed, 28 insertions(+), 51 deletions(-)
tests/i915/gem_ctx_engines.c +28 -51
@@ -316,41 +316,19 @@ static void none(int i915)static void execute_one (int i915) { -I915_DEFINE_CONTEXT_PARAM_ENGINES (engines,I915_EXEC_RING_MASK +1 ); -struct drm_i915_gem_context_param param = { - .ctx_id =gem_context_create (i915), - .param =I915_CONTEXT_PARAM_ENGINES , - .value =to_user_pointer (&engines), -/* .size to be filled in later */ - };struct drm_i915_gem_exec_object2 obj = { .handle =gem_create (i915,4096 ), };struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&obj), .buffer_count =1 , - .rsvd1 = param.ctx_id, };const uint32_t bbe =MI_BATCH_BUFFER_END ;const struct intel_execution_engine2 *e; -igt_spin_t *spin; - -/* Prewarm the spinner */ - spin = igt_spin_new(i915, .ctx_id = param.ctx_id, - .flags = (IGT_SPIN_NO_PREEMPTION | -IGT_SPIN_POLL_RUN ));gem_write (i915, obj.handle,0 , &bbe,sizeof (bbe)); -/* Unadulterated I915_EXEC_DEFAULT should work */ - execbuf.flags =0 ; -gem_execbuf (i915, &execbuf); - obj.flags |=EXEC_OBJECT_PINNED ; - -igt_spin_end (spin); -gem_sync (i915, obj.handle); - -__for_each_physical_engine (i915, e) { +for_each_physical_engine (i915, e) {struct drm_i915_gem_busy busy = { .handle = obj.handle };if (!gem_class_can_store_dword (i915, e->class))
@@ -359,32 +337,38 @@ static void execute_one(int i915)igt_debug ("Testing [%s...]\n" , e->name);for (int i =-1 ; i <=I915_EXEC_RING_MASK ; i++) { -memset (&engines,0 ,sizeof (engines)); -engine_class (&engines,0 ) = e->class; -engine_instance (&engines,0 ) = e->instance; - param.size = offsetof(typeof(engines), engines[1]); -gem_context_set_param (i915, ¶m); - -gem_sync (i915, spin->handle); -igt_spin_reset (spin); -gem_execbuf (i915, &spin->execbuf); +intel_ctx_cfg_t cfg = {}; +const intel_ctx_t *ctx; +igt_spin_t *spin; + + cfg.num_engines =1 ; + cfg.engines[0 ].engine_class = e->class; + cfg.engines[0 ].engine_instance = e->instance; + ctx =intel_ctx_create (i915, &cfg); + + spin = igt_spin_new(i915, .ctx = ctx, + .flags = (IGT_SPIN_NO_PREEMPTION | +IGT_SPIN_POLL_RUN ));do_ioctl (i915,DRM_IOCTL_I915_GEM_BUSY , &busy);igt_assert_eq (busy.busy,0 ); +intel_ctx_destroy (i915, ctx); +/* Create a new context with a lot of engines */ igt_debug ("Testing with map of %d engines\n" , i +1 ); -memset (&engines.engines,-1 ,sizeof (engines.engines)); +memset (cfg.engines,-1 ,sizeof (cfg.engines));if (i !=-1 ) { -engine_class (&engines, i) = e->class; -engine_instance (&engines, i) = e->instance; + cfg.engines[i].engine_class = e->class; + cfg.engines[i].engine_instance = e->instance; } - param.size =sizeof (uint64_t ) + (i +1 ) *sizeof (uint32_t ); -gem_context_set_param (i915, ¶m); + cfg.num_engines =GEM_MAX_ENGINES ; + ctx =intel_ctx_create (i915, &cfg);igt_spin_busywait_until_started (spin);for (int j =0 ; j <=I915_EXEC_RING_MASK ; j++) {int expected = j == i ?0 : -EINVAL ; + execbuf.rsvd1 = ctx->id; execbuf.flags = j; igt_assert_f(__gem_execbuf(i915, &execbuf) == expected, "Failed to report the %s engine for slot %d (valid at %d)\n",
@@ -395,38 +379,31 @@ static void execute_one(int i915)igt_assert_eq (batch_busy (busy.busy), i !=-1 ?1 << e->class :0 ); -igt_spin_end (spin); +igt_spin_free (i915, spin);gem_sync (i915, obj.handle); +intel_ctx_destroy (i915, ctx);do_ioctl (i915,DRM_IOCTL_I915_GEM_BUSY , &busy);igt_assert_eq (busy.busy,0 ); } } -/* Restore the defaults and check I915_EXEC_DEFAULT works again. */ - param.size =0 ; -gem_context_set_param (i915, ¶m); - execbuf.flags =0 ; -gem_execbuf (i915, &execbuf); - -igt_spin_free (i915, spin); -gem_close (i915, obj.handle); -gem_context_destroy (i915, param.ctx_id); }static void execute_oneforall (int i915) {I915_DEFINE_CONTEXT_PARAM_ENGINES (engines,I915_EXEC_RING_MASK +1 );struct drm_i915_gem_context_param param = { - .ctx_id =gem_context_create (i915), .param =I915_CONTEXT_PARAM_ENGINES , .value =to_user_pointer (&engines), .size =sizeof (engines), };const struct intel_execution_engine2 *e; -__for_each_physical_engine (i915, e) { +for_each_physical_engine (i915, e) { + param.ctx_id =gem_context_create (i915); +memset (&engines,0 ,sizeof (engines));for (int i =0 ; i <=I915_EXEC_RING_MASK ; i++) {engine_class (&engines, i) = e->class;
@@ -448,9 +425,9 @@ static void execute_oneforall(int i915)igt_spin_free (i915, spin); } - } -gem_context_destroy (i915, param.ctx_id); +gem_context_destroy (i915, param.ctx_id); + } }static void execute_allforone (int i915)
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 73/89 tests/i915/gem_ctx_engines: Use better engine iteration
In reply to Jason Ekstrand--- tests/i915/gem_ctx_engines.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-)
tests/i915/gem_ctx_engines.c +19 -13
@@ -443,7 +443,7 @@ static void execute_allforone(int i915) i =0 ;memset (&engines,0 ,sizeof (engines)); -__for_each_physical_engine (i915, e) { +for_each_physical_engine (i915, e) {engine_class (&engines, i) = e->class;engine_instance (&engines, i) = e->instance; i++;
@@ -452,7 +452,7 @@ static void execute_allforone(int i915)gem_context_set_param (i915, ¶m); i =0 ; -__for_each_physical_engine (i915, e) { +for_each_physical_engine (i915, e) {struct drm_i915_gem_busy busy = {};igt_spin_t *spin;
@@ -489,7 +489,8 @@ static bool has_cs_timestamp(const struct intel_execution_engine2 *e, int gen)return e->class ==I915_ENGINE_CLASS_RENDER ; } -static void independent (int i915,const struct intel_execution_engine2 *e) +static void independent (int i915,const intel_ctx_t *base_ctx, +const struct intel_execution_engine2 *e) {#define RCS_TIMESTAMP (mmio_base + 0x358)const unsigned int gen =intel_gen (intel_get_drm_devid (i915));
@@ -497,7 +498,6 @@ static void independent(int i915, const struct intel_execution_engine2 *e)const int has_64bit_reloc = gen >=8 ;I915_DEFINE_CONTEXT_PARAM_ENGINES (engines,I915_EXEC_RING_MASK +1 );struct drm_i915_gem_context_param param = { - .ctx_id =gem_context_clone_with_engines (i915,0 ), .param =I915_CONTEXT_PARAM_ENGINES , .value =to_user_pointer (&engines), .size =sizeof (engines),
@@ -517,7 +517,7 @@ static void independent(int i915, const struct intel_execution_engine2 *e)struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&results), .buffer_count =1 , - .rsvd1 = param.ctx_id, + .rsvd1 = base_ctx->id, .flags = e->flags, };gem_write (i915, results.handle,0 , &bbe,sizeof (bbe));
@@ -530,6 +530,7 @@ static void independent(int i915, const struct intel_execution_engine2 *e)engine_class (&engines, i) = e->class;engine_instance (&engines, i) = e->instance; } + param.ctx_id =gem_context_create (i915);gem_context_set_param (i915, ¶m);gem_set_caching (i915, results.handle,I915_CACHING_CACHED );
@@ -589,19 +590,20 @@ static void independent(int i915, const struct intel_execution_engine2 *e)gem_context_destroy (i915, param.ctx_id); } -static void independent_all (int i915) +static void independent_all (int i915,const intel_ctx_t *ctx) {const unsigned int gen =intel_gen (intel_get_drm_devid (i915));const struct intel_execution_engine2 *e;igt_spin_t *spin =NULL ; -__for_each_physical_engine (i915, e) { +for_each_ctx_engine (i915, ctx, e) {if (spin) { spin->execbuf.flags &= ~63 ; spin->execbuf.flags |= e->flags;gem_execbuf (i915, &spin->execbuf); }else { - spin = igt_spin_new(i915, .engine = e->flags, + spin = igt_spin_new(i915, .ctx = ctx, + .engine = e->flags, .flags = (IGT_SPIN_NO_PREEMPTION |IGT_SPIN_POLL_RUN )); }
@@ -609,7 +611,7 @@ static void independent_all(int i915)igt_require (spin);igt_spin_busywait_until_started (spin); -__for_each_physical_engine (i915, e) { +for_each_ctx_engine (i915, ctx, e) {if (!gem_engine_mmio_base (i915, e->name))continue ;
@@ -617,7 +619,7 @@ static void independent_all(int i915)continue ; igt_fork(child, 1) -independent (i915, e); +independent (i915, ctx, e); }sched_yield ();igt_spin_free (i915, spin);
@@ -726,14 +728,18 @@ igt_mainexecute_allforone (i915); igt_subtest_with_dynamic("independent") { +const intel_ctx_t *ctx; +igt_require (gem_scheduler_enabled (i915));igt_require (intel_gen (intel_get_drm_devid (i915) >=6 )); -__for_each_physical_engine (i915, e) { + + ctx =intel_ctx_create_all_physical (i915); +for_each_ctx_engine (i915, ctx, e) { igt_dynamic_f("%s", e->name) -independent (i915, e); +independent (i915, ctx, e); } igt_dynamic("all") -independent_all (i915); +independent_all (i915, ctx); }igt_subtest ("libapi" )
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 74/89 tests/i915/gem_ctx_engines: Drop the idempotent subtest
In reply to Jason EkstrandThis just tests the engines CONTEXT_GETPARAM which we're going to be dropping from i915.
--- tests/i915/gem_ctx_engines.c | 79 ------------------------------------ 1 file changed, 79 deletions(-)
tests/i915/gem_ctx_engines.c +0 -79
@@ -173,82 +173,6 @@ out:gem_context_destroy (i915, param.ctx_id); } -static void idempotent (int i915) -{ -I915_DEFINE_CONTEXT_PARAM_ENGINES (engines,I915_EXEC_RING_MASK +1 ); -I915_DEFINE_CONTEXT_PARAM_ENGINES (expected,I915_EXEC_RING_MASK +1 ); -struct drm_i915_gem_context_param p = { - .ctx_id =gem_context_create (i915), - .param =I915_CONTEXT_PARAM_ENGINES , - .value =to_user_pointer (&engines), - .size =sizeof (engines), - }; -const size_t base =sizeof (struct i915_context_param_engines ); -const struct intel_execution_engine2 *e; -int idx; - -/* What goes in, must come out. And what comes out, must go in */ - -gem_context_get_param (i915, &p); -igt_assert_eq (p.size,0 );/* atm default is to use legacy ring mask */ - - idx =0 ; -memset (&engines,0 ,sizeof (engines)); -__for_each_physical_engine (i915, e) { - engines.engines[idx].engine_class = e->class; - engines.engines[idx].engine_instance = e->instance; - idx++; - } - idx *=sizeof (*engines.engines); - p.size = base + idx; -gem_context_set_param (i915, &p); - -memcpy (&expected, &engines,sizeof (expected)); - -gem_context_get_param (i915, &p); -igt_assert_eq (p.size, base + idx); -igt_assert (!memcmp (&expected, &engines, idx)); - - p.size = base; -gem_context_set_param (i915, &p); -gem_context_get_param (i915, &p); -igt_assert_eq (p.size, base); - -/* and it should not have overwritten the previous contents */ -igt_assert (!memcmp (&expected, &engines, idx)); - -memset (&engines,0 ,sizeof (engines)); - engines.engines[0 ].engine_class =I915_ENGINE_CLASS_INVALID ; - engines.engines[0 ].engine_instance =I915_ENGINE_CLASS_INVALID_NONE ; - idx =sizeof (*engines.engines); - p.size = base + idx; -gem_context_set_param (i915, &p); - -memcpy (&expected, &engines,sizeof (expected)); - -gem_context_get_param (i915, &p); -igt_assert_eq (p.size, base + idx); -igt_assert (!memcmp (&expected, &engines, idx)); - - p.size =sizeof (engines); -__for_each_physical_engine (i915, e) { -memset (&engines,0 ,sizeof (engines)); -for (int n =0 ; n <I915_EXEC_RING_MASK +1 ; n++) { -engine_class (&engines, n) = e->class; -engine_instance (&engines, n) = e->instance; - } -gem_context_set_param (i915, &p); - -memcpy (&expected, &engines,sizeof (expected)); - -gem_context_get_param (i915, &p); -igt_assert_eq (p.size,sizeof (engines)); -igt_assert (!memcmp (&expected, &engines, p.size)); - } - -gem_context_destroy (i915, p.ctx_id); -} -static uint32_t batch_create (int i915) {const uint32_t bbe =MI_BATCH_BUFFER_END ;
@@ -712,9 +636,6 @@ igt_main igt_subtest("invalid-engines")invalid_engines (i915); - igt_subtest("idempotent") -idempotent (i915); - igt_subtest("none")none (i915);
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 75/89 tests/i915/gem_ctx_create: Convert benchmarks to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_ctx_create.c | 76 +++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 36 deletions(-)
tests/i915/gem_ctx_create.c +40 -36
@@ -78,7 +78,8 @@ static double elapsed(const struct timespec *start,return (end->tv_sec - start->tv_sec) +1e-9 *(end->tv_nsec - start->tv_nsec); } -static void files (int core,int timeout,const int ncpus) +static void files (int core,const intel_ctx_cfg_t *cfg, +int timeout,const int ncpus) {const uint32_t bbe =MI_BATCH_BUFFER_END ;struct drm_i915_gem_execbuffer2 execbuf;
@@ -97,18 +98,22 @@ static void files(int core, int timeout, const int ncpus) igt_fork(child, ncpus) {struct timespec start, end;unsigned count =0 ; +const intel_ctx_t *ctx;int fd;clock_gettime (CLOCK_MONOTONIC , &start); do { fd = gem_reopen_driver(core); - gem_context_copy_engines(core, 0, fd, 0); + + ctx = intel_ctx_create(fd, cfg); + execbuf.rsvd1 = ctx->id; obj.handle = gem_open(fd, name); execbuf.flags &= ~ENGINE_FLAGS; execbuf.flags |= ppgtt_engines[count % ppgtt_nengine]; gem_execbuf(fd, &execbuf); + intel_ctx_destroy(fd, ctx); close(fd); count++;
@@ -125,7 +130,8 @@ static void files(int core, int timeout, const int ncpus)gem_close (core, batch); } -static void active (int fd,const struct intel_execution_engine2 *e, +static void active (int fd,const intel_ctx_cfg_t *cfg, +const struct intel_execution_engine2 *e,int timeout,int ncpus) {const uint32_t bbe =MI_BATCH_BUFFER_END ;
@@ -157,19 +163,19 @@ static void active(int fd, const struct intel_execution_engine2 *e,if (ncpus <0 ) { igt_fork(child, ppgtt_nengine) {unsigned long count =0 ; -int i915; +const intel_ctx_t *ctx; - i915 =gem_reopen_driver (fd);/* * Ensure the gpu is idle by launching * a nop execbuf and stalling for it */ -gem_quiescent_gpu (i915); -gem_context_copy_engines (fd,0 , i915,0 ); +gem_quiescent_gpu (fd);if (ppgtt_engines[child] == e->flags)continue ; + ctx =intel_ctx_create (fd, cfg); + execbuf.rsvd1 = ctx->id; execbuf.flags = ppgtt_engines[child];while (!READ_ONCE (*shared)) {
@@ -182,6 +188,7 @@ static void active(int fd, const struct intel_execution_engine2 *e, }igt_debug ("hog[%d]: cycles=%lu\n" , child, count); +intel_ctx_destroy (fd, ctx); } ncpus = -ncpus; }
@@ -189,33 +196,27 @@ static void active(int fd, const struct intel_execution_engine2 *e, igt_fork(child, ncpus) {struct timespec start, end;unsigned count =0 ; -int i915; -uint32_t ctx; - i915 =gem_reopen_driver (fd);/* * Ensure the gpu is idle by launching * a nop execbuf and stalling for it. */ -gem_quiescent_gpu (i915); - ctx =gem_context_create (i915); -gem_context_copy_engines (fd,0 , i915, ctx); +gem_quiescent_gpu (fd);clock_gettime (CLOCK_MONOTONIC , &start);do { - execbuf.rsvd1 =gem_context_clone_with_engines (fd, ctx); +const intel_ctx_t *ctx =intel_ctx_create (fd, cfg); + execbuf.rsvd1 = ctx->id;for (unsigned n =0 ; n < nengine; n++) { execbuf.flags = engines[n];gem_execbuf (fd, &execbuf); } -gem_context_destroy (fd, execbuf.rsvd1); +intel_ctx_destroy (fd, ctx); count++;clock_gettime (CLOCK_MONOTONIC , &end); }while (elapsed (&start, &end) < timeout); -gem_context_destroy (fd, ctx); -gem_sync (fd, obj.handle);clock_gettime (CLOCK_MONOTONIC , &end); igt_info("[%d] Context creation + execution: %.3f us\n",
@@ -276,7 +277,8 @@ static uint64_t total_avail_mem(unsigned mode)return total <<20 ; } -static void maximum (int fd,int ncpus,unsigned mode) +static void maximum (int fd,const intel_ctx_cfg_t *cfg, +int ncpus,unsigned mode) {const uint32_t bbe =MI_BATCH_BUFFER_END ;struct drm_i915_gem_execbuffer2 execbuf;
@@ -299,9 +301,7 @@ static void maximum(int fd, int ncpus, unsigned mode) err = -ENOMEM ;if (avail_mem > (count +1 ) * ctx_size) - err =__gem_context_clone (fd,0 , -I915_CONTEXT_CLONE_ENGINES , -0 , &ctx_id); + err =__gem_context_create (fd, &ctx_id);if (err) {igt_info ("Created %lu contexts, before failing with '%s' [%d]\n" , count,strerror (-err), -err);
@@ -322,6 +322,7 @@ static void maximum(int fd, int ncpus, unsigned mode) igt_fork(child, ncpus) {struct timespec start, end; +const intel_ctx_t *ctx;int i915; i915 =gem_reopen_driver (fd);
@@ -330,7 +331,7 @@ static void maximum(int fd, int ncpus, unsigned mode)* a nop execbuf and stalling for it. */ gem_quiescent_gpu (i915); -gem_context_copy_engines (fd,0 , i915,0 ); + ctx =intel_ctx_create (i915, cfg);hars_petruska_f54_1_random_perturb (child); obj[0 ].handle =gem_create (i915,4096 );
@@ -351,6 +352,7 @@ static void maximum(int fd, int ncpus, unsigned mode)gem_sync (i915, obj[0 ].handle);clock_gettime (CLOCK_MONOTONIC , &end);gem_close (i915, obj[0 ].handle); +intel_ctx_destroy (i915, ctx);igt_info ("[%d] Context execution: %.3f us\n" , child,elapsed (&start, &end) / (3 * count * all_nengine) *1e6 );
@@ -560,6 +562,7 @@ igt_mainconst int ncpus =sysconf (_SC_NPROCESSORS_ONLN);struct drm_i915_gem_context_create create;const struct intel_execution_engine2 *e; +intel_ctx_cfg_t cfg;int fd =-1 ; igt_fixture {
@@ -567,7 +570,8 @@ igt_mainigt_require_gem (fd);gem_require_contexts (fd); -__for_each_physical_engine (fd, e) + cfg =intel_ctx_cfg_all_physical (fd); +for_each_ctx_cfg_engine (fd, &cfg, e) all_engines[all_nengine++] = e->flags;igt_require (all_nengine);
@@ -597,39 +601,39 @@ igt_mainiris_pipeline (fd); igt_subtest("maximum-mem") -maximum (fd, ncpus,CHECK_RAM ); +maximum (fd, &cfg, ncpus,CHECK_RAM ); igt_subtest("maximum-swap") -maximum (fd, ncpus,CHECK_RAM |CHECK_SWAP ); +maximum (fd, &cfg, ncpus,CHECK_RAM |CHECK_SWAP ); igt_subtest("basic-files") -files (fd,2 ,1 ); +files (fd, &cfg,2 ,1 ); igt_subtest("files") -files (fd,20 ,1 ); +files (fd, &cfg,20 ,1 ); igt_subtest("forked-files") -files (fd,20 , ncpus); +files (fd, &cfg,20 , ncpus);/* NULL value means all engines */ igt_subtest("active-all") -active (fd,NULL ,20 ,1 ); +active (fd, &cfg,NULL ,20 ,1 ); igt_subtest("forked-active-all") -active (fd,NULL ,20 , ncpus); +active (fd, &cfg,NULL ,20 , ncpus); igt_subtest_with_dynamic("active") { -__for_each_physical_engine (fd, e) { +for_each_ctx_cfg_engine (fd, &cfg, e) { igt_dynamic_f("%s", e->name) -active (fd, e,20 ,1 ); +active (fd, &cfg, e,20 ,1 ); } } igt_subtest_with_dynamic("forked-active") { -__for_each_physical_engine (fd, e) { +for_each_ctx_cfg_engine (fd, &cfg, e) { igt_dynamic_f("%s", e->name) -active (fd, e,20 , ncpus); +active (fd, &cfg, e,20 , ncpus); } } igt_subtest_with_dynamic("hog") { -__for_each_physical_engine (fd, e) { +for_each_ctx_cfg_engine (fd, &cfg, e) { igt_dynamic_f("%s", e->name) -active (fd, e,20 ,-1 ); +active (fd, &cfg, e,20 ,-1 ); } }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 76/89 tests/i915/gem_vm_create: Delete destroy racing tests
In reply to Jason EkstrandThe races these tests attempt to exercise won't exist once we rework the context creation to make the VM immutable state.
--- tests/i915/gem_vm_create.c | 104 ------------------------------------- 1 file changed, 104 deletions(-)
tests/i915/gem_vm_create.c +0 -104
@@ -352,104 +352,6 @@ static void isolation(int i915)gem_vm_destroy (i915, vm[0 ]); } -static void async_destroy (int i915) -{ -struct drm_i915_gem_context_param arg = { - .ctx_id =gem_context_create (i915), - .value =gem_vm_create (i915), - .param =I915_CONTEXT_PARAM_VM , - }; -igt_spin_t *spin[2 ]; -int err; - - spin[0] = igt_spin_new(i915, - .ctx_id = arg.ctx_id, - .flags =IGT_SPIN_POLL_RUN ); -igt_spin_busywait_until_started (spin[0 ]); - - err =__gem_context_set_param (i915, &arg); -if (err == -EBUSY )/* update while busy may be verboten, let it ride. */ - err =0 ; -igt_assert_eq (err,0 ); - - spin[1] = __igt_spin_new(i915, .ctx_id = arg.ctx_id); - -igt_spin_end (spin[0 ]); -gem_sync (i915, spin[0 ]->handle); - -gem_vm_destroy (i915, arg.value); -gem_context_destroy (i915, arg.ctx_id); - -igt_spin_end (spin[1 ]); -gem_sync (i915, spin[1 ]->handle); - -for (int i =0 ; i <ARRAY_SIZE (spin); i++) -igt_spin_free (i915, spin[i]); -} - -static void destroy_race (int i915) -{ -const int ncpus =sysconf (_SC_NPROCESSORS_ONLN); -uint32_t *vm; - -/* Check we can execute a polling spinner */ - igt_spin_free(i915, igt_spin_new(i915, .flags = IGT_SPIN_POLL_RUN)); - - vm =mmap (NULL ,4096 ,PROT_WRITE ,MAP_SHARED |MAP_ANON ,-1 ,0 ); -igt_assert (vm !=MAP_FAILED ); - -for (int child =0 ; child < ncpus; child++) - vm[child] =gem_vm_create (i915); - - igt_fork(child, ncpus) { -uint32_t ctx =gem_context_create (i915); -igt_spin_t *spin; - - spin = __igt_spin_new(i915, ctx, .flags = IGT_SPIN_POLL_RUN); -while (!READ_ONCE (vm[ncpus])) { -struct drm_i915_gem_context_param arg = { - .ctx_id = ctx, - .param =I915_CONTEXT_PARAM_VM , - .value =READ_ONCE (vm[child]), - }; -igt_spin_t *nxt; - -if (__gem_context_set_param (i915, &arg)) -continue ; - - nxt =__igt_spin_new (i915, ctx, - .flags = IGT_SPIN_POLL_RUN); - -igt_spin_end (spin); -gem_sync (i915, spin->handle); -igt_spin_free (i915, spin); - -usleep (1000 +hars_petruska_f54_1_random_unsafe () %2000 ); - - spin = nxt; - } - -igt_spin_free (i915, spin); -gem_context_destroy (i915, ctx); - } - - igt_until_timeout(5) { -for (int child =0 ; child < ncpus; child++) { -gem_vm_destroy (i915, vm[child]); - vm[child] =gem_vm_create (i915); - } -usleep (1000 +hars_petruska_f54_1_random_unsafe () %2000 ); - } - - vm[ncpus] =1 ; -igt_waitchildren (); - -for (int child =0 ; child < ncpus; child++) -gem_vm_destroy (i915, vm[child]); - -munmap (vm,4096 ); -} - igt_main {int i915 =-1 ;
@@ -479,12 +381,6 @@ igt_main igt_subtest("create-ext")create_ext (i915); - - igt_subtest("async-destroy") -async_destroy (i915); - - igt_subtest("destroy-race") -destroy_race (i915); } igt_fixture {
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 77/89 tests/i915/gem_vm_create: Use intel_ctx_t in the execbuf test
In reply to Jason Ekstrand--- tests/i915/gem_vm_create.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
tests/i915/gem_vm_create.c +12 -9
@@ -219,9 +219,8 @@ static void execbuf(int i915) .buffers_ptr = to_user_pointer(&batch), .buffer_count = 1, }; -struct drm_i915_gem_context_param arg = { - .param =I915_CONTEXT_PARAM_VM , - }; +intel_ctx_cfg_t cfg = {}; +const intel_ctx_t *ctx;/* First verify that we try to use "softpinning" by default */ batch.offset =48 <<20 ;
@@ -229,20 +228,24 @@ static void execbuf(int i915)igt_assert_eq_u64 (batch.offset,48 <<20 );gem_sync (i915, batch.handle); - arg.value =gem_vm_create (i915); -gem_context_set_param (i915, &arg); + cfg.vm =gem_vm_create (i915); + ctx =intel_ctx_create (i915, &cfg); + eb.rsvd1 = ctx->id;gem_execbuf (i915, &eb);igt_assert_eq_u64 (batch.offset,48 <<20 ); -gem_vm_destroy (i915, arg.value); +gem_vm_destroy (i915, cfg.vm); +intel_ctx_destroy (i915, ctx);gem_sync (i915, batch.handle);/* be idle! */ - arg.value =gem_vm_create (i915); -gem_context_set_param (i915, &arg); + cfg.vm =gem_vm_create (i915); + ctx =intel_ctx_create (i915, &cfg); batch.offset =0 ; + eb.rsvd1 = ctx->id;gem_execbuf (i915, &eb);igt_assert_eq_u64 (batch.offset,0 ); -gem_vm_destroy (i915, arg.value); +gem_vm_destroy (i915, cfg.vm); +intel_ctx_destroy (i915, ctx);gem_sync (i915, batch.handle);gem_close (i915, batch.handle);
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 78/89 tests/i915/sysfs: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/sysfs_heartbeat_interval.c | 40 ++++++++++----------- tests/i915/sysfs_preempt_timeout.c | 39 ++++++++++---------- tests/i915/sysfs_timeslice_duration.c | 51 +++++++++++++-------------- 3 files changed, 64 insertions(+), 66 deletions(-)
tests/i915/sysfs_heartbeat_interval.c +20 -20
@@ -132,13 +132,12 @@ static void set_unbannable(int i915, uint32_t ctx)gem_context_set_param (i915, &p); } -static uint32_t create_context (int i915,unsigned int class,unsigned int inst,int prio) +static const intel_ctx_t * +create_ctx (int i915,unsigned int class,unsigned int inst,int prio) { -uint32_t ctx; - - ctx =gem_context_create_for_engine (i915, class, inst); -set_unbannable (i915, ctx); -gem_context_set_priority (i915, ctx, prio); +const intel_ctx_t *ctx =intel_ctx_create_for_engine (i915, class, inst); +set_unbannable (i915, ctx->id); +gem_context_set_priority (i915, ctx->id, prio);return ctx; }
@@ -149,23 +148,23 @@ static uint64_t __test_timeout(int i915, int engine, unsigned int timeout)struct timespec ts = {};igt_spin_t *spin[2 ];uint64_t elapsed; -uint32_t ctx[2 ]; +const intel_ctx_t *ctx[2 ];igt_assert (igt_sysfs_scanf (engine,"class" ,"%u" , &class) ==1 );igt_assert (igt_sysfs_scanf (engine,"instance" ,"%u" , &inst) ==1 );set_heartbeat (engine, timeout); - ctx[0 ] =create_context (i915, class, inst,1023 ); - spin[0 ] =igt_spin_new (i915, ctx[0 ], + ctx[0 ] =create_ctx (i915, class, inst,1023 ); + spin[0] = igt_spin_new(i915, .ctx = ctx[0], .flags = (IGT_SPIN_NO_PREEMPTION |IGT_SPIN_POLL_RUN |IGT_SPIN_FENCE_OUT ));igt_spin_busywait_until_started (spin[0 ]); - ctx[1 ] =create_context (i915, class, inst,-1023 ); + ctx[1 ] =create_ctx (i915, class, inst,-1023 );igt_nsec_elapsed (&ts); - spin[1] = igt_spin_new(i915, ctx[1], .flags = IGT_SPIN_POLL_RUN); + spin[1] = igt_spin_new(i915, .ctx = ctx[1], .flags = IGT_SPIN_POLL_RUN);igt_spin_busywait_until_started (spin[1 ]); elapsed =igt_nsec_elapsed (&ts);
@@ -176,8 +175,8 @@ static uint64_t __test_timeout(int i915, int engine, unsigned int timeout)igt_spin_free (i915, spin[0 ]); -gem_context_destroy (i915, ctx[1 ]); -gem_context_destroy (i915, ctx[0 ]); +intel_ctx_destroy (i915, ctx[1 ]); +intel_ctx_destroy (i915, ctx[0 ]);gem_quiescent_gpu (i915);return elapsed;
@@ -292,18 +291,18 @@ static void client(int i915, int engine, int *ctl, int duration, int expect) {unsigned int class, inst;unsigned long count =0 ; -uint32_t ctx; +const intel_ctx_t *ctx;igt_assert (igt_sysfs_scanf (engine,"class" ,"%u" , &class) ==1 );igt_assert (igt_sysfs_scanf (engine,"instance" ,"%u" , &inst) ==1 ); - ctx =create_context (i915, class, inst,0 ); + ctx =create_ctx (i915, class, inst,0 );while (!READ_ONCE (*ctl)) {unsigned int elapsed;igt_spin_t *spin; - spin =igt_spin_new (i915, ctx, + spin = igt_spin_new(i915, .ctx = ctx, .flags = (IGT_SPIN_NO_PREEMPTION |IGT_SPIN_POLL_RUN |IGT_SPIN_FENCE_OUT ));
@@ -331,7 +330,7 @@ static void client(int i915, int engine, int *ctl, int duration, int expect) count++; } -gem_context_destroy (i915, ctx); +intel_ctx_destroy (i915, ctx);igt_info ("%s client completed %lu spins\n" , expect <0 ?"Bad" :"Good" , count); }
@@ -414,7 +413,7 @@ static void test_off(int i915, int engine)unsigned int class, inst;unsigned int saved;igt_spin_t *spin; -uint32_t ctx; +const intel_ctx_t *ctx;/* * Some other clients request that there is never any interruption
@@ -433,9 +432,9 @@ static void test_off(int i915, int engine)set_heartbeat (engine,0 ); - ctx =create_context (i915, class, inst,0 ); + ctx =create_ctx (i915, class, inst,0 ); - spin =igt_spin_new (i915, ctx, + spin = igt_spin_new(i915, .ctx = ctx, .flags = (IGT_SPIN_POLL_RUN |IGT_SPIN_NO_PREEMPTION |IGT_SPIN_FENCE_OUT ));
@@ -455,6 +454,7 @@ static void test_off(int i915, int engine)gem_quiescent_gpu (i915);set_heartbeat (engine, saved); +intel_ctx_destroy (i915, ctx); } igt_main
tests/i915/sysfs_preempt_timeout.c +19 -20
@@ -126,13 +126,12 @@ static void set_unbannable(int i915, uint32_t ctx)gem_context_set_param (i915, &p); } -static uint32_t create_context (int i915,unsigned int class,unsigned int inst,int prio) +static const intel_ctx_t * +create_ctx (int i915,unsigned int class,unsigned int inst,int prio) { -uint32_t ctx; - - ctx =gem_context_create_for_engine (i915, class, inst); -set_unbannable (i915, ctx); -gem_context_set_priority (i915, ctx, prio); +const intel_ctx_t *ctx =intel_ctx_create_for_engine (i915, class, inst); +set_unbannable (i915, ctx->id); +gem_context_set_priority (i915, ctx->id, prio);return ctx; }
@@ -143,23 +142,23 @@ static uint64_t __test_timeout(int i915, int engine, unsigned int timeout)struct timespec ts = {};igt_spin_t *spin[2 ];uint64_t elapsed; -uint32_t ctx[2 ]; +const intel_ctx_t *ctx[2 ];igt_assert (igt_sysfs_scanf (engine,"class" ,"%u" , &class) ==1 );igt_assert (igt_sysfs_scanf (engine,"instance" ,"%u" , &inst) ==1 );set_preempt_timeout (engine, timeout); - ctx[0 ] =create_context (i915, class, inst,-1023 ); - spin[0 ] =igt_spin_new (i915, ctx[0 ], + ctx[0 ] =create_ctx (i915, class, inst,-1023 ); + spin[0] = igt_spin_new(i915, .ctx = ctx[0], .flags = (IGT_SPIN_NO_PREEMPTION |IGT_SPIN_POLL_RUN |IGT_SPIN_FENCE_OUT ));igt_spin_busywait_until_started (spin[0 ]); - ctx[1 ] =create_context (i915, class, inst,1023 ); + ctx[1 ] =create_ctx (i915, class, inst,1023 );igt_nsec_elapsed (&ts); - spin[1] = igt_spin_new(i915, ctx[1], .flags = IGT_SPIN_POLL_RUN); + spin[1] = igt_spin_new(i915, .ctx = ctx[1], .flags = IGT_SPIN_POLL_RUN);igt_spin_busywait_until_started (spin[1 ]); elapsed =igt_nsec_elapsed (&ts);
@@ -170,8 +169,8 @@ static uint64_t __test_timeout(int i915, int engine, unsigned int timeout)igt_spin_free (i915, spin[0 ]); -gem_context_destroy (i915, ctx[1 ]); -gem_context_destroy (i915, ctx[0 ]); +intel_ctx_destroy (i915, ctx[1 ]); +intel_ctx_destroy (i915, ctx[0 ]);gem_quiescent_gpu (i915);return elapsed;
@@ -231,7 +230,7 @@ static void test_off(int i915, int engine)unsigned int class, inst;igt_spin_t *spin[2 ];unsigned int saved; -uint32_t ctx[2 ]; +const intel_ctx_t *ctx[2 ];/* * We support setting the timeout to 0 to disable the reset on
@@ -252,15 +251,15 @@ static void test_off(int i915, int engine)set_preempt_timeout (engine,0 ); - ctx[0 ] =create_context (i915, class, inst,-1023 ); - spin[0 ] =igt_spin_new (i915, ctx[0 ], + ctx[0 ] =create_ctx (i915, class, inst,-1023 ); + spin[0] = igt_spin_new(i915, .ctx = ctx[0], .flags = (IGT_SPIN_NO_PREEMPTION |IGT_SPIN_POLL_RUN |IGT_SPIN_FENCE_OUT ));igt_spin_busywait_until_started (spin[0 ]); - ctx[1 ] =create_context (i915, class, inst,1023 ); - spin[1] = igt_spin_new(i915, ctx[1], .flags = IGT_SPIN_POLL_RUN); + ctx[1 ] =create_ctx (i915, class, inst,1023 ); + spin[1] = igt_spin_new(i915, .ctx = ctx[1], .flags = IGT_SPIN_POLL_RUN);for (int i =0 ; i <150 ; i++) {igt_assert_eq (sync_fence_status (spin[0 ]->out_fence),0 );
@@ -277,8 +276,8 @@ static void test_off(int i915, int engine)igt_spin_free (i915, spin[0 ]); -gem_context_destroy (i915, ctx[1 ]); -gem_context_destroy (i915, ctx[0 ]); +intel_ctx_destroy (i915, ctx[1 ]); +intel_ctx_destroy (i915, ctx[0 ]);igt_assert (enable_hangcheck (i915, true));gem_quiescent_gpu (i915);
tests/i915/sysfs_timeslice_duration.c +25 -26
131 lines not on this page · raw message
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 79/89 tests/i915/gem_workarounds: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_workarounds.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
tests/i915/gem_workarounds.c +7 -6
@@ -84,7 +84,7 @@ static bool write_only(const uint32_t addr)#define MI_STORE_REGISTER_MEM (0x24 << 23) -static int workaround_fail_count (int i915,uint32_t ctx) +static int workaround_fail_count (int i915,const intel_ctx_t *ctx) {struct drm_i915_gem_exec_object2 obj[2 ];struct drm_i915_gem_relocation_entry *reloc;
@@ -130,12 +130,12 @@ static int workaround_fail_count(int i915, uint32_t ctx)memset (&execbuf,0 ,sizeof (execbuf)); execbuf.buffers_ptr =to_user_pointer (obj); execbuf.buffer_count =2 ; - execbuf.rsvd1 = ctx; + execbuf.rsvd1 = ctx->id;gem_execbuf (i915, &execbuf);gem_set_domain (i915, obj[0 ].handle,I915_GEM_DOMAIN_CPU ,0 ); - spin = igt_spin_new(i915, .ctx_id = ctx, .flags = IGT_SPIN_POLL_RUN); + spin = igt_spin_new(i915, .ctx = ctx, .flags = IGT_SPIN_POLL_RUN);igt_spin_busywait_until_started (spin); fw =igt_open_forcewake_handle (i915);
@@ -183,14 +183,15 @@ static int workaround_fail_count(int i915, uint32_t ctx)#define FD 0x2static void check_workarounds (int fd,enum operation op,unsigned int flags) { -uint32_t ctx =0 ; +const intel_ctx_t *ctx;if (flags &FD ) fd =gem_reopen_driver (fd); + ctx =intel_ctx_0 (fd);if (flags &CONTEXT ) {gem_require_contexts (fd); - ctx =gem_context_create (fd); + ctx =intel_ctx_create (fd,NULL ); }igt_assert_eq (workaround_fail_count (fd, ctx),0 );
@@ -220,7 +221,7 @@ static void check_workarounds(int fd, enum operation op, unsigned int flags)igt_assert_eq (workaround_fail_count (fd, ctx),0 );if (flags &CONTEXT ) -gem_context_destroy (fd, ctx); +intel_ctx_destroy (fd, ctx);if (flags &FD )close (fd); }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 80/89 lib/i915/gem_context: Delete all the context clone/copy stuff
In reply to Jason Ekstrand--- lib/i915/gem_context.c | 175 ----------------------------------------- lib/i915/gem_context.h | 17 ---- 2 files changed, 192 deletions(-)
lib/i915/gem_context.c +0 -175
@@ -390,125 +390,6 @@ bool gem_context_has_persistence(int i915)return __gem_context_get_param (i915, ¶m) ==0 ; } -int -__gem_context_clone (int i915, -uint32_t src,unsigned int share, -unsigned int flags, -uint32_t *out) -{ -struct drm_i915_gem_context_create_ext_clone clone = { - { .name =I915_CONTEXT_CREATE_EXT_CLONE }, - .clone_id = src, - .flags = share, - }; -struct drm_i915_gem_context_create_ext arg = { - .flags = flags |I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS , - .extensions =to_user_pointer (&clone), - }; -int err; - - err =create_ext_ioctl (i915, &arg); -if (err) -return err; - - *out = arg.ctx_id; -return 0 ; -} - -static bool __gem_context_has (int i915,uint32_t share,unsigned int flags) -{ -uint32_t ctx =0 ; - -__gem_context_clone (i915,0 , share, flags, &ctx); -if (ctx) -gem_context_destroy (i915, ctx); - - errno =0 ; -return ctx; -} - -bool gem_contexts_has_shared_gtt (int i915) -{ -return __gem_context_has (i915,I915_CONTEXT_CLONE_VM ,0 ); -} - -bool gem_has_queues (int i915) -{ -return __gem_context_has (i915, -I915_CONTEXT_CLONE_VM , -I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE ); -} - -uint32_t gem_context_clone (int i915, -uint32_t src,unsigned int share, -unsigned int flags) -{ -uint32_t ctx; - -igt_assert_eq (__gem_context_clone (i915, src, share, flags, &ctx),0 ); - -return ctx; -} - -bool gem_has_context_clone (int i915) -{ -struct drm_i915_gem_context_create_ext_clone ext = { - { .name =I915_CONTEXT_CREATE_EXT_CLONE }, - .clone_id =-1 , - }; -struct drm_i915_gem_context_create_ext create = { - .flags =I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS , - .extensions =to_user_pointer (&ext), - }; - -return create_ext_ioctl (i915, &create) == -ENOENT ; -} - -/** -* gem_context_clone_with_engines: -* @i915: open i915 drm file descriptor -* @src: i915 context id -* -* Special purpose wrapper to create a new context by cloning engines from @src. -* -* In can be called regardless of whether the kernel supports context cloning. -* -* Intended purpose is to use for creating contexts against which work will be -* submitted and the engine index came from external source, derived from a -* default context potentially configured with an engine map. -*/ -uint32_t gem_context_clone_with_engines (int i915,uint32_t src) -{ -if (!gem_has_context_clone (i915)) -return gem_context_create (i915); -else -return gem_context_clone (i915, src,I915_CONTEXT_CLONE_ENGINES , -0 ); -} - -uint32_t gem_queue_create (int i915) -{ -return gem_context_clone (i915,0 , -I915_CONTEXT_CLONE_VM | -I915_CONTEXT_CLONE_ENGINES , -I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE ); -} - -/** -* gem_queue_clone_with_engines: -* @i915: open i915 drm file descriptor -* @src: i915 context id -* -* See gem_context_clone_with_engines. -*/ -uint32_t gem_queue_clone_with_engines (int i915,uint32_t src) -{ -return gem_context_clone (i915, src, -I915_CONTEXT_CLONE_ENGINES | -I915_CONTEXT_CLONE_VM , -I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE ); -} -bool gem_context_has_engine (int fd,uint32_t ctx,uint64_t engine) {struct drm_i915_gem_exec_object2 exec = {};
@@ -534,62 +415,6 @@ bool gem_context_has_engine(int fd, uint32_t ctx, uint64_t engine)return __gem_execbuf (fd, &execbuf) == -ENOENT ; } -/** -* gem_context_copy_engines: -* @src_fd: open i915 drm file descriptor where @src context belongs to -* @src: source engine map context id -* @dst_fd: open i915 drm file descriptor where @dst context belongs to -* @dst: destination engine map context id -* -* Special purpose helper for copying engine map from one context to another. -* -* In can be called regardless of whether the kernel supports context engine -* maps and is a no-op if not supported. -*/ -void -gem_context_copy_engines (int src_fd,uint32_t src,int dst_fd,uint32_t dst) -{ -I915_DEFINE_CONTEXT_PARAM_ENGINES (engines,I915_EXEC_RING_MASK +1 ); -struct drm_i915_gem_context_param param = { - .param =I915_CONTEXT_PARAM_ENGINES , - .ctx_id = src, - .size =sizeof (engines), - .value =to_user_pointer (&engines), - }; - -if (__gem_context_get_param (src_fd, ¶m)) -return ; - - param.ctx_id = dst; -gem_context_set_param (dst_fd, ¶m); -} - -uint32_t gem_context_create_for_engine (int i915,unsigned int class,unsigned int inst) -{ - I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, 1) = { - .engines = { { .engine_class = class, .engine_instance = inst } } - }; -struct drm_i915_gem_context_create_ext_setparam p_engines = { - .base = { - .name =I915_CONTEXT_CREATE_EXT_SETPARAM , - .next_extension =0 ,/* end of chain */ - }, - .param = { - .param =I915_CONTEXT_PARAM_ENGINES , - .value =to_user_pointer (&engines), - .size =sizeof (engines), - }, - }; -struct drm_i915_gem_context_create_ext create = { - .flags =I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS , - .extensions =to_user_pointer (&p_engines), - }; - -igt_assert_eq (create_ext_ioctl (i915, &create),0 ); -igt_assert_neq (create.ctx_id,0 ); -return create.ctx_id; -} -static size_t sizeof_param_engines (int count) { return offsetof(struct i915_context_param_engines, engines[count]);
lib/i915/gem_context.h +0 -17
@@ -37,23 +37,8 @@ int __gem_context_create_ext(int fd, uint32_t flags, uint64_t extensions,void gem_context_destroy (int fd,uint32_t ctx_id);int __gem_context_destroy (int fd,uint32_t ctx_id); -uint32_t gem_context_create_for_engine (int fd,unsigned int class,unsigned int inst);uint32_t gem_context_create_for_class (int i915,unsigned int class,unsigned int *count); -int __gem_context_clone (int i915, -uint32_t src,unsigned int share, -unsigned int flags, -uint32_t *out); -uint32_t gem_context_clone (int i915, -uint32_t src,unsigned int share, -unsigned int flags); -uint32_t gem_context_clone_with_engines (int i915,uint32_t src); -void gem_context_copy_engines (int src_fd,uint32_t src, -int dst_fd,uint32_t dst); - -uint32_t gem_queue_create (int i915); -uint32_t gem_queue_clone_with_engines (int i915,uint32_t src); -bool gem_contexts_has_shared_gtt (int i915);bool gem_has_queues (int i915);
@@ -62,8 +47,6 @@ void gem_require_contexts(int fd);void gem_context_require_bannable (int fd);void gem_context_require_param (int fd,uint64_t param); -bool gem_has_context_clone (int i915); -void gem_context_get_param (int fd,struct drm_i915_gem_context_param *p);void gem_context_set_param (int fd,struct drm_i915_gem_context_param *p);int __gem_context_set_param (int fd,struct drm_i915_gem_context_param *p);
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 81/89 tests/i915/gem_ctx_engines: Delete the libapi subtest
In reply to Jason EkstrandIt just tests enumeration APIs that we're about to delete.
--- tests/i915/gem_ctx_engines.c | 71 ------------------------------------ 1 file changed, 71 deletions(-)
tests/i915/gem_ctx_engines.c +0 -71
@@ -550,74 +550,6 @@ static void independent_all(int i915, const intel_ctx_t *ctx)igt_waitchildren (); } -static void libapi (int i915) -{ - I915_DEFINE_CONTEXT_PARAM_ENGINES(engines, 64) = {}; -struct drm_i915_gem_context_param p = { - .ctx_id =gem_context_create (i915), - .param =I915_CONTEXT_PARAM_ENGINES , - .value =to_user_pointer (&engines), - }; -const struct intel_execution_engine2 *e; -unsigned int count, idx; - - p.size =sizeof (struct i915_context_param_engines ); -gem_context_set_param (i915, &p); - -/* An empty context should be a short loop */ - count =0 ; -for_each_context_engine (i915, p.ctx_id, e) - count++; -igt_assert_eq (count,0 ); - - p.size +=sizeof (struct i915_engine_class_instance ); -engine_class (&engines,0 ) =-1 ; -engine_instance (&engines,0 ) =-1 ; -gem_context_set_param (i915, &p); - -/* We report all engines from the context, even if invalid/unusable */ - count =0 ; -for_each_context_engine (i915, p.ctx_id, e) { -igt_assert_eq (e->class,engine_class (&engines,0 )); -igt_assert_eq (e->instance,engine_instance (&engines,0 )); - count++; - } -igt_assert_eq (count,1 ); - -/* Check that every known engine can be found from the context map */ - idx =0 ; - p.size =sizeof (struct i915_context_param_engines ); - p.size +=sizeof (struct i915_engine_class_instance ); -for (engine_class (&engines, idx) =0 ; -engine_class (&engines, idx) <16 ; -engine_class (&engines, idx)++) { -for (engine_instance (&engines, idx) =0 ; -engine_instance (&engines, idx) <16 ; -engine_instance (&engines, idx)++) { -if (__gem_context_set_param (i915, &p)) -break ; - - count =0 ; -for_each_context_engine (i915, p.ctx_id, e) { -igt_assert_eq (e->class, -engine_class (&engines, count)); -igt_assert_eq (e->instance, -engine_instance (&engines, count)); - count++; - } -igt_assert_eq (count, idx +1 ); - - engines.engines[(idx +1 ) %64 ] = engines.engines[idx]; - idx = (idx +1 ) %64 ; - - p.size =sizeof (struct i915_context_param_engines ); - p.size += (idx +1 ) *sizeof (struct i915_engine_class_instance ); - } - } - -gem_context_destroy (i915, p.ctx_id); -} - igt_main {const struct intel_execution_engine2 *e;
@@ -663,9 +595,6 @@ igt_mainindependent_all (i915, ctx); } - igt_subtest("libapi") -libapi (i915); -igt_fixture igt_stop_hang_detector (); }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 82/89 lib/igt_dummyload: Stop supporting ALL_ENGINES without an intel_ctx_t
In reply to Jason Ekstrand--- lib/igt_dummyload.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-)
lib/igt_dummyload.c +6 -15
@@ -129,22 +129,13 @@ emit_recursive_batch(igt_spin_t *spin,if (opts->engine ==ALL_ENGINES ) {struct intel_execution_engine2 *engine; -if (opts->ctx) { -for_each_ctx_engine (fd, opts->ctx, engine) { -if (opts->flags &IGT_SPIN_POLL_RUN && - !gem_class_can_store_dword (fd, engine->class)) -continue ; +igt_assert (opts->ctx); +for_each_ctx_engine (fd, opts->ctx, engine) { +if (opts->flags &IGT_SPIN_POLL_RUN && + !gem_class_can_store_dword (fd, engine->class)) +continue ; - flags[nengine++] = engine->flags; - } - }else { -for_each_context_engine (fd, opts->ctx_id, engine) { -if (opts->flags &IGT_SPIN_POLL_RUN && - !gem_class_can_store_dword (fd, engine->class)) -continue ; - - flags[nengine++] = engine->flags; - } + flags[nengine++] = engine->flags; } }else { flags[nengine++] = opts->engine;
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 82/89] lib/igt_dummyload: Stop supporting ALL_ENGINES without an intel_ctx_t
Quoted 41 lines · Jason Ekstrand
Signed-off-by Jason Ekstrand <[email protected]>--- lib/igt_dummyload.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-)lib/igt_dummyload.c +6
-15@@ -129,22 +129,13 @@ emit_recursive_batch(igt_spin_t *spin,if (opts->engine ==ALL_ENGINES ) {struct intel_execution_engine2 *engine; -if (opts->ctx) { -for_each_ctx_engine (fd, opts->ctx, engine) { -if (opts->flags &IGT_SPIN_POLL_RUN && - !gem_class_can_store_dword (fd, engine->class)) -continue ; +igt_assert (opts->ctx); +for_each_ctx_engine (fd, opts->ctx, engine) { +if (opts->flags &IGT_SPIN_POLL_RUN && + !gem_class_can_store_dword (fd, engine->class)) +continue ; - flags[nengine++] = engine->flags; - } - }else { -for_each_context_engine (fd, opts->ctx_id, engine) { -if (opts->flags &IGT_SPIN_POLL_RUN && - !gem_class_can_store_dword (fd, engine->class)) -continue ; - - flags[nengine++] = engine->flags; - } + flags[nengine++] = engine->flags; } }else { flags[nengine++] = opts->engine;Signature · 1 line
2.31.1
I got no objections.
--
Zbigniew
Quoted 4 lines
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 83/89 lib/i915/gem_engine_topology: Delete the old physical engine iterators
In reply to Jason Ekstrand--- lib/i915/gem_engine_topology.c | 58 ---------------------------------- lib/i915/gem_engine_topology.h | 15 --------- 2 files changed, 73 deletions(-)
lib/i915/gem_engine_topology.c +0 -58
@@ -136,25 +136,6 @@ int __gem_query_engines(int fd,return __gem_query (fd, &query); } -static void ctx_map_engines (int fd,struct intel_engine_data *ed, -struct drm_i915_gem_context_param *param) -{ -struct i915_context_param_engines *engines = -from_user_pointer (param->value); -int i =0 ; - -for (typeof (engines->engines[0 ]) *p = &engines->engines[0 ]; - i < ed->nengines; i++, p++) { - p->engine_class = ed->engines[i].class; - p->engine_instance = ed->engines[i].instance; - } - - param->size = offsetof(typeof(*engines), engines[i]); - engines->extensions =0 ; - -gem_context_set_param (fd, param); -} -static const char *class_names[] = { [I915_ENGINE_CLASS_RENDER ] ="rcs" , [I915_ENGINE_CLASS_COPY ] ="bcs" ,
@@ -215,11 +196,6 @@ static int __query_engine_list(int fd, struct intel_engine_data *ed)return 0 ; } -static void query_engine_list (int fd,struct intel_engine_data *ed) -{ -igt_assert_eq (__query_engine_list (fd, ed),0 ); -} -struct intel_execution_engine2 *intel_get_current_engine (struct intel_engine_data *ed) {
@@ -352,40 +328,6 @@ static int gem_topology_get_param(int fd,return 0 ; } -struct intel_engine_data intel_init_engine_list (int fd,uint32_t ctx_id) -{ -DEFINE_CONTEXT_ENGINES_PARAM (engines, param, ctx_id,GEM_MAX_ENGINES ); -struct intel_engine_data engine_data = { }; -int i; - -if (gem_topology_get_param (fd, ¶m)) { -/* if kernel does not support engine/context mapping */ -return intel_engine_list_for_static (fd); - } - -if (!param.size) { -query_engine_list (fd, &engine_data); -ctx_map_engines (fd, &engine_data, ¶m); - }else { -/* engine count can be inferred from size */ - param.size -=sizeof (struct i915_context_param_engines ); - param.size /=sizeof (struct i915_engine_class_instance ); - -igt_assert_f (param.size <=GEM_MAX_ENGINES , -"unsupported engine count\n" ); - -for (i =0 ; i < param.size; i++) -init_engine (&engine_data.engines[i], - engines.engines[i].engine_class, - engines.engines[i].engine_instance, - i); - - engine_data.nengines = i; - } - -return engine_data; -} -int gem_context_lookup_engine (int fd,uint64_t engine,uint32_t ctx_id,struct intel_execution_engine2 *e) {
lib/i915/gem_engine_topology.h +0 -15
@@ -51,7 +51,6 @@ struct intel_engine_data {bool gem_has_engine_topology (int fd);struct intel_engine_data intel_engine_list_of_physical (int fd);struct intel_engine_data intel_engine_list_for_ctx_cfg (int fd,const intel_ctx_cfg_t *cfg); -struct intel_engine_data intel_init_engine_list (int fd,uint32_t ctx_id);/* iteration functions */ struct intel_execution_engine2 *
@@ -106,11 +105,6 @@ struct intel_execution_engine2 gem_eb_flags_to_engine(unsigned int flags);#define for_each_ctx_engine (fd__, ctx__, e__) \ for_each_ctx_cfg_engine(fd__, &(ctx__)->cfg, e__) -#define for_each_context_engine (fd__, ctx__, e__) \ - for (struct intel_engine_data i__ = intel_init_engine_list(fd__, ctx__); \ - ((e__) = intel_get_current_engine(&i__)); \ - intel_next_engine(&i__)) -/** * for_each_physical_engine * @fd__: open i915 drm file descriptor
@@ -126,15 +120,6 @@ struct intel_execution_engine2 gem_eb_flags_to_engine(unsigned int flags); ((e__) = intel_get_current_physical_engine(&i__##e__)); \ intel_next_engine(&i__##e__)) -/* needs to replace "for_each_physical_engine" when conflicts are fixed */ -#define ____for_each_physical_engine (fd__, ctx__, e__) \ - for (struct intel_engine_data i__##e__ = intel_init_engine_list(fd__, ctx__); \ - ((e__) = intel_get_current_physical_engine(&i__##e__)); \ - intel_next_engine(&i__##e__)) - -#define __for_each_physical_engine (fd__, e__) \ - ____for_each_physical_engine(fd__, 0, e__) - __attribute__((format (scanf,4 ,5 )))int gem_engine_property_scanf (int i915,const char *engine,const char *attr,const char *fmt, ...);
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 83/89] lib/i915/gem_engine_topology: Delete the old physical engine iterators
Quoted 132 lines · Jason Ekstrand
Signed-off-by Jason Ekstrand <[email protected]>--- lib/i915/gem_engine_topology.c | 58 ---------------------------------- lib/i915/gem_engine_topology.h | 15 --------- 2 files changed, 73 deletions(-)lib/i915/gem_engine_topology.c +0
-58@@ -136,25 +136,6 @@ int __gem_query_engines(int fd,return __gem_query (fd, &query); } -static void ctx_map_engines (int fd,struct intel_engine_data *ed, -struct drm_i915_gem_context_param *param) -{ -struct i915_context_param_engines *engines = -from_user_pointer (param->value); -int i =0 ; - -for (typeof (engines->engines[0 ]) *p = &engines->engines[0 ]; - i < ed->nengines; i++, p++) { - p->engine_class = ed->engines[i].class; - p->engine_instance = ed->engines[i].instance; - } - - param->size = offsetof(typeof(*engines), engines[i]); - engines->extensions =0 ; - -gem_context_set_param (fd, param); -} -static const char *class_names[] = { [I915_ENGINE_CLASS_RENDER ] ="rcs" , [I915_ENGINE_CLASS_COPY ] ="bcs" ,@@ -215,11 +196,6 @@ static int __query_engine_list(int fd, struct intel_engine_data *ed)return 0 ; } -static void query_engine_list (int fd,struct intel_engine_data *ed) -{ -igt_assert_eq (__query_engine_list (fd, ed),0 ); -} -struct intel_execution_engine2 *intel_get_current_engine (struct intel_engine_data *ed) {@@ -352,40 +328,6 @@ static int gem_topology_get_param(int fd,return 0 ; } -struct intel_engine_data intel_init_engine_list (int fd,uint32_t ctx_id) -{ -DEFINE_CONTEXT_ENGINES_PARAM (engines, param, ctx_id,GEM_MAX_ENGINES ); -struct intel_engine_data engine_data = { }; -int i; - -if (gem_topology_get_param (fd, ¶m)) { -/* if kernel does not support engine/context mapping */ -return intel_engine_list_for_static (fd); - } - -if (!param.size) { -query_engine_list (fd, &engine_data); -ctx_map_engines (fd, &engine_data, ¶m); - }else { -/* engine count can be inferred from size */ - param.size -=sizeof (struct i915_context_param_engines ); - param.size /=sizeof (struct i915_engine_class_instance ); - -igt_assert_f (param.size <=GEM_MAX_ENGINES , -"unsupported engine count\n" ); - -for (i =0 ; i < param.size; i++) -init_engine (&engine_data.engines[i], - engines.engines[i].engine_class, - engines.engines[i].engine_instance, - i); - - engine_data.nengines = i; - } - -return engine_data; -} -int gem_context_lookup_engine (int fd,uint64_t engine,uint32_t ctx_id,struct intel_execution_engine2 *e) {lib/i915/gem_engine_topology.h +0
-15@@ -51,7 +51,6 @@ struct intel_engine_data {bool gem_has_engine_topology (int fd);struct intel_engine_data intel_engine_list_of_physical (int fd);struct intel_engine_data intel_engine_list_for_ctx_cfg (int fd,const intel_ctx_cfg_t *cfg); -struct intel_engine_data intel_init_engine_list (int fd,uint32_t ctx_id);/* iteration functions */ struct intel_execution_engine2 *@@ -106,11 +105,6 @@ struct intel_execution_engine2 gem_eb_flags_to_engine(unsigned int flags);#define for_each_ctx_engine (fd__, ctx__, e__) \ for_each_ctx_cfg_engine(fd__, &(ctx__)->cfg, e__) -#define for_each_context_engine (fd__, ctx__, e__) \ - for (struct intel_engine_data i__ = intel_init_engine_list(fd__, ctx__); \ - ((e__) = intel_get_current_engine(&i__)); \ - intel_next_engine(&i__)) -/** * for_each_physical_engine * @fd__: open i915 drm file descriptor @@ -126,15 +120,6 @@ struct intel_execution_engine2 gem_eb_flags_to_engine(unsigned int flags); ((e__) = intel_get_current_physical_engine(&i__##e__)); \ intel_next_engine(&i__##e__)) -/* needs to replace "for_each_physical_engine" when conflicts are fixed */ -#define ____for_each_physical_engine (fd__, ctx__, e__) \ - for (struct intel_engine_data i__##e__ = intel_init_engine_list(fd__, ctx__); \ - ((e__) = intel_get_current_physical_engine(&i__##e__)); \ - intel_next_engine(&i__##e__)) - -#define __for_each_physical_engine (fd__, e__) \ - ____for_each_physical_engine(fd__, 0, e__) - __attribute__((format (scanf,4 ,5 )))int gem_engine_property_scanf (int i915,const char *engine,const char *attr,const char *fmt, ...);Signature · 1 line
2.31.1
Ok, so from now on we got only iterators over engines stored in intel_engine_list_for_ctx_cfg() or returned from intel_engine_list_of_physical() (both static or queried).
--
Zbigniew
Quoted 4 lines
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 84/89 tests/i915/gem_mmap_gtt: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gem_mmap_gtt.c | 18 ++++++++++++++---- tests/i915/i915_query.c | 17 +++++------------ 2 files changed, 19 insertions(+), 16 deletions(-)
tests/i915/gem_mmap_gtt.c +14 -4
@@ -736,14 +736,18 @@ static void test_hang_busy(int i915) {uint32_t *ptr, *tile, *x; +const intel_ctx_t *ctx =intel_ctx_create (i915,NULL );igt_spin_t *spin;igt_hang_t hang;uint32_t handle; - hang =igt_allow_hang (i915,0 ,0 ); + hang =igt_allow_hang (i915, ctx->id,0 );igt_require (igt_params_set (i915,"reset" ,"1" ));/* global */ - spin = igt_spin_new(i915, .flags = IGT_SPIN_POLL_RUN | IGT_SPIN_FENCE_OUT | IGT_SPIN_NO_PREEMPTION); + spin = igt_spin_new(i915, .ctx = ctx, + .flags =IGT_SPIN_POLL_RUN | +IGT_SPIN_FENCE_OUT | +IGT_SPIN_NO_PREEMPTION );igt_spin_busywait_until_started (spin);igt_assert (spin->execbuf.buffer_count ==2 );
@@ -784,20 +788,25 @@ test_hang_busy(int i915)igt_spin_free (i915, spin);igt_disallow_hang (i915, hang); +intel_ctx_destroy (i915, ctx); }static void test_hang_user (int i915) { +const intel_ctx_t *ctx =intel_ctx_create (i915,NULL );uint32_t *ptr, *mem, *x;igt_spin_t *spin;igt_hang_t hang;uint32_t handle; - hang =igt_allow_hang (i915,0 ,0 ); + hang =igt_allow_hang (i915, ctx->id,0 );igt_require (igt_params_set (i915,"reset" ,"1" ));/* global */ - spin = igt_spin_new(i915, .flags = IGT_SPIN_POLL_RUN | IGT_SPIN_FENCE_OUT | IGT_SPIN_NO_PREEMPTION); + spin = igt_spin_new(i915, .ctx = ctx, + .flags =IGT_SPIN_POLL_RUN | +IGT_SPIN_FENCE_OUT | +IGT_SPIN_NO_PREEMPTION );igt_spin_busywait_until_started (spin);igt_assert (spin->execbuf.buffer_count ==2 );
@@ -834,6 +843,7 @@ test_hang_user(int i915)igt_spin_free (i915, spin);igt_disallow_hang (i915, hang); +intel_ctx_destroy (i915, ctx); }static int min_tile_width (uint32_t devid,int tiling)
tests/i915/i915_query.c +5 -12
@@ -682,19 +682,14 @@ static void engines(int fd)for (i =0 ; i < engines->num_engines; i++) {struct drm_i915_engine_info *engine = (struct drm_i915_engine_info *)&engines->engines[i]; - I915_DEFINE_CONTEXT_PARAM_ENGINES(p_engines, 1) = { - .engines = { engine->engine } - }; -struct drm_i915_gem_context_param param = { - .param =I915_CONTEXT_PARAM_ENGINES , - .value =to_user_pointer (&p_engines), - .size =sizeof (p_engines), - }; - +const intel_ctx_t *ctx = +intel_ctx_create_for_engine (fd, engine->engine.engine_class, + engine->engine.engine_instance);struct drm_i915_gem_exec_object2 obj = {};struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr =to_user_pointer (&obj), .buffer_count =1 , + .rsvd1 = ctx->id, }; igt_debug("%u: class=%u instance=%u flags=%llx capabilities=%llx\n",
@@ -703,11 +698,9 @@ static void engines(int fd) engine->engine.engine_instance, engine->flags, engine->capabilities); -gem_context_set_param (fd, ¶m);igt_assert_eq (__gem_execbuf (fd, &execbuf), -ENOENT ); - param.size =0 ;/* reset context engine map to defaults */ -gem_context_set_param (fd, ¶m); +intel_ctx_destroy (fd, ctx); }/* Check results match the legacy GET_PARAM (where we can). */
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 85/89 igt/dummyload: Require an intel_ctx_t for POLL_RUN and !ALL_ENGINES
In reply to Jason EkstrandThis lets us drop gem_context_lookup_engines
--- lib/i915/gem_engine_topology.c | 29 ----------------------------- lib/i915/gem_engine_topology.h | 3 --- lib/igt_dummyload.c | 20 +++++--------------- 3 files changed, 5 insertions(+), 47 deletions(-)
lib/i915/gem_engine_topology.c +0 -29
@@ -316,35 +316,6 @@ intel_engine_list_for_ctx_cfg(int fd, const intel_ctx_cfg_t *cfg) } } -static int gem_topology_get_param (int fd, -struct drm_i915_gem_context_param *p) -{ -if (igt_only_list_subtests ()) -return -ENODEV ; - -if (__gem_context_get_param (fd, p)) -return -1 ;/* using default engine map */ - -return 0 ; -} - -int gem_context_lookup_engine (int fd,uint64_t engine,uint32_t ctx_id, -struct intel_execution_engine2 *e) -{ -DEFINE_CONTEXT_ENGINES_PARAM (engines, param, ctx_id,GEM_MAX_ENGINES ); - -/* a bit paranoic */ -igt_assert (e); - -if (gem_topology_get_param (fd, ¶m) || !param.size) -return -EINVAL ; - - e->class = engines.engines[engine].engine_class; - e->instance = engines.engines[engine].engine_instance; - -return 0 ; -} -/** * gem_has_engine_topology: * @fd: open i915 drm file descriptor
lib/i915/gem_engine_topology.h +0 -3
@@ -61,9 +61,6 @@ intel_get_current_physical_engine(struct intel_engine_data *ed);void intel_next_engine (struct intel_engine_data *ed); -int gem_context_lookup_engine (int fd,uint64_t engine,uint32_t ctx_id, -struct intel_execution_engine2 *e); -bool gem_context_has_engine_map (int fd,uint32_t ctx); bool gem_engine_is_equal(const struct intel_execution_engine2 *e1,
lib/igt_dummyload.c +5 -15
@@ -421,22 +421,12 @@ igt_spin_factory(int fd, const struct igt_spin_factory *opts) {igt_spin_t *spin; -if (opts->engine !=ALL_ENGINES ) { -struct intel_execution_engine2 e; -int class; - -if (opts->ctx) { - class = opts->ctx->cfg.engines[opts->engine].engine_class; - }else if (!gem_context_lookup_engine (fd, opts->engine, - opts->ctx_id, &e)) { - class = e.class; - }else { -gem_require_ring (fd, opts->engine); - class =gem_execbuf_flags_to_engine_class (opts->engine); - } +if ((opts->flags &IGT_SPIN_POLL_RUN ) && opts->engine !=ALL_ENGINES ) { +unsigned int class; -if (opts->flags &IGT_SPIN_POLL_RUN ) -igt_require (gem_class_can_store_dword (fd, class)); +igt_assert (opts->ctx); + class =intel_ctx_engine_class (opts->ctx, opts->engine); +igt_require (gem_class_can_store_dword (fd, class)); }if (opts->flags &IGT_SPIN_INVALID_CS )
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 85/89] igt/dummyload: Require an intel_ctx_t for POLL_RUN and !ALL_ENGINES
Quoted 97 lines · Jason Ekstrand
This lets us drop
gem_context_lookup_enginesSigned-off-by Jason Ekstrand <[email protected]>--- lib/i915/gem_engine_topology.c | 29 ----------------------------- lib/i915/gem_engine_topology.h | 3 --- lib/igt_dummyload.c | 20 +++++--------------- 3 files changed, 5 insertions(+), 47 deletions(-)lib/i915/gem_engine_topology.c +0
-29@@ -316,35 +316,6 @@ intel_engine_list_for_ctx_cfg(int fd, const intel_ctx_cfg_t *cfg) } } -static int gem_topology_get_param (int fd, -struct drm_i915_gem_context_param *p) -{ -if (igt_only_list_subtests ()) -return -ENODEV ; - -if (__gem_context_get_param (fd, p)) -return -1 ;/* using default engine map */ - -return 0 ; -} - -int gem_context_lookup_engine (int fd,uint64_t engine,uint32_t ctx_id, -struct intel_execution_engine2 *e) -{ -DEFINE_CONTEXT_ENGINES_PARAM (engines, param, ctx_id,GEM_MAX_ENGINES ); - -/* a bit paranoic */ -igt_assert (e); - -if (gem_topology_get_param (fd, ¶m) || !param.size) -return -EINVAL ; - - e->class = engines.engines[engine].engine_class; - e->instance = engines.engines[engine].engine_instance; - -return 0 ; -} -/** * gem_has_engine_topology: * @fd: open i915 drm file descriptor lib/i915/gem_engine_topology.h +0
-3@@ -61,9 +61,6 @@ intel_get_current_physical_engine(struct intel_engine_data *ed);void intel_next_engine (struct intel_engine_data *ed); -int gem_context_lookup_engine (int fd,uint64_t engine,uint32_t ctx_id, -struct intel_execution_engine2 *e); -bool gem_context_has_engine_map (int fd,uint32_t ctx); bool gem_engine_is_equal(const struct intel_execution_engine2 *e1,lib/igt_dummyload.c +5
-15@@ -421,22 +421,12 @@ igt_spin_factory(int fd, const struct igt_spin_factory *opts) {igt_spin_t *spin; -if (opts->engine !=ALL_ENGINES ) { -struct intel_execution_engine2 e; -int class; - -if (opts->ctx) { - class = opts->ctx->cfg.engines[opts->engine].engine_class; - }else if (!gem_context_lookup_engine (fd, opts->engine, - opts->ctx_id, &e)) { - class = e.class; - }else { -gem_require_ring (fd, opts->engine); - class =gem_execbuf_flags_to_engine_class (opts->engine); - } +if ((opts->flags &IGT_SPIN_POLL_RUN ) && opts->engine !=ALL_ENGINES ) { +unsigned int class; -if (opts->flags &IGT_SPIN_POLL_RUN ) -igt_require (gem_class_can_store_dword (fd, class)); +igt_assert (opts->ctx); + class =intel_ctx_engine_class (opts->ctx, opts->engine); +igt_require (gem_class_can_store_dword (fd, class)); }if (opts->flags &IGT_SPIN_INVALID_CS )Signature · 1 line
2.31.1
LGTM.
--
Zbigniew
Quoted 5 lines
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 86/89 lib/i915: Rework engine API availability checks (v2)
In reply to Jason EkstrandInstead of relying on the context param, check for the device query or attempt to set engines as a create param.
v2 (Jason Ekstrand):
- Add a common gem_has_context_engines helper
--- lib/i915/gem_context.c | 30 +++++++++++++++++++++++++++++ lib/i915/gem_context.h | 1 + lib/i915/gem_engine_topology.c | 35 ++-------------------------------- lib/i915/gem_engine_topology.h | 2 -- tests/i915/gem_ctx_engines.c | 11 +---------- tests/i915/gem_exec_balancer.c | 11 +---------- tests/i915/gem_exec_schedule.c | 11 +---------- 7 files changed, 36 insertions(+), 65 deletions(-)
lib/i915/gem_context.c +30 -0
@@ -78,6 +78,36 @@ bool gem_has_contexts(int fd)return ctx_id; } +/** +* gem_has_context_engines: +* @fd: open i915 drm file descriptor +* +* Queries whether specifying an engine set at context creation is +* supported or not. +* +* Returns: Context creation engine API availability. +*/ +bool gem_has_context_engines (int fd) +{ +struct drm_i915_gem_context_create_ext_setparam e = { + .base = { + .name =I915_CONTEXT_CREATE_EXT_SETPARAM , + }, + .param = { + .param =I915_CONTEXT_PARAM_ENGINES , + .size =0 , + }, + }; +uint32_t ctx_id; +int err; + + err =__gem_context_create_ext (fd,0 ,to_user_pointer (&e), &ctx_id); +if (!err) +gem_context_destroy (fd, ctx_id); + +return !err; +} +/** * gem_require_contexts: * @fd: open i915 drm file descriptor
lib/i915/gem_context.h +1 -0
@@ -43,6 +43,7 @@ bool gem_contexts_has_shared_gtt(int i915);bool gem_has_queues (int i915);bool gem_has_contexts (int fd); +bool gem_has_context_engines (int fd);void gem_require_contexts (int fd);void gem_context_require_bannable (int fd);void gem_context_require_param (int fd,uint64_t param);
lib/i915/gem_engine_topology.c +2 -33
@@ -86,20 +86,9 @@* Limit what we support for simplicity due limitation in how much we * can address via execbuf2. */ -#define SIZEOF_CTX_PARAM offsetof(struct i915_context_param_engines, \ - engines[GEM_MAX_ENGINES])#define SIZEOF_QUERY offsetof(struct drm_i915_query_engine_info, \ engines[GEM_MAX_ENGINES]) -#define DEFINE_CONTEXT_ENGINES_PARAM (e__, p__, c__,N__ ) \ - I915_DEFINE_CONTEXT_PARAM_ENGINES(e__, N__); \ - struct drm_i915_gem_context_param p__ = { \ - .param = I915_CONTEXT_PARAM_ENGINES, \ - .ctx_id = c__, \ - .size = SIZEOF_CTX_PARAM, \ - .value = to_user_pointer(memset(&e__, 0, sizeof(e__))), \ - } -static int __gem_query (int fd,struct drm_i915_query *q) {int err =0 ;
@@ -326,11 +315,8 @@ intel_engine_list_for_ctx_cfg(int fd, const intel_ctx_cfg_t *cfg)*/ bool gem_has_engine_topology (int fd) { -struct drm_i915_gem_context_param param = { - .param =I915_CONTEXT_PARAM_ENGINES , - }; - -return !__gem_context_get_param (fd, ¶m); +struct intel_engine_data ed; +return !__query_engine_list (fd, &ed); }struct intel_execution_engine2 gem_eb_flags_to_engine (unsigned int flags)
@@ -359,23 +345,6 @@ struct intel_execution_engine2 gem_eb_flags_to_engine(unsigned int flags)return e2__; } -bool gem_context_has_engine_map (int fd,uint32_t ctx) -{ -struct drm_i915_gem_context_param param = { - .param =I915_CONTEXT_PARAM_ENGINES , - .ctx_id = ctx - }; - -/* -* If the kernel is too old to support PARAM_ENGINES, -* then naturally the context has no engine map. -*/ -if (__gem_context_get_param (fd, ¶m)) -return false; - -return param.size; -} -bool gem_engine_is_equal (const struct intel_execution_engine2 *e1,const struct intel_execution_engine2 *e2) {
lib/i915/gem_engine_topology.h +0 -2
@@ -61,8 +61,6 @@ intel_get_current_physical_engine(struct intel_engine_data *ed);void intel_next_engine (struct intel_engine_data *ed); -bool gem_context_has_engine_map (int fd,uint32_t ctx); -bool gem_engine_is_equal (const struct intel_execution_engine2 *e1,const struct intel_execution_engine2 *e2);
tests/i915/gem_ctx_engines.c +1 -10
@@ -45,15 +45,6 @@#define engine_class (e, n) ((e)->engines[(n)].engine_class)#define engine_instance (e, n) ((e)->engines[(n)].engine_instance) -static bool has_context_engines (int i915) -{ -struct drm_i915_gem_context_param param = { - .ctx_id =0 , - .param =I915_CONTEXT_PARAM_ENGINES , - }; -return __gem_context_set_param (i915, ¶m) ==0 ; -} -static void invalid_engines (int i915) {struct i915_context_param_engines stack = {}, *engines;
@@ -560,7 +551,7 @@ igt_mainigt_require_gem (i915);gem_require_contexts (i915); -igt_require (has_context_engines (i915)); +igt_require (gem_has_context_engines (i915));igt_fork_hang_detector (i915); }
tests/i915/gem_exec_balancer.c +1 -10
@@ -2778,15 +2778,6 @@ static bool has_persistence(int i915)return __gem_context_set_param (i915, &p) ==0 ; } -static bool has_context_engines (int i915) -{ -struct drm_i915_gem_context_param p = { - .param =I915_CONTEXT_PARAM_ENGINES , - }; - -return __gem_context_set_param (i915, &p) ==0 ; -} -static bool has_load_balancer (int i915) {const intel_ctx_cfg_t cfg = {
@@ -2811,7 +2802,7 @@ igt_mainigt_require_gem (i915);gem_require_contexts (i915); -igt_require (has_context_engines (i915)); +igt_require (gem_has_context_engines (i915));igt_require (has_load_balancer (i915));igt_require (has_perf_engines (i915));
tests/i915/gem_exec_schedule.c +1 -10
@@ -1664,15 +1664,6 @@ static void preempt_queue(int fd, const intel_ctx_cfg_t *cfg, } } -static bool has_context_engines (int i915) -{ -struct drm_i915_gem_context_param param = { - .ctx_id =0 , - .param =I915_CONTEXT_PARAM_ENGINES , - }; -return __gem_context_set_param (i915, ¶m) ==0 ; -} -static void preempt_engines (int i915,const struct intel_execution_engine2 *e,unsigned int flags)
@@ -1693,7 +1684,7 @@ static void preempt_engines(int i915,* timeline that we can reprioritise and shuffle amongst themselves. */ -igt_require (has_context_engines (i915)); +igt_require (gem_has_context_engines (i915));for (int n =0 ; n <GEM_MAX_ENGINES ; n++) { cfg.engines[n].engine_class = e->class;
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 87/89 lib/intel_bb: Remove intel_bb_assign_vm and tests
In reply to Jason EkstrandIt's not used by anything other than the tests for that functionality and it relies on setting the VM via SET_CONTEXT_PARAM which is deprecated. Delete it for now. We can add it back in later if it's actually useful and do it properly then.
--- lib/intel_batchbuffer.c | 52 ------------------- lib/intel_batchbuffer.h | 3 -- tests/i915/api_intel_bb.c | 104 -------------------------------------- 3 files changed, 159 deletions(-)
lib/intel_batchbuffer.c +0 -52
@@ -1513,14 +1513,6 @@ static void __intel_bb_destroy_cache(struct intel_bb *ibb) ibb->root =NULL ; } -static void __intel_bb_detach_intel_bufs (struct intel_bb *ibb) -{ -struct intel_buf *entry, *tmp; - -igt_list_for_each_entry_safe (entry, tmp, &ibb->intel_bufs, link) -intel_bb_detach_intel_buf (ibb, entry); -} -static void __intel_bb_remove_intel_bufs (struct intel_bb *ibb) {struct intel_buf *entry, *tmp;
@@ -1649,50 +1641,6 @@ int intel_bb_sync(struct intel_bb *ibb)return ret; } -uint64_t intel_bb_assign_vm (struct intel_bb *ibb,uint64_t allocator, -uint32_t vm_id) -{ -struct drm_i915_gem_context_param arg = { - .param =I915_CONTEXT_PARAM_VM , - }; -uint64_t prev_allocator = ibb->allocator_handle; -bool closed = false; - -if (ibb->vm_id == vm_id) { -igt_debug ("Skipping to assign same vm_id: %u\n" , vm_id); -return 0 ; - } - -/* Cannot switch if someone keeps bb refcount */ -igt_assert (ibb->refcount ==1 ); - -/* Detach intel_bufs and remove bb handle */ -__intel_bb_detach_intel_bufs (ibb); -intel_bb_remove_object (ibb, ibb->handle, ibb->batch_offset, ibb->size); - -/* Cache + objects are not valid after change anymore */ -__intel_bb_destroy_objects (ibb); -__intel_bb_destroy_cache (ibb); - -/* Attach new allocator */ - ibb->allocator_handle = allocator; - -/* Setparam */ - ibb->vm_id = vm_id; - -/* Skip set param, we likely return to default vm */ -if (vm_id) { - arg.ctx_id = ibb->ctx; - arg.value = vm_id; -gem_context_set_param (ibb->i915, &arg); - } - -/* Recreate bb */ -intel_bb_reset (ibb, false); - -return closed ?0 : prev_allocator; -} -/* * intel_bb_print: * @ibb: pointer to intel_bb
lib/intel_batchbuffer.h +0 -3
@@ -523,9 +523,6 @@ static inline void intel_bb_unref(struct intel_bb *ibb)void intel_bb_reset (struct intel_bb *ibb,bool purge_objects_cache);int intel_bb_sync (struct intel_bb *ibb); -uint64_t intel_bb_assign_vm (struct intel_bb *ibb,uint64_t allocator, -uint32_t vm_id); -void intel_bb_print (struct intel_bb *ibb);void intel_bb_dump (struct intel_bb *ibb,const char *filename);void intel_bb_set_debug (struct intel_bb *ibb,bool debug);
tests/i915/api_intel_bb.c +0 -104
116 lines not on this page · raw message
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 87/89] lib/intel_bb: Remove intel_bb_assign_vm and tests
Quoted 15 lines · Jason Ekstrand
It's not used by anything other than the tests for that functionality and it relies on setting the VM via
SET_CONTEXT_PARAMwhich is deprecated. Delete it for now. We can add it back in later if it's actually useful and do it properly then.--- lib/intel_batchbuffer.c | 52 ------------------- lib/intel_batchbuffer.h | 3 -- tests/i915/api_intel_bb.c | 104 -------------------------------------- 3 files changed, 159 deletions(-)lib/intel_batchbuffer.c +0
-0
lib/intel_batchbuffer.c static void __intel_bb_destroy_cache(struct intel_bb *ibb) · line 1521
Quoted 9 lines
lib/intel_batchbuffer.c +0
-6@@ -1513,14 +1513,6 @@ static void __intel_bb_destroy_cache(struct intel_bb *ibb) ibb->root =NULL ; } -static void __intel_bb_detach_intel_bufs (struct intel_bb *ibb) -{ -struct intel_buf *entry, *tmp; - -igt_list_for_each_entry_safe (entry, tmp, &ibb->intel_bufs, link) -intel_bb_detach_intel_buf (ibb, entry);
You can also remove intel_bb_detach_intel_buf(), I think keeping it doesn't makes sense anymore. Then:
--
Zbigniew
Quoted 199 lines
lib/intel_batchbuffer.c +0
-46-} -static void __intel_bb_remove_intel_bufs (struct intel_bb *ibb) {struct intel_buf *entry, *tmp;@@ -1649,50 +1641,6 @@ int intel_bb_sync(struct intel_bb *ibb)return ret; } -uint64_t intel_bb_assign_vm (struct intel_bb *ibb,uint64_t allocator, -uint32_t vm_id) -{ -struct drm_i915_gem_context_param arg = { - .param =I915_CONTEXT_PARAM_VM , - }; -uint64_t prev_allocator = ibb->allocator_handle; -bool closed = false; - -if (ibb->vm_id == vm_id) { -igt_debug ("Skipping to assign same vm_id: %u\n" , vm_id); -return 0 ; - } - -/* Cannot switch if someone keeps bb refcount */ -igt_assert (ibb->refcount ==1 ); - -/* Detach intel_bufs and remove bb handle */ -__intel_bb_detach_intel_bufs (ibb); -intel_bb_remove_object (ibb, ibb->handle, ibb->batch_offset, ibb->size); - -/* Cache + objects are not valid after change anymore */ -__intel_bb_destroy_objects (ibb); -__intel_bb_destroy_cache (ibb); - -/* Attach new allocator */ - ibb->allocator_handle = allocator; - -/* Setparam */ - ibb->vm_id = vm_id; - -/* Skip set param, we likely return to default vm */ -if (vm_id) { - arg.ctx_id = ibb->ctx; - arg.value = vm_id; -gem_context_set_param (ibb->i915, &arg); - } - -/* Recreate bb */ -intel_bb_reset (ibb, false); - -return closed ?0 : prev_allocator; -} -/* * intel_bb_print: * @ibb: pointer to intel_bb lib/intel_batchbuffer.h +0
-3@@ -523,9 +523,6 @@ static inline void intel_bb_unref(struct intel_bb *ibb)void intel_bb_reset (struct intel_bb *ibb,bool purge_objects_cache);int intel_bb_sync (struct intel_bb *ibb); -uint64_t intel_bb_assign_vm (struct intel_bb *ibb,uint64_t allocator, -uint32_t vm_id); -void intel_bb_print (struct intel_bb *ibb);void intel_bb_dump (struct intel_bb *ibb,const char *filename);void intel_bb_set_debug (struct intel_bb *ibb,bool debug);tests/i915/api_intel_bb.c +0
-104@@ -240,107 +240,6 @@ static void bb_with_allocator(struct buf_ops *bops)intel_bb_destroy (ibb); } -static void bb_with_vm (struct buf_ops *bops) -{ -int i915 =buf_ops_get_fd (bops); -struct drm_i915_gem_context_param arg = { - .param =I915_CONTEXT_PARAM_VM , - }; -struct intel_bb *ibb; -struct intel_buf *src, *dst, *gap; -uint32_t ctx =0 , vm_id1, vm_id2; -uint64_t prev_vm, vm; -uint64_t src_addr[5 ], dst_addr[5 ]; - -igt_require (gem_uses_full_ppgtt (i915)); - - ibb =intel_bb_create_with_allocator (i915, ctx,PAGE_SIZE , -INTEL_ALLOCATOR_SIMPLE ); -if (debug_bb) -intel_bb_set_debug (ibb, true); - - src =intel_buf_create (bops,4096 /32 ,32 ,8 ,0 ,I915_TILING_NONE , -I915_COMPRESSION_NONE ); - dst =intel_buf_create (bops,4096 /32 ,32 ,8 ,0 ,I915_TILING_NONE , -I915_COMPRESSION_NONE ); - gap =intel_buf_create (bops,4096 ,128 ,8 ,0 ,I915_TILING_NONE , -I915_COMPRESSION_NONE ); - -/* vm for second blit */ - vm_id1 =gem_vm_create (i915); - -/* Get vm_id for default vm */ - arg.ctx_id = ctx; -gem_context_get_param (i915, &arg); - vm_id2 = arg.value; - -igt_debug ("Vm_id1: %u\n" , vm_id1); -igt_debug ("Vm_id2: %u\n" , vm_id2); - -/* First blit without set calling setparam */ -intel_bb_copy_intel_buf (ibb, dst, src,4096 ); - src_addr[0 ] = src->addr.offset; - dst_addr[0 ] = dst->addr.offset; -igt_debug ("step1: src: 0x%llx, dst: 0x%llx\n" , - (long long ) src_addr[0 ], (long long ) dst_addr[0 ]); - -/* Open new allocator with vm_id */ - vm =intel_allocator_open_vm (i915, vm_id1,INTEL_ALLOCATOR_SIMPLE ); - prev_vm =intel_bb_assign_vm (ibb, vm, vm_id1); - -intel_bb_add_intel_buf (ibb, gap, false); -intel_bb_copy_intel_buf (ibb, dst, src,4096 ); - src_addr[1 ] = src->addr.offset; - dst_addr[1 ] = dst->addr.offset; -igt_debug ("step2: src: 0x%llx, dst: 0x%llx\n" , - (long long ) src_addr[1 ], (long long ) dst_addr[1 ]); - -/* Back with default vm */ -intel_bb_assign_vm (ibb, prev_vm, vm_id2); -intel_bb_add_intel_buf (ibb, gap, false); -intel_bb_copy_intel_buf (ibb, dst, src,4096 ); - src_addr[2 ] = src->addr.offset; - dst_addr[2 ] = dst->addr.offset; -igt_debug ("step3: src: 0x%llx, dst: 0x%llx\n" , - (long long ) src_addr[2 ], (long long ) dst_addr[2 ]); - -/* And exchange one more time */ -intel_bb_assign_vm (ibb, vm, vm_id1); -intel_bb_copy_intel_buf (ibb, dst, src,4096 ); - src_addr[3 ] = src->addr.offset; - dst_addr[3 ] = dst->addr.offset; -igt_debug ("step4: src: 0x%llx, dst: 0x%llx\n" , - (long long ) src_addr[3 ], (long long ) dst_addr[3 ]); - -/* Back with default vm */ -gem_vm_destroy (i915, vm_id1); -gem_vm_destroy (i915, vm_id2); -intel_bb_assign_vm (ibb, prev_vm,0 ); - -/* We can close it after assign previous vm to ibb */ -intel_allocator_close (vm); - -/* Try default vm still works */ -intel_bb_copy_intel_buf (ibb, dst, src,4096 ); - src_addr[4 ] = src->addr.offset; - dst_addr[4 ] = dst->addr.offset; -igt_debug ("step5: src: 0x%llx, dst: 0x%llx\n" , - (long long ) src_addr[4 ], (long long ) dst_addr[4 ]); - -/* Addresses should match for vm and prev_vm blits */ -igt_assert_eq (src_addr[0 ], src_addr[2 ]); -igt_assert_eq (dst_addr[0 ], dst_addr[2 ]); -igt_assert_eq (src_addr[1 ], src_addr[3 ]); -igt_assert_eq (dst_addr[1 ], dst_addr[3 ]); -igt_assert_eq (src_addr[2 ], src_addr[4 ]); -igt_assert_eq (dst_addr[2 ], dst_addr[4 ]); - -intel_buf_destroy (src); -intel_buf_destroy (dst); -intel_buf_destroy (gap); -intel_bb_destroy (ibb); -} -/* * Make sure we lead to realloc in the intel_bb. */ @@ -1557,9 +1456,6 @@ igt_main_args("dpib", NULL, help_str, opt_handler, NULL) igt_subtest("bb-with-allocator")bb_with_allocator (bops); - igt_subtest("bb-with-vm") -bb_with_vm (bops); - igt_subtest("lot-of-buffers")lot_of_buffers (bops);Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 87/89] lib/intel_bb: Remove intel_bb_assign_vm and tests
Quoted 20 lines · Zbigniew Kempczyński
Quoted 18 lines · Jason Ekstrand
It's not used by anything other than the tests for that functionality and it relies on setting the VM via
SET_CONTEXT_PARAMwhich is deprecated. Delete it for now. We can add it back in later if it's actually useful and do it properly then.--- lib/intel_batchbuffer.c | 52 ------------------- lib/intel_batchbuffer.h | 3 -- tests/i915/api_intel_bb.c | 104 -------------------------------------- 3 files changed, 159 deletions(-)lib/intel_batchbuffer.c +0
-0@@ -1513,14 +1513,6 @@ static void __intel_bb_destroy_cache(struct intel_bb *ibb) ibb->root =NULL ; }
Quoted 9 lines
lib/intel_batchbuffer.c static void __intel_bb_destroy_cache(struct intel_bb *ibb) · line 1521
Quoted 6 lines
lib/intel_batchbuffer.c +0
-6-static void __intel_bb_detach_intel_bufs (struct intel_bb *ibb) -{ -struct intel_buf *entry, *tmp; - -igt_list_for_each_entry_safe (entry, tmp, &ibb->intel_bufs, link) -intel_bb_detach_intel_buf (ibb, entry);You can also remove
intel_bb_detach_intel_buf(), I think keeping it doesn't makes sense anymore. Then:
Done. It'll be in the next send.
Quoted 1 line
Reviewed-by Zbigniew Kempczyński <[email protected]>
Thanks!
Quoted 195 lines
--
ZbigniewQuoted 192 lines
lib/intel_batchbuffer.c +0
-46-} -static void __intel_bb_remove_intel_bufs (struct intel_bb *ibb) {struct intel_buf *entry, *tmp;@@ -1649,50 +1641,6 @@ int intel_bb_sync(struct intel_bb *ibb)return ret; } -uint64_t intel_bb_assign_vm (struct intel_bb *ibb,uint64_t allocator, -uint32_t vm_id) -{ -struct drm_i915_gem_context_param arg = { - .param =I915_CONTEXT_PARAM_VM , - }; -uint64_t prev_allocator = ibb->allocator_handle; -bool closed = false; - -if (ibb->vm_id == vm_id) { -igt_debug ("Skipping to assign same vm_id: %u\n" , vm_id); -return 0 ; - } - -/* Cannot switch if someone keeps bb refcount */ -igt_assert (ibb->refcount ==1 ); - -/* Detach intel_bufs and remove bb handle */ -__intel_bb_detach_intel_bufs (ibb); -intel_bb_remove_object (ibb, ibb->handle, ibb->batch_offset, ibb->size); - -/* Cache + objects are not valid after change anymore */ -__intel_bb_destroy_objects (ibb); -__intel_bb_destroy_cache (ibb); - -/* Attach new allocator */ - ibb->allocator_handle = allocator; - -/* Setparam */ - ibb->vm_id = vm_id; - -/* Skip set param, we likely return to default vm */ -if (vm_id) { - arg.ctx_id = ibb->ctx; - arg.value = vm_id; -gem_context_set_param (ibb->i915, &arg); - } - -/* Recreate bb */ -intel_bb_reset (ibb, false); - -return closed ?0 : prev_allocator; -} -/* * intel_bb_print: * @ibb: pointer to intel_bb lib/intel_batchbuffer.h +0
-3@@ -523,9 +523,6 @@ static inline void intel_bb_unref(struct intel_bb *ibb)void intel_bb_reset (struct intel_bb *ibb,bool purge_objects_cache);int intel_bb_sync (struct intel_bb *ibb); -uint64_t intel_bb_assign_vm (struct intel_bb *ibb,uint64_t allocator, -uint32_t vm_id); -void intel_bb_print (struct intel_bb *ibb);void intel_bb_dump (struct intel_bb *ibb,const char *filename);void intel_bb_set_debug (struct intel_bb *ibb,bool debug);tests/i915/api_intel_bb.c +0
-104@@ -240,107 +240,6 @@ static void bb_with_allocator(struct buf_ops *bops)intel_bb_destroy (ibb); } -static void bb_with_vm (struct buf_ops *bops) -{ -int i915 =buf_ops_get_fd (bops); -struct drm_i915_gem_context_param arg = { - .param =I915_CONTEXT_PARAM_VM , - }; -struct intel_bb *ibb; -struct intel_buf *src, *dst, *gap; -uint32_t ctx =0 , vm_id1, vm_id2; -uint64_t prev_vm, vm; -uint64_t src_addr[5 ], dst_addr[5 ]; - -igt_require (gem_uses_full_ppgtt (i915)); - - ibb =intel_bb_create_with_allocator (i915, ctx,PAGE_SIZE , -INTEL_ALLOCATOR_SIMPLE ); -if (debug_bb) -intel_bb_set_debug (ibb, true); - - src =intel_buf_create (bops,4096 /32 ,32 ,8 ,0 ,I915_TILING_NONE , -I915_COMPRESSION_NONE ); - dst =intel_buf_create (bops,4096 /32 ,32 ,8 ,0 ,I915_TILING_NONE , -I915_COMPRESSION_NONE ); - gap =intel_buf_create (bops,4096 ,128 ,8 ,0 ,I915_TILING_NONE , -I915_COMPRESSION_NONE ); - -/* vm for second blit */ - vm_id1 =gem_vm_create (i915); - -/* Get vm_id for default vm */ - arg.ctx_id = ctx; -gem_context_get_param (i915, &arg); - vm_id2 = arg.value; - -igt_debug ("Vm_id1: %u\n" , vm_id1); -igt_debug ("Vm_id2: %u\n" , vm_id2); - -/* First blit without set calling setparam */ -intel_bb_copy_intel_buf (ibb, dst, src,4096 ); - src_addr[0 ] = src->addr.offset; - dst_addr[0 ] = dst->addr.offset; -igt_debug ("step1: src: 0x%llx, dst: 0x%llx\n" , - (long long ) src_addr[0 ], (long long ) dst_addr[0 ]); - -/* Open new allocator with vm_id */ - vm =intel_allocator_open_vm (i915, vm_id1,INTEL_ALLOCATOR_SIMPLE ); - prev_vm =intel_bb_assign_vm (ibb, vm, vm_id1); - -intel_bb_add_intel_buf (ibb, gap, false); -intel_bb_copy_intel_buf (ibb, dst, src,4096 ); - src_addr[1 ] = src->addr.offset; - dst_addr[1 ] = dst->addr.offset; -igt_debug ("step2: src: 0x%llx, dst: 0x%llx\n" , - (long long ) src_addr[1 ], (long long ) dst_addr[1 ]); - -/* Back with default vm */ -intel_bb_assign_vm (ibb, prev_vm, vm_id2); -intel_bb_add_intel_buf (ibb, gap, false); -intel_bb_copy_intel_buf (ibb, dst, src,4096 ); - src_addr[2 ] = src->addr.offset; - dst_addr[2 ] = dst->addr.offset; -igt_debug ("step3: src: 0x%llx, dst: 0x%llx\n" , - (long long ) src_addr[2 ], (long long ) dst_addr[2 ]); - -/* And exchange one more time */ -intel_bb_assign_vm (ibb, vm, vm_id1); -intel_bb_copy_intel_buf (ibb, dst, src,4096 ); - src_addr[3 ] = src->addr.offset; - dst_addr[3 ] = dst->addr.offset; -igt_debug ("step4: src: 0x%llx, dst: 0x%llx\n" , - (long long ) src_addr[3 ], (long long ) dst_addr[3 ]); - -/* Back with default vm */ -gem_vm_destroy (i915, vm_id1); -gem_vm_destroy (i915, vm_id2); -intel_bb_assign_vm (ibb, prev_vm,0 ); - -/* We can close it after assign previous vm to ibb */ -intel_allocator_close (vm); - -/* Try default vm still works */ -intel_bb_copy_intel_buf (ibb, dst, src,4096 ); - src_addr[4 ] = src->addr.offset; - dst_addr[4 ] = dst->addr.offset; -igt_debug ("step5: src: 0x%llx, dst: 0x%llx\n" , - (long long ) src_addr[4 ], (long long ) dst_addr[4 ]); - -/* Addresses should match for vm and prev_vm blits */ -igt_assert_eq (src_addr[0 ], src_addr[2 ]); -igt_assert_eq (dst_addr[0 ], dst_addr[2 ]); -igt_assert_eq (src_addr[1 ], src_addr[3 ]); -igt_assert_eq (dst_addr[1 ], dst_addr[3 ]); -igt_assert_eq (src_addr[2 ], src_addr[4 ]); -igt_assert_eq (dst_addr[2 ], dst_addr[4 ]); - -intel_buf_destroy (src); -intel_buf_destroy (dst); -intel_buf_destroy (gap); -intel_bb_destroy (ibb); -} -/* * Make sure we lead to realloc in the intel_bb. */ @@ -1557,9 +1456,6 @@ igt_main_args("dpib", NULL, help_str, opt_handler, NULL) igt_subtest("bb-with-allocator")bb_with_allocator (bops); - igt_subtest("bb-with-vm") -bb_with_vm (bops); - igt_subtest("lot-of-buffers")lot_of_buffers (bops);
Quoted 7 lines
Quoted 7 lines
--
2.31.1_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 88/89 tests/i915/gem_ctx_param: Stop setting VMs on old contexts
In reply to Jason EkstrandWe can still test all the same basic functionality, we just have to re-create the context more often.
--- tests/i915/gem_ctx_param.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
tests/i915/gem_ctx_param.c +7 -7
@@ -161,6 +161,7 @@ static void test_vm(int i915)struct drm_i915_gem_context_param arg = { .param =I915_CONTEXT_PARAM_VM , }; +int err;uint32_t parent, child;igt_spin_t *spin;
@@ -173,8 +174,11 @@ static void test_vm(int i915)* in the next context that shared the VM. */ + arg.ctx_id =gem_context_create (i915); arg.value =-1ull ; -igt_require (__gem_context_set_param (i915, &arg) == -ENOENT ); + err =__gem_context_set_param (i915, &arg); +gem_context_destroy (i915, arg.ctx_id); +igt_require (err == -ENOENT ); parent =gem_context_create (i915); child =gem_context_create (i915);
@@ -198,6 +202,7 @@ static void test_vm(int i915) batch.offset =0 ;gem_execbuf (i915, &eb);igt_assert_eq_u64 (batch.offset,0 ); +gem_context_destroy (i915, child); eb.rsvd1 = parent;gem_execbuf (i915, &eb);
@@ -205,14 +210,9 @@ static void test_vm(int i915) arg.ctx_id = parent;gem_context_get_param (i915, &arg); -gem_context_set_param (i915, &arg); - -/* Still the same VM, so expect the old VMA again */ - batch.offset =0 ; -gem_execbuf (i915, &eb); -igt_assert_eq_u64 (batch.offset, nonzero_offset);/* Note: changing an active ctx->vm may be verboten */ + child =gem_context_create (i915); arg.ctx_id = child;if (__gem_context_set_param (i915, &arg) != -EBUSY ) { eb.rsvd1 = child;
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 89/89 tests/i915/gen9_exec_parse: Convert to intel_ctx_t
In reply to Jason Ekstrand--- tests/i915/gen9_exec_parse.c | 106 +++++++++++++++++------------------ 1 file changed, 53 insertions(+), 53 deletions(-)
tests/i915/gen9_exec_parse.c +53 -53
@@ -80,7 +80,7 @@ __checked_execbuf(int i915, struct drm_i915_gem_execbuffer2 *eb) }static int -__exec_batch_patched (int i915,int engine, +__exec_batch_patched (int i915,const intel_ctx_t *ctx,int engine,uint32_t cmd_bo,const uint32_t *cmds,int size,uint32_t target_bo,uint64_t target_offset,uint64_t target_delta) {
@@ -109,12 +109,13 @@ __exec_batch_patched(int i915, int engine, execbuf.buffers_ptr =to_user_pointer (obj); execbuf.buffer_count =2 ; execbuf.batch_len = size; + execbuf.rsvd1 = ctx->id; execbuf.flags = engine;return __checked_execbuf (i915, &execbuf); } -static void exec_batch_patched (int i915,int engine, +static void exec_batch_patched (int i915,const intel_ctx_t *ctx,int engine,uint32_t cmd_bo,const uint32_t *cmds,int size,int patch_offset,long int expected_value)
@@ -123,7 +124,8 @@ static void exec_batch_patched(int i915, int engine,uint64_t actual_value =0 ;long int ret; - ret =__exec_batch_patched (i915, engine, cmd_bo, cmds, size, target_bo, patch_offset,0 ); + ret =__exec_batch_patched (i915, ctx, engine, cmd_bo, cmds, size, + target_bo, patch_offset,0 );if (ret) {igt_assert_lt (ret,0 );gem_close (i915, target_bo);
@@ -138,8 +140,8 @@ static void exec_batch_patched(int i915, int engine,igt_assert_eq (actual_value, expected_value); } -static int __exec_batch (int i915,int engine,uint32_t cmd_bo, -const uint32_t *cmds,int size) +static int __exec_batch (int i915,const intel_ctx_t *ctx,int engine, +uint32_t cmd_bo,const uint32_t *cmds,int size) {struct drm_i915_gem_execbuffer2 execbuf;struct drm_i915_gem_exec_object2 obj[1 ];
@@ -153,6 +155,7 @@ static int __exec_batch(int i915, int engine, uint32_t cmd_bo, execbuf.buffers_ptr =to_user_pointer (obj); execbuf.buffer_count =1 ; execbuf.batch_len = size; + execbuf.rsvd1 = ctx->id; execbuf.flags = engine;return __checked_execbuf (i915, &execbuf);
@@ -172,12 +175,12 @@ static void print_batch(const uint32_t *cmds, const uint32_t sz)#define print_batch (cmds, size)#endif -#define exec_batch (i915, engine, bo, cmds, sz, expected) \ +#define exec_batch (i915, ctx, engine, bo, cmds, sz, expected) \ print_batch(cmds, sz); \ - igt_assert_eq(__exec_batch(i915, engine, bo, cmds, sz), expected) + igt_assert_eq(__exec_batch(i915, ctx, engine, bo, cmds, sz), expected) -static void exec_split_batch (int i915,int engine,const uint32_t *cmds, -int size,int expected_ret) +static void exec_split_batch (int i915,const intel_ctx_t *ctx,int engine, +const uint32_t *cmds,int size,int expected_ret) {struct drm_i915_gem_execbuffer2 execbuf;struct drm_i915_gem_exec_object2 obj[1 ];
@@ -212,6 +215,7 @@ static void exec_split_batch(int i915, int engine, const uint32_t *cmds, execbuf.batch_len =ALIGN (size + actual_start_offset - execbuf.batch_start_offset,0x8 ); + execbuf.rsvd1 = ctx->id; execbuf.flags = engine;igt_assert_eq (__checked_execbuf (i915, &execbuf), expected_ret);
@@ -219,7 +223,7 @@ static void exec_split_batch(int i915, int engine, const uint32_t *cmds,gem_close (i915, cmd_bo); } -static void exec_batch_chained(int i915, int engine, +static void exec_batch_chained(int i915, const intel_ctx_t *ctx, int engine, uint32_t cmd_bo, const uint32_t *cmds, int size, int patch_offset, uint64_t expected_value,
@@ -275,6 +279,7 @@ static void exec_batch_chained(int i915, int engine, execbuf.buffers_ptr =to_user_pointer (obj); execbuf.buffer_count =3 ; execbuf.batch_len =sizeof (first_level_cmds); + execbuf.rsvd1 = ctx->id; execbuf.flags = engine; ret =__checked_execbuf (i915, &execbuf);
@@ -370,7 +375,8 @@ static void test_allowed_all(const int i915, const uint32_t handle) b =inject_cmd (b,MI_BATCH_BUFFER_END ,1 ); -exec_batch (i915,I915_EXEC_BLT , handle, batch,batch_bytes (batch, b),0 ); +exec_batch (i915,intel_ctx_0 (i915),I915_EXEC_BLT , + handle, batch,batch_bytes (batch, b),0 ); }static void test_allowed_single (const int i915,const uint32_t handle)
@@ -385,7 +391,8 @@ static void test_allowed_single(const int i915, const uint32_t handle) b =inject_cmd (b,MI_BATCH_BUFFER_END ,1 ); -igt_assert_eq (__exec_batch (i915,I915_EXEC_BLT , handle, +igt_assert_eq (__exec_batch (i915,intel_ctx_0 (i915), +I915_EXEC_BLT , handle, batch,batch_bytes (batch, b)),0 ); };
@@ -657,14 +664,14 @@ static void test_bb_chained(const int i915, const uint32_t handle)MI_BATCH_BUFFER_END , }; -exec_batch_chained (i915,I915_EXEC_RENDER , +exec_batch_chained (i915,intel_ctx_0 (i915),I915_EXEC_RENDER , handle, batch,sizeof (batch),4 ,0xbaadf00d ,0 ); - exec_batch_chained(i915, I915_EXEC_BLT, + exec_batch_chained(i915, intel_ctx_0(i915), I915_EXEC_BLT, handle, batch, sizeof(batch), 4,
@@ -689,11 +696,11 @@ static void test_cmd_crossing_page(const int i915, const uint32_t handle) MI_BATCH_BUFFER_END, }; -exec_split_batch (i915,I915_EXEC_BLT , +exec_split_batch (i915,intel_ctx_0 (i915),I915_EXEC_BLT , lri_ok,sizeof (lri_ok),0 ); -exec_batch_patched (i915,I915_EXEC_BLT , handle, +exec_batch_patched (i915,intel_ctx_0 (i915),I915_EXEC_BLT , handle, store_reg,sizeof (store_reg),2 *sizeof (uint32_t ),/* reloc */ 0xbaadf00d );
@@ -728,25 +735,25 @@ static void test_invalid_length(const int i915, const uint32_t handle)MI_BATCH_BUFFER_END , }; -exec_batch (i915,I915_EXEC_BLT , handle, +exec_batch (i915,intel_ctx_0 (i915),I915_EXEC_BLT , handle, lri_ok,sizeof (lri_ok),0 ); -exec_batch_patched (i915,I915_EXEC_BLT , handle, +exec_batch_patched (i915,intel_ctx_0 (i915),I915_EXEC_BLT , handle, store_reg,sizeof (store_reg),2 *sizeof (uint32_t ),/* reloc */ ok_val); -exec_batch (i915,I915_EXEC_BLT , handle, +exec_batch (i915,intel_ctx_0 (i915),I915_EXEC_BLT , handle, lri_bad,0 ,0 ); -exec_batch_patched (i915,I915_EXEC_BLT , handle, +exec_batch_patched (i915,intel_ctx_0 (i915),I915_EXEC_BLT , handle, store_reg,sizeof (store_reg),2 *sizeof (uint32_t ),/* reloc */ ok_val); -exec_batch (i915,I915_EXEC_BLT , handle, +exec_batch (i915,intel_ctx_0 (i915),I915_EXEC_BLT , handle, lri_ok,4096 ,0 );
@@ -841,20 +848,20 @@ static void test_register(const int i915, const uint32_t handle,MI_BATCH_BUFFER_END , }; -exec_batch (i915,I915_EXEC_BLT , handle, +exec_batch (i915,intel_ctx_0 (i915),I915_EXEC_BLT , handle, lri_mask,sizeof (lri_mask), r->privileged ? -EACCES :0 ); -exec_batch_patched (i915,I915_EXEC_BLT , handle, +exec_batch_patched (i915,intel_ctx_0 (i915),I915_EXEC_BLT , handle, store_reg,sizeof (store_reg),2 *sizeof (uint32_t ),/* reloc */ r->privileged ? -EACCES : r->mask); -exec_batch (i915,I915_EXEC_BLT , handle, +exec_batch (i915,intel_ctx_0 (i915),I915_EXEC_BLT , handle, lri_zero,sizeof (lri_zero), r->privileged ? -EACCES :0 ); -exec_batch_patched (i915,I915_EXEC_BLT , handle, +exec_batch_patched (i915,intel_ctx_0 (i915),I915_EXEC_BLT , handle, store_reg,sizeof (store_reg),2 *sizeof (uint32_t ),/* reloc */ r->privileged ? -EACCES :0 );
@@ -885,8 +892,8 @@ static long int read_reg(const int i915, const uint32_t handle, target_bo =gem_create (i915,HANDLE_SIZE ); - ret =__exec_batch_patched (i915,I915_EXEC_BLT , handle, - store_reg,sizeof (store_reg), + ret =__exec_batch_patched (i915,intel_ctx_0 (i915),I915_EXEC_BLT , + handle, store_reg,sizeof (store_reg), target_bo,2 *sizeof (uint32_t ),0 );if (ret) {
@@ -912,7 +919,7 @@ static int write_reg(const int i915, const uint32_t handle, MI_BATCH_BUFFER_END, }; -return __exec_batch (i915,I915_EXEC_BLT , handle, +return __exec_batch (i915,intel_ctx_0 (i915),I915_EXEC_BLT , handle, lri,sizeof (lri)); }
@@ -998,7 +1005,8 @@ static void test_unaligned_jump(const int i915, const uint32_t handle) }static void -test_reject_on_engine (int i915,uint32_t handle,unsigned int engine) +test_reject_on_engine (int i915,const intel_ctx_t *ctx,unsigned int engine, +uint32_t handle) {const uint32_t invalid_cmd[] = {INSTR_INVALID_CLIENT <<INSTR_CLIENT_SHIFT ,
@@ -1009,45 +1017,37 @@ test_reject_on_engine(int i915, uint32_t handle, unsigned int engine)MI_BATCH_BUFFER_END , }; -exec_batch (i915, engine, handle, +exec_batch (i915, ctx, engine, handle, invalid_cmd,sizeof (invalid_cmd), -EINVAL ); -exec_batch (i915, engine, handle, +exec_batch (i915, ctx, engine, handle, invalid_set_context,sizeof (invalid_set_context), -EINVAL ); }static void test_rejected (int i915,uint32_t handle,bool ctx_param) { -#define engine_class (e, n) ((e)->engines[(n)].engine_class) -#define engine_instance (e, n) ((e)->engines[(n)].engine_instance) -if (ctx_param) { +intel_ctx_cfg_t cfg = {}; +const intel_ctx_t *ctx;int i; -I915_DEFINE_CONTEXT_PARAM_ENGINES (engines ,I915_EXEC_RING_MASK +1 ); -struct drm_i915_gem_context_param param = { - .ctx_id =0 , - .param =I915_CONTEXT_PARAM_ENGINES , - .value =to_user_pointer (&engines), - .size =sizeof (engines), - }; - -memset (&engines,0 ,sizeof (engines)); -for (i =0 ; i <=I915_EXEC_RING_MASK ; i++) { -engine_class (&engines, i) =I915_ENGINE_CLASS_COPY ; -engine_instance (&engines, i) =0 ; +for (i =0 ; i <GEM_MAX_ENGINES ; i++) { + cfg.engines[i].engine_class =I915_ENGINE_CLASS_COPY ; + cfg.engines[i].engine_instance =0 ; } -gem_context_set_param (i915, ¶m); + cfg.num_engines =GEM_MAX_ENGINES ; + + ctx =intel_ctx_create (i915, &cfg);for (i =0 ; i <=I915_EXEC_RING_MASK ; i++) -test_reject_on_engine (i915, handle, i); +test_reject_on_engine (i915, ctx, i, handle); - param.size =0 ; -gem_context_set_param (i915, ¶m); +intel_ctx_destroy (i915, ctx); }else { -test_reject_on_engine (i915, handle,I915_EXEC_BLT ); +test_reject_on_engine (i915,intel_ctx_0 (i915), +I915_EXEC_BLT , handle); } }
@@ -1222,7 +1222,7 @@ igt_main igt_subtest("batch-without-end") {const uint32_t noop[1024 ] = {0 }; -exec_batch (i915,I915_EXEC_BLT , handle, +exec_batch (i915,intel_ctx_0 (i915),I915_EXEC_BLT , handle, noop,sizeof (noop), -EINVAL ); }
@@ -1230,7 +1230,7 @@ igt_main igt_subtest("batch-zero-length") {const uint32_t noop[] = {0 ,MI_BATCH_BUFFER_END }; -exec_batch (i915,I915_EXEC_BLT , handle, +exec_batch (i915,intel_ctx_0 (i915),I915_EXEC_BLT , handle, noop,0 , -EINVAL ); }
Signature · 6 lines
2.31.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Unfortunately, there are a few SOB's missing on this series. I realized it after I'd sent the first 50 or so. I've added them locally.
--Jason
Quoted 273 lines · Jason Ekstrand
I'm trying to clean up some of our uAPI technical debt in i915. One of the biggest areas we have right now is context mutability. There's no good reason why things like the set of engines or the VM should be able to be changed on the fly and no "real" userspace actually relies on this functionality. It does, however, make for a good excuse for tests and lots of bug reports as things like swapping out the set of engines under load break randomly. The solution here is to stop allowing that behavior and simplify the i915 internals.
In particular, we'd like to remove the following from the i915 API:
1. I915_CONTEXT_CLONE_*. These are only used by IGT and have never been used by any "real" userspace.
2. Changing the VM or set of engines via SETPARAM after they've been "used" by an execbuf or similar. This would effectively make those parameters create params rather than mutable state. We can't drop setparam entirely for those because media does use it but we can enforce some rules.
3. Unused (by non-IGT userspace) GETPARAM for things like engines.
As much as we'd love to do that, we have a bit of a problem in IGT. The way we handle multi-engine testing today relies heavily on this soon-to-be- deprecated functionality. In particular, the standard flow is usually something like this:
static void run_test1(int fd, uint32_t engine) { igt_spin_t *spin; ctx = = gem_context_clone_with_engines(fd, 0); __igt_spin_new(fd, ctx, .engine = engine); /* do some testing with ctx */ igt_spin_free(fd, spin); gem_destroy_context(fd, ctx); } igt_main { struct intel_execution_engine2 *e; /* Usual fixture code */ __for_each_physical_engine(fd, e) run_test1(fd, e->flags); __for_each_physical_engine(fd, e) run_test2(fd, e->flags); }Let's walk through what this does:
1.
__for_each_physical_enginecallsintel_init_engine_list()which resets the set of engines on ctx0 to the full set of engines available as per the engine query. On older kernels/hardware where we don't have the engines query, it leaves the set alone.2.
intel_init_engine_list()also returns a set of engines for iteration and__for_each_physical_engine()sets up a for loop to walk the set.3.
gem_context_clone_with_engines()creates a new context usingI915_CONTEXT_CONTEXT_CLONE_ENGINES(not used by anything other than IGT) to ask that the newly created context has the same set of engines as ctx0. Remember we changed that at the start of loop iteration!4. When the context is passed to
__igt_spin_new(), it callsgem_context_lookup_enginewhich does a GETPARAM to introspet the set of engines on the context and figure out the engine class.If you've been keeping track, this trivial and extremely common example uses every single one of these soon-to-be-deprecated APIs even though the test author may be completely obvious to it. It also means that getting rid of IGT's use of them is going to require some fairly deep surgery.
The approach proposed and partially implemented here is to add a new wrapper struct
intel_ctx_twhich wraps a GEM context handle as well as the full set of parameters used to create it, represented byintel_ctx_cfg_t. We can then use the context anywhere we would regularly use a context, we just have to doctx->id. If we want to clone it, we can do so by re-using the create parameters by callingintel_ctx_create(fd, &old_ctx->cfg);Along with the above rework (which got long, sorry) I've got a few other patches in here which delete tests which exist expressly to test APIs that are on the chopping block.
v2 (Jason Ekstrand):
- Better documentation
- Two more patches at the end to clean up query APIs even morev3 (Jason Ekstrand):
- Improvedintel_ctxinterface
- More tests converted tointel_ctx_t
- Misc. bug fixes--Jason
Jason Ekstrand (89):
tests/i915: Dropgem_ctx_ringsizetests/i915/gem_exec_balancer: Drop the ringsize subtest tests/i915/gem_exec_endless: Stop setting the ring size tests/i915/gem_ctx_param: Drop the zeromap subtests tests/i915: Dropgem_ctx_clone
docs: Addgem_engine_topology.hto the docslib/i915/gem_engine_topology: Expose the__query_engineshelper (v2)lib/i915/gem_context: Addgem_context_create_exthelpers
lib: Add anintel_ctxwrapper struct and helpers (v4)lib/i915/gem_engine_topology: Reworkquery_engine_list()lib/i915/gem_engine_topology: Factor out static engine listinglib/i915/gem_engine_topology: Add an iterator which doesn't munge
contexts (v2)
lib/i915/gem_engine_topology: Add an iterator forintel_ctx_t(v2) tests/i915/gem_exec_basic: Convert tointel_ctx_tlib/dummyload: Better documentigt_spin_factorylib/dummyload: Renameigt_spin_factory::ctxtoctx_idlib/dummyload: Supportintel_ctx_ttests/i915/gem_exec_fence: Move the engine data into
inter_engine_context
tests/i915/gem_exec_fence: Convert tointel_ctx_ttests/i915/gem_exec_schedule: Convert tointel_ctx_ttests/i915/perf_pmu: Convert tointel_ctx_ttests/i915/gem_exec_nop: Convert tointel_ctx_ttests/i915/gem_exec_reloc: Convert tointel_ctx_ttests/i915/gem_busy: Convert tointel_ctx_ttests/i915/gem_ctx_isolation: Convert tointel_ctx_ttests/i915/gem_exec_async: Convert tointel_ctx_ttests/i915/sysfs_clients: Convert tointel_ctx_ttests/i915/gem_exec_fair: Convert tointel_ctx_ttests/i915/gem_spin_batch: Convert tointel_ctx_ttests/i915/gem_exec_store: Convert tointel_ctx_ttests/amdgpu/amd_prime: Convert tointel_ctx_ttests/i915/i915_hangman: Convert tointel_ctx_ttests/i915/gem_ringfill: Convert tointel_ctx_ttests/prime_busy: Convert tointel_ctx_t
tests/prime_vgem: Convert tointel_ctx_ttests/gem_exec_whisper: Convert tointel_ctx_ttests/i915/gem_ctx_exec: Stop cloning contexts inclose_racetests/i915/gem_ctx_exec: Convert tointel_ctx_ttests/i915/gem_exec_suspend: Convert tointel_ctx_ttests/i915/gem_sync: Convert tointel_ctx_ttests/i915/gem_userptr_blits: Convert tointel_ctx_ttests/i915/gem_wait: Convert tointel_ctx_ttests/i915/gem_request_retire: Convert tointel_ctx_ttests/i915/gem_ctx_shared: Convert tointel_ctx_ttests/i915/gem_ctx_shared: Stop cloning contexts tests/i915/gem_create: Convert tointel_ctx_ttests/i915/gem_ctx_switch: Convert tointel_ctx_ttests/i915/gem_exec_parallel: Convert tointel_ctx_ttests/i915/gem_exec_latency: Convert tointel_ctx_ttests/i915/gem_watchdog: Convert tointel_ctx_ttests/i915/gem_shrink: Convert tointel_ctx_ttests/i915/gem_exec_params: Convert tointel_ctx_ttests/i915/gem_exec_gttfill: Convert tointel_ctx_ttests/i915/gem_exec_capture: Convert tointel_ctx_ttests/i915/gem_exec_create: Convert tointel_ctx_ttests/i915/gem_exec_await: Convert tointel_ctx_ttests/i915/gem_ctx_persistence: Drop the clone subtest tests/i915/gem_ctx_persistence: Drop the engine replace subtests tests/i915/gem_ctx_persistence: Convert tointel_ctx_ttests/i915/module_load: Convert tointel_ctx_ttests/i915/pm_rc6_residency: Convert tointel_ctx_ttests/i915/gem_cs_tlb: Convert tointel_ctx_ttests/core_hotplug: Convert tointel_ctx_ttests/i915/gem_exec_balancer: Stop cloning engines tests/i915/gem_exec_balancer: Don't reset engines on a context tests/i915/gem_exec_balancer: Stop munging ctx0 engines tests/i915/gem_exec_balancer: Drop bonded testslib/intel_ctx: Add load balancing support tests/i915/gem_exec_balancer: Convert tointel_ctx_ttests/i915/gem_exec_endless: Stop munging ctx0 engines lib/i915: Usefor_each_physical_ringfor submission tests tests/i915/gem_ctx_engines: Rework execute-one* tests/i915/gem_ctx_engines: Use better engine iteration tests/i915/gem_ctx_engines: Drop the idempotent subtest tests/i915/gem_ctx_create: Convert benchmarks tointel_ctx_ttests/i915/gem_vm_create: Delete destroy racing tests tests/i915/gem_vm_create: Useintel_ctx_tin the execbuf test tests/i915/sysfs: Convert tointel_ctx_ttests/i915/gem_workarounds: Convert tointel_ctx_tlib/i915/gem_context: Delete all the context clone/copy stuff tests/i915/gem_ctx_engines: Delete the libapi subtestlib/igt_dummyload: Stop supportingALL_ENGINESwithout anintel_ctx_tlib/i915/gem_engine_topology: Delete the old physical engine iterators tests/i915/gem_mmap_gtt: Convert tointel_ctx_tigt/dummyload: Require anintel_ctx_tforPOLL_RUNand !ALL_ENGINES lib/i915: Rework engine API availability checks (v2)lib/intel_bb: Removeintel_bb_assign_vmand tests tests/i915/gem_ctx_param: Stop setting VMs on old contexts tests/i915/gen9_exec_parse: Convert tointel_ctx_t.../igt-gpu-tools/igt-gpu-tools-docs.xml | 2 + lib/i915/gem_context.c | 261 ++---- lib/i915/gem_context.h | 21 +- lib/i915/gem_engine_topology.c | 277 +++--- lib/i915/gem_engine_topology.h | 78 +- lib/i915/gem_submission.c | 13 +- lib/igt_dummyload.c | 25 +- lib/igt_dummyload.h | 28 +- lib/igt_gt.c | 2 +- lib/intel_batchbuffer.c | 52 - lib/intel_batchbuffer.h | 3 - lib/intel_ctx.c | 327 +++++++ lib/intel_ctx.h | 79 ++ lib/meson.build | 1 + tests/amdgpu/amd_prime.c | 10 +- tests/core_hotunplug.c | 6 +- tests/i915/api_intel_bb.c | 104 -- tests/i915/gem_busy.c | 77 +- tests/i915/gem_create.c | 14 +- tests/i915/gem_cs_tlb.c | 10 +- tests/i915/gem_ctx_clone.c | 450 --------- tests/i915/gem_ctx_create.c | 76 +- tests/i915/gem_ctx_engines.c | 276 +----- tests/i915/gem_ctx_exec.c | 54 +- tests/i915/gem_ctx_isolation.c | 112 +-- tests/i915/gem_ctx_param.c | 47 +- tests/i915/gem_ctx_persistence.c | 457 +++------ tests/i915/gem_ctx_ringsize.c | 345 ------- tests/i915/gem_ctx_shared.c | 335 ++++--- tests/i915/gem_ctx_switch.c | 115 ++- tests/i915/gem_eio.c | 2 +- tests/i915/gem_exec_async.c | 32 +- tests/i915/gem_exec_await.c | 20 +- tests/i915/gem_exec_balancer.c | 887 ++++-------------- tests/i915/gem_exec_basic.c | 7 +- tests/i915/gem_exec_capture.c | 30 +- tests/i915/gem_exec_create.c | 9 +- tests/i915/gem_exec_endless.c | 14 +- tests/i915/gem_exec_fair.c | 112 ++- tests/i915/gem_exec_fence.c | 302 +++--- tests/i915/gem_exec_gttfill.c | 15 +- tests/i915/gem_exec_latency.c | 118 +-- tests/i915/gem_exec_nop.c | 156 +-- tests/i915/gem_exec_parallel.c | 29 +- tests/i915/gem_exec_params.c | 4 +- tests/i915/gem_exec_reloc.c | 102 +- tests/i915/gem_exec_schedule.c | 887 +++++++++--------- tests/i915/gem_exec_store.c | 36 +- tests/i915/gem_exec_suspend.c | 52 +- tests/i915/gem_exec_whisper.c | 83 +- tests/i915/gem_mmap_gtt.c | 18 +- tests/i915/gem_request_retire.c | 17 +- tests/i915/gem_ringfill.c | 48 +- tests/i915/gem_shrink.c | 37 +- tests/i915/gem_spin_batch.c | 79 +- tests/i915/gem_sync.c | 159 ++-- tests/i915/gem_userptr_blits.c | 25 +- tests/i915/gem_vm_create.c | 125 +-- tests/i915/gem_wait.c | 20 +- tests/i915/gem_watchdog.c | 167 +--- tests/i915/gem_workarounds.c | 11 +- tests/i915/gen9_exec_parse.c | 106 +-- tests/i915/i915_hangman.c | 37 +- tests/i915/i915_module_load.c | 7 +- tests/i915/i915_pm_rc6_residency.c | 7 +- tests/i915/i915_query.c | 17 +- tests/i915/perf_pmu.c | 226 +++-- tests/i915/sysfs_clients.c | 87 +- tests/i915/sysfs_heartbeat_interval.c | 40 +- tests/i915/sysfs_preempt_timeout.c | 39 +- tests/i915/sysfs_timeslice_duration.c | 51 +- tests/meson.build | 2 - tests/prime_busy.c | 19 +- tests/prime_vgem.c | 35 +- 74 files changed, 3374 insertions(+), 4559 deletions(-) create mode 100644 lib/intel_ctx.c create mode 100644 lib/intel_ctx.h delete mode 100644 tests/i915/gem_ctx_clone.c delete mode 100644 tests/i915/gem_ctx_ringsize.c
Quoted 3 lines
--
2.31.1
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for Stop depending on context mutation (rev4)
In reply to Jason Ekstrand== Series Details ==
== Series Details ==
Series: Stop depending on context mutation (rev4)
URL : https://patchwork.freedesktop.org/series/88986/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_10005 -> IGTPW_5761
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/index.html
Known issues
------------
Here are the changes found in IGTPW_5761 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-tgl-y: [PASS][1] -> [DMESG-WARN][2] ([i915#1982])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/fi-tgl-y/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/fi-tgl-y/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2373]: https://gitlab.freedesktop.org/drm/intel/issues/2373
[i915#3012]: https://gitlab.freedesktop.org/drm/intel/issues/3012
[i915#3276]: https://gitlab.freedesktop.org/drm/intel/issues/3276
[i915#3277]: https://gitlab.freedesktop.org/drm/intel/issues/3277
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3283]: https://gitlab.freedesktop.org/drm/intel/issues/3283
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#750]: https://gitlab.freedesktop.org/drm/intel/issues/750
Participating hosts (43 -> 37)
------------------------------
Additional (1): fi-rkl-11500t
Missing (7): fi-ilk-m540 fi-hsw-4200u fi-bsw-n3050 fi-bsw-cyan fi-dg1-1 fi-icl-y fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_6074 -> IGTPW_5761
CI-20190529: 20190529
CI_DRM_10005: 7a27cb7ac19a95d801c391044cea5274677e7744 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_5761: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/index.html
IGT_6074: 3f43ae9fd22dc5a517786b984dc3aa717997664f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Testlist changes ==
-igt@api_intel_bb@bb-with-vm
-igt@gem_ctx_clone@engines
-igt@gem_ctx_clone@flags
-igt@gem_ctx_clone@invalid
-igt@gem_ctx_clone@scheduler
-igt@gem_ctx_clone@vm
-igt@gem_ctx_engines@idempotent
-igt@gem_ctx_engines@libapi
-igt@gem_ctx_param@non-root-set-no-zeromap
-igt@gem_ctx_param@root-set-no-zeromap-disabled
-igt@gem_ctx_param@root-set-no-zeromap-enabled
-igt@gem_ctx_persistence@clone
-igt@gem_ctx_persistence@close-replace-race
-igt@gem_ctx_persistence@replace
-igt@gem_ctx_persistence@replace-hostile
-igt@gem_ctx_ringsize@active
-igt@gem_ctx_ringsize@clone
-igt@gem_ctx_ringsize@create
-igt@gem_ctx_ringsize@idempotent
-igt@gem_ctx_ringsize@idle
-igt@gem_ctx_ringsize@invalid
-igt@gem_ctx_ringsize@plugged
-igt@gem_exec_balancer@bonded-cork
-igt@gem_exec_balancer@bonded-early
-igt@gem_exec_balancer@bonded-imm
-igt@gem_exec_balancer@ringsize
-igt@gem_vm_create@async-destroy
-igt@gem_vm_create@destroy-race
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/index.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.IGT: success for Stop depending on context mutation (rev4)
In reply to Jason Ekstrand== Series Details ==
== Series Details ==
Series: Stop depending on context mutation (rev4)
URL : https://patchwork.freedesktop.org/series/88986/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_10005_full -> IGTPW_5761_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/index.html
Known issues
------------
Here are the changes found in IGTPW_5761_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_create@create-clear:
- shard-glk: [PASS][1] -> [FAIL][2] ([i915#1888] / [i915#3160])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-glk8/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-glk2/igt@[email protected]
* igt@gem_create@create-massive:
- shard-iclb: NOTRUN -> [DMESG-WARN][3] ([i915#3002])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb7/igt@[email protected]
- shard-snb: NOTRUN -> [DMESG-WARN][4] ([i915#3002])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-snb5/igt@[email protected]
- shard-kbl: NOTRUN -> [DMESG-WARN][5] ([i915#3002])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-kbl3/igt@[email protected]
- shard-tglb: NOTRUN -> [DMESG-WARN][6] ([i915#3002])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-tglb8/igt@[email protected]
- shard-glk: NOTRUN -> [DMESG-WARN][7] ([i915#3002])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-glk1/igt@[email protected]
- shard-apl: NOTRUN -> [DMESG-WARN][8] ([i915#3002])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl2/igt@[email protected]
* igt@gem_ctx_isolation@preservation-s3@vecs0:
- shard-apl: NOTRUN -> [DMESG-WARN][9] ([i915#180])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl7/igt@gem_ctx_isolation@[email protected]
* igt@gem_ctx_persistence@legacy-engines-queued:
- shard-snb: NOTRUN -> [SKIP][10] ([fdo#109271] / [i915#1099]) +6 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-snb6/igt@[email protected]
* igt@gem_exec_fair@basic-deadline:
- shard-glk: [PASS][11] -> [FAIL][12] ([i915#2846])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-glk1/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-glk9/igt@[email protected]
* igt@gem_exec_fair@basic-none-share@rcs0:
- shard-tglb: [PASS][13] -> [FAIL][14] ([i915#2842]) +1 similar issue
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-tglb2/igt@gem_exec_fair@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-tglb3/igt@gem_exec_fair@[email protected]
* igt@gem_exec_fair@basic-pace@rcs0:
- shard-kbl: [PASS][15] -> [FAIL][16] ([i915#2842])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-kbl6/igt@gem_exec_fair@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-kbl7/igt@gem_exec_fair@[email protected]
* igt@gem_exec_fair@basic-pace@vcs0:
- shard-iclb: [PASS][17] -> [FAIL][18] ([i915#2842])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-iclb7/igt@gem_exec_fair@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb5/igt@gem_exec_fair@[email protected]
- shard-glk: [PASS][19] -> [FAIL][20] ([i915#2842]) +1 similar issue
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-glk5/igt@gem_exec_fair@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-glk2/igt@gem_exec_fair@[email protected]
* igt@gem_exec_whisper@basic-queues-forked-all:
- shard-glk: [PASS][21] -> [DMESG-WARN][22] ([i915#118] / [i915#95]) +1 similar issue
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-glk6/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-glk1/igt@[email protected]
* igt@gem_mmap_gtt@cpuset-medium-copy-odd:
- shard-glk: [PASS][23] -> [FAIL][24] ([i915#307])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-glk1/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-glk1/igt@[email protected]
* igt@gem_pwrite@basic-exhaustion:
- shard-snb: NOTRUN -> [WARN][25] ([i915#2658]) +1 similar issue
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-snb2/igt@[email protected]
- shard-apl: NOTRUN -> [WARN][26] ([i915#2658])
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl2/igt@[email protected]
* igt@gem_render_copy@y-tiled-mc-ccs-to-y-tiled-ccs:
- shard-iclb: NOTRUN -> [SKIP][27] ([i915#768]) +1 similar issue
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb1/igt@[email protected]
* igt@gem_userptr_blits@unsync-overlap:
- shard-tglb: NOTRUN -> [SKIP][28] ([i915#3297])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-tglb2/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][29] ([i915#3297])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb8/igt@[email protected]
* igt@gen3_render_tiledy_blits:
- shard-tglb: NOTRUN -> [SKIP][30] ([fdo#109289])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-tglb2/igt@gen3_render_tiledy_blits.html
- shard-iclb: NOTRUN -> [SKIP][31] ([fdo#109289])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb8/igt@gen3_render_tiledy_blits.html
* igt@gen9_exec_parse@batch-invalid-length:
- shard-snb: NOTRUN -> [SKIP][32] ([fdo#109271]) +356 similar issues
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-snb6/igt@[email protected]
* igt@gen9_exec_parse@secure-batches:
- shard-iclb: NOTRUN -> [SKIP][33] ([fdo#112306])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb6/igt@[email protected]
- shard-tglb: NOTRUN -> [SKIP][34] ([fdo#112306])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-tglb7/igt@[email protected]
* igt@kms_big_fb@linear-8bpp-rotate-270:
- shard-tglb: NOTRUN -> [SKIP][35] ([fdo#111614]) +1 similar issue
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-tglb8/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][36] ([fdo#110725] / [fdo#111614]) +1 similar issue
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb7/igt@[email protected]
* igt@kms_big_fb@yf-tiled-32bpp-rotate-90:
- shard-tglb: NOTRUN -> [SKIP][37] ([fdo#111615])
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-tglb3/igt@[email protected]
* igt@kms_chamelium@hdmi-edid-change-during-suspend:
- shard-apl: NOTRUN -> [SKIP][38] ([fdo#109271] / [fdo#111827]) +23 similar issues
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl1/igt@[email protected]
* igt@kms_color_chamelium@pipe-a-ctm-blue-to-red:
- shard-snb: NOTRUN -> [SKIP][39] ([fdo#109271] / [fdo#111827]) +20 similar issues
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-snb5/igt@[email protected]
* igt@kms_color_chamelium@pipe-a-ctm-limited-range:
- shard-glk: NOTRUN -> [SKIP][40] ([fdo#109271] / [fdo#111827]) +2 similar issues
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-glk6/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][41] ([fdo#109284] / [fdo#111827]) +1 similar issue
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb7/igt@[email protected]
* igt@kms_color_chamelium@pipe-d-ctm-max:
- shard-tglb: NOTRUN -> [SKIP][42] ([fdo#109284] / [fdo#111827]) +2 similar issues
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-tglb3/igt@[email protected]
- shard-kbl: NOTRUN -> [SKIP][43] ([fdo#109271] / [fdo#111827]) +1 similar issue
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-kbl6/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][44] ([fdo#109278] / [fdo#109284] / [fdo#111827])
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb1/igt@[email protected]
* igt@kms_content_protection@srm:
- shard-apl: NOTRUN -> [TIMEOUT][45] ([i915#1319])
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl3/igt@[email protected]
* igt@kms_cursor_crc@pipe-a-cursor-512x170-sliding:
- shard-tglb: NOTRUN -> [SKIP][46] ([fdo#109279] / [i915#3359])
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-tglb1/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][47] ([fdo#109278] / [fdo#109279])
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb5/igt@[email protected]
* igt@kms_cursor_crc@pipe-b-cursor-32x10-random:
- shard-kbl: NOTRUN -> [SKIP][48] ([fdo#109271]) +33 similar issues
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-kbl3/igt@[email protected]
- shard-tglb: NOTRUN -> [SKIP][49] ([i915#3359]) +3 similar issues
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-tglb8/igt@[email protected]
* igt@kms_fbcon_fbt@fbc-suspend:
- shard-kbl: [PASS][50] -> [INCOMPLETE][51] ([i915#155] / [i915#180] / [i915#636])
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-kbl1/igt@[email protected]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-kbl2/igt@[email protected]
* igt@kms_flip@2x-busy-flip:
- shard-tglb: NOTRUN -> [SKIP][52] ([fdo#111825]) +5 similar issues
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-tglb3/igt@[email protected]
* igt@kms_flip@2x-plain-flip-fb-recreate-interruptible:
- shard-iclb: NOTRUN -> [SKIP][53] ([fdo#109274]) +1 similar issue
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb5/igt@[email protected]
* igt@kms_flip@flip-vs-expired-vblank-interruptible@b-dp1:
- shard-apl: NOTRUN -> [FAIL][54] ([i915#79])
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl8/igt@kms_flip@[email protected]
* igt@kms_flip@flip-vs-expired-vblank@a-hdmi-a2:
- shard-glk: [PASS][55] -> [FAIL][56] ([i915#79])
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-glk4/igt@kms_flip@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-glk1/igt@kms_flip@[email protected]
* igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytilegen12rcccs:
- shard-apl: NOTRUN -> [SKIP][57] ([fdo#109271] / [i915#2672]) +1 similar issue
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl6/igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytilegen12rcccs.html
* igt@kms_flip_scaled_crc@flip-32bpp-ytileccs-to-64bpp-ytile:
- shard-apl: NOTRUN -> [SKIP][58] ([fdo#109271] / [i915#2642])
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl6/igt@[email protected]
* igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-cur-indfb-onoff:
- shard-glk: [PASS][59] -> [FAIL][60] ([i915#49])
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-glk8/igt@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-glk2/igt@[email protected]
* igt@kms_frontbuffer_tracking@fbc-suspend:
- shard-kbl: [PASS][61] -> [INCOMPLETE][62] ([i915#155])
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-kbl7/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-kbl4/igt@[email protected]
* igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-cur-indfb-move:
- shard-iclb: NOTRUN -> [SKIP][63] ([fdo#109280]) +3 similar issues
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb8/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb:
- shard-apl: NOTRUN -> [FAIL][64] ([fdo#108145] / [i915#265]) +3 similar issues
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl8/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-a-alpha-transparent-fb:
- shard-apl: NOTRUN -> [FAIL][65] ([i915#265])
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl7/igt@[email protected]
- shard-glk: NOTRUN -> [FAIL][66] ([i915#265])
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-glk5/igt@[email protected]
- shard-kbl: NOTRUN -> [FAIL][67] ([i915#265])
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-kbl6/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-d-constant-alpha-max:
- shard-iclb: NOTRUN -> [SKIP][68] ([fdo#109278]) +8 similar issues
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb6/igt@[email protected]
* igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-4:
- shard-apl: NOTRUN -> [SKIP][69] ([fdo#109271] / [i915#658]) +5 similar issues
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl3/igt@[email protected]
* igt@kms_psr@psr2_primary_render:
- shard-iclb: NOTRUN -> [SKIP][70] ([fdo#109441])
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb5/igt@kms_psr@psr2_primary_render.html
* igt@kms_psr@psr2_sprite_mmap_cpu:
- shard-iclb: [PASS][71] -> [SKIP][72] ([fdo#109441])
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-iclb2/igt@kms_psr@psr2_sprite_mmap_cpu.html
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb4/igt@kms_psr@psr2_sprite_mmap_cpu.html
* igt@kms_setmode@basic:
- shard-snb: NOTRUN -> [FAIL][73] ([i915#31])
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-snb6/igt@[email protected]
* igt@kms_vblank@pipe-a-ts-continuation-suspend:
- shard-kbl: [PASS][74] -> [DMESG-WARN][75] ([i915#180] / [i915#295])
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-kbl6/igt@[email protected]
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-kbl2/igt@[email protected]
* igt@kms_vblank@pipe-d-ts-continuation-idle:
- shard-apl: NOTRUN -> [SKIP][76] ([fdo#109271]) +200 similar issues
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl2/igt@[email protected]
* igt@kms_vblank@pipe-d-wait-idle:
- shard-apl: NOTRUN -> [SKIP][77] ([fdo#109271] / [i915#533]) +2 similar issues
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl7/igt@[email protected]
* igt@perf_pmu@rc6-suspend:
- shard-kbl: [PASS][78] -> [DMESG-WARN][79] ([i915#180])
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-kbl7/igt@[email protected]
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-kbl2/igt@[email protected]
* igt@prime_nv_api@i915_self_import:
- shard-glk: NOTRUN -> [SKIP][80] ([fdo#109271]) +30 similar issues
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-glk3/igt@prime_nv_api@i915_self_import.html
- shard-tglb: NOTRUN -> [SKIP][81] ([fdo#109291]) +1 similar issue
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-tglb7/igt@prime_nv_api@i915_self_import.html
- shard-iclb: NOTRUN -> [SKIP][82] ([fdo#109291]) +1 similar issue
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb6/igt@prime_nv_api@i915_self_import.html
* igt@sysfs_clients@fair-1:
- shard-apl: NOTRUN -> [SKIP][83] ([fdo#109271] / [i915#2994]) +3 similar issues
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl7/igt@[email protected]
#### Possible fixes ####
* igt@gem_eio@unwedge-stress:
- shard-tglb: [TIMEOUT][84] ([i915#2369] / [i915#3063]) -> [PASS][85]
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-tglb3/igt@[email protected]
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-tglb7/igt@[email protected]
* igt@gem_exec_fair@basic-none-share@rcs0:
- shard-apl: [SKIP][86] ([fdo#109271]) -> [PASS][87]
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-apl2/igt@gem_exec_fair@[email protected]
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl7/igt@gem_exec_fair@[email protected]
* igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-glk: [FAIL][88] ([i915#2842]) -> [PASS][89] +1 similar issue
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-glk7/igt@gem_exec_fair@[email protected]
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-glk1/igt@gem_exec_fair@[email protected]
* igt@gem_exec_whisper@basic-fds:
- shard-glk: [DMESG-WARN][90] ([i915#118] / [i915#95]) -> [PASS][91] +1 similar issue
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-glk1/igt@[email protected]
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-glk3/igt@[email protected]
* igt@gem_mmap_gtt@cpuset-big-copy:
- shard-iclb: [FAIL][92] ([i915#307]) -> [PASS][93]
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-iclb6/igt@[email protected]
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb4/igt@[email protected]
* igt@gem_softpin@noreloc-s3:
- shard-apl: [DMESG-WARN][94] ([i915#180]) -> [PASS][95]
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-apl3/igt@[email protected]
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl1/igt@[email protected]
* igt@kms_atomic@plane-primary-legacy:
- shard-snb: [SKIP][96] ([fdo#109271]) -> [PASS][97]
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-snb2/igt@[email protected]
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-snb2/igt@[email protected]
* igt@kms_ccs@pipe-a-random-ccs-data:
- shard-iclb: [DMESG-WARN][98] ([i915#3219]) -> [PASS][99]
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-iclb1/igt@[email protected]
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb3/igt@[email protected]
* igt@kms_cursor_edge_walk@pipe-a-64x64-right-edge:
- shard-glk: [DMESG-FAIL][100] ([i915#118] / [i915#70] / [i915#95]) -> [PASS][101]
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-glk7/igt@[email protected]
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-glk6/igt@[email protected]
* igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-mmap-wc:
- shard-glk: [FAIL][102] ([i915#49]) -> [PASS][103]
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-glk9/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-mmap-wc.html
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-glk6/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-mmap-wc.html
* igt@kms_frontbuffer_tracking@psr-shrfb-scaledprimary:
- shard-iclb: [SKIP][104] ([i915#668]) -> [PASS][105]
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-iclb1/igt@[email protected]
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb7/igt@[email protected]
* igt@kms_psr@psr2_primary_mmap_cpu:
- shard-iclb: [SKIP][106] ([fdo#109441]) -> [PASS][107] +1 similar issue
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-iclb4/igt@kms_psr@psr2_primary_mmap_cpu.html
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb2/igt@kms_psr@psr2_primary_mmap_cpu.html
#### Warnings ####
* igt@gem_exec_fair@basic-pace@vcs1:
- shard-kbl: [SKIP][108] ([fdo#109271]) -> [FAIL][109] ([i915#2842])
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-kbl6/igt@gem_exec_fair@[email protected]
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-kbl7/igt@gem_exec_fair@[email protected]
* igt@i915_pm_rc6_residency@rc6-fence:
- shard-iclb: [WARN][110] ([i915#1804] / [i915#2684]) -> [WARN][111] ([i915#2681] / [i915#2684])
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-iclb3/igt@[email protected]
[111]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb1/igt@[email protected]
* igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-3:
- shard-iclb: [SKIP][112] ([i915#658]) -> [SKIP][113] ([i915#2920]) +1 similar issue
[112]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-iclb7/igt@[email protected]
[113]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb2/igt@[email protected]
* igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-4:
- shard-iclb: [SKIP][114] ([i915#2920]) -> [SKIP][115] ([i915#658]) +1 similar issue
[114]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-iclb2/igt@[email protected]
[115]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-iclb7/igt@[email protected]
* igt@runner@aborted:
- shard-kbl: [FAIL][116] ([i915#3002]) -> ([FAIL][117], [FAIL][118], [FAIL][119], [FAIL][120], [FAIL][121]) ([i915#180] / [i915#1814] / [i915#2292] / [i915#3002] / [i915#602] / [i915#92])
[116]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-kbl2/igt@[email protected]
[117]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-kbl2/igt@[email protected]
[118]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-kbl2/igt@[email protected]
[119]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-kbl3/igt@[email protected]
[120]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-kbl3/igt@[email protected]
[121]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-kbl2/igt@[email protected]
- shard-apl: ([FAIL][122], [FAIL][123], [FAIL][124]) ([i915#180] / [i915#1814] / [i915#3002]) -> ([FAIL][125], [FAIL][126], [FAIL][127]) ([i915#180] / [i915#3002])
[122]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-apl8/igt@[email protected]
[123]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-apl3/igt@[email protected]
[124]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10005/shard-apl3/igt@[email protected]
[125]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl2/igt@[email protected]
[126]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl3/igt@[email protected]
[127]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/shard-apl7/igt@[email protected]
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109279]: https://bugs.freedesktop.org/show_bug.cgi?id=109279
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#110725]: https://bugs.freedesktop.org/show_bug.cgi?id=110725
[fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[fdo#112306]: https://bugs.freedesktop.org/show_bug.cgi?id=112306
[i915#1099]: https://gitlab.freedesktop.org/drm/intel/issues/1099
[i915#118]: https://gitlab.freedesktop.org/drm/intel/issues/118
[i915#1319]: https://gitlab.freedesktop.org/drm/intel/issues/1319
[i915#155]: https://gitlab.freedesktop.org/drm/intel/issues/155
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#1804]: https://gitlab.freedesktop.org/drm/intel/issues/1804
[i915#1814]: https://gitlab.freedesktop.org/drm/intel/issues/1814
[i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888
[i915#2292]: https://gitlab.freedesktop.org/drm/intel/issues/2292
[i915#2369]: https://gitlab.freedesktop.org/drm/intel/issues/2369
[i915#2642]: https://gitlab.freedesktop.org/drm/intel/issues/2642
[i915#265]: https://gitlab.freedesktop.org/drm/intel/issues/265
[i915#2658]: https://gitlab.freedesktop.org/drm/intel/issues/2658
[i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
[i915#2681]: https://gitlab.freedesktop.org/drm/intel/issues/2681
[i915#2684]: https://gitlab.freedesktop.org/drm/intel/issues/2684
[i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
[i915#2846]: https://gitlab.freedesktop.org/drm/intel/issues/2846
[i915#2920]: https://gitlab.freedesktop.org/drm/intel/issues/2920
[i915#295]: https://gitlab.freedesktop.org/drm/intel/issues/295
[i915#2994]: https://gitlab.freedesktop.org/drm/intel/issues/2994
[i915#3002]: https://gitlab.freedesktop.org/drm/intel/issues/3002
[i915#3063]: https://gitlab.freedesktop.org/drm/intel/issues/3063
[i915#307]: https://gitlab.freedesktop.org/drm/intel/issues/307
[i915#31]: https://gitlab.freedesktop.org/drm/intel/issues/31
[i915#3160]: https://gitlab.freedesktop.org/drm/intel/issues/3160
[i915#3219]: https://gitlab.freedesktop.org/drm/intel/issues/3219
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
[i915#49]: https://gitlab.freedesktop.org/drm/intel/issues/49
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#602]: https://gitlab.freedesktop.org/drm/intel/issues/602
[i915#636]: https://gitlab.freedesktop.org/drm/intel/issues/636
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#668]: https://gitlab.freedesktop.org/drm/intel/issues/668
[i915#70]: https://gitlab.freedesktop.org/drm/intel/issues/70
[i915#768]: https://gitlab.freedesktop.org/drm/intel/issues/768
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
[i915#92]: https://gitlab.freedesktop.org/drm/intel/issues/92
[i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95
Participating hosts (11 -> 8)
------------------------------
Missing (3): pig-skl-6260u pig-kbl-iris pig-glk-j5005
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_6074 -> IGTPW_5761
* Piglit: piglit_4509 -> None
CI-20190529: 20190529
CI_DRM_10005: 7a27cb7ac19a95d801c391044cea5274677e7744 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_5761: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/index.html
IGT_6074: 3f43ae9fd22dc5a517786b984dc3aa717997664f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_5761/index.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev