1
0
forked from rpms/mesa

backport correct llvmpipe artifact fix

This commit is contained in:
Dave Airlie 2022-05-26 11:02:51 +10:00
parent 57415a0c66
commit 024c891e6f
2 changed files with 29 additions and 102 deletions

View File

@ -1,102 +0,0 @@
From 17138c1943afa845772e9d566bbe168ef678cb36 Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Thu, 26 May 2022 06:58:40 +1000
Subject: [PATCH] Revert "Reinstate: llvmpipe: allow vertex processing and
fragment processing in parallel"
This reverts commit 6bbbe15a783a3b004d994057a96b91d5cf5d08da.
---
src/gallium/drivers/llvmpipe/lp_rast.c | 2 ++
src/gallium/drivers/llvmpipe/lp_scene.c | 2 +-
src/gallium/drivers/llvmpipe/lp_setup.c | 18 ++++++++++++++----
.../drivers/llvmpipe/lp_setup_context.h | 1 +
4 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index e27d78a3432..f67fbda6b01 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -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;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c
index dbe0cc3873c..3d109ff52b6 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.c
+++ b/src/gallium/drivers/llvmpipe/lp_scene.c
@@ -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);
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index ce681792683..366efceca42 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -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__);
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h
index 420b78e2f52..92dfeb890d5 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h
@@ -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
--
2.35.3

View File

@ -0,0 +1,29 @@
From 9f3eeb126143a510511789cf8669d8c24b99e086 Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Thu, 26 May 2022 10:54:51 +1000
Subject: [PATCH] llvmpipe: flush resources for kms swrast path.
The kms_swrast path calls this callback via the dri2 paths,
not flushing caused artifacts when running inside a VM or on hw
in weston/gnome-shell.
Fixes: 6bbbe15a783a ("Reinstate: llvmpipe: allow vertex processing and fragment processing in parallel")
---
src/gallium/drivers/llvmpipe/lp_surface.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c
index cc97565893d..78a1b06b81d 100644
--- a/src/gallium/drivers/llvmpipe/lp_surface.c
+++ b/src/gallium/drivers/llvmpipe/lp_surface.c
@@ -174,6 +174,7 @@ static void lp_blit(struct pipe_context *pipe,
static void
lp_flush_resource(struct pipe_context *ctx, struct pipe_resource *resource)
{
+ llvmpipe_flush_resource(ctx, resource, 0, true, true, false, "resource");
}
--
2.35.3