[Mesa-dev] [PATCH 14/14] WIP swr: make sure that all rendering is finished on shader destroy

Cherniak, Bruce bruce.cherniak at intel.com
Tue Nov 15 01:47:36 UTC 2016


This works for now, but totally agree with you, we need work attached to fences.  That’s been high on my list.

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>

> On Nov 12, 2016, at 5:00 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> 
> Rendering could still be ongoing (or have yet to start) when the shader
> is deleted. There's no refcounting on the shader text, so insert a
> pipeline stall unconditionally when this happens.
> 
> [Note, this commit should instead introduce a way to attach work to
> fences, so that the freeing can be done in the current fence.]
> 
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
> src/gallium/drivers/swr/swr_state.cpp | 8 ++++++++
> 1 file changed, 8 insertions(+)
> 
> diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp
> index 2c7f3be..8aca557 100644
> --- a/src/gallium/drivers/swr/swr_state.cpp
> +++ b/src/gallium/drivers/swr/swr_state.cpp
> @@ -371,6 +371,10 @@ swr_delete_vs_state(struct pipe_context *pipe, void *vs)
> {
>    struct swr_vertex_shader *swr_vs = (swr_vertex_shader *)vs;
>    FREE((void *)swr_vs->pipe.tokens);
> +   struct swr_screen *screen = swr_screen(pipe->screen);
> +   if (!swr_is_fence_pending(screen->flush_fence))
> +      swr_fence_submit(swr_context(pipe), screen->flush_fence);
> +   swr_fence_finish(pipe->screen, NULL, screen->flush_fence, 0);
>    delete swr_vs;
> }
> 
> @@ -407,6 +411,10 @@ swr_delete_fs_state(struct pipe_context *pipe, void *fs)
> {
>    struct swr_fragment_shader *swr_fs = (swr_fragment_shader *)fs;
>    FREE((void *)swr_fs->pipe.tokens);
> +   struct swr_screen *screen = swr_screen(pipe->screen);
> +   if (!swr_is_fence_pending(screen->flush_fence))
> +      swr_fence_submit(swr_context(pipe), screen->flush_fence);
> +   swr_fence_finish(pipe->screen, NULL, screen->flush_fence, 0);
>    delete swr_fs;
> }
> 
> -- 
> 2.7.3
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list