From: Marek Olšák <marek.ol...@amd.com> This might fix mmap errors with Natural Selection 2, which a 32-bit game.
It would be nice if someone tested this patch with the game. --- src/gallium/drivers/radeon/r600_pipe_common.h | 6 ++++++ src/gallium/drivers/radeon/r600_texture.c | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index 88e9cbc..01e0d8f 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -43,6 +43,12 @@ #include "util/u_suballoc.h" #include "util/u_transfer.h" +#ifdef PIPE_ARCH_X86 +#define CPU_HAS_32BIT_ADDRESS_SPACE 1 +#else +#define CPU_HAS_32BIT_ADDRESS_SPACE 0 +#endif + #define R600_RESOURCE_FLAG_TRANSFER (PIPE_RESOURCE_FLAG_DRV_PRIV << 0) #define R600_RESOURCE_FLAG_FLUSHED_DEPTH (PIPE_RESOURCE_FLAG_DRV_PRIV << 1) #define R600_RESOURCE_FLAG_FORCE_TILING (PIPE_RESOURCE_FLAG_DRV_PRIV << 2) diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 7c4717d..d373a18 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -1153,10 +1153,19 @@ static void *r600_texture_transfer_map(struct pipe_context *ctx, static void r600_texture_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer* transfer) { + struct r600_common_context *rctx = (struct r600_common_context*)ctx; struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; struct pipe_resource *texture = transfer->resource; struct r600_texture *rtex = (struct r600_texture*)texture; + if (CPU_HAS_32BIT_ADDRESS_SPACE) { + /* 32-bit address space can run out of space pretty quickly. */ + if (rtransfer->staging) + rctx->ws->buffer_unmap(rtransfer->staging->buf); + else + rctx->ws->buffer_unmap(rtex->resource.buf); + } + if ((transfer->usage & PIPE_TRANSFER_WRITE) && rtransfer->staging) { if (rtex->is_depth && rtex->resource.b.b.nr_samples <= 1) { ctx->resource_copy_region(ctx, texture, transfer->level, -- 2.1.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev