Skip to content

va: allocator: don't destroy surfaces if memory is a copy

va: allocator: don't destroy surfaces if memory is a copy

With commit bc89cb69 frame's output buffer is not writable anymore since it has a refcount of 2. This lead to a copy of the buffer to make it writable.

Currently there's an implementation for a shallow copy of VA based memories by just copying the VASurfaceID. Nonetheless, this implementation was buggy since at freeing the copied buffer, the surface is destroyed, and no further decoding is possible.

This patch add a flag to check if the VA based memory is a copy and when freed the surface is not destroyed, just the rest of the structure.

It was tried to follow the shared memory so making writable is just increasing the memory's refcount. But, if a downstream element keeps a reference of the copied buffer, the bufferpool logic breaks since it will try to release a shared buffer, discarding it.

Cc: @ndufresne, @seungha.yang, @He_Junyan

Merge request reports