meta-digi/meta-digi-dey/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0038-glupload-need-upload-e...

102 lines
3.3 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 2f11f9247972d09ba461de10be2398e513764045 Mon Sep 17 00:00:00 2001
From: Haihua Hu <jared.hu@nxp.com>
Date: Fri, 17 Nov 2017 13:06:56 +0800
Subject: [PATCH] [MMFMWK-7782] glupload: need upload each plane to single
eglimage when output format is not RGBA
when glupload out format is not RGBA, need to use single eglimage
upload each plane.
Upstream-Status: Inappropriate [i.MX specific]
---
gst-libs/gst/gl/gstglupload.c | 62 ++++++++++++++++++++++---------------------
1 file changed, 32 insertions(+), 30 deletions(-)
diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c
index 5c7eca0..ed5e54b 100644
--- a/gst-libs/gst/gl/gstglupload.c
+++ b/gst-libs/gst/gl/gstglupload.c
@@ -657,6 +657,7 @@ _dma_buf_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
gsize mems_skip[GST_VIDEO_MAX_PLANES];
GstMemory *mems[GST_VIDEO_MAX_PLANES];
guint i;
+ GstVideoFormat out_fmt;
n_mem = gst_buffer_n_memory (buffer);
meta = gst_buffer_get_video_meta (buffer);
@@ -773,40 +774,41 @@ _dma_buf_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
return FALSE;
}
-#ifdef EGL_DMA_BUF_PLANE1_FD_EXT
- /* Now create one single EGLImage */
- /* check if one is cached */
- dmabuf->eglimage[0] = _get_cached_eglimage (mems[0], 0);
- if (dmabuf->eglimage[0])
- return TRUE;
-
- dmabuf->eglimage[0] =
- gst_egl_image_from_dmabuf_singleplaner (dmabuf->upload->context,
- mems, in_info, n_planes, mems_skip);
- if (!dmabuf->eglimage[0])
- return FALSE;
-
- _set_cached_eglimage (mems[0], dmabuf->eglimage[0], 0);
-#else
- /* Now create an EGLImage for each dmabufs */
- for (i = 0; i < n_planes; i++) {
+ out_fmt = GST_VIDEO_INFO_FORMAT (&dmabuf->upload->priv->out_info);
+ if (out_fmt == GST_VIDEO_FORMAT_RGBA) {
+ /* Now create one single EGLImage */
/* check if one is cached */
- dmabuf->eglimage[i] = _get_cached_eglimage (mems[i], i);
- if (dmabuf->eglimage[i])
- continue;
-
- /* otherwise create one and cache it */
- dmabuf->eglimage[i] =
- gst_egl_image_from_dmabuf (dmabuf->upload->context,
- gst_dmabuf_memory_get_fd (mems[i]), in_info, i,
- mems[i]->offset + mems_skip[i]);
-
- if (!dmabuf->eglimage[i])
+ dmabuf->eglimage[0] = _get_cached_eglimage (mems[0], 0);
+ if (dmabuf->eglimage[0])
+ return TRUE;
+
+ dmabuf->eglimage[0] =
+ gst_egl_image_from_dmabuf_singleplaner (dmabuf->upload->context,
+ mems, in_info, n_planes, mems_skip);
+ if (!dmabuf->eglimage[0])
return FALSE;
- _set_cached_eglimage (mems[i], dmabuf->eglimage[i], i);
+ _set_cached_eglimage (mems[0], dmabuf->eglimage[0], 0);
+ } else {
+ /* Now create an EGLImage for each dmabufs */
+ for (i = 0; i < n_planes; i++) {
+ /* check if one is cached */
+ dmabuf->eglimage[i] = _get_cached_eglimage (mems[i], i);
+ if (dmabuf->eglimage[i])
+ continue;
+
+ /* otherwise create one and cache it */
+ dmabuf->eglimage[i] =
+ gst_egl_image_from_dmabuf (dmabuf->upload->context,
+ gst_dmabuf_memory_get_fd (mems[i]), in_info, i,
+ mems[i]->offset + mems_skip[i]);
+
+ if (!dmabuf->eglimage[i])
+ return FALSE;
+
+ _set_cached_eglimage (mems[i], dmabuf->eglimage[i], i);
+ }
}
-#endif
return TRUE;
}
--
1.9.1