[Mesa-dev] [PATCH] gallium/radeon: always unmap textures on 32-bit (v2)

Marek Olšák maraeo at gmail.com
Tue Feb 2 22:24:39 UTC 2016


Sadly, this patch doesn't fix NS2, so I'm kinda on the fence about pushing it.

Marek

On Tue, Feb 2, 2016 at 9:01 PM, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at 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.
>
> v2: use sizeof(void*)
> ---
>  src/gallium/drivers/radeon/r600_texture.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
> index 7c4717d..0bb3c81 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 (sizeof(void*) == 4) {
> +               /* 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
>


More information about the mesa-dev mailing list