lib: Extract helpers for determining submission method
PATCH 1/3 lib: Extract helpers for determining submission method
Couple of tests are using either determining submission method, or pretty printing. Let's move those to helpers in lib.
--- lib/igt_aux.c | 18 +++++++++++++ lib/igt_aux.h | 2 ++ lib/igt_gt.c | 63 +++++++++++++++++++++++++++++++++++++++++++++ lib/igt_gt.h | 7 +++++ tests/gem_ctx_thrash.c | 19 ++------------ tests/gem_eio.c | 45 ++------------------------------ tests/gem_exec_await.c | 39 ++-------------------------- tests/gem_exec_fence.c | 41 +++-------------------------- tests/gem_exec_latency.c | 31 +--------------------- tests/gem_exec_nop.c | 31 +--------------------- tests/gem_exec_schedule.c | 40 ++-------------------------- tests/gem_exec_whisper.c | 31 +--------------------- tests/gem_read_read_speed.c | 17 +----------- tests/gem_sync.c | 31 +--------------------- 14 files changed, 106 insertions(+), 309 deletions(-)
lib/igt_aux.c +18 -0
@@ -1455,6 +1455,24 @@ igt_show_stat(proc_t *info, int *state, const char *fn) ++*state; } +void igt_show_submission_method (int fd) +{ +const unsigned flags =gem_submission_method (fd); + +if (flags &GEM_SUBMISSION_GUC ) { +igt_info ("Using GuC submission\n" ); +return ; + } + +if (flags &GEM_SUBMISSION_EXECLISTS ) { +igt_info ("Using Execlists submission\n" ); +return ; + } + +igt_info ("Using Legacy submission%s\n" , + flags &GEM_SUBMISSION_SEMAPHORES ?", with semaphores" :"" ); +} +static void __igt_lsof_fds (proc_t *proc_info,int *state,char *proc_path,const char *dir) {
lib/igt_aux.h +2 -0
@@ -278,6 +278,8 @@ void igt_unlock_mem(void); ret_; \ }) +void igt_show_submission_method (int fd); +struct igt_mean ;void igt_start_siglatency (int sig);/* 0 => SIGRTMIN (default) */ double igt_stop_siglatency (struct igt_mean *result);
lib/igt_gt.c +63 -0
66 lines not on this page · raw message
lib/igt_gt.h +7 -0
@@ -80,4 +80,11 @@ extern const struct intel_execution_engine {bool gem_can_store_dword (int fd,unsigned int engine); +#define GEM_SUBMISSION_SEMAPHORES (1 << 0) +#define GEM_SUBMISSION_EXECLISTS (1 << 1) +#define GEM_SUBMISSION_GUC (1 << 2) +unsigned gem_submission_method (int fd); +bool gem_has_semaphores (int fd); +bool gem_has_execlists (int fd); +#endif /* IGT_GT_H */
tests/gem_ctx_thrash.c +2 -17
@@ -42,21 +42,6 @@ static void xchg_int(void *array, unsigned i, unsigned j)igt_swap (A [i],A [j]); } -static bool has_execlists (int fd) -{ -bool enabled = false; -int dir; - - dir =igt_sysfs_open_parameters (fd); -if (dir <0 ) -return false; - - enabled =igt_sysfs_get_boolean (dir,"enable_execlists" ); -close (dir); - -return enabled; -} -static unsigned context_size (int fd) {const int gen =intel_gen (intel_get_drm_devid (fd));
@@ -86,7 +71,7 @@ static unsigned get_num_contexts(int fd, int num_engines) ggtt_size =gem_global_aperture_size (fd); size =context_size (fd); -if (has_execlists (fd)) { +if (gem_has_execlists (fd)) { size +=4 <<12 ;/* ringbuffer as well */ if (num_engines)/* one per engine with execlists */ size *= num_engines;
@@ -95,7 +80,7 @@ static unsigned get_num_contexts(int fd, int num_engines) count =3 * (ggtt_size / size) /2 ;igt_info ("Creating %lld contexts (assuming of size %lld%s)\n" , (long long )count, (long long )size, -has_execlists (fd) ?" with execlists" :"" ); +gem_has_execlists (fd) ?" with execlists" :"" );intel_require_memory (count, size,CHECK_RAM |CHECK_SWAP );return count;
tests/gem_eio.c +2 -43
69 lines not on this page · raw message
tests/gem_exec_await.c +2 -37
@@ -246,40 +246,6 @@ static void wide(int fd, int ring_size, int timeout, unsigned int flags)free (exec); } -#define HAVE_EXECLISTS 0x1 -static unsigned int print_welcome (int fd) -{ -unsigned int result =0 ; -bool active; -int dir; - - dir =igt_sysfs_open_parameters (fd); -if (dir <0 ) -return 0 ; - - active =igt_sysfs_get_boolean (dir,"enable_guc_submission" ); -if (active) { -igt_info ("Using GuC submission\n" ); - result |=HAVE_EXECLISTS ; - goto out; - } - - active =igt_sysfs_get_boolean (dir,"enable_execlists" ); -if (active) { -igt_info ("Using Execlists submission\n" ); - result |=HAVE_EXECLISTS ; - goto out; - } - - active =igt_sysfs_get_boolean (dir,"semaphores" ); -igt_info ("Using Legacy submission%s\n" , - active ?", with semaphores" :"" ); - -out: -close (dir); -return result; -} -struct cork {int device;uint32_t handle;
@@ -374,14 +340,13 @@ igt_mainint device =-1 ; igt_fixture { -unsigned int caps; device =drm_open_driver (DRIVER_INTEL );igt_require_gem (device); - caps =print_welcome (device); +igt_show_submission_method (device); ring_size =measure_ring_size (device) -10 ; -if (!(caps &HAVE_EXECLISTS )) +if (!gem_has_execlists (device)) ring_size /=2 ;igt_info ("Ring size: %d batches\n" , ring_size);igt_require (ring_size >0 );
tests/gem_exec_fence.c +3 -38
71 lines not on this page · raw message
tests/gem_exec_latency.c +1 -30
@@ -407,35 +407,6 @@ static void latency_from_ring(int fd,gem_close (fd, obj[2 ].handle); } -static void print_welcome (int fd) -{ -bool active; -int dir; - - dir =igt_sysfs_open_parameters (fd); -if (dir <0 ) -return ; - - active =igt_sysfs_get_boolean (dir,"enable_guc_submission" ); -if (active) { -igt_info ("Using GuC submission\n" ); - goto out; - } - - active =igt_sysfs_get_boolean (dir,"enable_execlists" ); -if (active) { -igt_info ("Using Execlists submission\n" ); - goto out; - } - - active =igt_sysfs_get_boolean (dir,"semaphores" ); -igt_info ("Using Legacy submission%s\n" , - active ?", with semaphores" :"" ); - -out: -close (dir); -} - igt_main {const struct intel_execution_engine *e;
@@ -446,7 +417,7 @@ igt_mainigt_require_gem (device);gem_require_mmap_wc (device); -print_welcome (device); +igt_show_submission_method (device); ring_size =measure_ring_size (device);igt_info ("Ring size: %d batches\n" , ring_size);
tests/gem_exec_nop.c +1 -30
@@ -665,35 +665,6 @@ static void preempt(int fd, uint32_t handle, ring_name, count, elapsed(&start, &now)*1e6 / count); } -static void print_welcome (int fd) -{ -bool active; -int dir; - - dir =igt_sysfs_open_parameters (fd); -if (dir <0 ) -return ; - - active =igt_sysfs_get_boolean (dir,"enable_guc_submission" ); -if (active) { -igt_info ("Using GuC submission\n" ); - goto out; - } - - active =igt_sysfs_get_boolean (dir,"enable_execlists" ); -if (active) { -igt_info ("Using Execlists submission\n" ); - goto out; - } - - active =igt_sysfs_get_boolean (dir,"semaphores" ); -igt_info ("Using Legacy submission%s\n" , - active ?", with semaphores" :"" ); - -out: -close (dir); -} -static unsigned int has_scheduler (int fd) {drm_i915_getparam_t gp;
@@ -727,7 +698,7 @@ igt_main device =drm_open_driver (DRIVER_INTEL );igt_require_gem (device); -print_welcome (device); +igt_show_submission_method (device); sched_caps =has_scheduler (device); handle =gem_create (device,4096 );
tests/gem_exec_schedule.c +2 -38
@@ -1000,45 +1000,9 @@ static unsigned int has_scheduler(int fd)return caps; } -#define HAVE_EXECLISTS 0x1 -#define HAVE_GUC 0x2 -static unsigned print_welcome (int fd) -{ -unsigned flags =0 ; -bool active; -int dir; - - dir =igt_sysfs_open_parameters (fd); -if (dir <0 ) -return 0 ; - - active =igt_sysfs_get_boolean (dir,"enable_guc_submission" ); -if (active) { -igt_info ("Using GuC submission\n" ); - flags |=HAVE_GUC |HAVE_EXECLISTS ; - goto out; - } - - active =igt_sysfs_get_boolean (dir,"enable_execlists" ); -if (active) { -igt_info ("Using Execlists submission\n" ); - flags |=HAVE_EXECLISTS ; - goto out; - } - - active =igt_sysfs_get_boolean (dir,"semaphores" ); -igt_info ("Using Legacy submission%s\n" , - active ?", with semaphores" :"" ); - -out: -close (dir); -return flags; -} - igt_main {const struct intel_execution_engine *e; -unsigned int exec_caps =0 ;unsigned int sched_caps =0 ;int fd =-1 ;
@@ -1046,7 +1010,7 @@ igt_main igt_fixture { fd =drm_open_driver_master (DRIVER_INTEL ); - exec_caps =print_welcome (fd); +igt_show_submission_method (fd); sched_caps =has_scheduler (fd);igt_require_gem (fd);gem_require_mmap_wc (fd);
@@ -1135,7 +1099,7 @@ igt_mainctx_has_priority (fd);/* need separate rings */ -igt_require (exec_caps &HAVE_EXECLISTS ); +igt_require (gem_has_execlists (fd)); }for (e = intel_execution_engines; e->name; e++) {
tests/gem_exec_whisper.c +1 -30
@@ -552,35 +552,6 @@ static void whisper(int fd, unsigned engine, unsigned flags)close (debugfs); } -static void print_welcome (int fd) -{ -bool active; -int dir; - - dir =igt_sysfs_open_parameters (fd); -if (dir <0 ) -return ; - - active =igt_sysfs_get_boolean (dir,"enable_guc_submission" ); -if (active) { -igt_info ("Using GuC submission\n" ); - goto out; - } - - active =igt_sysfs_get_boolean (dir,"enable_execlists" ); -if (active) { -igt_info ("Using Execlists submission\n" ); - goto out; - } - - active =igt_sysfs_get_boolean (dir,"semaphores" ); -igt_info ("Using Legacy submission%s\n" , - active ?", with semaphores" :"" ); - -out: -close (dir); -} - igt_main { const struct mode {
@@ -615,7 +586,7 @@ igt_main fd =drm_open_driver_master (DRIVER_INTEL );igt_require_gem (fd);igt_require (gem_can_store_dword (fd,0 )); -print_welcome (fd); +igt_show_submission_method (fd);igt_fork_hang_detector (fd); }
tests/gem_read_read_speed.c +1 -16
@@ -49,21 +49,6 @@ igt_render_copyfunc_t rendercopy;struct intel_batchbuffer *batch;int width, height; -static int semaphores_enabled (int fd) -{ -bool enabled = false; -int dir; - - dir =igt_sysfs_open_parameters (fd); -if (dir <0 ) -return false; - - enabled =igt_sysfs_get_boolean (dir,"semaphores" ); -close (dir); - -return enabled; -} -static drm_intel_bo *rcs_copy_bo (drm_intel_bo *dst,drm_intel_bo *src) {struct igt_buf d = {
@@ -212,7 +197,7 @@ igt_main batch =intel_batchbuffer_alloc (bufmgr, devid); -igt_info ("Semaphores: %d\n" ,semaphores_enabled (fd)); +igt_show_submission_method (fd); }for (i =0 ; sizes[i] !=0 ; i++) {
tests/gem_sync.c +1 -30
@@ -807,35 +807,6 @@ preempt(int fd, unsigned ring, int num_children, int timeout)gem_context_destroy (fd, ctx[0 ]); } -static void print_welcome (int fd) -{ -bool active; -int dir; - - dir =igt_sysfs_open_parameters (fd); -if (dir <0 ) -return ; - - active =igt_sysfs_get_boolean (dir,"enable_guc_submission" ); -if (active) { -igt_info ("Using GuC submission\n" ); - goto out; - } - - active =igt_sysfs_get_boolean (dir,"enable_execlists" ); -if (active) { -igt_info ("Using Execlists submission\n" ); - goto out; - } - - active =igt_sysfs_get_boolean (dir,"semaphores" ); -igt_info ("Using Legacy submission %s\n" , - active ?", with semaphores" :"" ); - -out: -close (dir); -} -static unsigned int has_scheduler (int fd) {drm_i915_getparam_t gp;
@@ -869,7 +840,7 @@ igt_main igt_fixture { fd =drm_open_driver (DRIVER_INTEL );igt_require_gem (fd); -print_welcome (fd); +igt_show_submission_method (fd); sched_caps =has_scheduler (fd);igt_fork_hang_detector (fd);
Signature · 6 lines
2.13.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/3 lib: Extract helpers for determining scheduler capabilities
Couple of tests are using either determining scheduler capabilities or pretty printing. Let's move those to helpers in lib. We can also keep the value obtained from getparam static.
--- lib/igt_aux.c | 14 ++++++++++ lib/igt_aux.h | 1 + lib/ioctl_wrappers.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++ lib/ioctl_wrappers.h | 8 ++++++ tests/gem_exec_nop.c | 34 +++---------------------- tests/gem_exec_schedule.c | 47 +++++----------------------------- tests/gem_exec_whisper.c | 22 ++-------------- tests/gem_sync.c | 34 +++---------------------- 8 files changed, 103 insertions(+), 122 deletions(-)
lib/igt_aux.c +14 -0
@@ -1473,6 +1473,20 @@ void igt_show_submission_method(int fd) flags & GEM_SUBMISSION_SEMAPHORES ? ", with semaphores" : ""); } +void igt_show_scheduler_capability (int fd) +{ +unsigned caps =gem_scheduler_capability (fd); + +if (!caps) +return ; + +igt_info ("Has kernel scheduler\n" ); +if (caps &LOCAL_I915_SCHEDULER_CAP_PRIORITY ) +igt_info (" - With priority sorting\n" ); +if (caps &LOCAL_I915_SCHEDULER_CAP_PREEMPTION ) +igt_info (" - With preemption enabled\n" ); +} +static void __igt_lsof_fds (proc_t *proc_info,int *state,char *proc_path,const char *dir) {
lib/igt_aux.h +1 -0
@@ -279,6 +279,7 @@ void igt_unlock_mem(void); })void igt_show_submission_method (int fd); +void igt_show_scheduler_capability (int fd);struct igt_mean ;void igt_start_siglatency (int sig);/* 0 => SIGRTMIN (default) */
lib/ioctl_wrappers.c +65 -0
71 lines not on this page · raw message
lib/ioctl_wrappers.h +8 -0
@@ -187,6 +187,14 @@ void gem_require_ring(int fd, unsigned ring);bool gem_has_mocs_registers (int fd);void gem_require_mocs_registers (int fd); +#define LOCAL_I915_SCHEDULER_CAP_ENABLED (1 << 0) +#define LOCAL_I915_SCHEDULER_CAP_PRIORITY (1 << 1) +#define LOCAL_I915_SCHEDULER_CAP_PREEMPTION (1 << 2) +unsigned gem_scheduler_capability (int fd); +bool gem_has_scheduler (int fd); +bool gem_has_ctx_priority (int fd); +bool gem_has_preemption (int fd); +/* prime */ struct local_dma_buf_sync {uint64_t flags;
tests/gem_exec_nop.c +3 -31
@@ -44,8 +44,6 @@#include <time.h> #include "drm.h" -#define BIT (x) (1ul << (x)) -#define LOCAL_I915_EXEC_NO_RELOC (1<<11)#define LOCAL_I915_EXEC_HANDLE_LUT (1<<12)
@@ -54,10 +52,6 @@#define ENGINE_FLAGS (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK) -#define LOCAL_PARAM_HAS_SCHEDULER 41 -#define HAS_SCHEDULER BIT(0) -#define HAS_PRIORITY BIT(1) -#define HAS_PREEMPTION BIT(2)#define LOCAL_CONTEXT_PARAM_PRIORITY 6#define MAX_PRIO 1023#define MIN_PRIO -1023
@@ -665,31 +659,9 @@ static void preempt(int fd, uint32_t handle, ring_name, count, elapsed(&start, &now)*1e6 / count); } -static unsigned int has_scheduler (int fd) -{ -drm_i915_getparam_t gp; -unsigned int caps =0 ; - - gp.param =LOCAL_PARAM_HAS_SCHEDULER ; - gp.value = (int *)∩︀ -drmIoctl (fd,DRM_IOCTL_I915_GETPARAM , &gp); - -if (!caps) -return 0 ; - -igt_info ("Has kernel scheduler\n" ); -if (caps &HAS_PRIORITY ) -igt_info (" - With priority sorting\n" ); -if (caps &HAS_PREEMPTION ) -igt_info (" - With preemption enabled\n" ); - -return caps; -} - igt_main {const struct intel_execution_engine *e; -unsigned int sched_caps =0 ;uint32_t handle =0 ;int device =-1 ;
@@ -699,7 +671,7 @@ igt_main device =drm_open_driver (DRIVER_INTEL );igt_require_gem (device);igt_show_submission_method (device); - sched_caps =has_scheduler (device); +igt_show_scheduler_capability (device); handle =gem_create (device,4096 );gem_write (device, handle,0 , &bbe,sizeof (bbe));
@@ -746,8 +718,8 @@ igt_main igt_subtest_group { igt_fixture { -igt_require (sched_caps &HAS_PRIORITY ); -igt_require (sched_caps &HAS_PREEMPTION ); +igt_require (gem_has_ctx_priority (device)); +igt_require (gem_has_preemption (device)); }for (e = intel_execution_engines; e->name; e++) {
tests/gem_exec_schedule.c +7 -40
98 lines not on this page · raw message
tests/gem_exec_whisper.c +2 -20
@@ -191,21 +191,8 @@ static void fini_hang(struct hang *h)close (h->fd); } -#define LOCAL_PARAM_HAS_SCHEDULER 41#define LOCAL_CONTEXT_PARAM_PRIORITY 6 -static bool __has_scheduler (int fd) -{ -drm_i915_getparam_t gp; -int has =-1 ; - - gp.param =LOCAL_PARAM_HAS_SCHEDULER ; - gp.value = &has; -drmIoctl (fd,DRM_IOCTL_I915_GETPARAM , &gp); - -return has >0 ; -} -static int __ctx_set_priority (int fd,uint32_t ctx,int prio) {struct local_i915_gem_context_param param;
@@ -250,13 +237,8 @@ static void whisper(int fd, unsigned engine, unsigned flags)int debugfs;if (flags &PRIORITY ) { -int __fd =drm_open_driver (DRIVER_INTEL ); -bool has_scheduler =__has_scheduler (__fd); -bool ctx_has_priority = -__ctx_set_priority (__fd,0 ,1 ) ==0 ; -close (__fd); - -igt_require (has_scheduler && ctx_has_priority); +igt_require (gem_has_scheduler (fd)); +igt_require (gem_has_ctx_priority (fd)); } debugfs =igt_debugfs_dir (fd);
tests/gem_sync.c +3 -31
@@ -27,18 +27,12 @@#include "igt.h" #include "igt_sysfs.h" -#define BIT (x) (1ul << (x)) -#define LOCAL_I915_EXEC_NO_RELOC (1<<11)#define LOCAL_I915_EXEC_HANDLE_LUT (1<<12)#define LOCAL_I915_EXEC_BSD_SHIFT (13)#define LOCAL_I915_EXEC_BSD_MASK (3 << LOCAL_I915_EXEC_BSD_SHIFT) -#define LOCAL_PARAM_HAS_SCHEDULER 41 -#define HAS_SCHEDULER BIT(0) -#define HAS_PRIORITY BIT(1) -#define HAS_PREEMPTION BIT(2)#define LOCAL_CONTEXT_PARAM_PRIORITY 6#define MAX_PRIO 1023#define MIN_PRIO -1023
@@ -807,32 +801,10 @@ preempt(int fd, unsigned ring, int num_children, int timeout)gem_context_destroy (fd, ctx[0 ]); } -static unsigned int has_scheduler (int fd) -{ -drm_i915_getparam_t gp; -unsigned int caps =0 ; - - gp.param =LOCAL_PARAM_HAS_SCHEDULER ; - gp.value = (int *)∩︀ -drmIoctl (fd,DRM_IOCTL_I915_GETPARAM , &gp); - -if (!caps) -return 0 ; - -igt_info ("Has kernel scheduler\n" ); -if (caps &HAS_PRIORITY ) -igt_info (" - With priority sorting\n" ); -if (caps &HAS_PREEMPTION ) -igt_info (" - With preemption enabled\n" ); - -return caps; -} - igt_main {const struct intel_execution_engine *e;const int ncpus =sysconf (_SC_NPROCESSORS_ONLN); -unsigned int sched_caps =0 ;int fd =-1 ;igt_skip_on_simulation ();
@@ -841,7 +813,7 @@ igt_main fd =drm_open_driver (DRIVER_INTEL );igt_require_gem (fd);igt_show_submission_method (fd); - sched_caps =has_scheduler (fd); +igt_show_scheduler_capability (fd);igt_fork_hang_detector (fd); }
@@ -886,8 +858,8 @@ igt_main igt_subtest_group { igt_fixture { -igt_require (sched_caps &HAS_PRIORITY ); -igt_require (sched_caps &HAS_PREEMPTION ); +igt_require (gem_has_ctx_priority (fd)); +igt_require (gem_has_preemption (fd)); }igt_subtest ("preempt-all" )
Signature · 6 lines
2.13.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 2/3] lib: Extract helpers for determining scheduler capabilities
Quoting Michał Winiarski (2017-10-11 10:15:25)
Quoted 9 lines
Couple of tests are using either determining scheduler capabilities or pretty printing. Let's move those to helpers in lib. We can also keep the value obtained from getparam static.
Signed-off-by Michał Winiarski <[email protected]>Cc Arkadiusz Hiler <[email protected]>Cc Chris Wilson <[email protected]>Cc Katarzyna Dec <[email protected]>Cc Petri Latvala <[email protected]>
Bah humbug.
Quoted 5 lines
--- lib/igt_aux.c | 14 ++++++++++ lib/igt_aux.h | 1 + lib/ioctl_wrappers.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++ lib/ioctl_wrappers.h | 8 ++++++
If we have a choice, not here.
lib/i915/gem_scheduler.c ?
tests/gem_exec_nop.c igt_main · line 674
Quoted 12 lines
tests/gem_exec_nop.c | 34 +++---------------------- tests/gem_exec_schedule.c | 47 +++++----------------------------- tests/gem_exec_whisper.c | 22 ++-------------- tests/gem_sync.c | 34 +++---------------------- 8 files changed, 103 insertions(+), 122 deletions(-)tests/gem_exec_nop.c +1
-1@@ -699,7 +671,7 @@ igt_main device =drm_open_driver (DRIVER_INTEL );igt_require_gem (device);igt_show_submission_method (device); - sched_caps =has_scheduler (device); +igt_show_scheduler_capability (device);
Is it really generic? My suggestion would be gem_scheduler_show_capability(), or gem_show_scheduler_capability() if we stick to the gem_has_*() format.
tests/gem_exec_nop.c igt_main · line 722
Quoted 11 lines
tests/gem_exec_nop.c +2
-2handle =gem_create (device,4096 );gem_write (device, handle,0 , &bbe,sizeof (bbe));@@ -746,8 +718,8 @@ igt_main igt_subtest_group { igt_fixture { -igt_require (sched_caps &HAS_PRIORITY ); -igt_require (sched_caps &HAS_PREEMPTION ); +igt_require (gem_has_ctx_priority (device)); +igt_require (gem_has_preemption (device));
gem_has_scheduler_preemption() ? Looking to keep some sort of verbose oop-in-C, and room for future expansion.
(And we need to kill all of the gem == i915 at some point. And classes.) -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/3 lib: Extract context priority setparam to a helper
In reply to Michał WiniarskiAnother example of something that is used across different tests, and should be moved to lib.
--- lib/ioctl_wrappers.c | 40 +++++++++++++++++++++++++++++++ lib/ioctl_wrappers.h | 6 +++++ tests/gem_exec_nop.c | 26 ++++---------------- tests/gem_exec_schedule.c | 60 ++++++++++++++++------------------------------- tests/gem_exec_whisper.c | 23 ++++-------------- tests/gem_sync.c | 27 ++++----------------- 6 files changed, 78 insertions(+), 104 deletions(-)
lib/ioctl_wrappers.c +40 -0
@@ -1049,6 +1049,46 @@ void gem_context_require_bannable(int fd)igt_require (has_ban_period || has_bannable); } +#define LOCAL_I915_CONTEXT_PARAM_PRIORITY 0x6 + +/** +* __gem_context_set_priority: +* @fd: open i915 drm file descriptor +* @ctx_id: i915 context id +* @prio: desired context priority +* +* This function modifies priority property of the context. +* It is used by the scheduler to decide on the ordering of requests submitted +* to the hardware. +* +* Returns: An integer equal to zero for success and negative for failure +*/ +int __gem_context_set_priority (int fd,uint32_t ctx_id,int prio) +{ +struct local_i915_gem_context_param p; + +memset (&p,0 ,sizeof (p)); + p.context = ctx_id; + p.size =0 ; + p.param =LOCAL_I915_CONTEXT_PARAM_PRIORITY ; + p.value = prio; + +return __gem_context_set_param (fd, &p); +} + +/** +* gem_context_set_priority: +* @fd: open i915 drm file descriptor +* @ctx_id: i915 context id +* @prio: desired context priority +* +* Like __gem_context_set_priority(), except we assert on failure. +*/ +void gem_context_set_priority (int fd,uint32_t ctx_id,int prio) +{ +igt_assert (__gem_context_set_priority (fd, ctx_id, prio) ==0 ); +} +int __gem_userptr (int fd,void *ptr,int size,int read_only,uint32_t flags,uint32_t *handle) {struct local_i915_gem_userptr userptr;
lib/ioctl_wrappers.h +6 -0
@@ -195,6 +195,12 @@ bool gem_has_scheduler(int fd);bool gem_has_ctx_priority (int fd);bool gem_has_preemption (int fd); +#define LOCAL_I915_CONTEXT_MAX_USER_PRIORITY 1023 +#define LOCAL_I915_CONTEXT_DEFAULT_PRIORITY 0 +#define LOCAL_I915_CONTEXT_MIN_USER_PRIORITY -1023 +int __gem_context_set_priority (int fd,uint32_t ctx,int prio); +void gem_context_set_priority (int fd,uint32_t ctx,int prio); +/* prime */ struct local_dma_buf_sync {uint64_t flags;
tests/gem_exec_nop.c +4 -22
@@ -52,9 +52,8 @@#define ENGINE_FLAGS (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK) -#define LOCAL_CONTEXT_PARAM_PRIORITY 6 -#define MAX_PRIO 1023 -#define MIN_PRIO -1023 +#define MAX_PRIO LOCAL_I915_CONTEXT_MAX_USER_PRIORITY +#define MIN_PRIO LOCAL_I915_CONTEXT_MIN_USER_PRIORITY#define FORKED 1#define CHAINED 2
@@ -585,23 +584,6 @@ static void fence_signal(int fd, uint32_t handle,igt_info ("Signal %s: %'lu cycles (%'lu signals): %.3fus\n" , ring_name, count, signal,elapsed (&start, &now) *1e6 / count); } -static int __ctx_set_priority (int fd,uint32_t ctx,int prio) -{ -struct local_i915_gem_context_param param; - -memset (¶m,0 ,sizeof (param)); - param.context = ctx; - param.size =0 ; - param.param =LOCAL_CONTEXT_PARAM_PRIORITY ; - param.value = prio; - -return __gem_context_set_param (fd, ¶m); -} - -static void ctx_set_priority (int fd,uint32_t ctx,int prio) -{ -igt_assert_eq (__ctx_set_priority (fd, ctx, prio),0 ); -}static void preempt (int fd,uint32_t handle,unsigned ring_id,const char *ring_name)
@@ -615,10 +597,10 @@ static void preempt(int fd, uint32_t handle,gem_require_ring (fd, ring_id); ctx[0 ] =gem_context_create (fd); -ctx_set_priority (fd, ctx[0 ],MIN_PRIO ); +gem_context_set_priority (fd, ctx[0 ],MIN_PRIO ); ctx[1 ] =gem_context_create (fd); -ctx_set_priority (fd, ctx[1 ],MAX_PRIO ); +gem_context_set_priority (fd, ctx[1 ],MAX_PRIO );memset (&obj,0 ,sizeof (obj)); obj.handle = handle;
tests/gem_exec_schedule.c +20 -40
164 lines not on this page · raw message
tests/gem_exec_whisper.c +4 -19
@@ -191,25 +191,10 @@ static void fini_hang(struct hang *h)close (h->fd); } -#define LOCAL_CONTEXT_PARAM_PRIORITY 6 - -static int __ctx_set_priority (int fd,uint32_t ctx,int prio) -{ -struct local_i915_gem_context_param param; - -memset (¶m,0 ,sizeof (param)); - param.context = ctx; - param.size =0 ; - param.param =LOCAL_CONTEXT_PARAM_PRIORITY ; - param.value = prio; - -return __gem_context_set_param (fd, ¶m); -} - -static void ctx_set_priority (int fd,uint32_t ctx) +static void ctx_set_random_priority (int fd,uint32_t ctx) {int prio =hars_petruska_f54_1_random_unsafe_max (1024 ) -512 ; -igt_assert_eq (__ctx_set_priority (fd, ctx, prio),0 ); +gem_context_set_priority (fd, ctx, prio); };static void whisper (int fd,unsigned engine,unsigned flags)
@@ -430,7 +415,7 @@ static void whisper(int fd, unsigned engine, unsigned flags)gem_open (this_fd,gem_flink (fd, handle[1 ]));if (flags &PRIORITY ) -ctx_set_priority (this_fd,0 ); +ctx_set_random_priority (this_fd,0 ); }if (!(flags &CHAIN )) {
@@ -440,7 +425,7 @@ static void whisper(int fd, unsigned engine, unsigned flags)if (flags &CONTEXTS ) { execbuf.rsvd1 = contexts[rand () %64 ];if (flags &PRIORITY ) -ctx_set_priority (this_fd, execbuf.rsvd1); +ctx_set_random_priority (this_fd, execbuf.rsvd1); }gem_execbuf (this_fd, &execbuf);
tests/gem_sync.c +4 -23
@@ -33,9 +33,8 @@#define LOCAL_I915_EXEC_BSD_SHIFT (13)#define LOCAL_I915_EXEC_BSD_MASK (3 << LOCAL_I915_EXEC_BSD_SHIFT) -#define LOCAL_CONTEXT_PARAM_PRIORITY 6 -#define MAX_PRIO 1023 -#define MIN_PRIO -1023 +#define MAX_PRIO LOCAL_I915_CONTEXT_MAX_USER_PRIORITY +#define MIN_PRIO LOCAL_I915_CONTEXT_MIN_USER_PRIORITY#define ENGINE_MASK (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK)
@@ -690,24 +689,6 @@ store_all(int fd, int num_children, int timeout)igt_assert_eq (intel_detect_and_clear_missed_interrupts (fd),0 ); } -static int __ctx_set_priority (int fd,uint32_t ctx,int prio) -{ -struct local_i915_gem_context_param param; - -memset (¶m,0 ,sizeof (param)); - param.context = ctx; - param.size =0 ; - param.param =LOCAL_CONTEXT_PARAM_PRIORITY ; - param.value = prio; - -return __gem_context_set_param (fd, ¶m); -} - -static void ctx_set_priority (int fd,uint32_t ctx,int prio) -{ -igt_assert_eq (__ctx_set_priority (fd, ctx, prio),0 ); -} -static void preempt (int fd,unsigned ring,int num_children,int timeout) {
@@ -746,10 +727,10 @@ preempt(int fd, unsigned ring, int num_children, int timeout) } ctx[0 ] =gem_context_create (fd); -ctx_set_priority (fd, ctx[0 ],MIN_PRIO ); +gem_context_set_priority (fd, ctx[0 ],MIN_PRIO ); ctx[1 ] =gem_context_create (fd); -ctx_set_priority (fd, ctx[1 ],MAX_PRIO ); +gem_context_set_priority (fd, ctx[1 ],MAX_PRIO );intel_detect_and_clear_missed_interrupts (fd); igt_fork(child, num_children) {
Signature · 6 lines
2.13.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 3/3] lib: Extract context priority setparam to a helper
Quoting Michał Winiarski (2017-10-11 10:15:26)
Quoted 8 lines
Another example of something that is used across different tests, and should be moved to lib.
Signed-off-by Michał Winiarski <[email protected]>Cc Arkadiusz Hiler <[email protected]>Cc Chris Wilson <[email protected]>Cc Katarzyna Dec <[email protected]>Cc Petri Latvala <[email protected]>
Happier with the gem_context naming, but
Quoted 3 lines
--- lib/ioctl_wrappers.c | 40 +++++++++++++++++++++++++++++++ lib/ioctl_wrappers.h | 6 +++++
Let's break this habit if we can.
(Happier, but there's still the i915 == gem overshadowing us.) -Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: failure for series starting with [1/3] lib: Extract helpers for determining submission method
In reply to Michał Winiarski== Series Details ==
== Series Details ==
Series: series starting with [1/3] lib: Extract helpers for determining submission method
URL : https://patchwork.freedesktop.org/series/31726/
State : failure
== Summary ==
IGT patchset tested on top of latest successful build 136100c2f00b590bc9485100cce012282c1217cf igt/syncobj_wait: Don't close the timeline early in wait_snapshot
with latest DRM-Tip kernel build CI_DRM_32112dcc40d169e6 drm-tip: 2017y-10m-11d-08h-54m-27s UTC integration manifest
No testlist changes.
Test kms_frontbuffer_tracking:
Subgroup basic:
pass -> INCOMPLETE (fi-cfl-s)fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:462s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:470s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:397s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:572s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:288s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:526s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:530s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:538s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:530s fi-cfl-s total:225 pass:198 dwarn:1 dfail:0 fail:0 skip:25 fi-cnl-y total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:633s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:438s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:608s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:439s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:472s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:510s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:475s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:504s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:587s fi-kbl-7567u total:289 pass:265 dwarn:4 dfail:0 fail:0 skip:20 time:489s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:591s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:674s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:480s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:658s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:533s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:515s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:478s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:585s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:440s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_325/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx