summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2017-04-12 12:41:05 +0200
committerNicolai Hähnle <[email protected]>2017-04-13 17:36:26 +0200
commitb52721e3b693e113aa537d163c8a855169e7b75d (patch)
tree4aa70e0fee4f612f473eb8865cf6457c37d6f9d2 /src/gallium/drivers/radeon
parent4f7e3fbb50f06ab523594a7ee4693b1a95c0e66a (diff)
gallium/radeon: never use staging buffers with AMD_pinned_memory
Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r--src/gallium/drivers/radeon/r600_buffer_common.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c
index 10036afeba4..0e93404c018 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -327,11 +327,25 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx,
{
struct r600_common_context *rctx = (struct r600_common_context*)ctx;
struct r600_common_screen *rscreen = (struct r600_common_screen*)ctx->screen;
- struct r600_resource *rbuffer = r600_resource(resource);
- uint8_t *data;
+ struct r600_resource *rbuffer = r600_resource(resource);
+ uint8_t *data;
assert(box->x + box->width <= resource->width0);
+ /* From GL_AMD_pinned_memory issues:
+ *
+ * 4) Is glMapBuffer on a shared buffer guaranteed to return the
+ * same system address which was specified at creation time?
+ *
+ * RESOLVED: NO. The GL implementation might return a different
+ * virtual mapping of that memory, although the same physical
+ * page will be used.
+ *
+ * So don't ever use staging buffers.
+ */
+ if (rscreen->ws->buffer_is_user_ptr(rbuffer->buf))
+ usage |= PIPE_TRANSFER_PERSISTENT;
+
/* See if the buffer range being mapped has never been initialized,
* in which case it can be mapped unsynchronized. */
if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED) &&