summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2020-12-21 01:27:44 -0500
committerMarge Bot <eric+marge@anholt.net>2021-01-27 23:53:34 +0000
commit0aa63c31ca807e8aaa01a75d918830ac87fc070c (patch)
tree6bd16338d163dd1b167d8d42b5ae25e386949f32
parent8be936f29511d95a3ab385f08d3dc67f599b7e33 (diff)
Revert "gallium/u_upload_mgr: allow use of FLUSH_EXPLICIT with persistent mappings"
It's no longer needed after radeonsi had its SDMA uploads removed. This reverts commit 54f7545cd7925db9ff78b9dccbff7406dd2ad4a4. Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8298>
-rw-r--r--src/gallium/auxiliary/util/u_upload_mgr.c36
-rw-r--r--src/gallium/auxiliary/util/u_upload_mgr.h4
2 files changed, 8 insertions, 32 deletions
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
index 6eab49fdab0..1d48cc08e75 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -54,7 +54,6 @@ struct u_upload_mgr {
unsigned buffer_size; /* Same as buffer->width0. */
unsigned offset; /* Aligned offset to the upload buffer, pointing
* at the first unused byte. */
- unsigned flushed_size; /* Size we have flushed by transfer_flush_region. */
};
@@ -109,22 +108,11 @@ u_upload_clone(struct pipe_context *pipe, struct u_upload_mgr *upload)
upload->flags);
if (!upload->map_persistent && result->map_persistent)
u_upload_disable_persistent(result);
- else if (upload->map_persistent &&
- upload->map_flags & PIPE_MAP_FLUSH_EXPLICIT)
- u_upload_enable_flush_explicit(result);
return result;
}
void
-u_upload_enable_flush_explicit(struct u_upload_mgr *upload)
-{
- assert(upload->map_persistent);
- upload->map_flags &= ~PIPE_MAP_COHERENT;
- upload->map_flags |= PIPE_MAP_FLUSH_EXPLICIT;
-}
-
-void
u_upload_disable_persistent(struct u_upload_mgr *upload)
{
upload->map_persistent = FALSE;
@@ -135,27 +123,19 @@ u_upload_disable_persistent(struct u_upload_mgr *upload)
static void
upload_unmap_internal(struct u_upload_mgr *upload, boolean destroying)
{
- if (!upload->transfer)
+ if ((!destroying && upload->map_persistent) || !upload->transfer)
return;
- if (upload->map_flags & PIPE_MAP_FLUSH_EXPLICIT) {
- struct pipe_box *box = &upload->transfer->box;
- unsigned flush_offset = box->x + upload->flushed_size;
+ struct pipe_box *box = &upload->transfer->box;
- if (upload->offset > flush_offset) {
- pipe_buffer_flush_mapped_range(upload->pipe, upload->transfer,
- flush_offset,
- upload->offset - flush_offset);
- upload->flushed_size = upload->offset;
- }
+ if (!upload->map_persistent && (int) upload->offset > box->x) {
+ pipe_buffer_flush_mapped_range(upload->pipe, upload->transfer,
+ box->x, upload->offset - box->x);
}
- if (destroying || !upload->map_persistent) {
- pipe_transfer_unmap(upload->pipe, upload->transfer);
- upload->transfer = NULL;
- upload->map = NULL;
- upload->flushed_size = 0;
- }
+ pipe_transfer_unmap(upload->pipe, upload->transfer);
+ upload->transfer = NULL;
+ upload->map = NULL;
}
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.h b/src/gallium/auxiliary/util/u_upload_mgr.h
index 6a4a60963fe..edfa0ce5fb1 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.h
+++ b/src/gallium/auxiliary/util/u_upload_mgr.h
@@ -69,10 +69,6 @@ u_upload_create_default(struct pipe_context *pipe);
struct u_upload_mgr *
u_upload_clone(struct pipe_context *pipe, struct u_upload_mgr *upload);
-/** Whether to use FLUSH_EXPLICIT with persistent mappings. */
-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);