va: Move allocators and pool objects into gstva library.
authorHe Junyan <junyan.he@intel.com>
Wed, 23 Feb 2022 07:40:19 +0000 (15:40 +0800)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 29 Mar 2022 19:48:30 +0000 (19:48 +0000)
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>

19 files changed:
subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c [moved from subprojects/gst-plugins-bad/sys/va/gstvaallocator.c with 97% similarity]
subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.h [moved from subprojects/gst-plugins-bad/sys/va/gstvaallocator.h with 70% similarity]
subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.c [moved from subprojects/gst-plugins-bad/sys/va/gstvapool.c with 98% similarity]
subprojects/gst-plugins-bad/gst-libs/gst/va/gstvapool.h [moved from subprojects/gst-plugins-bad/sys/va/gstvapool.h with 51% similarity]
subprojects/gst-plugins-bad/gst-libs/gst/va/gstvasurfacecopy.c [moved from subprojects/gst-plugins-bad/sys/va/gstvasurfacecopy.c with 75% similarity]
subprojects/gst-plugins-bad/gst-libs/gst/va/gstvasurfacecopy.h [moved from subprojects/gst-plugins-bad/sys/va/gstvasurfacecopy.h with 100% similarity]
subprojects/gst-plugins-bad/gst-libs/gst/va/meson.build
subprojects/gst-plugins-bad/gst-libs/gst/va/vasurfaceimage.c [moved from subprojects/gst-plugins-bad/sys/va/vasurfaceimage.c with 99% similarity]
subprojects/gst-plugins-bad/gst-libs/gst/va/vasurfaceimage.h [moved from subprojects/gst-plugins-bad/sys/va/vasurfaceimage.h with 100% similarity]
subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c
subprojects/gst-plugins-bad/sys/va/gstvabasedec.c
subprojects/gst-plugins-bad/sys/va/gstvabasetransform.c
subprojects/gst-plugins-bad/sys/va/gstvadecoder.c
subprojects/gst-plugins-bad/sys/va/gstvadeinterlace.c
subprojects/gst-plugins-bad/sys/va/gstvaencoder.c
subprojects/gst-plugins-bad/sys/va/gstvafilter.c
subprojects/gst-plugins-bad/sys/va/gstvah264enc.c
subprojects/gst-plugins-bad/sys/va/gstvavpp.c
subprojects/gst-plugins-bad/sys/va/meson.build

 
 #include "gstvaallocator.h"
 
-#include <gst/va/gstvavideoformat.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#include "gstvacaps.h"
 #include "gstvasurfacecopy.h"
+#include "gstvavideoformat.h"
 #include "vasurfaceimage.h"
 
 #define GST_CAT_DEFAULT gst_va_memory_debug
@@ -254,6 +253,11 @@ struct _GstVaDmabufAllocator
   GstVaMemoryPool pool;
 };
 
+struct _GstVaDmabufAllocatorClass
+{
+  GstDmaBufAllocatorClass parent_class;
+};
+
 #define gst_va_dmabuf_allocator_parent_class dmabuf_parent_class
 G_DEFINE_TYPE_WITH_CODE (GstVaDmabufAllocator, gst_va_dmabuf_allocator,
     GST_TYPE_DMABUF_ALLOCATOR, _init_debug_category ());
@@ -735,9 +739,13 @@ gboolean
 gst_va_dmabuf_allocator_prepare_buffer (GstAllocator * allocator,
     GstBuffer * buffer)
 {
-  GstVaDmabufAllocator *self = GST_VA_DMABUF_ALLOCATOR (allocator);
+  GstVaDmabufAllocator *self;
   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);
   surface = gst_va_dmabuf_allocator_prepare_buffer_unlocked (self, buffer);
   GST_VA_MEMORY_POOL_UNLOCK (&self->pool);
@@ -748,7 +756,11 @@ gst_va_dmabuf_allocator_prepare_buffer (GstAllocator * allocator,
 void
 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);
 }
