[Mesa-dev] [PATCH 6/6] radeonsi: make const and stream uploaders allocate read-only memory

Marek Olšák maraeo at gmail.com
Tue Dec 5 19:05:58 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

and anything that clones these uploaders, like u_threaded_context.
---
 src/gallium/drivers/radeon/r600_pipe_common.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 9090e65..9e45a9f 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -438,26 +438,29 @@ bool si_common_context_init(struct r600_common_context *rctx,
 			return false;
 	}
 
 	rctx->allocator_zeroed_memory =
 		u_suballocator_create(&rctx->b, sscreen->info.gart_page_size,
 				      0, PIPE_USAGE_DEFAULT, 0, true);
 	if (!rctx->allocator_zeroed_memory)
 		return false;
 
 	rctx->b.stream_uploader = u_upload_create(&rctx->b, 1024 * 1024,
-						  0, PIPE_USAGE_STREAM, 0);
+						  0, PIPE_USAGE_STREAM,
+						  R600_RESOURCE_FLAG_READ_ONLY);
 	if (!rctx->b.stream_uploader)
 		return false;
 
 	rctx->b.const_uploader = u_upload_create(&rctx->b, 128 * 1024,
-						 0, PIPE_USAGE_DEFAULT, 0);
+						 0, PIPE_USAGE_DEFAULT,
+						 sscreen->cpdma_prefetch_writes_memory ?
+							0 : R600_RESOURCE_FLAG_READ_ONLY);
 	if (!rctx->b.const_uploader)
 		return false;
 
 	rctx->cached_gtt_allocator = u_upload_create(&rctx->b, 16 * 1024,
 						     0, PIPE_USAGE_STAGING, 0);
 	if (!rctx->cached_gtt_allocator)
 		return false;
 
 	rctx->ctx = rctx->ws->ctx_create(rctx->ws);
 	if (!rctx->ctx)
-- 
2.7.4



More information about the mesa-dev mailing list