<div dir="ltr"><div>Reviewed-by: Marek Olšák <<a href="mailto:marek.olsak@amd.com">marek.olsak@amd.com</a>></div><div><br></div><div>Marek<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 19, 2019 at 4:42 AM Thomas Hellström (VMware) <<a href="mailto:thomas@shipmail.org">thomas@shipmail.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Thomas Hellstrom <<a href="mailto:thellstrom@vmware.com" target="_blank">thellstrom@vmware.com</a>><br>
<br>
For svga, the use of persistent / coherent maps is typically slightly<br>
slower than without them. It's probably a bit case-dependent and<br>
possible to tune, but for now, make sure we can disable those.<br>
<br>
Signed-off-by: Thomas Hellstrom <<a href="mailto:thellstrom@vmware.com" target="_blank">thellstrom@vmware.com</a>><br>
Reviewed-by: Brian Paul <<a href="mailto:brianp@vmware.com" target="_blank">brianp@vmware.com</a>><br>
---<br>
src/gallium/auxiliary/util/u_upload_mgr.c | 14 ++++++++++++--<br>
src/gallium/auxiliary/util/u_upload_mgr.h | 4 ++++<br>
2 files changed, 16 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c<br>
index c2c0ba957e3..73f6cae0b6d 100644<br>
--- a/src/gallium/auxiliary/util/u_upload_mgr.c<br>
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c<br>
@@ -106,8 +106,10 @@ u_upload_clone(struct pipe_context *pipe, struct u_upload_mgr *upload)<br>
struct u_upload_mgr *result = u_upload_create(pipe, upload->default_size,<br>
upload->bind, upload->usage,<br>
upload->flags);<br>
- if (upload->map_persistent &&<br>
- upload->map_flags & PIPE_TRANSFER_FLUSH_EXPLICIT)<br>
+ if (!upload->map_persistent && result->map_persistent)<br>
+ u_upload_disable_persistent(result);<br>
+ else if (upload->map_persistent &&<br>
+ upload->map_flags & PIPE_TRANSFER_FLUSH_EXPLICIT)<br>
u_upload_enable_flush_explicit(result);<br>
<br>
return result;<br>
@@ -121,6 +123,14 @@ u_upload_enable_flush_explicit(struct u_upload_mgr *upload)<br>
upload->map_flags |= PIPE_TRANSFER_FLUSH_EXPLICIT;<br>
}<br>
<br>
+void<br>
+u_upload_disable_persistent(struct u_upload_mgr *upload)<br>
+{<br>
+ upload->map_persistent = FALSE;<br>
+ upload->map_flags &= ~(PIPE_TRANSFER_COHERENT | PIPE_TRANSFER_PERSISTENT);<br>
+ upload->map_flags |= PIPE_TRANSFER_FLUSH_EXPLICIT;<br>
+}<br>
+<br>
static void<br>
upload_unmap_internal(struct u_upload_mgr *upload, boolean destroying)<br>
{<br>
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h b/src/gallium/auxiliary/util/u_upload_mgr.h<br>
index 80832016272..6a4a60963fe 100644<br>
--- a/src/gallium/auxiliary/util/u_upload_mgr.h<br>
+++ b/src/gallium/auxiliary/util/u_upload_mgr.h<br>
@@ -73,6 +73,10 @@ u_upload_clone(struct pipe_context *pipe, struct u_upload_mgr *upload);<br>
void<br>
u_upload_enable_flush_explicit(struct u_upload_mgr *upload);<br>
<br>
+/** Whether to avoid persistent mappings where available */<br>
+void<br>
+u_upload_disable_persistent(struct u_upload_mgr *upload);<br>
+<br>
/**<br>
* Destroy the upload manager.<br>
*/<br>
-- <br>
2.20.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a></blockquote></div>