diff options
| author | Yuqing Zhu <carol.zhu@nxp.com> | 2016-10-13 09:59:51 +0800 |
|---|---|---|
| committer | Otavio Salvador <otavio@ossystems.com.br> | 2016-10-27 10:36:28 -0200 |
| commit | 7d3e10c59af9aef7e672b906fa29203672772c1f (patch) | |
| tree | c9911b8ff5e30eb763813a5ff87ca67bde0f6d26 | |
| parent | cdcc02c5857ebf0c044dbb2ec2f1a46f047c5b8f (diff) | |
| download | meta-freescale-7d3e10c59af9aef7e672b906fa29203672772c1f.tar.gz | |
gstreamer1.0-plugins-bad: Accelerate gldownload with directviv API
1) Propose a physical buffer pool to upstream in gldownload
2) Bind the physical buffer with texture via dirctviv
3) In gldownload, wrap the physical buffer to gstbuffer, pass to
downstream plugins.
Signed-off-by: Yuqing Zhu <carol.zhu@nxp.com>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
5 files changed, 1239 insertions, 0 deletions
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0003-MMFMWK-6930-glplugin-Accelerate-gldownload-with-dire.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0003-MMFMWK-6930-glplugin-Accelerate-gldownload-with-dire.patch new file mode 100644 index 000000000..1cead36d4 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0003-MMFMWK-6930-glplugin-Accelerate-gldownload-with-dire.patch | |||
| @@ -0,0 +1,729 @@ | |||
| 1 | From 05bbd82dd527afa44d6b403b02a0dbd198c96859 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jian Li <jian.li@freescale.com> | ||
| 3 | Date: Fri, 6 Nov 2015 15:00:19 +0800 | ||
| 4 | Subject: [PATCH 14/18] MMFMWK-6930 [glplugin] Accelerate gldownload with | ||
| 5 | directviv API | ||
| 6 | MIME-Version: 1.0 | ||
| 7 | Content-Type: text/plain; charset=UTF-8 | ||
| 8 | Content-Transfer-Encoding: 8bit | ||
| 9 | |||
| 10 | 1) Propose a physical buffer pool to upstream in gldownload | ||
| 11 | 2) Bind the physical buffer with texture via dirctviv | ||
| 12 | 3) In gldownload, wrap the physical buffer to gstbuffer, pass to | ||
| 13 | downstream plugins. | ||
| 14 | |||
| 15 | Upstream-Status: Inappropriate [i.MX specific] | ||
| 16 | |||
| 17 | Signed-off-by: Jian Li <jian.li@freescale.com> | ||
| 18 | Signed-off-by: Lyon Wang <lyon.wang@freescale.com> | ||
| 19 | --- | ||
| 20 | ext/gl/gstgldownloadelement.c | 91 ++++++++++++ | ||
| 21 | gst-libs/gst/gl/Makefile.am | 4 + | ||
| 22 | gst-libs/gst/gl/gstglbufferpool.c | 12 ++ | ||
| 23 | gst-libs/gst/gl/gstglphymemory.c | 254 ++++++++++++++++++++++++++++++++ | ||
| 24 | gst-libs/gst/gl/gstglphymemory.h | 43 ++++++ | ||
| 25 | gst-libs/gst/gl/gstglvivdirecttexture.c | 147 +++++++++--------- | ||
| 26 | gst-libs/gst/gl/gstglvivdirecttexture.h | 3 + | ||
| 27 | 7 files changed, 484 insertions(+), 70 deletions(-) | ||
| 28 | create mode 100644 gst-libs/gst/gl/gstglphymemory.c | ||
| 29 | create mode 100644 gst-libs/gst/gl/gstglphymemory.h | ||
| 30 | |||
| 31 | diff --git a/ext/gl/gstgldownloadelement.c b/ext/gl/gstgldownloadelement.c | ||
| 32 | index ff931fa..9ea0146 100644 | ||
| 33 | --- a/ext/gl/gstgldownloadelement.c | ||
| 34 | +++ b/ext/gl/gstgldownloadelement.c | ||
| 35 | @@ -23,6 +23,7 @@ | ||
| 36 | #endif | ||
| 37 | |||
| 38 | #include <gst/gl/gl.h> | ||
| 39 | +#include <gst/gl/gstglphymemory.h> | ||
| 40 | #include "gstgldownloadelement.h" | ||
| 41 | |||
| 42 | GST_DEBUG_CATEGORY_STATIC (gst_gl_download_element_debug); | ||
| 43 | @@ -45,6 +46,8 @@ gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt, | ||
| 44 | GstBuffer * buffer, GstBuffer ** outbuf); | ||
| 45 | static GstFlowReturn gst_gl_download_element_transform (GstBaseTransform * bt, | ||
| 46 | GstBuffer * buffer, GstBuffer * outbuf); | ||
| 47 | +static gboolean gst_gl_download_element_propose_allocation (GstBaseTransform * | ||
| 48 | + bt, GstQuery * decide_query, GstQuery * query); | ||
| 49 | |||
| 50 | static GstStaticPadTemplate gst_gl_download_element_src_pad_template = | ||
| 51 | GST_STATIC_PAD_TEMPLATE ("src", | ||
| 52 | @@ -70,6 +73,7 @@ gst_gl_download_element_class_init (GstGLDownloadElementClass * klass) | ||
| 53 | bt_class->prepare_output_buffer = | ||
| 54 | gst_gl_download_element_prepare_output_buffer; | ||
| 55 | bt_class->transform = gst_gl_download_element_transform; | ||
| 56 | + bt_class->propose_allocation = gst_gl_download_element_propose_allocation; | ||
| 57 | |||
| 58 | bt_class->passthrough_on_same_caps = TRUE; | ||
| 59 | |||
| 60 | @@ -160,9 +164,24 @@ static GstFlowReturn | ||
| 61 | gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt, | ||
| 62 | GstBuffer * inbuf, GstBuffer ** outbuf) | ||
| 63 | { | ||
| 64 | + GstGLDownloadElement *download = GST_GL_DOWNLOAD_ELEMENT (bt); | ||
| 65 | GstCaps *src_caps = gst_pad_get_current_caps (bt->srcpad); | ||
| 66 | GstCapsFeatures *features = NULL; | ||
| 67 | gint i, n; | ||
| 68 | + GstGLMemory *glmem; | ||
| 69 | + | ||
| 70 | + glmem = gst_buffer_peek_memory (inbuf, 0); | ||
| 71 | + if (gst_is_gl_physical_memory (glmem)) { | ||
| 72 | + GstGLContext *context = GST_GL_BASE_FILTER (bt)->context; | ||
| 73 | + GstVideoInfo info; | ||
| 74 | + | ||
| 75 | + gst_video_info_from_caps (&info, src_caps); | ||
| 76 | + *outbuf = gst_gl_phymem_buffer_to_gstbuffer (context, &info, inbuf); | ||
| 77 | + | ||
| 78 | + GST_DEBUG_OBJECT (download, "gl download with direct viv."); | ||
| 79 | + | ||
| 80 | + return GST_FLOW_OK; | ||
| 81 | + } | ||
| 82 | |||
| 83 | *outbuf = inbuf; | ||
| 84 | |||
| 85 | @@ -194,3 +213,75 @@ gst_gl_download_element_transform (GstBaseTransform * bt, | ||
| 86 | { | ||
| 87 | return GST_FLOW_OK; | ||
| 88 | } | ||
| 89 | + | ||
| 90 | +static gboolean | ||
| 91 | +gst_gl_download_element_propose_allocation (GstBaseTransform * bt, | ||
| 92 | + GstQuery * decide_query, GstQuery * query) | ||
| 93 | +{ | ||
| 94 | + GstGLContext *context = GST_GL_BASE_FILTER (bt)->context; | ||
| 95 | + GstGLDownloadElement *download = GST_GL_DOWNLOAD_ELEMENT (bt); | ||
| 96 | + GstAllocationParams params; | ||
| 97 | + GstAllocator *allocator = NULL; | ||
| 98 | + GstBufferPool *pool = NULL; | ||
| 99 | + guint n_pools, i; | ||
| 100 | + GstVideoInfo info; | ||
| 101 | + GstCaps *caps; | ||
| 102 | + GstStructure *config; | ||
| 103 | + gsize size; | ||
| 104 | + | ||
| 105 | + gst_query_parse_allocation (query, &caps, NULL); | ||
| 106 | + if (!gst_video_info_from_caps (&info, caps)) { | ||
| 107 | + GST_WARNING_OBJECT (bt, "invalid caps specified"); | ||
| 108 | + return FALSE; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + GST_DEBUG_OBJECT (bt, "video format is %s", gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&info))); | ||
| 112 | + | ||
| 113 | + gst_allocation_params_init (¶ms); | ||
| 114 | + if (gst_is_gl_physical_memory_supported_fmt (&info)) { | ||
| 115 | + allocator = gst_phy_mem_allocator_obtain (); | ||
| 116 | + GST_DEBUG_OBJECT (bt, "obtain physical memory allocator %p.", allocator); | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + if (!allocator) | ||
| 120 | + allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR_NAME); | ||
| 121 | + | ||
| 122 | + if (!allocator) { | ||
| 123 | + GST_ERROR_OBJECT (bt, "Can't obtain physical memory allocator."); | ||
| 124 | + return FALSE; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + gst_query_add_allocation_param (query, allocator, ¶ms); | ||
| 128 | + gst_object_unref (allocator); | ||
| 129 | + | ||
| 130 | + n_pools = gst_query_get_n_allocation_pools (query); | ||
| 131 | + for (i = 0; i < n_pools; i++) { | ||
| 132 | + gst_query_parse_nth_allocation_pool (query, i, &pool, NULL, NULL, NULL); | ||
| 133 | + gst_object_unref (pool); | ||
| 134 | + pool = NULL; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + //new buffer pool | ||
| 138 | + pool = gst_gl_buffer_pool_new (context); | ||
| 139 | + config = gst_buffer_pool_get_config (pool); | ||
| 140 | + | ||
| 141 | + /* the normal size of a frame */ | ||
| 142 | + size = info.size; | ||
| 143 | + gst_buffer_pool_config_set_params (config, caps, size, 0, 0); | ||
| 144 | + gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_GL_SYNC_META); | ||
| 145 | + | ||
| 146 | + if (!gst_buffer_pool_set_config (pool, config)) { | ||
| 147 | + gst_object_unref (pool); | ||
| 148 | + GST_WARNING_OBJECT (bt, "failed setting config"); | ||
| 149 | + return FALSE; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + GST_DEBUG_OBJECT (download, "create pool %p", pool); | ||
| 153 | + | ||
| 154 | + //propose 3 buffers for better performance | ||
| 155 | + gst_query_add_allocation_pool (query, pool, size, 3, 0); | ||
| 156 | + | ||
| 157 | + gst_object_unref (pool); | ||
| 158 | + | ||
| 159 | + return TRUE; | ||
| 160 | +} | ||
| 161 | diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am | ||
| 162 | index c396603..5c05230 100644 | ||
| 163 | --- a/gst-libs/gst/gl/Makefile.am | ||
| 164 | +++ b/gst-libs/gst/gl/Makefile.am | ||
| 165 | @@ -34,6 +34,7 @@ libgstgl_@GST_API_VERSION@_la_SOURCES = \ | ||
| 166 | gstgloverlaycompositor.c \ | ||
| 167 | gstglquery.c \ | ||
| 168 | gstglvivdirecttexture.c \ | ||
| 169 | + gstglphymemory.c \ | ||
| 170 | gstglcontrolbindingproxy.c | ||
| 171 | |||
| 172 | libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl | ||
| 173 | @@ -68,6 +69,7 @@ libgstgl_@GST_API_VERSION@include_HEADERS = \ | ||
| 174 | gstgl_fwd.h \ | ||
| 175 | gstgl_enums.h \ | ||
| 176 | gstglvivdirecttexture.h \ | ||
| 177 | + gstglphymemory.h \ | ||
| 178 | gl.h | ||
| 179 | |||
| 180 | noinst_HEADERS = \ | ||
| 181 | @@ -84,6 +86,8 @@ libgstgl_@GST_API_VERSION@_la_LIBADD = \ | ||
| 182 | $(GST_LIBS) \ | ||
| 183 | $(GL_LIBS) | ||
| 184 | |||
| 185 | +libgstgl_@GST_API_VERSION@_la_LIBADD += -lgstfsl-$(GST_API_VERSION) | ||
| 186 | + | ||
| 187 | if HAVE_WINDOW_WIN32 | ||
| 188 | SUBDIRS += win32 | ||
| 189 | libgstgl_@GST_API_VERSION@_la_LIBADD += win32/libgstgl-win32.la | ||
| 190 | diff --git a/gst-libs/gst/gl/gstglbufferpool.c b/gst-libs/gst/gl/gstglbufferpool.c | ||
| 191 | index 90536b0..71c726a 100644 | ||
| 192 | --- a/gst-libs/gst/gl/gstglbufferpool.c | ||
| 193 | +++ b/gst-libs/gst/gl/gstglbufferpool.c | ||
| 194 | @@ -30,6 +30,8 @@ | ||
| 195 | #include <gst/gl/egl/gsteglimagememory.h> | ||
| 196 | #endif | ||
| 197 | |||
| 198 | +#include <gst/gl/gstglphymemory.h> | ||
| 199 | + | ||
| 200 | /** | ||
| 201 | * SECTION:gstglbufferpool | ||
| 202 | * @short_description: buffer pool for #GstGLMemory objects | ||
| 203 | @@ -290,6 +292,16 @@ gst_gl_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer, | ||
| 204 | } | ||
| 205 | #endif | ||
| 206 | |||
| 207 | + if ((g_strcmp0 (priv->allocator->mem_type, GST_GL_PHY_MEM_ALLOCATOR) == 0)) { | ||
| 208 | + GstAllocator* allocator = (GstAllocator*) gst_phy_mem_allocator_obtain (); | ||
| 209 | + if (!gst_gl_physical_memory_setup_buffer (allocator, buf, priv->gl_params)) { | ||
| 210 | + GST_ERROR_OBJECT (pool, "Can't create physcial buffer."); | ||
| 211 | + return GST_FLOW_ERROR; | ||
| 212 | + } | ||
| 213 | + *buffer = buf; | ||
| 214 | + return GST_FLOW_OK; | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | alloc = GST_GL_MEMORY_ALLOCATOR (priv->allocator); | ||
| 218 | if (!gst_gl_memory_setup_buffer (alloc, buf, priv->gl_params)) | ||
| 219 | goto mem_create_failed; | ||
| 220 | diff --git a/gst-libs/gst/gl/gstglphymemory.c b/gst-libs/gst/gl/gstglphymemory.c | ||
| 221 | new file mode 100644 | ||
| 222 | index 0000000..52ae41f | ||
| 223 | --- /dev/null | ||
| 224 | +++ b/gst-libs/gst/gl/gstglphymemory.c | ||
| 225 | @@ -0,0 +1,254 @@ | ||
| 226 | +/* | ||
| 227 | + * GStreamer | ||
| 228 | + * Copyright (c) 2015, Freescale Semiconductor, Inc. | ||
| 229 | + * | ||
| 230 | + * This library is free software; you can redistribute it and/or | ||
| 231 | + * modify it under the terms of the GNU Library General Public | ||
| 232 | + * License as published by the Free Software Foundation; either | ||
| 233 | + * version 2 of the License, or (at your option) any later version. | ||
| 234 | + * | ||
| 235 | + * This library is distributed in the hope that it will be useful, | ||
| 236 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 237 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 238 | + * Library General Public License for more details. | ||
| 239 | + * | ||
| 240 | + * You should have received a copy of the GNU Library General Public | ||
| 241 | + * License along with this library; if not, write to the | ||
| 242 | + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, | ||
| 243 | + * Boston, MA 02110-1301, USA. | ||
| 244 | + */ | ||
| 245 | + | ||
| 246 | +#ifdef HAVE_CONFIG_H | ||
| 247 | +#include "config.h" | ||
| 248 | +#endif | ||
| 249 | + | ||
| 250 | +#include "gstglvivdirecttexture.h" | ||
| 251 | +#include "gstglphymemory.h" | ||
| 252 | +#include "g2d.h" | ||
| 253 | + | ||
| 254 | +GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_PHY_MEMORY); | ||
| 255 | +#define GST_CAT_DEFAULT GST_CAT_GL_PHY_MEMORY | ||
| 256 | + | ||
| 257 | +typedef struct _GstPhyMemAllocator GstPhyMemAllocator; | ||
| 258 | +typedef struct _GstPhyMemAllocatorClass GstPhyMemAllocatorClass; | ||
| 259 | + | ||
| 260 | +struct _GstPhyMemAllocator | ||
| 261 | +{ | ||
| 262 | + GstAllocatorPhyMem parent; | ||
| 263 | +}; | ||
| 264 | + | ||
| 265 | +struct _GstPhyMemAllocatorClass | ||
| 266 | +{ | ||
| 267 | + GstAllocatorPhyMemClass parent_class; | ||
| 268 | +}; | ||
| 269 | + | ||
| 270 | +GType gst_phy_mem_allocator_get_type (void); | ||
| 271 | +G_DEFINE_TYPE (GstPhyMemAllocator, gst_phy_mem_allocator, GST_TYPE_ALLOCATOR_PHYMEM); | ||
| 272 | + | ||
| 273 | +static int | ||
| 274 | +alloc_phymem (GstAllocatorPhyMem *allocator, PhyMemBlock *memblk) | ||
| 275 | +{ | ||
| 276 | + struct g2d_buf *pbuf = NULL; | ||
| 277 | + | ||
| 278 | + memblk->size = PAGE_ALIGN(memblk->size); | ||
| 279 | + | ||
| 280 | + pbuf = g2d_alloc (memblk->size, 0); | ||
| 281 | + if (!pbuf) { | ||
| 282 | + GST_ERROR("G2D allocate %u bytes memory failed: %s", | ||
| 283 | + memblk->size, strerror(errno)); | ||
| 284 | + return -1; | ||
| 285 | + } | ||
| 286 | + | ||
| 287 | + memblk->vaddr = (guchar*) pbuf->buf_vaddr; | ||
| 288 | + memblk->paddr = (guchar*) pbuf->buf_paddr; | ||
| 289 | + memblk->user_data = (gpointer) pbuf; | ||
| 290 | + GST_DEBUG("G2D allocated memory (%p)", memblk->paddr); | ||
| 291 | + | ||
| 292 | + return 1; | ||
| 293 | +} | ||
| 294 | + | ||
| 295 | +static int | ||
| 296 | +free_phymem (GstAllocatorPhyMem *allocator, PhyMemBlock *memblk) | ||
| 297 | +{ | ||
| 298 | + GST_DEBUG("G2D free memory (%p)", memblk->paddr); | ||
| 299 | + gint ret = g2d_free ((struct g2d_buf*)(memblk->user_data)); | ||
| 300 | + memblk->user_data = NULL; | ||
| 301 | + memblk->vaddr = NULL; | ||
| 302 | + memblk->paddr = NULL; | ||
| 303 | + memblk->size = 0; | ||
| 304 | + | ||
| 305 | + return ret; | ||
| 306 | +} | ||
| 307 | + | ||
| 308 | +static void | ||
| 309 | +gst_phy_mem_allocator_class_init (GstPhyMemAllocatorClass * klass) | ||
| 310 | +{ | ||
| 311 | + GstAllocatorPhyMemClass *phy_allocator_klass = (GstAllocatorPhyMemClass *) klass; | ||
| 312 | + | ||
| 313 | + phy_allocator_klass->alloc_phymem = alloc_phymem; | ||
| 314 | + phy_allocator_klass->free_phymem = free_phymem; | ||
| 315 | +} | ||
| 316 | + | ||
| 317 | +static void | ||
| 318 | +gst_phy_mem_allocator_init (GstPhyMemAllocator * allocator) | ||
| 319 | +{ | ||
| 320 | + GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator); | ||
| 321 | + | ||
| 322 | + alloc->mem_type = GST_GL_PHY_MEM_ALLOCATOR; | ||
| 323 | +} | ||
| 324 | + | ||
| 325 | + | ||
| 326 | +static gpointer | ||
| 327 | +gst_phy_mem_allocator_init_instance (gpointer data) | ||
| 328 | +{ | ||
| 329 | + GstAllocator *allocator = | ||
| 330 | + g_object_new (gst_phy_mem_allocator_get_type (), NULL); | ||
| 331 | + | ||
| 332 | + GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_PHY_MEMORY, "glphymemory", 0, | ||
| 333 | + "GLPhysical Memory"); | ||
| 334 | + | ||
| 335 | + gst_allocator_register (GST_GL_PHY_MEM_ALLOCATOR, gst_object_ref (allocator)); | ||
| 336 | + | ||
| 337 | + return allocator; | ||
| 338 | +} | ||
| 339 | + | ||
| 340 | +static void | ||
| 341 | +_finish_texture (GstGLContext * ctx, gpointer *data) | ||
| 342 | +{ | ||
| 343 | + GstGLFuncs *gl = ctx->gl_vtable; | ||
| 344 | + | ||
| 345 | + gl->Finish (); | ||
| 346 | +} | ||
| 347 | + | ||
| 348 | +static void | ||
| 349 | +gst_gl_phy_mem_destroy (GstMemory *mem) | ||
| 350 | +{ | ||
| 351 | + gst_memory_unref (mem); | ||
| 352 | +} | ||
| 353 | + | ||
| 354 | + | ||
| 355 | +GstAllocator * | ||
| 356 | +gst_phy_mem_allocator_obtain (void) | ||
| 357 | +{ | ||
| 358 | + static GOnce once = G_ONCE_INIT; | ||
| 359 | + | ||
| 360 | + g_once (&once, gst_phy_mem_allocator_init_instance, NULL); | ||
| 361 | + | ||
| 362 | + g_return_val_if_fail (once.retval != NULL, NULL); | ||
| 363 | + | ||
| 364 | + return (GstAllocator *) (g_object_ref (once.retval)); | ||
| 365 | +} | ||
| 366 | + | ||
| 367 | +gboolean | ||
| 368 | +gst_is_gl_physical_memory (GstMemory * mem) | ||
| 369 | +{ | ||
| 370 | + GstGLBaseMemory *glmem; | ||
| 371 | + g_return_val_if_fail (gst_is_gl_memory (mem), FALSE); | ||
| 372 | + | ||
| 373 | + glmem = (GstGLBaseMemory*) mem; | ||
| 374 | + | ||
| 375 | + if (glmem->user_data | ||
| 376 | + && GST_IS_MINI_OBJECT_TYPE(glmem->user_data, GST_TYPE_MEMORY)) | ||
| 377 | + return gst_memory_is_type ((GstMemory*)glmem->user_data, GST_GL_PHY_MEM_ALLOCATOR); | ||
| 378 | + else | ||
| 379 | + return FALSE; | ||
| 380 | +} | ||
| 381 | + | ||
| 382 | +gboolean | ||
| 383 | +gst_is_gl_physical_memory_supported_fmt (GstVideoInfo * info) | ||
| 384 | +{ | ||
| 385 | + if (GST_VIDEO_INFO_IS_RGB(info) | ||
| 386 | + && gst_gl_is_directviv_supported_format (GST_VIDEO_INFO_FORMAT (info))) { | ||
| 387 | + return TRUE; | ||
| 388 | + } | ||
| 389 | + else | ||
| 390 | + return FALSE; | ||
| 391 | +} | ||
| 392 | + | ||
| 393 | +gboolean | ||
| 394 | +gst_gl_physical_memory_setup_buffer (GstAllocator * allocator, GstBuffer *buffer, | ||
| 395 | + GstGLVideoAllocationParams * params) | ||
| 396 | +{ | ||
| 397 | + GstGLBaseMemoryAllocator *gl_alloc; | ||
| 398 | + GstMemory *mem = NULL; | ||
| 399 | + PhyMemBlock *memblk = NULL; | ||
| 400 | + GstGLMemory *glmem = NULL; | ||
| 401 | + gsize size; | ||
| 402 | + | ||
| 403 | + GstVideoInfo * info = params->v_info; | ||
| 404 | + GstVideoAlignment * valign = params->valign; | ||
| 405 | + | ||
| 406 | + GST_DEBUG ("glphymemory setup buffer format %s", gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (info))); | ||
| 407 | + | ||
| 408 | + if (!gst_is_gl_physical_memory_supported_fmt (info)) { | ||
| 409 | + GST_DEBUG ("Not support format."); | ||
| 410 | + return FALSE; | ||
| 411 | + } | ||
| 412 | + | ||
| 413 | + //allocator = (GstAllocator*) gst_phy_mem_allocator_obtain (); | ||
| 414 | + size = gst_gl_get_plane_data_size (info, valign, 0); | ||
| 415 | + mem = gst_allocator_alloc (allocator, size, params->parent.alloc_params); | ||
| 416 | + if (!mem) { | ||
| 417 | + GST_DEBUG ("Can't allocate physical memory size %d", size); | ||
| 418 | + return FALSE; | ||
| 419 | + } | ||
| 420 | + | ||
| 421 | + memblk = gst_memory_query_phymem_block (mem); | ||
| 422 | + if (!memblk) { | ||
| 423 | + GST_ERROR("Can't find physic memory block."); | ||
| 424 | + return FALSE; | ||
| 425 | + } | ||
| 426 | + | ||
| 427 | + gl_alloc = | ||
| 428 | + GST_GL_BASE_MEMORY_ALLOCATOR (gst_gl_memory_allocator_get_default | ||
| 429 | + (params->parent.context)); | ||
| 430 | + | ||
| 431 | + params->plane = 0; | ||
| 432 | + params->parent.user_data = mem; | ||
| 433 | + params->parent.notify = gst_gl_phy_mem_destroy; | ||
| 434 | + | ||
| 435 | + glmem = (GstGLMemory *)gst_gl_base_memory_alloc (gl_alloc, (GstGLAllocationParams *) params); | ||
| 436 | + if (!glmem) { | ||
| 437 | + GST_ERROR("Can't get gl memory."); | ||
| 438 | + return FALSE; | ||
| 439 | + } | ||
| 440 | + | ||
| 441 | + gst_buffer_append_memory (buffer, (GstMemory *) glmem); | ||
| 442 | + | ||
| 443 | + gst_buffer_add_video_meta_full (buffer, 0, | ||
| 444 | + GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info), | ||
| 445 | + GST_VIDEO_INFO_HEIGHT (info), 1, info->offset, info->stride); | ||
| 446 | + | ||
| 447 | + gst_gl_viv_direct_bind_data(params->parent.context, glmem->tex_id, | ||
| 448 | + GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info), | ||
| 449 | + GST_VIDEO_INFO_HEIGHT (info), memblk->vaddr, memblk->paddr); | ||
| 450 | + | ||
| 451 | + return TRUE; | ||
| 452 | +} | ||
| 453 | + | ||
| 454 | +GstBuffer * | ||
| 455 | +gst_gl_phymem_buffer_to_gstbuffer (GstGLContext * ctx, | ||
| 456 | + GstVideoInfo * info, GstBuffer *glbuf) | ||
| 457 | +{ | ||
| 458 | + GstBuffer *buf; | ||
| 459 | + GstGLBaseMemory *glmem; | ||
| 460 | + | ||
| 461 | + gst_gl_context_thread_add (ctx, (GstGLContextThreadFunc) _finish_texture, NULL); | ||
| 462 | + | ||
| 463 | + glmem = gst_buffer_peek_memory (glbuf, 0); | ||
| 464 | + | ||
| 465 | + buf = gst_buffer_new (); | ||
| 466 | + gst_buffer_append_memory (buf, (GstMemory *) glmem->user_data); | ||
| 467 | + gst_memory_ref ((GstMemory *)glmem->user_data); | ||
| 468 | + | ||
| 469 | + gst_buffer_add_video_meta_full (buf, 0, | ||
| 470 | + GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info), | ||
| 471 | + GST_VIDEO_INFO_HEIGHT (info), 1, info->offset, info->stride); | ||
| 472 | + GST_BUFFER_FLAGS (buf) = GST_BUFFER_FLAGS (glbuf); | ||
| 473 | + GST_BUFFER_PTS (buf) = GST_BUFFER_PTS (glbuf); | ||
| 474 | + GST_BUFFER_DTS (buf) = GST_BUFFER_DTS (glbuf); | ||
| 475 | + GST_BUFFER_DURATION (buf) = GST_BUFFER_DURATION (glbuf); | ||
| 476 | + | ||
| 477 | + return buf; | ||
| 478 | +} | ||
| 479 | + | ||
| 480 | diff --git a/gst-libs/gst/gl/gstglphymemory.h b/gst-libs/gst/gl/gstglphymemory.h | ||
| 481 | new file mode 100644 | ||
| 482 | index 0000000..b1a69e7 | ||
| 483 | --- /dev/null | ||
| 484 | +++ b/gst-libs/gst/gl/gstglphymemory.h | ||
| 485 | @@ -0,0 +1,43 @@ | ||
| 486 | +/* | ||
| 487 | + * GStreamer | ||
| 488 | + * Copyright (c) 2015, Freescale Semiconductor, Inc. | ||
| 489 | + * | ||
| 490 | + * This library is free software; you can redistribute it and/or | ||
| 491 | + * modify it under the terms of the GNU Library General Public | ||
| 492 | + * License as published by the Free Software Foundation; either | ||
| 493 | + * version 2 of the License, or (at your option) any later version. | ||
| 494 | + * | ||
| 495 | + * This library is distributed in the hope that it will be useful, | ||
| 496 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 497 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 498 | + * Library General Public License for more details. | ||
| 499 | + * | ||
| 500 | + * You should have received a copy of the GNU Library General Public | ||
| 501 | + * License along with this library; if not, write to the | ||
| 502 | + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, | ||
| 503 | + * Boston, MA 02110-1301, USA. | ||
| 504 | + */ | ||
| 505 | + | ||
| 506 | +#ifndef _GST_GL_PHY_MEMORY_H_ | ||
| 507 | +#define _GST_GL_PHY_MEMORY_H_ | ||
| 508 | + | ||
| 509 | +#include <gst/gst.h> | ||
| 510 | +#include <gst/gstmemory.h> | ||
| 511 | +#include <gst/video/video.h> | ||
| 512 | +#include <gst/imx-mm/gstallocatorphymem.h> | ||
| 513 | + | ||
| 514 | +#include <gst/gl/gl.h> | ||
| 515 | + | ||
| 516 | +G_BEGIN_DECLS | ||
| 517 | + | ||
| 518 | +#define GST_GL_PHY_MEM_ALLOCATOR "GLPhyMemory" | ||
| 519 | + | ||
| 520 | +GstAllocator *gst_phy_mem_allocator_obtain (void); | ||
| 521 | +gboolean gst_is_gl_physical_memory (GstMemory * mem); | ||
| 522 | +gboolean gst_is_gl_physical_memory_supported_fmt (GstVideoInfo * info); | ||
| 523 | +gboolean gst_gl_physical_memory_setup_buffer (GstAllocator * allocator, GstBuffer *buffer, GstGLVideoAllocationParams * params); | ||
| 524 | +GstBuffer * gst_gl_phymem_buffer_to_gstbuffer (GstGLContext * ctx, GstVideoInfo * info, GstBuffer *glbuf); | ||
| 525 | + | ||
| 526 | +G_END_DECLS | ||
| 527 | + | ||
| 528 | +#endif /* _GST_GL_PHY_MEMORY_H_ */ | ||
| 529 | diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.c b/gst-libs/gst/gl/gstglvivdirecttexture.c | ||
| 530 | index c19b617..e8e0b82 100644 | ||
| 531 | --- a/gst-libs/gst/gl/gstglvivdirecttexture.c | ||
| 532 | +++ b/gst-libs/gst/gl/gstglvivdirecttexture.c | ||
| 533 | @@ -22,6 +22,7 @@ | ||
| 534 | #include "config.h" | ||
| 535 | #endif | ||
| 536 | |||
| 537 | +#include <gst/imx-mm/gstallocatorphymem.h> | ||
| 538 | #include "gl.h" | ||
| 539 | |||
| 540 | GST_DEBUG_CATEGORY_EXTERN (gst_gl_upload_debug); | ||
| 541 | @@ -37,17 +38,28 @@ typedef struct { | ||
| 542 | gboolean ret; | ||
| 543 | } GstVivDirectTexture; | ||
| 544 | |||
| 545 | +typedef struct { | ||
| 546 | + GstVideoFormat gst_fmt; | ||
| 547 | + guint viv_fmt; | ||
| 548 | +} VIV_FMT_MAP; | ||
| 549 | + | ||
| 550 | +static VIV_FMT_MAP viv_fmt_map_table[] = { | ||
| 551 | + {GST_VIDEO_FORMAT_I420, GL_VIV_I420}, | ||
| 552 | + {GST_VIDEO_FORMAT_YV12, GL_VIV_YV12}, | ||
| 553 | + {GST_VIDEO_FORMAT_NV12, GL_VIV_NV12}, | ||
| 554 | + {GST_VIDEO_FORMAT_NV21, GL_VIV_NV21}, | ||
| 555 | + {GST_VIDEO_FORMAT_YUY2, GL_VIV_YUY2}, | ||
| 556 | + {GST_VIDEO_FORMAT_UYVY, GL_VIV_UYVY}, | ||
| 557 | + {GST_VIDEO_FORMAT_RGBA, GL_RGBA}, | ||
| 558 | + {GST_VIDEO_FORMAT_RGBx, GL_RGBA}, | ||
| 559 | + {GST_VIDEO_FORMAT_BGRA, GL_BGRA_EXT}, | ||
| 560 | + {GST_VIDEO_FORMAT_RGB16, GL_RGB565_OES} | ||
| 561 | +}; | ||
| 562 | + | ||
| 563 | gboolean | ||
| 564 | gst_is_physical_buffer (GstBuffer *buffer) | ||
| 565 | { | ||
| 566 | - | ||
| 567 | - GstMemory *mem; | ||
| 568 | - | ||
| 569 | - mem = gst_buffer_peek_memory (buffer, 0); | ||
| 570 | - if (!mem->allocator) | ||
| 571 | - return FALSE; | ||
| 572 | - | ||
| 573 | - return g_type_check_instance_is_a (mem->allocator, g_type_from_name("GstAllocatorPhyMem")); | ||
| 574 | + return gst_buffer_is_phymem (buffer); | ||
| 575 | } | ||
| 576 | |||
| 577 | static void | ||
| 578 | @@ -65,32 +77,64 @@ _do_viv_direct_tex_bind_mem (GstGLContext * context, GstVivDirectTexture * viv_t | ||
| 579 | } | ||
| 580 | |||
| 581 | gboolean | ||
| 582 | +gst_gl_is_directviv_supported_format (GstVideoFormat fmt) | ||
| 583 | +{ | ||
| 584 | + gint i; | ||
| 585 | + gboolean ret = FALSE; | ||
| 586 | + | ||
| 587 | + for (i=0; i<sizeof(viv_fmt_map_table)/sizeof(VIV_FMT_MAP); i++) { | ||
| 588 | + if (fmt == viv_fmt_map_table[i].gst_fmt) { | ||
| 589 | + ret = TRUE; | ||
| 590 | + break; | ||
| 591 | + } | ||
| 592 | + } | ||
| 593 | + | ||
| 594 | + return ret; | ||
| 595 | +} | ||
| 596 | + | ||
| 597 | +gboolean | ||
| 598 | +gst_gl_viv_direct_bind_data (GstGLContext * context, | ||
| 599 | + guint tex_id, GstVideoFormat fmt, gint width, gint height, | ||
| 600 | + gpointer * vaddr, gpointer *paddr) | ||
| 601 | +{ | ||
| 602 | + guint viv_fmt = GL_NONE; | ||
| 603 | + gint i; | ||
| 604 | + | ||
| 605 | + for (i=0; i<sizeof(viv_fmt_map_table)/sizeof(VIV_FMT_MAP); i++) { | ||
| 606 | + if (fmt == viv_fmt_map_table[i].gst_fmt) { | ||
| 607 | + viv_fmt = viv_fmt_map_table[i].viv_fmt; | ||
| 608 | + break; | ||
| 609 | + } | ||
| 610 | + } | ||
| 611 | + | ||
| 612 | + if (viv_fmt == GL_NONE) { | ||
| 613 | + GST_ERROR ("Not supported format %d for viv direct texture upload.", fmt); | ||
| 614 | + return FALSE; | ||
| 615 | + } | ||
| 616 | + | ||
| 617 | + GstVivDirectTexture viv_tex = {tex_id, width, height, viv_fmt, vaddr, paddr, FALSE}; | ||
| 618 | + gst_gl_context_thread_add (context, (GstGLContextThreadFunc) _do_viv_direct_tex_bind_mem, &viv_tex); | ||
| 619 | + | ||
| 620 | + return viv_tex.ret; | ||
| 621 | +} | ||
| 622 | + | ||
| 623 | +gboolean | ||
| 624 | gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideoInfo * info, GstBuffer * buffer) | ||
| 625 | { | ||
| 626 | - typedef struct { | ||
| 627 | - guint8 *vaddr; | ||
| 628 | - guint8 *paddr; | ||
| 629 | - guint8 *caddr; | ||
| 630 | - gsize size; | ||
| 631 | - gpointer *user_data; | ||
| 632 | - } PhyMemBlock; | ||
| 633 | - //Note: structure PhyMemBlock is copied from gst1.0-fsl-plugin/libs/allocator/gstallocatorphymem.h | ||
| 634 | - | ||
| 635 | - typedef struct { | ||
| 636 | - GstMemory mem; | ||
| 637 | - guint8 *vaddr; | ||
| 638 | - guint8 *paddr; | ||
| 639 | - PhyMemBlock block; | ||
| 640 | - } GstMemoryPhy; | ||
| 641 | - //Note: structure GstMemoryPhy is copied from gst1.0-fsl-plugin/libs/allocator/gstallocatorphymem.c | ||
| 642 | - | ||
| 643 | - GstMemory *mem = gst_buffer_peek_memory (buffer, 0); | ||
| 644 | - GstMemoryPhy *memphy = (GstMemoryPhy*) mem; | ||
| 645 | - PhyMemBlock *memblk = &memphy->block; | ||
| 646 | - | ||
| 647 | - GstVideoFormat fmt = GST_VIDEO_INFO_FORMAT (info); | ||
| 648 | + PhyMemBlock *memblk; | ||
| 649 | + GstVideoMeta *vmeta; | ||
| 650 | + GstVideoFormat fmt; | ||
| 651 | gint width, height; | ||
| 652 | - GstVideoMeta *vmeta = gst_buffer_get_video_meta (buffer); | ||
| 653 | + | ||
| 654 | + memblk = gst_buffer_query_phymem_block (buffer); | ||
| 655 | + if (!memblk) | ||
| 656 | + return FALSE; | ||
| 657 | + | ||
| 658 | + width = GST_VIDEO_INFO_WIDTH (info); | ||
| 659 | + height = GST_VIDEO_INFO_HEIGHT (info); | ||
| 660 | + | ||
| 661 | + vmeta = gst_buffer_get_video_meta (buffer); | ||
| 662 | + fmt = GST_VIDEO_INFO_FORMAT (info); | ||
| 663 | if (vmeta && (fmt == GST_VIDEO_FORMAT_I420 || fmt == GST_VIDEO_FORMAT_NV12)) { | ||
| 664 | width = vmeta->stride[0]; | ||
| 665 | height = vmeta->offset[1] / width; | ||
| 666 | @@ -100,44 +144,7 @@ gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideo | ||
| 667 | height = GST_VIDEO_INFO_HEIGHT (info); | ||
| 668 | } | ||
| 669 | |||
| 670 | - guint viv_fmt; | ||
| 671 | - switch (fmt) { | ||
| 672 | - case GST_VIDEO_FORMAT_I420: | ||
| 673 | - viv_fmt = GL_VIV_I420; | ||
| 674 | - break; | ||
| 675 | - case GST_VIDEO_FORMAT_YV12: | ||
| 676 | - viv_fmt = GL_VIV_YV12; | ||
| 677 | - break; | ||
| 678 | - case GST_VIDEO_FORMAT_NV12: | ||
| 679 | - viv_fmt = GL_VIV_NV12; | ||
| 680 | - break; | ||
| 681 | - case GST_VIDEO_FORMAT_NV21: | ||
| 682 | - viv_fmt = GL_VIV_NV21; | ||
| 683 | - break; | ||
| 684 | - case GST_VIDEO_FORMAT_YUY2: | ||
| 685 | - viv_fmt = GL_VIV_YUY2; | ||
| 686 | - break; | ||
| 687 | - case GST_VIDEO_FORMAT_UYVY: | ||
| 688 | - viv_fmt = GL_VIV_UYVY; | ||
| 689 | - break; | ||
| 690 | - case GST_VIDEO_FORMAT_RGBA: | ||
| 691 | - viv_fmt = GL_RGBA; | ||
| 692 | - break; | ||
| 693 | - case GST_VIDEO_FORMAT_BGRA: | ||
| 694 | - viv_fmt = GL_BGRA_EXT; | ||
| 695 | - break; | ||
| 696 | - case GST_VIDEO_FORMAT_RGB16: | ||
| 697 | - viv_fmt = GL_RGB565_OES; | ||
| 698 | - break; | ||
| 699 | - default: | ||
| 700 | - GST_ERROR ("Not supported format %d for viv direct texture upload.", fmt); | ||
| 701 | - viv_fmt = GL_NONE; | ||
| 702 | - return FALSE; | ||
| 703 | - } | ||
| 704 | - | ||
| 705 | - GstVivDirectTexture viv_tex = {tex_id, width, height, viv_fmt, memblk->vaddr, memblk->paddr, FALSE}; | ||
| 706 | - gst_gl_context_thread_add (context, (GstGLContextThreadFunc) _do_viv_direct_tex_bind_mem, &viv_tex); | ||
| 707 | - | ||
| 708 | - return viv_tex.ret; | ||
| 709 | + return gst_gl_viv_direct_bind_data (context, tex_id, fmt, width, height, memblk->vaddr, memblk->paddr); | ||
| 710 | } | ||
| 711 | |||
| 712 | + | ||
| 713 | diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.h b/gst-libs/gst/gl/gstglvivdirecttexture.h | ||
| 714 | index fa88e1a..9a2d123 100644 | ||
| 715 | --- a/gst-libs/gst/gl/gstglvivdirecttexture.h | ||
| 716 | +++ b/gst-libs/gst/gl/gstglvivdirecttexture.h | ||
| 717 | @@ -28,6 +28,9 @@ | ||
| 718 | G_BEGIN_DECLS | ||
| 719 | |||
| 720 | gboolean gst_is_physical_buffer (GstBuffer *buffer); | ||
| 721 | +gboolean gst_gl_is_directviv_supported_format (GstVideoFormat fmt); | ||
| 722 | +gboolean gst_gl_viv_direct_bind_data (GstGLContext * context, guint tex_id, GstVideoFormat fmt, gint width, gint height, | ||
| 723 | + gpointer * vaddr, gpointer *paddr); | ||
| 724 | gboolean gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideoInfo * info, GstBuffer * buffer); | ||
| 725 | |||
| 726 | G_END_DECLS | ||
| 727 | -- | ||
| 728 | 1.9.1 | ||
| 729 | |||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0004-Fix-dependence-issue-between-gst-plugin-.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0004-Fix-dependence-issue-between-gst-plugin-.patch new file mode 100755 index 000000000..44633cf91 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0004-Fix-dependence-issue-between-gst-plugin-.patch | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | From 4f73ba8dde190b0e2d3a7a16b394762f7459ca31 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Haihua Hu <jared.hu@nxp.com> | ||
| 3 | Date: Fri, 5 Aug 2016 17:04:02 +0800 | ||
| 4 | Subject: [PATCH] [MMFMWK-7259]Fix dependence issue between gst-plugin-bad and | ||
| 5 | imx-gst1.0-plugin | ||
| 6 | |||
| 7 | Change dependence to gst-plugin-base since we have move physical memory allocator | ||
| 8 | to gst-plugin-base | ||
| 9 | |||
| 10 | Upstream-Status: Inappropriate [i.MX specific] | ||
| 11 | |||
| 12 | Signed-off-by: Haihua Hu <jared.hu@nxp.com> | ||
| 13 | --- | ||
| 14 | gst-libs/gst/gl/Makefile.am | 2 +- | ||
| 15 | gst-libs/gst/gl/gstglphymemory.c | 2 +- | ||
| 16 | gst-libs/gst/gl/gstglphymemory.h | 2 +- | ||
| 17 | gst-libs/gst/gl/gstglvivdirecttexture.c | 2 +- | ||
| 18 | 4 files changed, 4 insertions(+), 4 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am | ||
| 21 | index 5c05230..55f8a20 100644 | ||
| 22 | --- a/gst-libs/gst/gl/Makefile.am | ||
| 23 | +++ b/gst-libs/gst/gl/Makefile.am | ||
| 24 | @@ -86,7 +86,7 @@ libgstgl_@GST_API_VERSION@_la_LIBADD = \ | ||
| 25 | $(GST_LIBS) \ | ||
| 26 | $(GL_LIBS) | ||
| 27 | |||
| 28 | -libgstgl_@GST_API_VERSION@_la_LIBADD += -lgstfsl-$(GST_API_VERSION) | ||
| 29 | +libgstgl_@GST_API_VERSION@_la_LIBADD += -lg2d | ||
| 30 | |||
| 31 | if HAVE_WINDOW_WIN32 | ||
| 32 | SUBDIRS += win32 | ||
| 33 | diff --git a/gst-libs/gst/gl/gstglphymemory.c b/gst-libs/gst/gl/gstglphymemory.c | ||
| 34 | index 52ae41f..e28546c 100644 | ||
| 35 | --- a/gst-libs/gst/gl/gstglphymemory.c | ||
| 36 | +++ b/gst-libs/gst/gl/gstglphymemory.c | ||
| 37 | @@ -24,7 +24,7 @@ | ||
| 38 | |||
| 39 | #include "gstglvivdirecttexture.h" | ||
| 40 | #include "gstglphymemory.h" | ||
| 41 | -#include "g2d.h" | ||
| 42 | +#include <g2d.h> | ||
| 43 | |||
| 44 | GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_PHY_MEMORY); | ||
| 45 | #define GST_CAT_DEFAULT GST_CAT_GL_PHY_MEMORY | ||
| 46 | diff --git a/gst-libs/gst/gl/gstglphymemory.h b/gst-libs/gst/gl/gstglphymemory.h | ||
| 47 | index b1a69e7..ebb9911 100644 | ||
| 48 | --- a/gst-libs/gst/gl/gstglphymemory.h | ||
| 49 | +++ b/gst-libs/gst/gl/gstglphymemory.h | ||
| 50 | @@ -24,7 +24,7 @@ | ||
| 51 | #include <gst/gst.h> | ||
| 52 | #include <gst/gstmemory.h> | ||
| 53 | #include <gst/video/video.h> | ||
| 54 | -#include <gst/imx-mm/gstallocatorphymem.h> | ||
| 55 | +#include <gst/allocators/gstallocatorphymem.h> | ||
| 56 | |||
| 57 | #include <gst/gl/gl.h> | ||
| 58 | |||
| 59 | diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.c b/gst-libs/gst/gl/gstglvivdirecttexture.c | ||
| 60 | index e8e0b82..242b7c0 100644 | ||
| 61 | --- a/gst-libs/gst/gl/gstglvivdirecttexture.c | ||
| 62 | +++ b/gst-libs/gst/gl/gstglvivdirecttexture.c | ||
| 63 | @@ -22,7 +22,7 @@ | ||
| 64 | #include "config.h" | ||
| 65 | #endif | ||
| 66 | |||
| 67 | -#include <gst/imx-mm/gstallocatorphymem.h> | ||
| 68 | +#include <gst/allocators/gstallocatorphymem.h> | ||
| 69 | #include "gl.h" | ||
| 70 | |||
| 71 | GST_DEBUG_CATEGORY_EXTERN (gst_gl_upload_debug); | ||
| 72 | -- | ||
| 73 | 1.9.1 | ||
| 74 | |||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend index 16d0ce84d..be23ff777 100644 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend | |||
| @@ -12,6 +12,8 @@ PACKAGECONFIG_GL_mx6sl = "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', \ | |||
| 12 | 12 | ||
| 13 | SRC_URI_append = " file://0001-glplugin-Change-wayland-default-res-to-1024x768.patch \ | 13 | SRC_URI_append = " file://0001-glplugin-Change-wayland-default-res-to-1024x768.patch \ |
| 14 | file://0002-Add-directviv-to-glimagesink-to-improve-playback-per.patch \ | 14 | file://0002-Add-directviv-to-glimagesink-to-improve-playback-per.patch \ |
| 15 | file://0003-MMFMWK-6930-glplugin-Accelerate-gldownload-with-dire.patch \ | ||
| 16 | file://0004-Fix-dependence-issue-between-gst-plugin-.patch \ | ||
| 15 | " | 17 | " |
| 16 | 18 | ||
| 17 | 19 | ||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0002-Remove-dependence-on-imx-plugin-git.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0002-Remove-dependence-on-imx-plugin-git.patch new file mode 100755 index 000000000..80009a9ac --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0002-Remove-dependence-on-imx-plugin-git.patch | |||
| @@ -0,0 +1,433 @@ | |||
| 1 | From 950fe3a224eb5339c946193413f9373c333ea1f0 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Haihua Hu <jared.hu@nxp.com> | ||
| 3 | Date: Fri, 5 Aug 2016 17:08:40 +0800 | ||
| 4 | Subject: [PATCH] [MMFMWK-7259] Remove dependence on imx plugin git. | ||
| 5 | |||
| 6 | Add physical memory allocator | ||
| 7 | |||
| 8 | Upstream-Status: Inappropriate [i.MX specific] | ||
| 9 | |||
| 10 | Signed-off-by: Haihua Hu <jared.hu@nxp.com> | ||
| 11 | --- | ||
| 12 | gst-libs/gst/allocators/Makefile.am | 6 +- | ||
| 13 | gst-libs/gst/allocators/gstallocatorphymem.c | 314 +++++++++++++++++++++++++++ | ||
| 14 | gst-libs/gst/allocators/gstallocatorphymem.h | 64 ++++++ | ||
| 15 | 3 files changed, 382 insertions(+), 2 deletions(-) | ||
| 16 | create mode 100755 gst-libs/gst/allocators/gstallocatorphymem.c | ||
| 17 | create mode 100755 gst-libs/gst/allocators/gstallocatorphymem.h | ||
| 18 | |||
| 19 | diff --git a/gst-libs/gst/allocators/Makefile.am b/gst-libs/gst/allocators/Makefile.am | ||
| 20 | index 5c11b8a..13ffd9c 100644 | ||
| 21 | --- a/gst-libs/gst/allocators/Makefile.am | ||
| 22 | +++ b/gst-libs/gst/allocators/Makefile.am | ||
| 23 | @@ -5,13 +5,15 @@ libgstallocators_@GST_API_VERSION@_includedir = $(includedir)/gstreamer-@GST_API | ||
| 24 | libgstallocators_@GST_API_VERSION@_include_HEADERS = \ | ||
| 25 | allocators.h \ | ||
| 26 | gstfdmemory.h \ | ||
| 27 | - gstdmabuf.h | ||
| 28 | + gstdmabuf.h \ | ||
| 29 | + gstallocatorphymem.h | ||
| 30 | |||
| 31 | noinst_HEADERS = | ||
| 32 | |||
| 33 | libgstallocators_@GST_API_VERSION@_la_SOURCES = \ | ||
| 34 | gstfdmemory.c \ | ||
| 35 | - gstdmabuf.c | ||
| 36 | + gstdmabuf.c \ | ||
| 37 | + gstallocatorphymem.c | ||
| 38 | |||
| 39 | libgstallocators_@GST_API_VERSION@_la_LIBADD = $(GST_LIBS) $(LIBM) | ||
| 40 | libgstallocators_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) | ||
| 41 | diff --git a/gst-libs/gst/allocators/gstallocatorphymem.c b/gst-libs/gst/allocators/gstallocatorphymem.c | ||
| 42 | new file mode 100755 | ||
| 43 | index 0000000..cf5995e | ||
| 44 | --- /dev/null | ||
| 45 | +++ b/gst-libs/gst/allocators/gstallocatorphymem.c | ||
| 46 | @@ -0,0 +1,314 @@ | ||
| 47 | +/* | ||
| 48 | + * Copyright (c) 2013-2015, Freescale Semiconductor, Inc. All rights reserved. | ||
| 49 | + * | ||
| 50 | + * This library is free software; you can redistribute it and/or | ||
| 51 | + * modify it under the terms of the GNU Library General Public | ||
| 52 | + * License as published by the Free Software Foundation; either | ||
| 53 | + * version 2 of the License, or (at your option) any later version. | ||
| 54 | + * | ||
| 55 | + * This library is distributed in the hope that it will be useful, | ||
| 56 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 57 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 58 | + * Library General Public License for more details. | ||
| 59 | + * | ||
| 60 | + * You should have received a copy of the GNU Library General Public | ||
| 61 | + * License along with this library; if not, write to the | ||
| 62 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 63 | + * Boston, MA 02111-1307, USA. | ||
| 64 | + */ | ||
| 65 | + | ||
| 66 | +#include <stdio.h> | ||
| 67 | +#include <string.h> | ||
| 68 | +#include "gstallocatorphymem.h" | ||
| 69 | + | ||
| 70 | +typedef struct { | ||
| 71 | + GstMemory mem; | ||
| 72 | + guint8 *vaddr; | ||
| 73 | + guint8 *paddr; | ||
| 74 | + PhyMemBlock block; | ||
| 75 | +} GstMemoryPhy; | ||
| 76 | + | ||
| 77 | +static int | ||
| 78 | +default_copy (GstAllocatorPhyMem *allocator, PhyMemBlock *dst_mem, | ||
| 79 | + PhyMemBlock *src_mem, guint offset, guint size) | ||
| 80 | +{ | ||
| 81 | + GST_WARNING ("No default copy implementation for physical memory allocator.\n"); | ||
| 82 | + return -1; | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +static gpointer | ||
| 86 | +gst_phymem_map (GstMemory * mem, gsize maxsize, GstMapFlags flags) | ||
| 87 | +{ | ||
| 88 | + GstMemoryPhy *phymem = (GstMemoryPhy*) mem; | ||
| 89 | + | ||
| 90 | + if (GST_MEMORY_IS_READONLY(mem) && (flags & GST_MAP_WRITE)) { | ||
| 91 | + GST_ERROR("memory is read only"); | ||
| 92 | + return NULL; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + return phymem->vaddr; | ||
| 96 | +} | ||
| 97 | + | ||
| 98 | +static void | ||
| 99 | +gst_phymem_unmap (GstMemory * mem) | ||
| 100 | +{ | ||
| 101 | + return; | ||
| 102 | +} | ||
| 103 | + | ||
| 104 | +static GstMemory * | ||
| 105 | +gst_phymem_copy (GstMemory * mem, gssize offset, gssize size) | ||
| 106 | +{ | ||
| 107 | + GstAllocatorPhyMemClass *klass; | ||
| 108 | + GstMemoryPhy *src_mem = (GstMemoryPhy *)mem; | ||
| 109 | + | ||
| 110 | + GstMemoryPhy *dst_mem = g_slice_alloc(sizeof(GstMemoryPhy)); | ||
| 111 | + if(dst_mem == NULL) { | ||
| 112 | + GST_ERROR("Can't allocate for GstMemoryPhy structure.\n"); | ||
| 113 | + return NULL; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + klass = GST_ALLOCATOR_PHYMEM_CLASS(G_OBJECT_GET_CLASS(mem->allocator)); | ||
| 117 | + if(klass == NULL) { | ||
| 118 | + GST_ERROR("Can't get class from allocator object.\n"); | ||
| 119 | + return NULL; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + if(klass->copy_phymem((GstAllocatorPhyMem*)mem->allocator, | ||
| 123 | + &dst_mem->block, &src_mem->block, offset, size) < 0) { | ||
| 124 | + GST_WARNING ("Copy phymem %d failed.\n", size); | ||
| 125 | + return NULL; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + GST_DEBUG ("copied phymem, vaddr(%p), paddr(%p), size(%d).\n", | ||
| 129 | + dst_mem->block.vaddr, dst_mem->block.paddr, dst_mem->block.size); | ||
| 130 | + | ||
| 131 | + dst_mem->vaddr = dst_mem->block.vaddr; | ||
| 132 | + dst_mem->paddr = dst_mem->block.paddr; | ||
| 133 | + | ||
| 134 | + gst_memory_init (GST_MEMORY_CAST (dst_mem), | ||
| 135 | + mem->mini_object.flags&(~GST_MEMORY_FLAG_READONLY), | ||
| 136 | + mem->allocator, NULL, mem->maxsize, mem->align, | ||
| 137 | + mem->offset, mem->size); | ||
| 138 | + | ||
| 139 | + return (GstMemory*)dst_mem; | ||
| 140 | +} | ||
| 141 | + | ||
| 142 | +static GstMemory * | ||
| 143 | +gst_phymem_share (GstMemory * mem, gssize offset, gssize size) | ||
| 144 | +{ | ||
| 145 | + GST_ERROR("Not implemented mem_share in gstallocatorphymem.\n"); | ||
| 146 | + return NULL; | ||
| 147 | +} | ||
| 148 | + | ||
| 149 | +static gboolean | ||
| 150 | +gst_phymem_is_span (GstMemory * mem1, GstMemory * mem2, gsize * offset) | ||
| 151 | +{ | ||
| 152 | + return FALSE; | ||
| 153 | +} | ||
| 154 | + | ||
| 155 | +static gpointer | ||
| 156 | +gst_phymem_get_phy (GstMemory * mem) | ||
| 157 | +{ | ||
| 158 | + GstMemoryPhy *phymem = (GstMemoryPhy*) mem; | ||
| 159 | + | ||
| 160 | + return phymem->paddr; | ||
| 161 | +} | ||
| 162 | + | ||
| 163 | +static GstMemory * | ||
| 164 | +base_alloc (GstAllocator * allocator, gsize size, | ||
| 165 | + GstAllocationParams * params) | ||
| 166 | +{ | ||
| 167 | + GstAllocatorPhyMemClass *klass; | ||
| 168 | + GstMemoryPhy *mem; | ||
| 169 | + gsize maxsize, aoffset, offset, align, padding; | ||
| 170 | + guint8 *data; | ||
| 171 | + | ||
| 172 | + mem = g_slice_alloc(sizeof(GstMemoryPhy)); | ||
| 173 | + if(mem == NULL) { | ||
| 174 | + GST_ERROR("Can allocate for GstMemoryPhy structure.\n"); | ||
| 175 | + return NULL; | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + klass = GST_ALLOCATOR_PHYMEM_CLASS(G_OBJECT_GET_CLASS(allocator)); | ||
| 179 | + if(klass == NULL) { | ||
| 180 | + GST_ERROR("Can't get class from allocator object.\n"); | ||
| 181 | + return NULL; | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + GST_DEBUG ("allocate params, prefix (%d), padding (%d), align (%d), flags (%x).\n", | ||
| 185 | + params->prefix, params->padding, params->align, params->flags); | ||
| 186 | + | ||
| 187 | + maxsize = size + params->prefix + params->padding; | ||
| 188 | + mem->block.size = maxsize; | ||
| 189 | + if(klass->alloc_phymem((GstAllocatorPhyMem*)allocator, &mem->block) < 0) { | ||
| 190 | + GST_ERROR("Allocate phymem %d failed.\n", maxsize); | ||
| 191 | + return NULL; | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + GST_DEBUG ("allocated phymem, vaddr(%p), paddr(%p), size(%d).\n", | ||
| 195 | + mem->block.vaddr, mem->block.paddr, mem->block.size); | ||
| 196 | + | ||
| 197 | + data = mem->block.vaddr; | ||
| 198 | + offset = params->prefix; | ||
| 199 | + align = params->align; | ||
| 200 | + /* do alignment */ | ||
| 201 | + if ((aoffset = ((guintptr)data & align))) { | ||
| 202 | + aoffset = (align + 1) - aoffset; | ||
| 203 | + data += aoffset; | ||
| 204 | + maxsize -= aoffset; | ||
| 205 | + } | ||
| 206 | + mem->vaddr = mem->block.vaddr + aoffset; | ||
| 207 | + mem->paddr = mem->block.paddr + aoffset; | ||
| 208 | + | ||
| 209 | + GST_DEBUG ("aligned vaddr(%p), paddr(%p), size(%d).\n", | ||
| 210 | + mem->block.vaddr, mem->block.paddr, mem->block.size); | ||
| 211 | + | ||
| 212 | + if (offset && (params->flags & GST_MEMORY_FLAG_ZERO_PREFIXED)) | ||
| 213 | + memset (data, 0, offset); | ||
| 214 | + | ||
| 215 | + padding = maxsize - (offset + size); | ||
| 216 | + if (padding && (params->flags & GST_MEMORY_FLAG_ZERO_PADDED)) | ||
| 217 | + memset (data + offset + size, 0, padding); | ||
| 218 | + | ||
| 219 | + gst_memory_init (GST_MEMORY_CAST (mem), params->flags, allocator, NULL, maxsize, align, offset, size); | ||
| 220 | + | ||
| 221 | + return (GstMemory*)mem; | ||
| 222 | +} | ||
| 223 | + | ||
| 224 | +static void | ||
| 225 | +base_free (GstAllocator * allocator, GstMemory * mem) | ||
| 226 | +{ | ||
| 227 | + GstAllocatorPhyMemClass *klass; | ||
| 228 | + GstMemoryPhy *phymem; | ||
| 229 | + | ||
| 230 | + klass = GST_ALLOCATOR_PHYMEM_CLASS(G_OBJECT_GET_CLASS(allocator)); | ||
| 231 | + if(klass == NULL) { | ||
| 232 | + GST_ERROR("Can't get class from allocator object, can't free %p\n", mem); | ||
| 233 | + return; | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + phymem = (GstMemoryPhy*)mem; | ||
| 237 | + | ||
| 238 | + GST_DEBUG ("free phymem, vaddr(%p), paddr(%p), size(%d).\n", | ||
| 239 | + phymem->block.vaddr, phymem->block.paddr, phymem->block.size); | ||
| 240 | + | ||
| 241 | + klass->free_phymem((GstAllocatorPhyMem*)allocator, &phymem->block); | ||
| 242 | + g_slice_free1(sizeof(GstMemoryPhy), mem); | ||
| 243 | + | ||
| 244 | + return; | ||
| 245 | +} | ||
| 246 | + | ||
| 247 | +static int | ||
| 248 | +default_alloc (GstAllocatorPhyMem *allocator, PhyMemBlock *phy_mem) | ||
| 249 | +{ | ||
| 250 | + GST_ERROR ("No default allocating implementation for physical memory allocation.\n"); | ||
| 251 | + return -1; | ||
| 252 | +} | ||
| 253 | + | ||
| 254 | +static int | ||
| 255 | +default_free (GstAllocatorPhyMem *allocator, PhyMemBlock *phy_mem) | ||
| 256 | +{ | ||
| 257 | + GST_ERROR ("No default free implementation for physical memory allocation.\n"); | ||
| 258 | + return -1; | ||
| 259 | +} | ||
| 260 | + | ||
| 261 | +G_DEFINE_TYPE (GstAllocatorPhyMem, gst_allocator_phymem, GST_TYPE_ALLOCATOR); | ||
| 262 | + | ||
| 263 | +static void | ||
| 264 | +gst_allocator_phymem_class_init (GstAllocatorPhyMemClass * klass) | ||
| 265 | +{ | ||
| 266 | + GstAllocatorClass *allocator_class; | ||
| 267 | + | ||
| 268 | + allocator_class = (GstAllocatorClass *) klass; | ||
| 269 | + | ||
| 270 | + allocator_class->alloc = base_alloc; | ||
| 271 | + allocator_class->free = base_free; | ||
| 272 | + klass->alloc_phymem = default_alloc; | ||
| 273 | + klass->free_phymem = default_free; | ||
| 274 | + klass->copy_phymem = default_copy; | ||
| 275 | +} | ||
| 276 | + | ||
| 277 | +static void | ||
| 278 | +gst_allocator_phymem_init (GstAllocatorPhyMem * allocator) | ||
| 279 | +{ | ||
| 280 | + GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator); | ||
| 281 | + | ||
| 282 | + alloc->mem_map = gst_phymem_map; | ||
| 283 | + alloc->mem_unmap = gst_phymem_unmap; | ||
| 284 | + alloc->mem_copy = gst_phymem_copy; | ||
| 285 | + alloc->mem_share = gst_phymem_share; | ||
| 286 | + alloc->mem_is_span = gst_phymem_is_span; | ||
| 287 | +} | ||
| 288 | + | ||
| 289 | + | ||
| 290 | +//global functions | ||
| 291 | + | ||
| 292 | +gboolean | ||
| 293 | +gst_buffer_is_phymem (GstBuffer *buffer) | ||
| 294 | +{ | ||
| 295 | + gboolean ret = FALSE; | ||
| 296 | + PhyMemBlock * memblk; | ||
| 297 | + GstMemory *mem = gst_buffer_get_memory (buffer, 0); | ||
| 298 | + if(mem == NULL) { | ||
| 299 | + GST_ERROR ("Not get memory from buffer.\n"); | ||
| 300 | + return FALSE; | ||
| 301 | + } | ||
| 302 | + | ||
| 303 | + if(GST_IS_ALLOCATOR_PHYMEM(mem->allocator)) { | ||
| 304 | + if (NULL == ((GstMemoryPhy*)mem)->block.paddr) { | ||
| 305 | + GST_WARNING("physical address in memory block is invalid"); | ||
| 306 | + ret = FALSE; | ||
| 307 | + } else { | ||
| 308 | + ret = TRUE; | ||
| 309 | + } | ||
| 310 | + } | ||
| 311 | + | ||
| 312 | + gst_memory_unref (mem); | ||
| 313 | + | ||
| 314 | + return ret; | ||
| 315 | +} | ||
| 316 | + | ||
| 317 | +PhyMemBlock * | ||
| 318 | +gst_buffer_query_phymem_block (GstBuffer *buffer) | ||
| 319 | +{ | ||
| 320 | + GstMemory *mem; | ||
| 321 | + GstMemoryPhy *memphy; | ||
| 322 | + PhyMemBlock *memblk; | ||
| 323 | + | ||
| 324 | + mem = gst_buffer_get_memory (buffer, 0); | ||
| 325 | + if(mem == NULL) { | ||
| 326 | + GST_ERROR ("Not get memory from buffer.\n"); | ||
| 327 | + return NULL; | ||
| 328 | + } | ||
| 329 | + | ||
| 330 | + if(!GST_IS_ALLOCATOR_PHYMEM(mem->allocator)) { | ||
| 331 | + gst_memory_unref (mem); | ||
| 332 | + return NULL; | ||
| 333 | + } | ||
| 334 | + | ||
| 335 | + memphy = (GstMemoryPhy*) mem; | ||
| 336 | + memblk = &memphy->block; | ||
| 337 | + | ||
| 338 | + gst_memory_unref (mem); | ||
| 339 | + | ||
| 340 | + return memblk; | ||
| 341 | +} | ||
| 342 | + | ||
| 343 | +PhyMemBlock * | ||
| 344 | +gst_memory_query_phymem_block (GstMemory *mem) | ||
| 345 | +{ | ||
| 346 | + GstMemoryPhy *memphy; | ||
| 347 | + PhyMemBlock *memblk; | ||
| 348 | + | ||
| 349 | + if (!mem) | ||
| 350 | + return NULL; | ||
| 351 | + | ||
| 352 | + if (!GST_IS_ALLOCATOR_PHYMEM(mem->allocator)) | ||
| 353 | + return NULL; | ||
| 354 | + | ||
| 355 | + memphy = (GstMemoryPhy*) mem; | ||
| 356 | + memblk = &memphy->block; | ||
| 357 | + | ||
| 358 | + return memblk; | ||
| 359 | +} | ||
| 360 | + | ||
| 361 | diff --git a/gst-libs/gst/allocators/gstallocatorphymem.h b/gst-libs/gst/allocators/gstallocatorphymem.h | ||
| 362 | new file mode 100755 | ||
| 363 | index 0000000..f0833ae | ||
| 364 | --- /dev/null | ||
| 365 | +++ b/gst-libs/gst/allocators/gstallocatorphymem.h | ||
| 366 | @@ -0,0 +1,64 @@ | ||
| 367 | +/* | ||
| 368 | + * Copyright (c) 2013-2015, Freescale Semiconductor, Inc. All rights reserved. | ||
| 369 | + * | ||
| 370 | + * This library is free software; you can redistribute it and/or | ||
| 371 | + * modify it under the terms of the GNU Library General Public | ||
| 372 | + * License as published by the Free Software Foundation; either | ||
| 373 | + * version 2 of the License, or (at your option) any later version. | ||
| 374 | + * | ||
| 375 | + * This library is distributed in the hope that it will be useful, | ||
| 376 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 377 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 378 | + * Library General Public License for more details. | ||
| 379 | + * | ||
| 380 | + * You should have received a copy of the GNU Library General Public | ||
| 381 | + * License along with this library; if not, write to the | ||
| 382 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 383 | + * Boston, MA 02111-1307, USA. | ||
| 384 | + */ | ||
| 385 | + | ||
| 386 | +#ifndef __ALLOCATOR_PHYMEM_H__ | ||
| 387 | +#define __ALLOCATOR_PHYMEM_H__ | ||
| 388 | + | ||
| 389 | +#include <gst/gst.h> | ||
| 390 | +#include <gst/gstallocator.h> | ||
| 391 | + | ||
| 392 | +#define PAGE_ALIGN(x) (((x) + 4095) & ~4095) | ||
| 393 | + | ||
| 394 | +#define GST_TYPE_ALLOCATOR_PHYMEM (gst_allocator_phymem_get_type()) | ||
| 395 | +#define GST_ALLOCATOR_PHYMEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_ALLOCATOR_PHYMEM, GstAllocatorPhyMem)) | ||
| 396 | +#define GST_ALLOCATOR_PHYMEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_ALLOCATOR_PHYMEM, GstAllocatorPhyMemClass)) | ||
| 397 | +#define GST_IS_ALLOCATOR_PHYMEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_ALLOCATOR_PHYMEM)) | ||
| 398 | +#define GST_IS_ALLOCATOR_PHYMEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_ALLOCATOR_PHYMEM)) | ||
| 399 | + | ||
| 400 | +typedef struct _GstAllocatorPhyMem GstAllocatorPhyMem; | ||
| 401 | +typedef struct _GstAllocatorPhyMemClass GstAllocatorPhyMemClass; | ||
| 402 | + | ||
| 403 | +/* also change gst-libs/gst/gl/gstglvivdirecttexture.c in gst-plugins-bad git | ||
| 404 | + * if changed below structure */ | ||
| 405 | +typedef struct { | ||
| 406 | + guint8 *vaddr; | ||
| 407 | + guint8 *paddr; | ||
| 408 | + guint8 *caddr; | ||
| 409 | + gsize size; | ||
| 410 | + gpointer *user_data; | ||
| 411 | +} PhyMemBlock; | ||
| 412 | + | ||
| 413 | +struct _GstAllocatorPhyMem { | ||
| 414 | + GstAllocator parent; | ||
| 415 | +}; | ||
| 416 | + | ||
| 417 | +struct _GstAllocatorPhyMemClass { | ||
| 418 | + GstAllocatorClass parent_class; | ||
| 419 | + int (*alloc_phymem) (GstAllocatorPhyMem *allocator, PhyMemBlock *phy_mem); | ||
| 420 | + int (*free_phymem) (GstAllocatorPhyMem *allocator, PhyMemBlock *phy_mem); | ||
| 421 | + int (*copy_phymem) (GstAllocatorPhyMem *allocator, PhyMemBlock *det_mem, | ||
| 422 | + PhyMemBlock *src_mem, guint offset, guint size); | ||
| 423 | +}; | ||
| 424 | + | ||
| 425 | +GType gst_allocator_phymem_get_type (void); | ||
| 426 | +gboolean gst_buffer_is_phymem (GstBuffer *buffer); | ||
| 427 | +PhyMemBlock *gst_buffer_query_phymem_block (GstBuffer *buffer); | ||
| 428 | +PhyMemBlock *gst_memory_query_phymem_block (GstMemory *mem); | ||
| 429 | + | ||
| 430 | +#endif | ||
| 431 | -- | ||
| 432 | 1.9.1 | ||
| 433 | |||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend index f1992c3bf..279a27ccb 100644 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_%.bbappend | |||
| @@ -2,6 +2,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | |||
| 2 | 2 | ||
| 3 | IMX_PATCHES = " file://gstplaybin-remove-flag-deinterlace.patch \ | 3 | IMX_PATCHES = " file://gstplaybin-remove-flag-deinterlace.patch \ |
| 4 | file://0001-MMFMWK-7030-Linux_MX6QP_ARD-IMXCameraApp-When-Enable.patch \ | 4 | file://0001-MMFMWK-7030-Linux_MX6QP_ARD-IMXCameraApp-When-Enable.patch \ |
| 5 | file://0002-Remove-dependence-on-imx-plugin-git.patch \ | ||
| 5 | " | 6 | " |
| 6 | 7 | ||
| 7 | SRC_URI_append_mx6 = "${IMX_PATCHES}" | 8 | SRC_URI_append_mx6 = "${IMX_PATCHES}" |