@@ -757,10 +769,15 @@ static gboolean
 gst_va_dmabuf_allocator_try (GstAllocator * allocator)
 {
   GstBuffer *buffer;
-  GstVaDmabufAllocator *self = GST_VA_DMABUF_ALLOCATOR (allocator);
-  GstVideoInfo info = self->info;
+  GstVaDmabufAllocator *self;
+  GstVideoInfo info;
   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 ();
   ret = gst_va_dmabuf_allocator_setup_buffer_full (allocator, buffer, &info);
   gst_buffer_unref (buffer);
@@ -920,6 +937,11 @@ struct _GstVaAllocator
   GstVaMemoryPool pool;
 };
 
+struct _GstVaAllocatorClass
+{
+  GstAllocatorClass parent_class;
+};
+
 typedef struct _GstVaMemory GstVaMemory;
 struct _GstVaMemory
 {
@@ -1452,9 +1474,13 @@ gst_va_allocator_prepare_buffer_unlocked (GstVaAllocator * self,
 gboolean
 gst_va_allocator_prepare_buffer (GstAllocator * allocator, GstBuffer * buffer)
 {
-  GstVaAllocator *self = GST_VA_ALLOCATOR (allocator);
+  GstVaAllocator *self;
   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);
   surface = gst_va_allocator_prepare_buffer_unlocked (self, buffer);
   GST_VA_MEMORY_POOL_UNLOCK (&self->pool);
@@ -1465,7 +1491,11 @@ gst_va_allocator_prepare_buffer (GstAllocator * allocator, GstBuffer * buffer)
 void
 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);
 }
@@ -1473,7 +1503,11 @@ gst_va_allocator_flush (GstAllocator * allocator)
 static gboolean
 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->rt_format = 0;
@@ -1553,7 +1587,10 @@ gboolean
 gst_va_allocator_get_format (GstAllocator * allocator, GstVideoInfo * info,
     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)
     return FALSE;
 
 G_BEGIN_DECLS
 
+typedef struct _GstVaAllocator GstVaAllocator;
+typedef struct _GstVaAllocatorClass GstVaAllocatorClass;
+typedef struct _GstVaDmabufAllocator GstVaDmabufAllocator;
+typedef struct _GstVaDmabufAllocatorClass GstVaDmabufAllocatorClass;
+
 #define GST_TYPE_VA_DMABUF_ALLOCATOR (gst_va_dmabuf_allocator_get_type())
-G_DECLARE_FINAL_TYPE (GstVaDmabufAllocator, gst_va_dmabuf_allocator, GST,
-    VA_DMABUF_ALLOCATOR, GstDmaBufAllocator);
+#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);
+GST_VA_API
 gboolean              gst_va_dmabuf_allocator_setup_buffer (GstAllocator * allocator,
                                                             GstBuffer * buffer);
+GST_VA_API
 gboolean              gst_va_dmabuf_allocator_prepare_buffer (GstAllocator * allocator,
                                                               GstBuffer * buffer);
+GST_VA_API
 void                  gst_va_dmabuf_allocator_flush       (GstAllocator * allocator);
+GST_VA_API
 gboolean              gst_va_dmabuf_allocator_set_format  (GstAllocator * allocator,
                                                            GstVideoInfo * info,
                                                            guint usage_hint);
+GST_VA_API
 gboolean              gst_va_dmabuf_allocator_get_format  (GstAllocator * allocator,
                                                            GstVideoInfo * info,
                                                            guint * usage_hint);
 
+GST_VA_API
 gboolean              gst_va_dmabuf_memories_setup        (GstVaDisplay * display,
                                                            GstVideoInfo * info,
                                                            guint n_planes,
@@ -54,31 +71,48 @@ gboolean              gst_va_dmabuf_memories_setup        (GstVaDisplay * displa
                                                            guint usage_hint);
 
 #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_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,
                                                            GArray * surface_formats);
+GST_VA_API
 GstMemory *           gst_va_allocator_alloc              (GstAllocator * allocator);
+GST_VA_API
 gboolean              gst_va_allocator_setup_buffer       (GstAllocator * allocator,
                                                            GstBuffer * buffer);
+GST_VA_API
 gboolean              gst_va_allocator_prepare_buffer     (GstAllocator * allocator,
                                                            GstBuffer * buffer);
+GST_VA_API
 void                  gst_va_allocator_flush              (GstAllocator * allocator);
+GST_VA_API
 gboolean              gst_va_allocator_set_format         (GstAllocator * allocator,
                                                            GstVideoInfo * info,
                                                            guint usage_hint);
+GST_VA_API
 gboolean              gst_va_allocator_get_format         (GstAllocator * allocator,
                                                            GstVideoInfo * info,
                                                            guint * usage_hint);
 
+GST_VA_API
 VASurfaceID           gst_va_memory_get_surface           (GstMemory * mem);
+GST_VA_API
 VASurfaceID           gst_va_buffer_get_surface           (GstBuffer * buffer);
 
+GST_VA_API
 gboolean              gst_va_buffer_create_aux_surface    (GstBuffer * buffer);
+GST_VA_API
 VASurfaceID           gst_va_buffer_get_aux_surface       (GstBuffer * buffer);
 
 G_END_DECLS
@@ -23,9 +23,7 @@
 #endif
 
 #include "gstvapool.h"
-
 #include "gstvaallocator.h"
-#include "gstvacaps.h"
 
 GST_DEBUG_CATEGORY_STATIC (gst_va_pool_debug);
 #define GST_CAT_DEFAULT gst_va_pool_debug
@@ -45,6 +43,11 @@ struct _GstVaPool
   gboolean starting;
 };
 
+struct _GstVaPoolClass
+{
+  GstBufferPoolClass parent_class;
+};
+
 #define gst_va_pool_parent_class parent_class
 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"));
@@ -341,6 +344,9 @@ gst_buffer_pool_config_set_va_allocation_params (GstStructure * config,
 gboolean
 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;
 }
 
 
 #pragma once
 
+#include <gst/va/va_fwd.h>
+#include <gst/va/va-prelude.h>
 #include <gst/gst.h>
 
 G_BEGIN_DECLS
 
+typedef struct _GstVaPool GstVaPool;
+typedef struct _GstVaPoolClass GstVaPoolClass;
+
 #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);
+GST_VA_API
 gboolean             gst_va_pool_requires_video_meta      (GstBufferPool * pool);
+GST_VA_API
 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,
-                                                          guint size,
-                                                          guint min_buffers,
-                                                          guint max_buffers,
-                                                          guint usage_hint,
-                                                          GstAllocator * allocator,
-                                                          GstAllocationParams * alloc_params);
+                                                           guint size,
+                                                           guint min_buffers,
+                                                           guint max_buffers,
+                                                           guint usage_hint,
+                                                           GstAllocator * allocator,
+                                                           GstAllocationParams * alloc_params);
 
 G_END_DECLS
  * Boston, MA 02110-1301, USA.
  */
 
-#include "gstvasurfacecopy.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
-#include "gstvaallocator.h"
-#include "gstvadisplay_priv.h"
-#include "gstvafilter.h"
+#include "gstvasurfacecopy.h"
 #include "vasurfaceimage.h"
 
 #define GST_CAT_DEFAULT gst_va_memory_debug
@@ -36,7 +36,6 @@ struct _GstVaSurfaceCopy
   gboolean has_copy;
 
   GRecMutex lock;
-  GstVaFilter *filter;
 };
 
 static gboolean
@@ -76,16 +75,8 @@ gst_va_surface_copy_new (GstVaDisplay * display, GstVideoInfo * vinfo)
   self->display = gst_object_ref (display);
   self->has_copy = _has_copy (display);
   self->info = *vinfo;
-  self->filter = NULL;
   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;
 }
 
