[Mesa-dev] [PATCH] RFC: llvmpipe map scene buffers outside thread.

Jose Fonseca jfonseca at vmware.com
Tue Nov 10 13:33:41 PST 2015


On 09/11/15 03:58, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> There might be a reason we do this inside the thread, but I'm not aware of it
> yet, move stuff around and see if this jogs anyone's memory.

It might be a relic from the time where we had swizzled tiles.

Jose

>
> Doing this outside the thread at least with front buffer rendering avoids
> problems with XGetImage failing in the thread and deadlocking, now things
> crash, which is a lot nicer from a piglit point of view.
> ---
>   src/gallium/drivers/llvmpipe/lp_scene.c | 21 ++++++++++++++++-----
>   src/gallium/drivers/llvmpipe/lp_scene.h |  5 +++--
>   src/gallium/drivers/llvmpipe/lp_setup.c |  1 +
>   3 files changed, 20 insertions(+), 7 deletions(-)
>
> diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c
> index 2441b3c..1a6fe5c 100644
> --- a/src/gallium/drivers/llvmpipe/lp_scene.c
> +++ b/src/gallium/drivers/llvmpipe/lp_scene.c
> @@ -147,7 +147,7 @@ lp_scene_bin_reset(struct lp_scene *scene, unsigned x, unsigned y)
>
>
>   void
> -lp_scene_begin_rasterization(struct lp_scene *scene)
> +lp_scene_map_buffers(struct lp_scene *scene)
>   {
>      const struct pipe_framebuffer_state *fb = &scene->fb;
>      int i;
> @@ -200,16 +200,20 @@ lp_scene_begin_rasterization(struct lp_scene *scene)
>      }
>   }
>
> -
> +void
> +lp_scene_begin_rasterization(struct lp_scene *scene)
> +{
> +   scene->started = true;
> +}
>
>
>   /**
>    * Free all the temporary data in a scene.
>    */
> -void
> -lp_scene_end_rasterization(struct lp_scene *scene )
> +static void
> +lp_scene_unmap_buffers(struct lp_scene *scene )
>   {
> -   int i, j;
> +   int i;
>
>      /* Unmap color buffers */
>      for (i = 0; i < scene->fb.nr_cbufs; i++) {
> @@ -232,7 +236,14 @@ lp_scene_end_rasterization(struct lp_scene *scene )
>                                 zsbuf->u.tex.first_layer);
>         scene->zsbuf.map = NULL;
>      }
> +}
>
> +void
> +lp_scene_end_rasterization(struct lp_scene *scene )
> +{
> +   int i, j;
> +   lp_scene_unmap_buffers(scene);
> +   scene->started = false;
>      /* Reset all command lists:
>       */
>      for (i = 0; i < scene->tiles_x; i++) {
> diff --git a/src/gallium/drivers/llvmpipe/lp_scene.h b/src/gallium/drivers/llvmpipe/lp_scene.h
> index b1464bb..7ed38c9 100644
> --- a/src/gallium/drivers/llvmpipe/lp_scene.h
> +++ b/src/gallium/drivers/llvmpipe/lp_scene.h
> @@ -178,6 +178,7 @@ struct lp_scene {
>
>      struct cmd_bin tile[TILES_X][TILES_Y];
>      struct data_block_list data;
> +   boolean started;
>   };
>
>
> @@ -405,8 +406,8 @@ lp_scene_begin_rasterization(struct lp_scene *scene);
>   void
>   lp_scene_end_rasterization(struct lp_scene *scene );
>
> -
> -
> +void
> +lp_scene_map_buffers(struct lp_scene *scene);
>
>
>   #endif /* LP_BIN_H */
> diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
> index 1778b13..df2c323 100644
> --- a/src/gallium/drivers/llvmpipe/lp_setup.c
> +++ b/src/gallium/drivers/llvmpipe/lp_setup.c
> @@ -176,6 +176,7 @@ lp_setup_rasterize_scene( struct lp_setup_context *setup )
>       * Certainly, lp_scene_end_rasterization() would need to be deferred too
>       * and there's probably other bits why this doesn't actually work.
>       */
> +   lp_scene_map_buffers(scene);
>      lp_rast_queue_scene(screen->rast, scene);
>      lp_rast_finish(screen->rast);
>      pipe_mutex_unlock(screen->rast_mutex);
>



More information about the mesa-dev mailing list