va: Move allocators and pool objects into gstva library.

In order to other plugins use gstva objects, such as allocators and buffer
pools, this merge request move them from the va plugin to the gstva library.

This objects are not exposed in <gst/va/gstva.h> since they are not expected
to be used by users, only by plugin implementators.

Because of the surface copy design, which is used to implement allocator's
mem_copy() virtual function, depends on the vafilter, which is kept inside
the plugin, memory copy through VAPosproc is disabled and removed temporarly.

Also added some missing parameter validation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2048>
This commit is contained in:
He Junyan 2022-02-23 15:40:19 +08:00 committed by GStreamer Marge Bot
parent 53783eab6c
commit 990fbb3b52
19 changed files with 181 additions and 104 deletions

View file

@ -24,12 +24,11 @@
#include "gstvaallocator.h" #include "gstvaallocator.h"
#include <gst/va/gstvavideoformat.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include "gstvacaps.h"
#include "gstvasurfacecopy.h" #include "gstvasurfacecopy.h"
#include "gstvavideoformat.h"
#include "vasurfaceimage.h" #include "vasurfaceimage.h"
#define GST_CAT_DEFAULT gst_va_memory_debug #define GST_CAT_DEFAULT gst_va_memory_debug
@ -254,6 +253,11 @@ struct _GstVaDmabufAllocator
GstVaMemoryPool pool; GstVaMemoryPool pool;
}; };
struct _GstVaDmabufAllocatorClass
{
GstDmaBufAllocatorClass parent_class;
};
#define gst_va_dmabuf_allocator_parent_class dmabuf_parent_class #define gst_va_dmabuf_allocator_parent_class dmabuf_parent_class
G_DEFINE_TYPE_WITH_CODE (GstVaDmabufAllocator, gst_va_dmabuf_allocator, G_DEFINE_TYPE_WITH_CODE (GstVaDmabufAllocator, gst_va_dmabuf_allocator,
GST_TYPE_DMABUF_ALLOCATOR, _init_debug_category ()); GST_TYPE_DMABUF_ALLOCATOR, _init_debug_category ());
@ -735,9 +739,13 @@ gboolean
gst_va_dmabuf_allocator_prepare_buffer (GstAllocator * allocator, gst_va_dmabuf_allocator_prepare_buffer (GstAllocator * allocator,
GstBuffer * buffer) GstBuffer * buffer)
{ {
GstVaDmabufAllocator *self = GST_VA_DMABUF_ALLOCATOR (allocator); GstVaDmabufAllocator *self;
VASurfaceID surface; VASurfaceID surface;
g_return_val_if_fail (GST_IS_VA_DMABUF_ALLOCATOR (allocator), FALSE);
self = GST_VA_DMABUF_ALLOCATOR (allocator);
GST_VA_MEMORY_POOL_LOCK (&self->pool); GST_VA_MEMORY_POOL_LOCK (&self->pool);
surface = gst_va_dmabuf_allocator_prepare_buffer_unlocked (self, buffer); surface = gst_va_dmabuf_allocator_prepare_buffer_unlocked (self, buffer);
GST_VA_MEMORY_POOL_UNLOCK (&self->pool); GST_VA_MEMORY_POOL_UNLOCK (&self->pool);
@ -748,7 +756,11 @@ gst_va_dmabuf_allocator_prepare_buffer (GstAllocator * allocator,
void void
gst_va_dmabuf_allocator_flush (GstAllocator * allocator) gst_va_dmabuf_allocator_flush (GstAllocator * allocator)
{ {
GstVaDmabufAllocator *self = GST_VA_DMABUF_ALLOCATOR (allocator); GstVaDmabufAllocator *self;
g_return_if_fail (GST_IS_VA_DMABUF_ALLOCATOR (allocator));
self = GST_VA_DMABUF_ALLOCATOR (allocator);
gst_va_memory_pool_flush (&self->pool, self->display); gst_va_memory_pool_flush (&self->pool, self->display);
} }
@ -757,10 +769,15 @@ static gboolean
gst_va_dmabuf_allocator_try (GstAllocator * allocator) gst_va_dmabuf_allocator_try (GstAllocator * allocator)
{ {
GstBuffer *buffer; GstBuffer *buffer;
GstVaDmabufAllocator *self = GST_VA_DMABUF_ALLOCATOR (allocator); GstVaDmabufAllocator *self;
GstVideoInfo info = self->info; GstVideoInfo info;
gboolean ret; gboolean ret;
g_return_val_if_fail (GST_IS_VA_DMABUF_ALLOCATOR (allocator), FALSE);
self = GST_VA_DMABUF_ALLOCATOR (allocator);
info = self->info;
buffer = gst_buffer_new (); buffer = gst_buffer_new ();
ret = gst_va_dmabuf_allocator_setup_buffer_full (allocator, buffer, &info); ret = gst_va_dmabuf_allocator_setup_buffer_full (allocator, buffer, &info);
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
@ -920,6 +937,11 @@ struct _GstVaAllocator
GstVaMemoryPool pool; GstVaMemoryPool pool;
}; };
struct _GstVaAllocatorClass
{
GstAllocatorClass parent_class;
};
typedef struct _GstVaMemory GstVaMemory; typedef struct _GstVaMemory GstVaMemory;
struct _GstVaMemory struct _GstVaMemory
{ {
@ -1452,9 +1474,13 @@ gst_va_allocator_prepare_buffer_unlocked (GstVaAllocator * self,
gboolean gboolean
gst_va_allocator_prepare_buffer (GstAllocator * allocator, GstBuffer * buffer) gst_va_allocator_prepare_buffer (GstAllocator * allocator, GstBuffer * buffer)
{ {
GstVaAllocator *self = GST_VA_ALLOCATOR (allocator); GstVaAllocator *self;
VASurfaceID surface; VASurfaceID surface;
g_return_val_if_fail (GST_IS_VA_ALLOCATOR (allocator), FALSE);
self = GST_VA_ALLOCATOR (allocator);
GST_VA_MEMORY_POOL_LOCK (&self->pool); GST_VA_MEMORY_POOL_LOCK (&self->pool);
surface = gst_va_allocator_prepare_buffer_unlocked (self, buffer); surface = gst_va_allocator_prepare_buffer_unlocked (self, buffer);
GST_VA_MEMORY_POOL_UNLOCK (&self->pool); GST_VA_MEMORY_POOL_UNLOCK (&self->pool);
@ -1465,7 +1491,11 @@ gst_va_allocator_prepare_buffer (GstAllocator * allocator, GstBuffer * buffer)
void void
gst_va_allocator_flush (GstAllocator * allocator) gst_va_allocator_flush (GstAllocator * allocator)
{ {
GstVaAllocator *self = GST_VA_ALLOCATOR (allocator); GstVaAllocator *self;
g_return_if_fail (GST_IS_VA_ALLOCATOR (allocator));
self = GST_VA_ALLOCATOR (allocator);
gst_va_memory_pool_flush (&self->pool, self->display); gst_va_memory_pool_flush (&self->pool, self->display);
} }
@ -1473,7 +1503,11 @@ gst_va_allocator_flush (GstAllocator * allocator)
static gboolean static gboolean
gst_va_allocator_try (GstAllocator * allocator) gst_va_allocator_try (GstAllocator * allocator)
{ {
GstVaAllocator *self = GST_VA_ALLOCATOR (allocator); GstVaAllocator *self;
g_return_val_if_fail (GST_IS_VA_ALLOCATOR (allocator), FALSE);
self = GST_VA_ALLOCATOR (allocator);
self->fourcc = 0; self->fourcc = 0;
self->rt_format = 0; self->rt_format = 0;
@ -1553,7 +1587,10 @@ gboolean
gst_va_allocator_get_format (GstAllocator * allocator, GstVideoInfo * info, gst_va_allocator_get_format (GstAllocator * allocator, GstVideoInfo * info,
guint * usage_hint) guint * usage_hint)
{ {
GstVaAllocator *self = GST_VA_ALLOCATOR (allocator); GstVaAllocator *self;
g_return_val_if_fail (GST_IS_VA_ALLOCATOR (allocator), FALSE);
self = GST_VA_ALLOCATOR (allocator);
if (GST_VIDEO_INFO_FORMAT (&self->info) == GST_VIDEO_FORMAT_UNKNOWN) if (GST_VIDEO_INFO_FORMAT (&self->info) == GST_VIDEO_FORMAT_UNKNOWN)
return FALSE; return FALSE;

View file

@ -28,23 +28,40 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define GST_TYPE_VA_DMABUF_ALLOCATOR (gst_va_dmabuf_allocator_get_type()) typedef struct _GstVaAllocator GstVaAllocator;
G_DECLARE_FINAL_TYPE (GstVaDmabufAllocator, gst_va_dmabuf_allocator, GST, typedef struct _GstVaAllocatorClass GstVaAllocatorClass;
VA_DMABUF_ALLOCATOR, GstDmaBufAllocator); typedef struct _GstVaDmabufAllocator GstVaDmabufAllocator;
typedef struct _GstVaDmabufAllocatorClass GstVaDmabufAllocatorClass;
#define GST_TYPE_VA_DMABUF_ALLOCATOR (gst_va_dmabuf_allocator_get_type())
#define GST_VA_DMABUF_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_VA_DMABUF_ALLOCATOR, GstVaDmabufAllocator))
#define GST_VA_DMABUF_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VA_DMABUF_ALLOCATOR, GstVaDmabufAllocatorClass))
#define GST_IS_VA_DMABUF_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VA_DMABUF_ALLOCATOR))
#define GST_IS_VA_DMABUF_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VA_DMABUF_ALLOCATOR))
#define GST_VA_DMABUF_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_VA_DMABUF_ALLOCATOR, GstVaDmabufAllocatorClass))
GST_VA_API
GType gst_va_dmabuf_allocator_get_type (void);
GST_VA_API
GstAllocator * gst_va_dmabuf_allocator_new (GstVaDisplay * display); GstAllocator * gst_va_dmabuf_allocator_new (GstVaDisplay * display);
GST_VA_API
gboolean gst_va_dmabuf_allocator_setup_buffer (GstAllocator * allocator, gboolean gst_va_dmabuf_allocator_setup_buffer (GstAllocator * allocator,
GstBuffer * buffer); GstBuffer * buffer);
GST_VA_API
gboolean gst_va_dmabuf_allocator_prepare_buffer (GstAllocator * allocator, gboolean gst_va_dmabuf_allocator_prepare_buffer (GstAllocator * allocator,
GstBuffer * buffer); GstBuffer * buffer);
GST_VA_API
void gst_va_dmabuf_allocator_flush (GstAllocator * allocator); void gst_va_dmabuf_allocator_flush (GstAllocator * allocator);
GST_VA_API
gboolean gst_va_dmabuf_allocator_set_format (GstAllocator * allocator, gboolean gst_va_dmabuf_allocator_set_format (GstAllocator * allocator,
GstVideoInfo * info, GstVideoInfo * info,
guint usage_hint); guint usage_hint);
GST_VA_API
gboolean gst_va_dmabuf_allocator_get_format (GstAllocator * allocator, gboolean gst_va_dmabuf_allocator_get_format (GstAllocator * allocator,
GstVideoInfo * info, GstVideoInfo * info,
guint * usage_hint); guint * usage_hint);
GST_VA_API
gboolean gst_va_dmabuf_memories_setup (GstVaDisplay * display, gboolean gst_va_dmabuf_memories_setup (GstVaDisplay * display,
GstVideoInfo * info, GstVideoInfo * info,
guint n_planes, guint n_planes,
@ -54,31 +71,48 @@ gboolean gst_va_dmabuf_memories_setup (GstVaDisplay * displa
guint usage_hint); guint usage_hint);
#define GST_TYPE_VA_ALLOCATOR (gst_va_allocator_get_type()) #define GST_TYPE_VA_ALLOCATOR (gst_va_allocator_get_type())
G_DECLARE_FINAL_TYPE (GstVaAllocator, gst_va_allocator, GST, VA_ALLOCATOR, GstAllocator); #define GST_VA_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_VA_ALLOCATOR, GstVaAllocator))
#define GST_VA_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VA_ALLOCATOR, GstVaAllocatorClass))
#define GST_IS_VA_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VA_ALLOCATOR))
#define GST_IS_VA_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VA_ALLOCATOR))
#define GST_VA_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_VA_ALLOCATOR, GstVaAllocatorClass))
#define GST_ALLOCATOR_VASURFACE "VAMemory" #define GST_ALLOCATOR_VASURFACE "VAMemory"
#define GST_MAP_VA (GST_MAP_FLAG_LAST << 1) #define GST_MAP_VA (GST_MAP_FLAG_LAST << 1)
GST_VA_API
GType gst_va_allocator_get_type (void);
GST_VA_API
GstAllocator * gst_va_allocator_new (GstVaDisplay * display, GstAllocator * gst_va_allocator_new (GstVaDisplay * display,
GArray * surface_formats); GArray * surface_formats);
GST_VA_API
GstMemory * gst_va_allocator_alloc (GstAllocator * allocator); GstMemory * gst_va_allocator_alloc (GstAllocator * allocator);
GST_VA_API
gboolean gst_va_allocator_setup_buffer (GstAllocator * allocator, gboolean gst_va_allocator_setup_buffer (GstAllocator * allocator,
GstBuffer * buffer); GstBuffer * buffer);
GST_VA_API
gboolean gst_va_allocator_prepare_buffer (GstAllocator * allocator, gboolean gst_va_allocator_prepare_buffer (GstAllocator * allocator,
GstBuffer * buffer); GstBuffer * buffer);
GST_VA_API
void gst_va_allocator_flush (GstAllocator * allocator); void gst_va_allocator_flush (GstAllocator * allocator);
GST_VA_API
gboolean gst_va_allocator_set_format (GstAllocator * allocator, gboolean gst_va_allocator_set_format (GstAllocator * allocator,
GstVideoInfo * info, GstVideoInfo * info,
guint usage_hint); guint usage_hint);
GST_VA_API
gboolean gst_va_allocator_get_format (GstAllocator * allocator, gboolean gst_va_allocator_get_format (GstAllocator * allocator,
GstVideoInfo * info, GstVideoInfo * info,
guint * usage_hint); guint * usage_hint);
GST_VA_API
VASurfaceID gst_va_memory_get_surface (GstMemory * mem); VASurfaceID gst_va_memory_get_surface (GstMemory * mem);
GST_VA_API
VASurfaceID gst_va_buffer_get_surface (GstBuffer * buffer); VASurfaceID gst_va_buffer_get_surface (GstBuffer * buffer);
GST_VA_API
gboolean gst_va_buffer_create_aux_surface (GstBuffer * buffer); gboolean gst_va_buffer_create_aux_surface (GstBuffer * buffer);
GST_VA_API
VASurfaceID gst_va_buffer_get_aux_surface (GstBuffer * buffer); VASurfaceID gst_va_buffer_get_aux_surface (GstBuffer * buffer);
G_END_DECLS G_END_DECLS

View file

@ -23,9 +23,7 @@
#endif #endif
#include "gstvapool.h" #include "gstvapool.h"
#include "gstvaallocator.h" #include "gstvaallocator.h"
#include "gstvacaps.h"
GST_DEBUG_CATEGORY_STATIC (gst_va_pool_debug); GST_DEBUG_CATEGORY_STATIC (gst_va_pool_debug);
#define GST_CAT_DEFAULT gst_va_pool_debug #define GST_CAT_DEFAULT gst_va_pool_debug
@ -45,6 +43,11 @@ struct _GstVaPool
gboolean starting; gboolean starting;
}; };
struct _GstVaPoolClass
{
GstBufferPoolClass parent_class;
};
#define gst_va_pool_parent_class parent_class #define gst_va_pool_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVaPool, gst_va_pool, GST_TYPE_BUFFER_POOL, G_DEFINE_TYPE_WITH_CODE (GstVaPool, gst_va_pool, GST_TYPE_BUFFER_POOL,
GST_DEBUG_CATEGORY_INIT (gst_va_pool_debug, "vapool", 0, "VA Pool")); GST_DEBUG_CATEGORY_INIT (gst_va_pool_debug, "vapool", 0, "VA Pool"));
@ -341,6 +344,9 @@ gst_buffer_pool_config_set_va_allocation_params (GstStructure * config,
gboolean gboolean
gst_va_pool_requires_video_meta (GstBufferPool * pool) gst_va_pool_requires_video_meta (GstBufferPool * pool)
{ {
g_return_val_if_fail (GST_IS_VA_POOL (pool), FALSE);
return GST_VA_POOL (pool)->force_videometa; return GST_VA_POOL (pool)->force_videometa;
} }

View file

@ -20,24 +20,38 @@
#pragma once #pragma once
#include <gst/va/va_fwd.h>
#include <gst/va/va-prelude.h>
#include <gst/gst.h> #include <gst/gst.h>
G_BEGIN_DECLS G_BEGIN_DECLS
typedef struct _GstVaPool GstVaPool;
typedef struct _GstVaPoolClass GstVaPoolClass;
#define GST_TYPE_VA_POOL (gst_va_pool_get_type()) #define GST_TYPE_VA_POOL (gst_va_pool_get_type())
G_DECLARE_FINAL_TYPE (GstVaPool, gst_va_pool, GST, VA_POOL, GstBufferPool) #define GST_VA_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_VA_POOL, GstVaPool))
#define GST_VA_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VA_POOL, GstVaPoolClass))
#define GST_IS_VA_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VA_POOL))
#define GST_IS_VA_POOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VA_POOL))
#define GST_VA_POOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_VA_POOL, GstVaPoolClass))
GST_VA_API
GType gst_va_pool_get_type (void);
GST_VA_API
GstBufferPool * gst_va_pool_new (void); GstBufferPool * gst_va_pool_new (void);
GST_VA_API
gboolean gst_va_pool_requires_video_meta (GstBufferPool * pool); gboolean gst_va_pool_requires_video_meta (GstBufferPool * pool);
GST_VA_API
void gst_buffer_pool_config_set_va_allocation_params (GstStructure * config, void gst_buffer_pool_config_set_va_allocation_params (GstStructure * config,
guint usage_hint); guint usage_hint);
GST_VA_API
GstBufferPool * gst_va_pool_new_with_config (GstCaps * caps, GstBufferPool * gst_va_pool_new_with_config (GstCaps * caps,
guint size, guint size,
guint min_buffers, guint min_buffers,
guint max_buffers, guint max_buffers,
guint usage_hint, guint usage_hint,
GstAllocator * allocator, GstAllocator * allocator,
GstAllocationParams * alloc_params); GstAllocationParams * alloc_params);
G_END_DECLS G_END_DECLS

View file

@ -18,11 +18,11 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#include "gstvasurfacecopy.h" #ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gstvaallocator.h" #include "gstvasurfacecopy.h"
#include "gstvadisplay_priv.h"
#include "gstvafilter.h"
#include "vasurfaceimage.h" #include "vasurfaceimage.h"
#define GST_CAT_DEFAULT gst_va_memory_debug #define GST_CAT_DEFAULT gst_va_memory_debug
@ -36,7 +36,6 @@ struct _GstVaSurfaceCopy
gboolean has_copy; gboolean has_copy;
GRecMutex lock; GRecMutex lock;
GstVaFilter *filter;
}; };
static gboolean static gboolean
@ -76,16 +75,8 @@ gst_va_surface_copy_new (GstVaDisplay * display, GstVideoInfo * vinfo)
self->display = gst_object_ref (display); self->display = gst_object_ref (display);
self->has_copy = _has_copy (display); self->has_copy = _has_copy (display);
self->info = *vinfo; self->info = *vinfo;
self->filter = NULL;
g_rec_mutex_init (&self->lock); g_rec_mutex_init (&self->lock);
if (gst_va_display_has_vpp (display)) {
self->filter = gst_va_filter_new (display);
if (!(gst_va_filter_open (self->filter)
&& gst_va_filter_set_video_info (self->filter, vinfo, vinfo)))
gst_clear_object (&self->filter);
}
return self; return self;
} }
@ -95,35 +86,12 @@ gst_va_surface_copy_free (GstVaSurfaceCopy * self)
g_return_if_fail (self && GST_IS_VA_DISPLAY (self->display)); g_return_if_fail (self && GST_IS_VA_DISPLAY (self->display));
gst_clear_object (&self->display); gst_clear_object (&self->display);
if (self->filter) {
gst_va_filter_close (self->filter);
gst_clear_object (&self->filter);
}
g_rec_mutex_clear (&self->lock); g_rec_mutex_clear (&self->lock);
g_slice_free (GstVaSurfaceCopy, self); g_slice_free (GstVaSurfaceCopy, self);
} }
static gboolean
_vpp_copy_surface (GstVaSurfaceCopy * self, VASurfaceID dst, VASurfaceID src)
{
gboolean ret;
GstVaSample gst_src = {
.surface = src,
};
GstVaSample gst_dst = {
.surface = dst,
};
g_rec_mutex_lock (&self->lock);
ret = gst_va_filter_process (self->filter, &gst_src, &gst_dst);
g_rec_mutex_unlock (&self->lock);
return ret;
}
gboolean gboolean
gst_va_surface_copy (GstVaSurfaceCopy * self, VASurfaceID dst, VASurfaceID src) gst_va_surface_copy (GstVaSurfaceCopy * self, VASurfaceID dst, VASurfaceID src)
{ {
@ -137,10 +105,7 @@ gst_va_surface_copy (GstVaSurfaceCopy * self, VASurfaceID dst, VASurfaceID src)
return TRUE; return TRUE;
} }
if (self->filter && _vpp_copy_surface (self, dst, src)) { /* TODO: Add the VPP copy. */
GST_LOG ("VPP copy of %#x to %#x", src, dst);
return TRUE;
}
if (!va_ensure_image (self->display, src, &self->info, &image, FALSE)) if (!va_ensure_image (self->display, src, &self->info, &image, FALSE))
return FALSE; return FALSE;

View file

@ -1,20 +1,26 @@
va_sources = [ va_sources = [
'gstvaallocator.c',
'gstvadisplay.c', 'gstvadisplay.c',
'gstvadisplay_drm.c', 'gstvadisplay_drm.c',
'gstvadisplay_wrapped.c', 'gstvadisplay_wrapped.c',
'gstvapool.c',
'gstvasurfacecopy.c',
'gstvautils.c', 'gstvautils.c',
'gstvavideoformat.c', 'gstvavideoformat.c',
'vasurfaceimage.c',
] ]
va_headers = [ va_headers = [
'gstva.h', 'gstva.h',
'gstvaallocator.h',
'gstvadisplay.h', 'gstvadisplay.h',
'gstvadisplay_drm.h', 'gstvadisplay_drm.h',
'gstvadisplay_wrapped.h', 'gstvadisplay_wrapped.h',
'gstvapool.h',
'gstvautils.h', 'gstvautils.h',
'gstvavideoformat.h', 'gstvavideoformat.h',
'va_fwd.h',
'va-prelude.h', 'va-prelude.h',
'va_fwd.h',
] ]
gstva_dep = dependency('', required : false) gstva_dep = dependency('', required : false)
@ -51,5 +57,5 @@ libraries += [[pkg_name, {'lib': gstva}]]
gstva_dep = declare_dependency(link_with : gstva, gstva_dep = declare_dependency(link_with : gstva,
include_directories : [libsinc], include_directories : [libsinc],
dependencies : [gst_dep, gstvideo_dep, libva_dep, libva_drm_dep, libdrm_dep]) dependencies : [gst_dep, gstvideo_dep, gstallocators_dep, libva_dep, libva_drm_dep, libdrm_dep])
meson.override_dependency(pkg_name, gstva_dep) meson.override_dependency(pkg_name, gstva_dep)

View file

@ -18,9 +18,12 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#include "vasurfaceimage.h" #ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/va/gstvavideoformat.h> #include "vasurfaceimage.h"
#include "gstvavideoformat.h"
#include <va/va.h> #include <va/va.h>
gboolean gboolean

View file

@ -43,10 +43,10 @@
#include "config.h" #include "config.h"
#endif #endif
#include <gst/codecs/gstav1decoder.h> #include <gst/va/gstvaallocator.h>
#include "gstvaav1dec.h" #include "gstvaav1dec.h"
#include "gstvabasedec.h" #include "gstvabasedec.h"
#include "gstvaallocator.h"
GST_DEBUG_CATEGORY_STATIC (gst_va_av1dec_debug); GST_DEBUG_CATEGORY_STATIC (gst_va_av1dec_debug);
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG

View file

@ -20,11 +20,11 @@
#include "gstvabasedec.h" #include "gstvabasedec.h"
#include <gst/va/gstvaallocator.h>
#include <gst/va/gstvapool.h>
#include <gst/va/gstvavideoformat.h> #include <gst/va/gstvavideoformat.h>
#include "gstvaallocator.h"
#include "gstvacaps.h" #include "gstvacaps.h"
#include "gstvapool.h"
#define GST_CAT_DEFAULT (base->debug_category) #define GST_CAT_DEFAULT (base->debug_category)
#define GST_VA_BASE_DEC_GET_PARENT_CLASS(obj) (GST_VA_BASE_DEC_GET_CLASS(obj)->parent_decoder_class) #define GST_VA_BASE_DEC_GET_PARENT_CLASS(obj) (GST_VA_BASE_DEC_GET_CLASS(obj)->parent_decoder_class)

View file

@ -24,9 +24,10 @@
#include "gstvabasetransform.h" #include "gstvabasetransform.h"
#include "gstvaallocator.h" #include <gst/va/gstvaallocator.h>
#include <gst/va/gstvapool.h>
#include "gstvacaps.h" #include "gstvacaps.h"
#include "gstvapool.h"
#define GST_CAT_DEFAULT gst_va_base_transform_debug #define GST_CAT_DEFAULT gst_va_base_transform_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);

View file

@ -24,9 +24,9 @@
#include "gstvadecoder.h" #include "gstvadecoder.h"
#include <gst/va/gstvaallocator.h>
#include <gst/va/gstvavideoformat.h> #include <gst/va/gstvavideoformat.h>
#include "gstvaallocator.h"
#include "gstvacaps.h" #include "gstvacaps.h"
#include "gstvadisplay_priv.h" #include "gstvadisplay_priv.h"
#include "gstvaprofile.h" #include "gstvaprofile.h"

View file

@ -51,16 +51,15 @@
#include "gstvadeinterlace.h" #include "gstvadeinterlace.h"
#include <gst/va/gstvaallocator.h>
#include <gst/va/gstvapool.h>
#include <gst/video/video.h> #include <gst/video/video.h>
#include <va/va_drmcommon.h> #include <va/va_drmcommon.h>
#include "gstvaallocator.h"
#include "gstvabasetransform.h" #include "gstvabasetransform.h"
#include "gstvacaps.h" #include "gstvacaps.h"
#include "gstvadisplay_priv.h" #include "gstvadisplay_priv.h"
#include "gstvafilter.h" #include "gstvafilter.h"
#include "gstvapool.h"
GST_DEBUG_CATEGORY_STATIC (gst_va_deinterlace_debug); GST_DEBUG_CATEGORY_STATIC (gst_va_deinterlace_debug);
#define GST_CAT_DEFAULT gst_va_deinterlace_debug #define GST_CAT_DEFAULT gst_va_deinterlace_debug

View file

@ -25,13 +25,14 @@
#include "gstvaencoder.h" #include "gstvaencoder.h"
#include <gst/va/gstvaallocator.h>
#include <gst/va/gstvadisplay_wrapped.h>
#include <gst/va/gstvapool.h>
#include <gst/va/gstvavideoformat.h>
#include "vacompat.h" #include "vacompat.h"
#include "gstvaallocator.h"
#include "gstvapool.h"
#include "gstvacaps.h" #include "gstvacaps.h"
#include "gstvadisplay_priv.h" #include "gstvadisplay_priv.h"
#include "gstvavideoformat.h"
#include <gst/va/gstvadisplay_wrapped.h>
#define VA_ENTRYPOINT_FLAG(entry) (1U << G_PASTE(VAEntrypoint, entry)) #define VA_ENTRYPOINT_FLAG(entry) (1U << G_PASTE(VAEntrypoint, entry))

View file

@ -24,15 +24,13 @@
#include "gstvafilter.h" #include "gstvafilter.h"
#include <gst/video/video.h> #include <gst/va/gstvaallocator.h>
#include <gst/va/gstvavideoformat.h> #include <gst/va/gstvavideoformat.h>
#include <gst/video/video.h>
#include <va/va_drmcommon.h> #include <va/va_drmcommon.h>
#include "gstvaallocator.h"
#include "gstvacaps.h" #include "gstvacaps.h"
#include "gstvadisplay_priv.h" #include "gstvadisplay_priv.h"
#include "vasurfaceimage.h"
struct _GstVaFilter struct _GstVaFilter
{ {
@ -1521,6 +1519,23 @@ gst_va_filter_drop_filter_buffers (GstVaFilter * self)
return ret; return ret;
} }
static gboolean
_check_surface (GstVaDisplay * display, VASurfaceID surface)
{
VADisplay dpy = gst_va_display_get_va_dpy (display);
VAStatus status;
VASurfaceStatus state;
status = vaQuerySurfaceStatus (dpy, surface, &state);
if (status != VA_STATUS_SUCCESS)
GST_ERROR ("vaQuerySurfaceStatus: %s", vaErrorStr (status));
GST_LOG ("surface %#x status %d", surface, state);
return (status == VA_STATUS_SUCCESS);
}
static gboolean static gboolean
_fill_va_sample (GstVaFilter * self, GstVaSample * sample, _fill_va_sample (GstVaFilter * self, GstVaSample * sample,
GstPadDirection direction) GstPadDirection direction)
@ -1535,7 +1550,7 @@ _fill_va_sample (GstVaFilter * self, GstVaSample * sample,
/* @FIXME: in gallium vaQuerySurfaceStatus only seems to work with /* @FIXME: in gallium vaQuerySurfaceStatus only seems to work with
* encoder's surfaces */ * encoder's surfaces */
if (!GST_VA_DISPLAY_IS_IMPLEMENTATION (self->display, MESA_GALLIUM)) { if (!GST_VA_DISPLAY_IS_IMPLEMENTATION (self->display, MESA_GALLIUM)) {
if (!va_check_surface (self->display, sample->surface)) if (!_check_surface (self->display, sample->surface))
return FALSE; return FALSE;
} }

View file

@ -50,22 +50,22 @@
#include "config.h" #include "config.h"
#endif #endif
#include <gst/video/video.h>
#include <va/va_drmcommon.h> #include "gstvah264enc.h"
#include <gst/codecparsers/gsth264bitwriter.h> #include <gst/codecparsers/gsth264bitwriter.h>
#include <gst/va/gstvaallocator.h>
#include <gst/va/gstvapool.h>
#include <gst/va/gstvautils.h> #include <gst/va/gstvautils.h>
#include <gst/va/gstvavideoformat.h>
#include <gst/video/video.h>
#include <va/va_drmcommon.h>
#include "vacompat.h" #include "vacompat.h"
#include "gstvah264enc.h"
#include "gstvaencoder.h" #include "gstvaencoder.h"
#include "gstvavideoformat.h"
#include "gstvaallocator.h"
#include "gstvacaps.h" #include "gstvacaps.h"
#include "gstvaprofile.h" #include "gstvaprofile.h"
#include "gstvadisplay_priv.h" #include "gstvadisplay_priv.h"
#include "gstvapool.h"
GST_DEBUG_CATEGORY_STATIC (gst_va_h264enc_debug); GST_DEBUG_CATEGORY_STATIC (gst_va_h264enc_debug);
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG

View file

@ -63,15 +63,14 @@
#include "gstvavpp.h" #include "gstvavpp.h"
#include <gst/video/video.h> #include <gst/video/video.h>
#include <gst/va/gstvaallocator.h>
#include <gst/va/gstvapool.h>
#include <va/va_drmcommon.h> #include <va/va_drmcommon.h>
#include "gstvaallocator.h"
#include "gstvabasetransform.h" #include "gstvabasetransform.h"
#include "gstvacaps.h" #include "gstvacaps.h"
#include "gstvadisplay_priv.h" #include "gstvadisplay_priv.h"
#include "gstvafilter.h" #include "gstvafilter.h"
#include "gstvapool.h"
GST_DEBUG_CATEGORY_STATIC (gst_va_vpp_debug); GST_DEBUG_CATEGORY_STATIC (gst_va_vpp_debug);
#define GST_CAT_DEFAULT gst_va_vpp_debug #define GST_CAT_DEFAULT gst_va_vpp_debug

View file

@ -1,6 +1,5 @@
va_sources = [ va_sources = [
'plugin.c', 'plugin.c',
'gstvaallocator.c',
'gstvabasedec.c', 'gstvabasedec.c',
'gstvabasetransform.c', 'gstvabasetransform.c',
'gstvacaps.c', 'gstvacaps.c',
@ -9,18 +8,16 @@ va_sources = [
'gstvaencoder.c', 'gstvaencoder.c',
'gstvadevice.c', 'gstvadevice.c',
'gstvadisplay_priv.c', 'gstvadisplay_priv.c',
'gstvaencoder.c',
'gstvafilter.c', 'gstvafilter.c',
'gstvah264dec.c', 'gstvah264dec.c',
'gstvah264enc.c',
'gstvah265dec.c', 'gstvah265dec.c',
'gstvapool.c', 'gstvampeg2dec.c',
'gstvaprofile.c', 'gstvaprofile.c',
'gstvasurfacecopy.c',
'gstvavp8dec.c', 'gstvavp8dec.c',
'gstvavp9dec.c', 'gstvavp9dec.c',
'gstvampeg2dec.c',
'gstvavpp.c', 'gstvavpp.c',
'gstvah264enc.c',
'vasurfaceimage.c'
] ]
if host_system != 'linux' if host_system != 'linux'
@ -53,7 +50,7 @@ gstva = library('gstva',
va_sources, va_sources,
c_args : gst_plugins_bad_args + gstva_cargs, c_args : gst_plugins_bad_args + gstva_cargs,
include_directories : [configinc], include_directories : [configinc],
dependencies : [gstvideo_dep, gstcodecs_dep, gstallocators_dep, gstva_dep, libgudev_dep] + extra_dep, dependencies : [gstcodecs_dep, gstva_dep, libgudev_dep] + extra_dep,
install : true, install : true,
install_dir : plugins_install_dir, install_dir : plugins_install_dir,
) )