radeonsi: make const and stream uploaders allocate read-only memory
authorMarek Olšák <marek.olsak@amd.com>
Fri, 1 Dec 2017 02:08:16 +0000 (03:08 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 6 Dec 2017 14:19:02 +0000 (15:19 +0100)
and anything that clones these uploaders, like u_threaded_context.

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeon/r600_pipe_common.c

index 9090e65aaa8b38d9bf547bded486911ac7f8b72a..9e45a9f0d1d707f29dcc9b9ad2dd6e9be6a2d1c9 100644 (file)
@@ -445,12 +445,15 @@ bool si_common_context_init(struct r600_common_context *rctx,
                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;