bufferpool: unify acquire_buffer() and remove internal surface pool in postproc
The VASurface and DMABuf output buffer creations are different. VASurface using surfaces in filter_pool while DMABuf does not. So the use_vpp_crop can only work for VASurface mode. We should unify the creation manner, delete the filter_pool.
We also improve the acquire_buffer() function to 3 manners:
- Calling acquire_buffer() with ALLOC_SURFACE flag. This is typically used by postproc to create the output buffer. The postproc does not need to map/unmap the buffer, so we should allocate the surface at the acquire_buffer() time. The old way uses acquire_buffer() to get a buffer but then attaches a surface allocated in the private surface pool, which makes the code path complicated(VASurface and DMA fall into different code path) and easy to make mistakes(the private surface pool may have totally different video format with the buffer pool).
- Calling acquire_buffer() with a surface proxy. This is typically used by decode to create the output buffer. The decode has a decoded picture in some surface and need to attach this surface to the buffer acquired in the buffer pool.
- Calling acquire_buffer() with no parameter. This is typically used by sink end of encode/postproc to create input buffer. Because the buffer will be mapped later, there is no need to create the surface immediately.
We also find a latent bug that the internal filter_pool is not well inited, it always uses GST_VIDEO_FORMAT_ENCODED as its format.
Edited by Tim-Philipp Müller