Revert "llvmpipe: allow vertex processing and fragment processing in parallel"
authorGert Wollny <gert.wollny@collabora.com>
Thu, 10 Mar 2022 13:17:55 +0000 (14:17 +0100)
committerMarge Bot <emma+marge@anholt.net>
Mon, 14 Mar 2022 09:22:22 +0000 (09:22 +0000)
This reverts commit ec8104c6b227421b3a21e9c0652e3050066bb169.
  llvmpipe: allow vertex processing and fragment processing in parallel

The commit breaks the the virglrenderer vtest environment used in the
virglrednerer CI and running wayland in virtualized environments.

Related: #6130
Related: #6110

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15338>

src/gallium/drivers/llvmpipe/lp_rast.c
src/gallium/drivers/llvmpipe/lp_scene.c
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_setup_context.h

index e27d78a..f67fbda 100644 (file)
@@ -81,6 +81,8 @@ lp_rast_begin( struct lp_rasterizer *rast,
 static void
 lp_rast_end( struct lp_rasterizer *rast )
 {
+   lp_scene_end_rasterization( rast->curr_scene );
+
    rast->curr_scene = NULL;
 }
 
index dbe0cc3..3d109ff 100644 (file)
@@ -100,7 +100,7 @@ lp_scene_create( struct lp_setup_context *setup )
 void
 lp_scene_destroy(struct lp_scene *scene)
 {
-   lp_scene_end_rasterization(scene);
+   lp_fence_reference(&scene->fence, NULL);
    mtx_destroy(&scene->mutex);
    assert(scene->data.head == &scene->data.first);
    slab_free_st(&scene->setup->scene_slab, scene);
index 4c9f6da..614a058 100644 (file)
@@ -73,7 +73,6 @@ lp_setup_wait_empty_scene(struct lp_setup_context *setup)
       debug_printf("%s: wait for scene %d\n",
                    __FUNCTION__, setup->scenes[0]->fence->id);
       lp_fence_wait(setup->scenes[0]->fence);
-      lp_scene_end_rasterization(setup->scenes[0]);
    }
    return 0;
 }
@@ -87,10 +86,8 @@ lp_setup_get_empty_scene(struct lp_setup_context *setup)
    /* try and find a scene that isn't being used */
    for (i = 0; i < setup->num_active_scenes; i++) {
       if (setup->scenes[i]->fence) {
-         if (lp_fence_signalled(setup->scenes[i]->fence)) {
-            lp_scene_end_rasterization(setup->scenes[i]);
+         if (lp_fence_signalled(setup->scene->fence))
             break;
-         }
       } else
          break;
    }
@@ -213,9 +210,22 @@ lp_setup_rasterize_scene( struct lp_setup_context *setup )
       setup->last_fence->issued = TRUE;
 
    mtx_lock(&screen->rast_mutex);
+
+   /* FIXME: We enqueue the scene then wait on the rasterizer to finish.
+    * This means we never actually run any vertex stuff in parallel to
+    * rasterization (not in the same context at least) which is what the
+    * multiple scenes per setup is about - when we get a new empty scene
+    * any old one is already empty again because we waited here for
+    * raster tasks to be finished. Ideally, we shouldn't need to wait here
+    * and rely on fences elsewhere when waiting is necessary.
+    * Certainly, lp_scene_end_rasterization() would need to be deferred too
+    * and there's probably other bits why this doesn't actually work.
+    */
    lp_rast_queue_scene(screen->rast, scene);
+   lp_rast_finish(screen->rast);
    mtx_unlock(&screen->rast_mutex);
 
+   lp_scene_end_rasterization(setup->scene);
    lp_setup_reset( setup );
 
    LP_DBG(DEBUG_SETUP, "%s done \n", __FUNCTION__);
index 420b78e..92dfeb8 100644 (file)
@@ -56,6 +56,7 @@ struct lp_setup_variant;
 
 
 /** Max number of scenes */
+/* XXX: make multiple scenes per context work, see lp_setup_rasterize_scene */
 #define INITIAL_SCENES 4
 #define MAX_SCENES 64