[Mesa-dev] [PATCH] st/va: use proper temp pipe_video_buffer template

Christian König deathsimple at vodafone.de
Wed Jun 8 08:18:15 UTC 2016


Am 02.06.2016 um 16:03 schrieb Julien Isorce:
> Instead of changing the format on the existing template
> which makes error handling not nice and confuses coverity.
>
> CoverityID: 1337953
>
> Signed-off-by: Julien Isorce <j.isorce at samsung.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>   src/gallium/state_trackers/va/image.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/state_trackers/va/image.c b/src/gallium/state_trackers/va/image.c
> index 92d014c..1b956e3 100644
> --- a/src/gallium/state_trackers/va/image.c
> +++ b/src/gallium/state_trackers/va/image.c
> @@ -473,19 +473,19 @@ vlVaPutImage(VADriverContextP ctx, VASurfaceID surface, VAImageID image,
>   
>      if (format != surf->buffer->buffer_format) {
>         struct pipe_video_buffer *tmp_buf;
> -      enum pipe_format old_surf_format = surf->templat.buffer_format;
> +      struct pipe_video_buffer templat = surf->templat;
>   
> -      surf->templat.buffer_format = format;
> -      tmp_buf = drv->pipe->create_video_buffer(drv->pipe, &surf->templat);
> +      templat.buffer_format = format;
> +      tmp_buf = drv->pipe->create_video_buffer(drv->pipe, &templat);
>   
>         if (!tmp_buf) {
> -         surf->templat.buffer_format = old_surf_format;
>            pipe_mutex_unlock(drv->mutex);
>            return VA_STATUS_ERROR_ALLOCATION_FAILED;
>         }
>   
>         surf->buffer->destroy(surf->buffer);
>         surf->buffer = tmp_buf;
> +      surf->templat.buffer_format = format;
>      }
>   
>      views = surf->buffer->get_sampler_view_planes(surf->buffer);



More information about the mesa-dev mailing list