gallium: add pipe_context::set_active_query_state for pausing queries
[mesa.git] / src / gallium / drivers / vc4 / vc4_job.c
index 5d071ec862f6c5a1e6cd540ab5370319363ce1b0..41660f6ac4daffef78ecddb32dc2be651a7ab6ff 100644 (file)
@@ -245,10 +245,19 @@ vc4_job_submit(struct vc4_context *vc4)
                         fprintf(stderr, "Draw call returned %s.  "
                                         "Expect corruption.\n", strerror(errno));
                         warned = true;
+                } else if (!ret) {
+                        vc4->last_emit_seqno = submit.seqno;
                 }
         }
 
-        vc4->last_emit_seqno = submit.seqno;
+        if (vc4->last_emit_seqno - vc4->screen->finished_seqno > 5) {
+                if (!vc4_wait_seqno(vc4->screen,
+                                    vc4->last_emit_seqno - 5,
+                                    PIPE_TIMEOUT_INFINITE,
+                                    "job throttling")) {
+                        fprintf(stderr, "Job throttling failed\n");
+                }
+        }
 
         if (vc4_debug & VC4_DEBUG_ALWAYS_SYNC) {
                 if (!vc4_wait_seqno(vc4->screen, vc4->last_emit_seqno,