[Mesa-dev] [PATCH v4 2/9] st/va: do not destroy old buffer when new one failed

Julien Isorce julien.isorce at gmail.com
Thu Oct 29 14:18:05 PDT 2015


Yes please. Thx
Julien

On 29 October 2015 at 19:12, Christian König <deathsimple at vodafone.de>
wrote:

> On 29.10.2015 18:40, Julien Isorce wrote:
>
>> 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 at samsung.com>
>>
>
> Reviewed-by: Christian König <christian.koenig at amd.com>
>
> Should I push the patches already reviewed?
>
> Regards,
> Christian.
>
>
> ---
>>   src/gallium/state_trackers/va/image.c | 19 +++++++++++++------
>>   1 file changed, 13 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/gallium/state_trackers/va/image.c
>> b/src/gallium/state_trackers/va/image.c
>> index 84d94c8..8e64673 100644
>> --- a/src/gallium/state_trackers/va/image.c
>> +++ b/src/gallium/state_trackers/va/image.c
>> @@ -346,13 +346,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);
>>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151029/41e0c073/attachment.html>


More information about the mesa-dev mailing list