[1/4] st/mesa: always unmap the uploader in st_atom_array.c

Submitted by Marek Olšák on Feb. 7, 2019, 1:21 a.m.

Details

Message ID 20190207012201.15832-2-maraeo@gmail.com
State New
Headers show
Series "RadeonSI: Upload constants to VRAM via SDMA" ( rev: 3 2 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Marek Olšák Feb. 7, 2019, 1:21 a.m.
From: Marek Olšák <marek.olsak@amd.com>

This is a no-op for drivers supporting persistent mappings.
---
 src/mesa/state_tracker/st_atom_array.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/state_tracker/st_atom_array.c b/src/mesa/state_tracker/st_atom_array.c
index 7a63d7504f3..c5e0792cc1d 100644
--- a/src/mesa/state_tracker/st_atom_array.c
+++ b/src/mesa/state_tracker/st_atom_array.c
@@ -489,31 +489,29 @@  st_setup_current(struct st_context *st,
       vbuffer[bufidx].buffer.resource = NULL;
       /* vbuffer[bufidx].buffer_offset is set below */
       vbuffer[bufidx].stride = 0;
 
       /* Use const_uploader for zero-stride vertex attributes, because
        * it may use a better memory placement than stream_uploader.
        * The reason is that zero-stride attributes can be fetched many
        * times (thousands of times), so a better placement is going to
        * perform better.
        */
-      u_upload_data(st->can_bind_const_buffer_as_vertex ?
-                    st->pipe->const_uploader :
-                    st->pipe->stream_uploader,
+      struct u_upload_mgr *uploader = st->can_bind_const_buffer_as_vertex ?
+                                      st->pipe->const_uploader :
+                                      st->pipe->stream_uploader;
+      u_upload_data(uploader,
                     0, cursor - data, max_alignment, data,
                     &vbuffer[bufidx].buffer_offset,
                     &vbuffer[bufidx].buffer.resource);
-
-      if (!ctx->Const.AllowMappedBuffersDuringExecution &&
-          !st->can_bind_const_buffer_as_vertex) {
-         u_upload_unmap(st->pipe->stream_uploader);
-      }
+      /* Always unmap. The uploader might use explicit flushes. */
+      u_upload_unmap(uploader);
    }
 }
 
 void
 st_setup_current_user(struct st_context *st,
                       const struct st_vertex_program *vp,
                       const struct st_vp_variant *vp_variant,
                       struct pipe_vertex_element *velements,
                       struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers)
 {