mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
st/va: do not destroy old buffer when new one failed
If formats are not the same vlVaPutImage re-creates the video
buffer with the right format. But if the creation of this new
video buffer fails then the surface looses its current buffer.
Let's just destroy the previous buffer on success.
Signed-off-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
(cherry picked from commit d42029d2d9)
Nominated-by: Emil Velikov <emil.velikov@collabora.co.uk>
This commit is contained in:
parent
bc47b385b4
commit
507b589685
1 changed files with 13 additions and 6 deletions
|
|
@ -332,13 +332,20 @@ vlVaPutImage(VADriverContextP ctx, VASurfaceID surface, VAImageID image,
|
|||
if (format == PIPE_FORMAT_NONE)
|
||||
return VA_STATUS_ERROR_OPERATION_FAILED;
|
||||
|
||||
if (surf->buffer == NULL || format != surf->buffer->buffer_format) {
|
||||
if (surf->buffer)
|
||||
surf->buffer->destroy(surf->buffer);
|
||||
if (format != surf->buffer->buffer_format) {
|
||||
struct pipe_video_buffer *tmp_buf;
|
||||
enum pipe_format old_surf_format = surf->templat.buffer_format;
|
||||
|
||||
surf->templat.buffer_format = format;
|
||||
surf->buffer = drv->pipe->create_video_buffer(drv->pipe, &surf->templat);
|
||||
if (!surf->buffer)
|
||||
return VA_STATUS_ERROR_ALLOCATION_FAILED;
|
||||
tmp_buf = drv->pipe->create_video_buffer(drv->pipe, &surf->templat);
|
||||
|
||||
if (!tmp_buf) {
|
||||
surf->templat.buffer_format = old_surf_format;
|
||||
return VA_STATUS_ERROR_ALLOCATION_FAILED;
|
||||
}
|
||||
|
||||
surf->buffer->destroy(surf->buffer);
|
||||
surf->buffer = tmp_buf;
|
||||
}
|
||||
|
||||
views = surf->buffer->get_sampler_view_planes(surf->buffer);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue