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

Michel Dänzer michel at daenzer.net
Mon Feb 1 19:58:46 PST 2016


On 01.02.2016 23:20, Marek Olšák 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.
> ---
>  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) {

Instead of hardcoding a list of architectures (which is missing many
32-bit architectures in this patch), you can just test for sizeof(void*)
== 4.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list