panfrost: Wait for last job to finish in force_flush_fragment
authorTomeu Vizoso <tomeu.vizoso@collabora.com>
Wed, 27 Mar 2019 15:28:35 +0000 (16:28 +0100)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Wed, 27 Mar 2019 16:03:34 +0000 (17:03 +0100)
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/pan_drm.c

index 887bf19148e7f05222b1cb2f3fbfdba107b7c273..c30beaf2b5001b42b6f2149f5048c2738a22b2d8 100644 (file)
@@ -296,6 +296,14 @@ panfrost_drm_force_flush_fragment(struct panfrost_context *ctx,
                                  struct pipe_fence_handle **fence)
 {
         struct pipe_context *gallium = (struct pipe_context *) ctx;
+        struct panfrost_screen *screen = pan_screen(gallium->screen);
+        struct panfrost_drm *drm = (struct panfrost_drm *)screen->driver;
+        int ret;
+
+        if (!screen->last_fragment_flushed) {
+               drmSyncobjWait(drm->fd, &ctx->out_sync, 1, INT64_MAX, 0, NULL);
+                screen->last_fragment_flushed = true;
+       }
 
         if (fence) {
                 struct panfrost_fence *f = panfrost_fence_create(ctx);