[Mesa-dev] [PATCH 5/6] gallium/util: Make it possible to disable persistent maps in the upload manager

Marek Olšák maraeo at gmail.com
Fri Jun 21 19:32:31 UTC 2019


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Wed, Jun 19, 2019 at 4:42 AM Thomas Hellström (VMware) <
thomas at shipmail.org> wrote:

> From: Thomas Hellstrom <thellstrom at vmware.com>
>
> For svga, the use of persistent / coherent maps is typically slightly
> slower than without them. It's probably a bit case-dependent and
> possible to tune, but for now, make sure we can disable those.
>
> Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
> Reviewed-by: Brian Paul <brianp at vmware.com>
> ---
>  src/gallium/auxiliary/util/u_upload_mgr.c | 14 ++++++++++++--
>  src/gallium/auxiliary/util/u_upload_mgr.h |  4 ++++
>  2 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c
> b/src/gallium/auxiliary/util/u_upload_mgr.c
> index c2c0ba957e3..73f6cae0b6d 100644
> --- a/src/gallium/auxiliary/util/u_upload_mgr.c
> +++ b/src/gallium/auxiliary/util/u_upload_mgr.c
> @@ -106,8 +106,10 @@ u_upload_clone(struct pipe_context *pipe, struct
> u_upload_mgr *upload)
>     struct u_upload_mgr *result = u_upload_create(pipe,
> upload->default_size,
>                                                   upload->bind,
> upload->usage,
>                                                   upload->flags);
> -   if (upload->map_persistent &&
> -       upload->map_flags & PIPE_TRANSFER_FLUSH_EXPLICIT)
> +   if (!upload->map_persistent && result->map_persistent)
> +      u_upload_disable_persistent(result);
> +   else if (upload->map_persistent &&
> +            upload->map_flags & PIPE_TRANSFER_FLUSH_EXPLICIT)
>        u_upload_enable_flush_explicit(result);
>
>     return result;
> @@ -121,6 +123,14 @@ u_upload_enable_flush_explicit(struct u_upload_mgr
> *upload)
>     upload->map_flags |= PIPE_TRANSFER_FLUSH_EXPLICIT;
>  }
>
> +void
> +u_upload_disable_persistent(struct u_upload_mgr *upload)
> +{
> +   upload->map_persistent = FALSE;
> +   upload->map_flags &= ~(PIPE_TRANSFER_COHERENT |
> PIPE_TRANSFER_PERSISTENT);
> +   upload->map_flags |= PIPE_TRANSFER_FLUSH_EXPLICIT;
> +}
> +
>  static void
>  upload_unmap_internal(struct u_upload_mgr *upload, boolean destroying)
>  {
> diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h
> b/src/gallium/auxiliary/util/u_upload_mgr.h
> index 80832016272..6a4a60963fe 100644
> --- a/src/gallium/auxiliary/util/u_upload_mgr.h
> +++ b/src/gallium/auxiliary/util/u_upload_mgr.h
> @@ -73,6 +73,10 @@ u_upload_clone(struct pipe_context *pipe, struct
> u_upload_mgr *upload);
>  void
>  u_upload_enable_flush_explicit(struct u_upload_mgr *upload);
>
> +/** Whether to avoid persistent mappings where available */
> +void
> +u_upload_disable_persistent(struct u_upload_mgr *upload);
> +
>  /**
>   * Destroy the upload manager.
>   */
> --
> 2.20.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190621/5c674071/attachment.html>


More information about the mesa-dev mailing list