Commit graph

18 commits

Author SHA1 Message Date
Gwenole Beauchesne
84b3f84925 plugins: fix memory leaks through GstVideoMeta maps.
When GstVideoMeta maps were used, the supporting functions incorrectly
used gst_buffer_get_memory() instead of gst_buffer_peek_memory(), thus
always increasing the associated GstMemory reference count and giving
zero chance to actually release that, and subsequently the VA display.
2013-11-28 19:08:28 +01:00
Gwenole Beauchesne
15519ebe3d legal: add per-file authorship information.
Credit original authors on a per-file basis as we cannot expect people
to know all country-specific rules, or bother browsing through the git
history.
2013-11-22 06:39:15 +01:00
Gwenole Beauchesne
399e887c4f plugins: fix and optimize check for buffer pool allocator params.
Reset the buffer pool allocator only if the config caps changed in a
sensible way: format or resolution change. i.e. don't bother with
other caps like colorimetry et al. as this doesn't affect the way to
allocate VA surfaces or images.
2013-10-09 18:30:06 +02:00
Gwenole Beauchesne
77b2d88452 plugins: enable memory maps for read & write with direct-rendering.
Enable read and write mappings only if direct-rendering is supported.
Otherwise, this means that we may need to download data from the VA
surface first for correctness, even if the VA surface doesn't need to
be read at all. i.e. sometimes, READWRITE mappings are meant for
surfaces that are written to first, and read afterwards for further
processing.

https://bugzilla.gnome.org/show_bug.cgi?id=704078
2013-10-09 18:30:06 +02:00
Gwenole Beauchesne
847e3efb4d plugins: fix check for direct-rendering support.
Fix check for direct-rendering if the creation of VA surfaces with
an explicit pixel format is not support, e.g. VA-API < 0.34.0, and
that we tried to allocate a VA surface based on the corresponding
chroma type. i.e. in that particular case, we have to make sure that
the derived image has actually the expected format.
2013-10-09 18:30:06 +02:00
Gwenole Beauchesne
f361d4a23d plugins: fix buffer pool reset_buffer() to reset memory resources.
Fix GstVaapiVideoBufferPool::reset_buffer() to reset the underlying
memory resources, and more particularly the VA surface proxy. Most
importantly, the GstVaapiVideoMeta is retained. Cached surface in
memory are released, thus triggering a new allocation the next time
we need to map the buffer.
2013-10-09 18:30:06 +02:00
Gwenole Beauchesne
4df68163dc plugins: fix GstVaapiVideoMemory to allocate VA surface proxies.
Make sure GstVaapiVideoMemory allocates VA surface proxies from a
pool stored in the parent VA memory allocator.

This fixes the following scenario:
- VA video buffer 1 is allocated from a buffer pool
- Another video buffer is created, and inherits info from buffer 1
- Buffer 1 is released, thus pushing it back to the buffer pool
- New buffer alloc request comes it, this yields buffer 1 back
- At this stage, buffers 1 and 2 still share the same underlying VA
  surface, but buffer 2 was already submitted downstream for further
  processing, thus conflicting with additional processing we were
  about to perform on buffer 1.

Maybe the core GstBufferPool implementation should have been fixed
instead to actually make sure that the returned GstBuffer memory we
found from the pool is writable?
2013-10-09 18:30:06 +02:00
Gwenole Beauchesne
c82a1bc0ff plugins: fix ref counting of GstVaapiVideoMemory allocator.
Fix reference counting issue whereby gst_memory_init() does not hold
an extra reference to the GstAllocator. So, there could be situations
where the last instance of GstVaapiVideoAllocator gets released before
a dangling GstVaapiVideoMemory object, thus possibly leading to a crash.
2013-07-12 17:14:49 +02:00
Gwenole Beauchesne
1cfe03ee52 plugins: allow creation of VA surfaces with explicit pixel format.
Adapt GstVaapiVideoMemory allocator to support creation of VA surfaces
with an explicit pixel format. This allows for direct rendering to
VA surface memory from a software decoder.
2013-07-10 17:03:47 +02:00
Gwenole Beauchesne
09397fa0d8 plugins: port to new video format API. 2013-07-09 17:16:35 +02:00
Gwenole Beauchesne
e712abba11 plugins: allow buffer mappings to GstVaapiSurfaceProxy.
Allow plain gst_buffer_map() interface to work with gstreamer-vaapi
video buffers, i.e. expose the underlying GstVaapiSurfaceProxy to the
caller. This is the only sensible enough thing to do in this mode as
the underlying surface pixels need to be extracted through an explicit
call to the gst_video_frame_map() function instead.

A possible use-case of this is to implement a "handoff" signal handler
to fakesink or identity element for further processing.
2013-06-05 11:09:37 +02:00
Gwenole Beauchesne
eb9dd361f8 plugins: silence check for direct-rendering mode in video memory.
Fix gst_vaapi_video_allocator_new() to silently check for direct-rendering
mode support, and not trigger fatal-criticals if either test surface or
image could not be created. Typical case: pixel format mismatch, e.g. NV12
supported by most hardware vs. I420 supported by most software decoders.
2013-06-05 11:09:37 +02:00
Gwenole Beauchesne
33f6415696 plugins: improve video memory flags safety checks.
On map, ensure we have GST_MAP_WRITE flags since this is only what we
support for now. Likewise, on unmap, make sure that the VA image is
unmapped for either read or write, while still committing it to the
VA surface if write was requested.
2013-06-05 11:09:37 +02:00
Gwenole Beauchesne
e52ea35b11 plugins: cope with GST_VAAPI_IS_xxx() macros removal. 2013-05-23 19:01:34 +02:00
Gwenole Beauchesne
9535bb9950 plugins: cope with new GstVaapiMiniObject objects. 2013-05-07 18:19:03 +02:00
Gwenole Beauchesne
3f15a682ea plugins: implement direct-rendering mode for raw YUV buffer uploads.
Allow direct-rendering (writes) into target VA surfaces.
2013-04-10 14:58:17 +02:00
Gwenole Beauchesne
c698a015a3 plugins: implement uploads from raw YUV buffers for GStreamer 1.0.
Implement GstVideoMeta::{,un}map() to support raw YUV buffer upload when
the last component is unmapped. Downloads are not supported yet. The aim
was to first support SW decoding + HW accelerated rendering (vaapisink).
e.g. for Wayland.
2013-04-10 14:58:17 +02:00
Sreerenj Balachandran
5b11b83321 plugins: add GstVaapiVideoMemory and GstVaapiVideoBufferPool objects.
Add initial support for GstVaapiVideoMemory backed buffer pool. The memory
object currently holds a reference to GstVaapiVideoMeta.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
2013-04-10 14:58:16 +02:00