[Mesa-dev] [PATCH 1/2] util: handle failed mapping in u_upload_alloc_buffer()

Jose Fonseca jfonseca at vmware.com
Mon Oct 24 10:16:49 PDT 2011


Both patches look good to me.

Jose

----- Original Message -----
> From: Brian Paul <brianp at vmware.com>
> 
> ---
>  src/gallium/auxiliary/util/u_upload_mgr.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c
> b/src/gallium/auxiliary/util/u_upload_mgr.c
> index 9bcc1bb..aef4d40 100644
> --- a/src/gallium/auxiliary/util/u_upload_mgr.c
> +++ b/src/gallium/auxiliary/util/u_upload_mgr.c
> @@ -141,7 +141,12 @@ u_upload_alloc_buffer( struct u_upload_mgr
> *upload,
>                                         PIPE_TRANSFER_WRITE |
>                                         PIPE_TRANSFER_FLUSH_EXPLICIT,
>                                         &upload->transfer);
> -
> +   if (upload->map == NULL) {
> +      upload->size = 0;
> +      pipe_resource_reference(&upload->buffer, NULL);
> +      return PIPE_ERROR_OUT_OF_MEMORY;
> +   }
> +
>     upload->size = size;
>  
>     upload->offset = 0;
> --
> 1.7.3.4
> 
> _______________________________________________
> 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