summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2020-08-02 17:52:50 +0200
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2020-08-03 19:33:01 +0200
commit62dacfd89a3dea7d7a926029f1170524b800d563 (patch)
tree4896fa9ad83ca19accb0c591cfa9dae9ada8c9eb /sys
parentf7cfb422f16d1f89d0cf51abc21a66fc307838e5 (diff)
downloadgstreamer-plugins-bad-62dacfd89a3dea7d7a926029f1170524b800d563.tar.gz
va: allocator: support for GST_MAP_VA map flag
This flag will return the VASurface value at mapping
Diffstat (limited to 'sys')
-rw-r--r--sys/va/gstvaallocator.c9
-rw-r--r--sys/va/gstvaallocator.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/sys/va/gstvaallocator.c b/sys/va/gstvaallocator.c
index b3b7ad422..6c4485400 100644
--- a/sys/va/gstvaallocator.c
+++ b/sys/va/gstvaallocator.c
@@ -706,6 +706,11 @@ _va_map_unlocked (GstVaMemory * mem, GstMapFlags flags)
(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,
&mem->is_derived))
return NULL;
@@ -757,6 +762,9 @@ _va_unmap_unlocked (GstVaMemory * mem)
if (!g_atomic_int_dec_and_test (&mem->map_count))
return TRUE;
+ if (mem->prev_mapflags & GST_MAP_VA)
+ goto bail;
+
display = GST_VA_ALLOCATOR (allocator)->display;
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 &= _destroy_image (display, mem->image.image_id);
+bail:
_clean_mem (mem);
return ret;
diff --git a/sys/va/gstvaallocator.h b/sys/va/gstvaallocator.h
index f25b065f1..9ac12a372 100644
--- a/sys/va/gstvaallocator.h
+++ b/sys/va/gstvaallocator.h
@@ -50,6 +50,8 @@ G_DECLARE_FINAL_TYPE (GstVaAllocator, gst_va_allocator, GST, VA_ALLOCATOR, GstAl
#define GST_ALLOCATOR_VASURFACE "VAMemory"
+#define GST_MAP_VA (GST_MAP_FLAG_LAST << 1)
+
GstAllocator * gst_va_allocator_new (GstVaDisplay * display,
GArray * surface_formats);
GstMemory * gst_va_allocator_alloc (GstAllocator * allocator,