radeonsi: always unmap texture CPU mappings on 32-bit CPU architectures
authorMarek Olšák <marek.olsak@amd.com>
Fri, 14 Dec 2018 21:03:00 +0000 (16:03 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 2 Jan 2019 20:01:59 +0000 (15:01 -0500)
Team Fortress 2 32-bit version runs out of the CPU address space.

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/gallium/drivers/radeonsi/si_texture.c

index 9df12e0f5bd3f89b837ec8cfaad86d526cba2386..c169d4e443dd478aa108f2ca0896d668999ace1a 100644 (file)
@@ -1798,6 +1798,12 @@ static void *si_texture_transfer_map(struct pipe_context *ctx,
                buf = &tex->buffer;
        }
 
+       /* Always unmap texture CPU mappings on 32-bit architectures, so that
+        * we don't run out of the CPU address space.
+        */
+       if (sizeof(void*) == 4)
+               usage |= RADEON_TRANSFER_TEMPORARY;
+
        if (!(map = si_buffer_map_sync_with_rings(sctx, buf, usage)))
                goto fail_trans;
 
@@ -1819,6 +1825,16 @@ static void si_texture_transfer_unmap(struct pipe_context *ctx,
        struct pipe_resource *texture = transfer->resource;
        struct si_texture *tex = (struct si_texture*)texture;
 
+       /* Always unmap texture CPU mappings on 32-bit architectures, so that
+        * we don't run out of the CPU address space.
+        */
+       if (sizeof(void*) == 4) {
+               struct r600_resource *buf =
+                       stransfer->staging ? stransfer->staging : &tex->buffer;
+
+               sctx->ws->buffer_unmap(buf->buf);
+       }
+
        if ((transfer->usage & PIPE_TRANSFER_WRITE) && stransfer->staging) {
                if (tex->is_depth && tex->buffer.b.b.nr_samples <= 1) {
                        ctx->resource_copy_region(ctx, texture, transfer->level,