@@ -95,35 +86,12 @@ gst_va_surface_copy_free (GstVaSurfaceCopy * self)
   g_return_if_fail (self && GST_IS_VA_DISPLAY (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_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
 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;
   }
 
-  if (self->filter && _vpp_copy_surface (self, dst, src)) {
-    GST_LOG ("VPP copy of %#x to %#x", src, dst);
-    return TRUE;
-  }
+  /* TODO: Add the VPP copy. */
 
   if (!va_ensure_image (self->display, src, &self->info, &image, FALSE))
     return FALSE;
index bb2ad0f..8d5ee3a 100644 (file)
@@ -1,20 +1,26 @@
 va_sources = [
+  'gstvaallocator.c',
   'gstvadisplay.c',
   'gstvadisplay_drm.c',
   'gstvadisplay_wrapped.c',
+  'gstvapool.c',
+  'gstvasurfacecopy.c',
   'gstvautils.c',
   'gstvavideoformat.c',
+  'vasurfaceimage.c',
 ]
 
 va_headers = [
   'gstva.h',
+  'gstvaallocator.h',
   'gstvadisplay.h',
   'gstvadisplay_drm.h',
   'gstvadisplay_wrapped.h',
+  'gstvapool.h',
   'gstvautils.h',
   'gstvavideoformat.h',
-  'va_fwd.h',
   'va-prelude.h',
+  'va_fwd.h',
 ]
 
 gstva_dep = dependency('', required : false)
@@ -51,5 +57,5 @@ libraries += [[pkg_name, {'lib': gstva}]]
 
 gstva_dep = declare_dependency(link_with : gstva,
   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)
  * 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>
 
 gboolean
index 429a8d3..fd8300c 100644 (file)
 #include "config.h"
 #endif
 
-#include <gst/codecs/gstav1decoder.h>
+#include <gst/va/gstvaallocator.h>
+
 #include "gstvaav1dec.h"
 #include "gstvabasedec.h"
-#include "gstvaallocator.h"
 
 GST_DEBUG_CATEGORY_STATIC (gst_va_av1dec_debug);
 #ifndef GST_DISABLE_GST_DEBUG
index d59ff72..f00ebf4 100644 (file)
 
 #include "gstvabasedec.h"
 
+#include <gst/va/gstvaallocator.h>
+#include <gst/va/gstvapool.h>
 #include <gst/va/gstvavideoformat.h>
 
-#include "gstvaallocator.h"
 #include "gstvacaps.h"
-#include "gstvapool.h"
 
 #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)
index 36a3fef..98435ec 100644 (file)
 
 #include "gstvabasetransform.h"
 
-#include "gstvaallocator.h"
+#include <gst/va/gstvaallocator.h>
+#include <gst/va/gstvapool.h>
+
 #include "gstvacaps.h"
-#include "gstvapool.h"
 
 #define GST_CAT_DEFAULT gst_va_base_transform_debug
 GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
index 9330b9d..50f7e4c 100644 (file)
@@ -24,9 +24,9 @@
 
 #include "gstvadecoder.h"
 
+#include <gst/va/gstvaallocator.h>
 #include <gst/va/gstvavideoformat.h>
 
-#include "gstvaallocator.h"
 #include "gstvacaps.h"
 #include "gstvadisplay_priv.h"
 #include "gstvaprofile.h"
index 8cb50a5..ff2aad6 100644 (file)
 
 #include "gstvadeinterlace.h"
 
+#include <gst/va/gstvaallocator.h>
+#include <gst/va/gstvapool.h>
 #include <gst/video/video.h>
-
 #include <va/va_drmcommon.h>
 
-#include "gstvaallocator.h"
 #include "gstvabasetransform.h"
 #include "gstvacaps.h"
 #include "gstvadisplay_priv.h"
 #include "gstvafilter.h"
-#include "gstvapool.h"
 
 GST_DEBUG_CATEGORY_STATIC (gst_va_deinterlace_debug);
 #define GST_CAT_DEFAULT gst_va_deinterlace_debug
index f35b346..55a7754 100644 (file)
 
 #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 "gstvaallocator.h"
-#include "gstvapool.h"
 #include "gstvacaps.h"
 #include "gstvadisplay_priv.h"
-#include "gstvavideoformat.h"
-#include <gst/va/gstvadisplay_wrapped.h>
 
 #define VA_ENTRYPOINT_FLAG(entry) (1U << G_PASTE(VAEntrypoint, entry))
 
index dc5c13e..5979fd1 100644 (file)
 
 #include "gstvafilter.h"
 
-#include <gst/video/video.h>
+#include <gst/va/gstvaallocator.h>
 #include <gst/va/gstvavideoformat.h>
-
+#include <gst/video/video.h>
 #include <va/va_drmcommon.h>
 
-#include "gstvaallocator.h"
 #include "gstvacaps.h"
 #include "gstvadisplay_priv.h"
-#include "vasurfaceimage.h"
 
 struct _GstVaFilter
 {
@@ -1522,6 +1520,23 @@ gst_va_filter_drop_filter_buffers (GstVaFilter * self)
 }
 
 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
 _fill_va_sample (GstVaFilter * self, GstVaSample * sample,
     GstPadDirection direction)
 {
@@ -1535,7 +1550,7 @@ _fill_va_sample (GstVaFilter * self, GstVaSample * sample,
   /* @FIXME: in gallium vaQuerySurfaceStatus only seems to work with
    * encoder's surfaces */
   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;
   }
 
index b8ef38f..124ba0f 100644 (file)
 #include "config.h"
 #endif
 
-#include <gst/video/video.h>
 
-#include <va/va_drmcommon.h>
+#include "gstvah264enc.h"
 
 #include <gst/codecparsers/gsth264bitwriter.h>
+#include <gst/va/gstvaallocator.h>
+#include <gst/va/gstvapool.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 "gstvah264enc.h"
 #include "gstvaencoder.h"
-#include "gstvavideoformat.h"
-#include "gstvaallocator.h"
 #include "gstvacaps.h"
 #include "gstvaprofile.h"
 #include "gstvadisplay_priv.h"
-#include "gstvapool.h"
 
 GST_DEBUG_CATEGORY_STATIC (gst_va_h264enc_debug);
 #ifndef GST_DISABLE_GST_DEBUG
index f08f0c2..9ec189a 100644 (file)
 #include "gstvavpp.h"
 
 #include <gst/video/video.h>
-
+#include <gst/va/gstvaallocator.h>
+#include <gst/va/gstvapool.h>
 #include <va/va_drmcommon.h>
 
-#include "gstvaallocator.h"
 #include "gstvabasetransform.h"
 #include "gstvacaps.h"
 #include "gstvadisplay_priv.h"
 #include "gstvafilter.h"
-#include "gstvapool.h"
 
 GST_DEBUG_CATEGORY_STATIC (gst_va_vpp_debug);
 #define GST_CAT_DEFAULT gst_va_vpp_debug
index 83cba95..4b65b94 100644 (file)
@@ -1,6 +1,5 @@
 va_sources = [
   'plugin.c',
-  'gstvaallocator.c',
   'gstvabasedec.c',
   'gstvabasetransform.c',
   'gstvacaps.c',
@@ -9,18 +8,16 @@ va_sources = [
   'gstvaencoder.c',
   'gstvadevice.c',
   'gstvadisplay_priv.c',
+  'gstvaencoder.c',
   'gstvafilter.c',
   'gstvah264dec.c',
+  'gstvah264enc.c',
   'gstvah265dec.c',
-  'gstvapool.c',
+  'gstvampeg2dec.c',
   'gstvaprofile.c',
-  'gstvasurfacecopy.c',
   'gstvavp8dec.c',
   'gstvavp9dec.c',
-  'gstvampeg2dec.c',
   'gstvavpp.c',
-  'gstvah264enc.c',
-  'vasurfaceimage.c'
 ]
 
 if host_system != 'linux'
@@ -53,7 +50,7 @@ gstva = library('gstva',
   va_sources,
   c_args : gst_plugins_bad_args + gstva_cargs,
   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_dir : plugins_install_dir,
 )