st/va: use proper temp pipe_video_buffer template

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@samsung.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
Julien Isorce
2016-06-02 15:03:34 +01:00
parent 6c43e0016e
commit a04804746f

View File

@@ -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);