mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
va: allocator: support for GST_MAP_VA map flag
This flag will return the VASurface value at mapping
This commit is contained in:
parent
f7cfb422f1
commit
62dacfd89a
2 changed files with 11 additions and 0 deletions
|
@ -706,6 +706,11 @@ _va_map_unlocked (GstVaMemory * mem, GstMapFlags flags)
|
||||||
(GST_VIDEO_INFO_FORMAT (&mem->info) == mem->surface_format);
|
(GST_VIDEO_INFO_FORMAT (&mem->info) == mem->surface_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flags & GST_MAP_VA) {
|
||||||
|
mem->mapped_data = &mem->surface;
|
||||||
|
goto success;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_ensure_image (display, mem->surface, &mem->info, &mem->image,
|
if (!_ensure_image (display, mem->surface, &mem->info, &mem->image,
|
||||||
&mem->is_derived))
|
&mem->is_derived))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -757,6 +762,9 @@ _va_unmap_unlocked (GstVaMemory * mem)
|
||||||
if (!g_atomic_int_dec_and_test (&mem->map_count))
|
if (!g_atomic_int_dec_and_test (&mem->map_count))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
if (mem->prev_mapflags & GST_MAP_VA)
|
||||||
|
goto bail;
|
||||||
|
|
||||||
display = GST_VA_ALLOCATOR (allocator)->display;
|
display = GST_VA_ALLOCATOR (allocator)->display;
|
||||||
|
|
||||||
if (mem->image.image_id != VA_INVALID_ID) {
|
if (mem->image.image_id != VA_INVALID_ID) {
|
||||||
|
@ -771,6 +779,7 @@ _va_unmap_unlocked (GstVaMemory * mem)
|
||||||
ret &= _unmap_buffer (display, mem->image.buf);
|
ret &= _unmap_buffer (display, mem->image.buf);
|
||||||
ret &= _destroy_image (display, mem->image.image_id);
|
ret &= _destroy_image (display, mem->image.image_id);
|
||||||
|
|
||||||
|
bail:
|
||||||
_clean_mem (mem);
|
_clean_mem (mem);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -50,6 +50,8 @@ G_DECLARE_FINAL_TYPE (GstVaAllocator, gst_va_allocator, GST, VA_ALLOCATOR, GstAl
|
||||||
|
|
||||||
#define GST_ALLOCATOR_VASURFACE "VAMemory"
|
#define GST_ALLOCATOR_VASURFACE "VAMemory"
|
||||||
|
|
||||||
|
#define GST_MAP_VA (GST_MAP_FLAG_LAST << 1)
|
||||||
|
|
||||||
GstAllocator * gst_va_allocator_new (GstVaDisplay * display,
|
GstAllocator * gst_va_allocator_new (GstVaDisplay * display,
|
||||||
GArray * surface_formats);
|
GArray * surface_formats);
|
||||||
GstMemory * gst_va_allocator_alloc (GstAllocator * allocator,
|
GstMemory * gst_va_allocator_alloc (GstAllocator * allocator,
|
||||||
|
|
Loading…
Reference in a new issue