On 11/10/2019 09:06, Chris Wilson wrote:
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@xxxxxxxxxxxxxxxxxx>
---
lib/i915/gem_ring.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/i915/gem_ring.c b/lib/i915/gem_ring.c
index 9f099edff..5ca2a728b 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 =
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx