summaryrefslogtreecommitdiff
path: root/lib/i915/gem_ring.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-10-11 09:03:46 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2019-10-19 11:13:20 +0100
commitabe63173a1e6edad1253c0c4009ae3c6c0eb384b (patch)
tree1551bdddf20b7fefebe09aa54c137655dea3d0e2 /lib/i915/gem_ring.c
parent5cac0192d4e3252be55955ee99f765e17a464fca (diff)
i915: Use O_NONBLOCK for faster ringsize probing
When the kernel supports O_NONBLOCK reporting of a full execbuf queue, take advantage of that to immediately report when the output would block due to the ring being full. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'lib/i915/gem_ring.c')
-rw-r--r--lib/i915/gem_ring.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/i915/gem_ring.c b/lib/i915/gem_ring.c
index 9f099edf..5ca2a728 100644
--- a/lib/i915/gem_ring.c
+++ b/lib/i915/gem_ring.c
@@ -21,6 +21,7 @@
* IN THE SOFTWARE.
*/
+#include <fcntl.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
@@ -89,11 +90,16 @@ __gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags
count = 0;
do {
- if (__execbuf(fd, &execbuf) == 0) {
+ int err = __execbuf(fd, &execbuf);
+
+ if (err == 0) {
count++;
continue;
}
+ if (err == -EWOULDBLOCK)
+ break;
+
if (last[1] == count)
break;
@@ -102,8 +108,6 @@ __gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags
last[1] = last[0];
last[0] = count;
} while (1);
-
- igt_assert_eq(__execbuf(fd, &execbuf), -EINTR);
igt_assert(count > 2);
memset(&itv, 0, sizeof(itv));
@@ -145,6 +149,9 @@ gem_measure_ring_inflight(int fd, unsigned int engine, enum measure_ring_flags f
fd = gem_reopen_driver(fd);
+ /* When available, disable execbuf throttling */
+ fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | O_NONBLOCK);
+
if (engine == ALL_ENGINES) {
for_each_physical_engine(fd, engine) {
unsigned int count =