diff options
author | Antonio Argenziano <antonio.argenziano@intel.com> | 2018-03-21 14:08:28 -0700 |
---|---|---|
committer | Antonio Argenziano <antonio.argenziano@intel.com> | 2018-03-22 13:15:24 -0700 |
commit | 07211614318000b3acd7d8f7ecea1f94caa71ecf (patch) | |
tree | 7fc5ccc49569c8a9dfd0db3d6fd5e4359bcbffaf /lib | |
parent | 0d5665783284fee1750bc4a9d7a0378cb5ce77fe (diff) |
igt/gem_measure_ring_size_inflight: Measure smallest inflight ring size
Some tests measure the render's ring size but are actually meant to
measure the smallest across all engines. This patch adds measuring the
smallest size in gem_measure_ring_size_inflight() given the appropriate
parameter.
v2:
- Only expose high level API. (Chris)
v3:
- Use ALL_ENGINES macro.
Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/i915/gem_ring.c | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/lib/i915/gem_ring.c b/lib/i915/gem_ring.c index df92e620..10d2f2cd 100644 --- a/lib/i915/gem_ring.c +++ b/lib/i915/gem_ring.c @@ -30,6 +30,7 @@ #include "drmtest.h" #include "ioctl_wrappers.h" #include "igt_dummyload.h" +#include "igt_gt.h" static int __execbuf(int fd, struct drm_i915_gem_execbuffer2 *execbuf) { @@ -47,22 +48,8 @@ static void alarm_handler(int sig) { } -/** - * gem_measure_ring_inflight: - * @fd: open i915 drm file descriptor - * @engine: execbuf engine flag - * @flags: flags to affect measurement: - * - MEASURE_RING_NEW_CTX: use a new context to account for the space - * used by the lrc init. - * - * This function calculates the maximum number of batches that can be inserted - * at the same time in the ring on the selected engine. - * - * Returns: - * Number of batches that fit in the ring - */ -unsigned int -gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags flags) +static unsigned int +__gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags flags) { struct sigaction old_sa, sa = { .sa_handler = alarm_handler }; struct drm_i915_gem_exec_object2 obj[2]; @@ -129,3 +116,37 @@ gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags f return count; } + +/** + * gem_measure_ring_inflight: + * @fd: open i915 drm file descriptor + * @engine: execbuf engine flag. Use macro ALL_ENGINES to get the minimum + * size across all physical engines. + * @flags: flags to affect measurement: + * - MEASURE_RING_NEW_CTX: use a new context to account for the space + * used by the lrc init. + * + * This function calculates the maximum number of batches that can be inserted + * at the same time in the ring on the selected engine. + * + * Returns: + * Number of batches that fit in the ring + */ +unsigned int +gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags flags) +{ + if (engine == ALL_ENGINES) { + unsigned int global_min = ~0u; + + for_each_physical_engine(fd, engine) { + unsigned int engine_min = __gem_measure_ring_inflight(fd, engine, flags); + + if (engine_min < global_min) + global_min = engine_min; + } + + return global_min; + } + + return __gem_measure_ring_inflight(fd, engine, flags); +} |