[Mesa-dev] [PATCH 2/3] nouveau: only try to get new storage if there are any levels

Francisco Jerez currojerez at riseup.net
Tue Aug 12 23:45:13 PDT 2014


Ilia Mirkin <imirkin at alum.mit.edu> writes:

> This would try to allocate 0-sized bo's when the max level was below the
> base level.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>

Reviewed-by: Francisco Jerez <currojerez at riseup.net>

> ---
>  src/mesa/drivers/dri/nouveau/nouveau_texture.c | 23 +++++++++++++----------
>  1 file changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
> index e7d5c02..118255f 100644
> --- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
> +++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
> @@ -345,17 +345,19 @@ relayout_texture(struct gl_context *ctx, struct gl_texture_object *t)
>  			height = minify(height, 1);
>  		}
>  
> -		/* Get new storage. */
> -		size = align(offset, 64);
> -
> -		ret = nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_MAP |
> -				     NOUVEAU_BO_GART | NOUVEAU_BO_VRAM,
> -				     0, size, NULL, &ss[last].bo);
> -		assert(!ret);
> -
> -		for (i = t->BaseLevel; i < last; i++)
> -			nouveau_bo_ref(ss[last].bo, &ss[i].bo);
> +		if (t->BaseLevel <= last) {
> +			/* Get new storage. */
> +			size = align(offset, 64);
> +			assert(size);
> +
> +			ret = nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_MAP |
> +					     NOUVEAU_BO_GART | NOUVEAU_BO_VRAM,
> +					     0, size, NULL, &ss[last].bo);
> +			assert(!ret);
> +
> +			for (i = t->BaseLevel; i < last; i++)
> +				nouveau_bo_ref(ss[last].bo, &ss[i].bo);
> +		}
>  	}
>  }
>  
> -- 
> 1.8.5.5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140813/961ab4d8/attachment.sig>


More information about the mesa-dev mailing list