[Mesa-dev] [PATCH 7/9] r600g/compute: map only against intermediate buffers

Tom Stellard tom at stellard.net
Mon Jun 16 08:04:26 PDT 2014


On Fri, Jun 13, 2014 at 10:35:36PM +0200, Bruno Jiménez wrote:
> With this we can assure that mapped buffers will never change
> its position when relocating the pool.
> 
> This patch should finally solve the mapping bug.
> ---
>  src/gallium/drivers/r600/evergreen_compute.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
> index 9123a40..e5967b5 100644
> --- a/src/gallium/drivers/r600/evergreen_compute.c
> +++ b/src/gallium/drivers/r600/evergreen_compute.c
> @@ -970,14 +970,12 @@ void *r600_compute_global_transfer_map(
>  	struct pipe_resource *dst;
>  	unsigned offset = box->x;
>  
> -	if (buffer->chunk->real_buffer) {
> -		dst = (struct pipe_resource*)buffer->chunk->real_buffer;
> -	}
> -	else {
> -		dst = (struct pipe_resource*)buffer->chunk->pool->bo;
> -		offset += (buffer->chunk->start_in_dw * 4);
> +	if (buffer->chunk->start_in_dw != -1) {

We could use the is_item_in_pool() helper here that I mentioned in an
earlier patch.

> +		compute_memory_demote_item(pool, buffer->chunk, ctx_);
>  	}
>  
> +	dst = (struct pipe_resource*)buffer->chunk->real_buffer;
> +
>  	if (usage & PIPE_TRANSFER_READ)
>  		buffer->chunk->status |= ITEM_MAPPED_FOR_READING;
>  
> -- 
> 2.0.0
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list