deleted file mode 100644
@@ -1,32 +0,0 @@
-From e613160ef171aaaffb40c0b800b6c6def110ee18 Mon Sep 17 00:00:00 2001
-From: Gowtham Tammana <g-tammana@ti.com>
-Date: Tue, 4 May 2021 22:08:25 -0500
-Subject: [PATCH] gstdrm: Remove wayland as required dependency
-
-gstdrmallocator is using dumb buffer api for buffer allocation and as
-such there is no hard dependency on wayland. Remove it from required.
-
-Upstream-Status: Inappropriate [depends on drmallocator patches in
-meta-argo]
-
-Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
----
- gst-libs/gst/drm/meson.build | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gst-libs/gst/drm/meson.build b/gst-libs/gst/drm/meson.build
-index 3310cc6..0700cab 100644
---- a/gst-libs/gst/drm/meson.build
-+++ b/gst-libs/gst/drm/meson.build
-@@ -6,7 +6,7 @@ gstdrm_headers = [
- ]
- install_headers(gstdrm_headers, subdir : 'gstreamer-1.0/gst/drm')
-
--libdrm_dep = dependency('libdrm', version: '>= 2.4.55', required: get_option('wayland'))
-+libdrm_dep = dependency('libdrm', version: '>= 2.4.55')
- if libdrm_dep.found()
- gstdrm = library('gstdrm-' + api_version,
- gstdrm_sources,
-2.31.1
-
deleted file mode 100644
@@ -1,469 +0,0 @@
-From 45f709bcaa243a6b503a11eb2e917f9719ea1cce Mon Sep 17 00:00:00 2001
-From: Ramprasad N <x0038811@ti.com>
-Date: Tue, 4 Dec 2018 18:56:52 +0530
-Subject: [PATCH 1/5] gstdrmallocator: Add DRM allocator support
-
-Add DRM based allocator support.
-
-The following changes are included :
-1. Use DRM dumb buffers and associated APIs for
- dmabuf allocation.
-2. Have DRM device fd a member of allocator object
-3. Allocate GstMemory objects with mem_type as 'dmabuf'
-
-Signed-off-by: Ramprasad N <x0038811@ti.com>
-
----
- configure.ac | 5 +
- gst-libs/gst/Makefile.am | 4 +-
- gst-libs/gst/drm/Makefile.am | 33 +++++
- gst-libs/gst/drm/gstdrmallocator.c | 206 ++++++++++++++++++++++++++++++
- gst-libs/gst/drm/gstdrmallocator.h | 77 +++++++++++
- pkgconfig/Makefile.am | 2 +
- pkgconfig/gstreamer-drm-uninstalled.pc.in | 11 ++
- pkgconfig/gstreamer-drm.pc.in | 12 ++
- 8 files changed, 348 insertions(+), 2 deletions(-)
- create mode 100644 gst-libs/gst/drm/Makefile.am
- create mode 100644 gst-libs/gst/drm/gstdrmallocator.c
- create mode 100644 gst-libs/gst/drm/gstdrmallocator.h
- create mode 100644 pkgconfig/gstreamer-drm-uninstalled.pc.in
- create mode 100644 pkgconfig/gstreamer-drm.pc.in
-
-diff --git a/configure.ac b/configure.ac
-index d29cac1..114cd89 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -208,6 +208,8 @@ AG_GST_PKG_CHECK_MODULES(GST_PBUTILS, gstreamer-pbutils-[$GST_API_VERSION], [$GS
- AG_GST_PKG_CHECK_MODULES(GST_GL, gstreamer-gl-[$GST_API_VERSION], [$GSTPB_REQ], no)
- AG_GST_PKG_CHECK_MODULES(GST_SDP, gstreamer-sdp-[$GST_API_VERSION], [$GSTPB_REQ], yes)
-
-+PKG_CHECK_MODULES([DRM], [libdrm libdrm_omap], HAVE_KMS=yes, HAVE_KMS=no)
-+
- if test "x$HAVE_GST_GL" = "xyes"; then
-
- AC_MSG_CHECKING([GStreamer OpenGL window systems ...])
-@@ -2587,6 +2589,7 @@ gst-libs/gst/codecparsers/Makefile
- gst-libs/gst/mpegts/Makefile
- gst-libs/gst/sctp/Makefile
- gst-libs/gst/uridownloader/Makefile
-+gst-libs/gst/drm/Makefile
- gst-libs/gst/wayland/Makefile
- gst-libs/gst/webrtc/Makefile
- gst-libs/gst/player/Makefile
-@@ -2712,6 +2715,8 @@ pkgconfig/gstreamer-plugins-bad.pc
- pkgconfig/gstreamer-plugins-bad-uninstalled.pc
- pkgconfig/gstreamer-codecparsers.pc
- pkgconfig/gstreamer-codecparsers-uninstalled.pc
-+pkgconfig/gstreamer-drm.pc
-+pkgconfig/gstreamer-drm-uninstalled.pc
- pkgconfig/gstreamer-insertbin.pc
- pkgconfig/gstreamer-insertbin-uninstalled.pc
- pkgconfig/gstreamer-mpegts.pc
-diff --git a/gst-libs/gst/Makefile.am b/gst-libs/gst/Makefile.am
-index a53f26e..7fe6ae7 100644
---- a/gst-libs/gst/Makefile.am
-+++ b/gst-libs/gst/Makefile.am
-@@ -7,12 +7,12 @@ OPENCV_DIR=opencv
- endif
-
- SUBDIRS = uridownloader adaptivedemux interfaces basecamerabinsrc codecparsers \
-- insertbin mpegts audio sctp player isoff webrtc $(WAYLAND_DIR) \
-+ insertbin mpegts audio sctp player isoff webrtc drm $(WAYLAND_DIR) \
- $(OPENCV_DIR)
-
- noinst_HEADERS = gst-i18n-plugin.h gettext.h glib-compat-private.h
- DIST_SUBDIRS = uridownloader adaptivedemux interfaces basecamerabinsrc \
-- codecparsers insertbin mpegts wayland opencv audio player isoff sctp webrtc
-+ codecparsers insertbin mpegts drm wayland opencv audio player isoff sctp webrtc
-
- adaptivedemux: uridownloader
-
-diff --git a/gst-libs/gst/drm/Makefile.am b/gst-libs/gst/drm/Makefile.am
-new file mode 100644
-index 0000000..9a45dfb
---- /dev/null
-+++ b/gst-libs/gst/drm/Makefile.am
-@@ -0,0 +1,33 @@
-+lib_LTLIBRARIES = libgstdrm-@GST_API_VERSION@.la
-+
-+CLEANFILES = $(BUILT_SOURCES)
-+
-+libgstdrm_@GST_API_VERSION@_la_SOURCES = \
-+ gstdrmallocator.c
-+
-+libgstdrm_@GST_API_VERSION@includedir = \
-+ $(includedir)/gstreamer-@GST_API_VERSION@/gst/drm
-+
-+libgstdrm_@GST_API_VERSION@include_HEADERS = \
-+ gstdrmallocator.h
-+
-+libgstdrm_@GST_API_VERSION@_la_CFLAGS = \
-+ $(DRM_CFLAGS) \
-+ $(OMAPDRM_CFLAGS) \
-+ $(GST_PLUGINS_BAD_CFLAGS) \
-+ $(GST_PLUGINS_BASE_CFLAGS) \
-+ -DGST_USE_UNSTABLE_API \
-+ $(GST_CFLAGS)
-+
-+libgstdrm_@GST_API_VERSION@_la_LIBADD = \
-+ $(DRM_LIBS) \
-+ $(GST_PLUGINS_BASE_LIBS) \
-+ $(GST_BASE_LIBS) \
-+ -lgstallocators-$(GST_API_VERSION) \
-+ $(GST_LIBS)
-+
-+libgstdrm_@GST_API_VERSION@_la_LDFLAGS = \
-+ $(DRM_LDFLAGS) \
-+ $(GST_LIB_LDFLAGS) \
-+ $(GST_ALL_LDFLAGS) \
-+ $(GST_LT_LDFLAGS)
-diff --git a/gst-libs/gst/drm/gstdrmallocator.c b/gst-libs/gst/drm/gstdrmallocator.c
-new file mode 100644
-index 0000000..b557ad2
---- /dev/null
-+++ b/gst-libs/gst/drm/gstdrmallocator.c
-@@ -0,0 +1,206 @@
-+/*
-+ * GStreamer
-+ *
-+ * Copyright (C) 2012 Texas Instruments
-+ *
-+ * Authors:
-+ * Pooja Prajod <poojaprajod@ti.com>
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation
-+ * version 2.1 of the License.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-+ */
-+
-+/**
-+ * SECTION:GstDRMAllocator
-+ * @short_description: GStreamer DRM allocator support
-+ *
-+ * Since: 1.6.3
-+ */
-+
-+
-+#include "gstdrmallocator.h"
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <errno.h>
-+#include <unistd.h>
-+#include <sys/mman.h>
-+#include <sys/types.h>
-+
-+#define INVALID_DRM_FD (-1)
-+
-+GST_DEBUG_CATEGORY (drmallocator_debug);
-+#define GST_CAT_DEFAULT drmallocator_debug
-+
-+#define gst_drm_allocator_parent_class parent_class
-+G_DEFINE_TYPE (GstDRMAllocator, gst_drm_allocator, GST_TYPE_FD_ALLOCATOR);
-+
-+static GstMemory *
-+gst_drm_allocator_alloc (GstAllocator * allocator, gsize size,
-+ GstAllocationParams * params)
-+{
-+ GstDRMAllocator *self = GST_DRM_ALLOCATOR (allocator);
-+ int fd = -1;
-+ int DrmDeviceFD = self->DrmDeviceFD;
-+ GstMemory *mem;
-+ /* Variable for DRM Dumb Buffers */
-+
-+ struct drm_mode_create_dumb creq;
-+ struct drm_mode_destroy_dumb dreq;
-+ int ret ;
-+
-+ GST_LOG_OBJECT (self, "DRM Memory alloc");
-+
-+ memset(&creq, 0, sizeof(struct drm_mode_create_dumb));
-+ /*
-+ We have only total size as argument to _allocator_alloc.
-+ Since the DDR storage is linear, it is as good as saying
-+ the buffer is of width = size and height = 1
-+ */
-+ creq.width = size;
-+ creq.height = 1;
-+ creq.bpp = 8;
-+
-+ /* Create a DRM dumb buffer */
-+ ret = drmIoctl (DrmDeviceFD, DRM_IOCTL_MODE_CREATE_DUMB, &creq);
-+ if (ret < 0) {
-+ GST_ERROR_OBJECT (self, "Create DRM dumb buffer failed");
-+ return NULL;
-+ }
-+ /* Get a dmabuf fd from the dumb buffer handle */
-+ drmPrimeHandleToFD (DrmDeviceFD, creq.handle, DRM_CLOEXEC | O_RDWR, &fd);
-+
-+ if (fd < 0) {
-+ GST_ERROR_OBJECT (self, "Invalid fd returned: %d", fd);
-+ goto fail;
-+ }
-+
-+ /* Get a dmabuf gstmemory with the fd */
-+ mem = gst_fd_allocator_alloc (allocator, fd, size, 0);
-+
-+ if (G_UNLIKELY (!mem)) {
-+ GST_ERROR_OBJECT (self, "GstDmaBufMemory allocation failed");
-+ close (fd);
-+ goto fail;
-+ }
-+
-+ return mem;
-+
-+ fail:
-+ memset(&dreq, 0, sizeof(struct drm_mode_destroy_dumb));
-+ dreq.handle = creq.handle;
-+ drmIoctl (DrmDeviceFD, DRM_IOCTL_MODE_DESTROY_DUMB, &dreq);
-+ return NULL;
-+}
-+
-+static void
-+gst_drm_allocator_free (GstAllocator * allocator, GstMemory * mem)
-+{
-+ GstDRMAllocator *self = GST_DRM_ALLOCATOR (allocator);
-+ uint32_t handle = 0;
-+ int DrmDeviceFD = self->DrmDeviceFD;
-+ int fd = -1;
-+
-+ GST_LOG_OBJECT (self, "DRM Memory free");
-+
-+ g_return_if_fail (GST_IS_ALLOCATOR (allocator));
-+ g_return_if_fail (mem != NULL);
-+ g_return_if_fail (gst_is_drm_memory (mem));
-+
-+ fd = gst_fd_memory_get_fd (mem);
-+ drmPrimeFDToHandle(DrmDeviceFD, fd, &handle);
-+
-+ /* Incase there are some mapped memory, we unmap and ready it to be cleaned*/
-+ GST_ALLOCATOR_CLASS (parent_class)->free (allocator, mem);
-+
-+ if (handle) {
-+ struct drm_mode_destroy_dumb dreq;
-+ memset(&dreq, 0, sizeof(struct drm_mode_destroy_dumb));
-+ dreq.handle = handle;
-+ drmIoctl (DrmDeviceFD, DRM_IOCTL_MODE_DESTROY_DUMB, &dreq);
-+ }
-+
-+ close (fd);
-+}
-+
-+static void
-+gst_drm_allocator_finalize (GObject * obj)
-+{
-+ GstDRMAllocator *self = GST_DRM_ALLOCATOR (obj);
-+ GST_LOG_OBJECT (obj, "DRM Allocator finalize");
-+
-+ close (self->DrmDeviceFD);
-+ self->DrmDeviceFD = INVALID_DRM_FD;
-+
-+ G_OBJECT_CLASS (parent_class)->finalize (obj);
-+}
-+
-+static void
-+gst_drm_allocator_class_init (GstDRMAllocatorClass * klass)
-+{
-+ GstAllocatorClass *drm_alloc = (GstAllocatorClass *) klass;
-+
-+ drm_alloc->alloc = GST_DEBUG_FUNCPTR (gst_drm_allocator_alloc);
-+ drm_alloc->free = GST_DEBUG_FUNCPTR (gst_drm_allocator_free);
-+ GST_DEBUG_CATEGORY_INIT (drmallocator_debug, "drmallocator", 0,
-+ "GstDRMAllocator debug");
-+
-+}
-+
-+static void
-+gst_drm_allocator_init (GstDRMAllocator * self)
-+{
-+ GstAllocator *alloc = GST_ALLOCATOR_CAST (self);
-+ GObjectClass *object_class = G_OBJECT_CLASS (GST_DRM_ALLOCATOR_GET_CLASS(self));
-+
-+ if (self->DrmDeviceFD <= 0) {
-+ self->DrmDeviceFD = open("/dev/dri/card0", O_RDWR | O_CLOEXEC);
-+ if (self->DrmDeviceFD < 0) {
-+ GST_ERROR_OBJECT (self, "Failed to open DRM device");
-+ } else {
-+ drmDropMaster (self->DrmDeviceFD);
-+ }
-+ }
-+
-+ alloc->mem_type = GST_ALLOCATOR_DMABUF;
-+
-+ object_class->finalize = gst_drm_allocator_finalize;
-+
-+ GST_OBJECT_FLAG_UNSET (self, GST_ALLOCATOR_FLAG_CUSTOM_ALLOC);
-+}
-+
-+void
-+gst_drm_allocator_register (void)
-+{
-+ gst_allocator_register (GST_ALLOCATOR_DRM,
-+ g_object_new (GST_TYPE_DRM_ALLOCATOR, NULL));
-+}
-+
-+GstAllocator *
-+gst_drm_allocator_get (void)
-+{
-+ GstAllocator *alloc;
-+ alloc = gst_allocator_find (GST_ALLOCATOR_DRM);
-+ if (!alloc) {
-+ gst_drm_allocator_register();
-+ alloc = gst_allocator_find (GST_ALLOCATOR_DRM);
-+ }
-+ return alloc;
-+}
-+
-+gboolean
-+gst_is_drm_memory (GstMemory * mem)
-+{
-+ return gst_memory_is_type (mem, GST_ALLOCATOR_DMABUF);
-+}
-diff --git a/gst-libs/gst/drm/gstdrmallocator.h b/gst-libs/gst/drm/gstdrmallocator.h
-new file mode 100644
-index 0000000..3199b92
---- /dev/null
-+++ b/gst-libs/gst/drm/gstdrmallocator.h
-@@ -0,0 +1,77 @@
-+/*
-+ * GStreamer
-+ *
-+ * Copyright (C) 2012 Texas Instruments
-+ *
-+ * Authors:
-+ * Pooja Prajod <poojaprajod@ti.com>
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation
-+ * version 2.1 of the License.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-+ */
-+
-+/**
-+ * SECTION:GstDRMAllocator
-+ * @short_description: GStreamer DRM allocator support
-+ *
-+ * Since: 1.6.3
-+ */
-+
-+#ifndef __GSTDRMALLOCATOR_H__
-+#define __GSTDRMALLOCATOR_H__
-+
-+#include <gst/gst.h>
-+#include <gst/video/video.h>
-+#include <gst/allocators/allocators.h>
-+#include <stdint.h>
-+
-+#include <xf86drm.h>
-+#include <xf86drmMode.h>
-+#include <fcntl.h>
-+
-+G_BEGIN_DECLS
-+
-+#define GST_TYPE_DRM_ALLOCATOR (gst_drm_allocator_get_type ())
-+#define GST_DRM_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DRM_ALLOCATOR, GstDRMAllocator))
-+#define GST_IS_DRM_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DRM_ALLOCATOR))
-+#define GST_DRM_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DRM_ALLOCATOR, GstDRMAllocatorClass))
-+#define GST_IS_DRM_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DRM_ALLOCATOR))
-+#define GST_DRM_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DRM_ALLOCATOR, GstDRMAllocatorClass))
-+
-+#define GST_ALLOCATOR_DRM "DRM"
-+
-+typedef struct _GstDRMAllocator GstDRMAllocator;
-+typedef struct _GstDRMAllocatorClass GstDRMAllocatorClass;
-+
-+struct _GstDRMAllocator
-+{
-+ GstFdAllocator parent;
-+ int DrmDeviceFD;
-+};
-+
-+struct _GstDRMAllocatorClass
-+{
-+ GstFdAllocatorClass parent_class;
-+};
-+
-+GST_EXPORT void gst_drm_allocator_register (void);
-+GST_EXPORT GstAllocator * gst_drm_allocator_get (void);
-+
-+GST_EXPORT gboolean gst_is_drm_memory (GstMemory * mem);
-+
-+GST_EXPORT GType gst_drm_allocator_get_type (void);
-+
-+G_END_DECLS
-+
-+#endif /* __GSTDRMALLOCATOR_H__ */
-diff --git a/pkgconfig/Makefile.am b/pkgconfig/Makefile.am
-index 8e74a8e..86ee8d6 100644
---- a/pkgconfig/Makefile.am
-+++ b/pkgconfig/Makefile.am
-@@ -2,6 +2,7 @@
- ### all of the standard pc files we need to generate
- pcverfiles = \
- gstreamer-plugins-bad-@GST_API_VERSION@.pc \
-+ gstreamer-drm-@GST_API_VERSION@.pc \
- gstreamer-codecparsers-@GST_API_VERSION@.pc \
- gstreamer-insertbin-@GST_API_VERSION@.pc \
- gstreamer-mpegts-@GST_API_VERSION@.pc \
-@@ -12,6 +13,7 @@ pcverfiles = \
-
- pcverfiles_uninstalled = \
- gstreamer-plugins-bad-@GST_API_VERSION@-uninstalled.pc \
-+ gstreamer-drm-@GST_API_VERSION@-uninstalled.pc \
- gstreamer-codecparsers-@GST_API_VERSION@-uninstalled.pc \
- gstreamer-insertbin-@GST_API_VERSION@-uninstalled.pc \
- gstreamer-mpegts-@GST_API_VERSION@-uninstalled.pc \
-diff --git a/pkgconfig/gstreamer-drm-uninstalled.pc.in b/pkgconfig/gstreamer-drm-uninstalled.pc.in
-new file mode 100644
-index 0000000..9dcf978
---- /dev/null
-+++ b/pkgconfig/gstreamer-drm-uninstalled.pc.in
-@@ -0,0 +1,11 @@
-+prefix=
-+exec_prefix=
-+libdir=${pcfiledir}/../gst-libs/gst/drm
-+includedir=${pcfiledir}/../gst-libs
-+
-+Name: GStreamer DRM Allocator, Uninstalled
-+Description: DRM Allocator for GStreamer elements, uninstalled
-+Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-base-@GST_MAJORMINOR@
-+Version: @VERSION@
-+Libs: -L${libdir} ${libdir}/libgstdrm-@GST_MAJORMINOR@.la
-+Cflags: -I${includedir}
-diff --git a/pkgconfig/gstreamer-drm.pc.in b/pkgconfig/gstreamer-drm.pc.in
-new file mode 100644
-index 0000000..d155e80
---- /dev/null
-+++ b/pkgconfig/gstreamer-drm.pc.in
-@@ -0,0 +1,12 @@
-+prefix=@prefix@
-+exec_prefix=@exec_prefix@
-+libdir=@libdir@
-+includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-+
-+Name: GStreamer DRM Allocator
-+Description: DRM Allocator for GStreamer elements
-+Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-base-@GST_MAJORMINOR@
-+Version: @VERSION@
-+Libs: -L${libdir} -lgstdrm-@GST_MAJORMINOR@
-+Cflags: -I${includedir}
-+
deleted file mode 100644
@@ -1,140 +0,0 @@
-From dc24c3386701639d8ba04451bb40317f36cbce0a Mon Sep 17 00:00:00 2001
-From: Denys Dmytriyenko <denys@ti.com>
-Date: Tue, 24 Mar 2020 21:26:07 -0400
-Subject: [PATCH] wayland,drm,kms: add support for meson build system
-
-Upstream-Status: Inappropriate [depends on drmallocator and kms/waylandsink patches in meta-arago]
-
-Signed-off-by: Denys Dmytriyenko <denys@ti.com>
----
- ext/wayland/meson.build | 4 +++-
- gst-libs/gst/drm/meson.build | 25 +++++++++++++++++++++++++
- gst-libs/gst/meson.build | 1 +
- pkgconfig/gstreamer-drm-uninstalled.pc.in | 4 ++--
- pkgconfig/meson.build | 2 ++
- sys/kms/meson.build | 2 +-
- 6 files changed, 34 insertions(+), 4 deletions(-)
- create mode 100644 gst-libs/gst/drm/meson.build
-
-diff --git a/ext/wayland/meson.build b/ext/wayland/meson.build
-index 3c377ee..294bf51 100644
---- a/ext/wayland/meson.build
-+++ b/ext/wayland/meson.build
-@@ -2,6 +2,7 @@ wl_sources = [
- 'gstwaylandsink.c',
- 'wlshmallocator.c',
- 'wlbuffer.c',
-+ 'wldrm.c',
- 'wldisplay.c',
- 'wlwindow.c',
- 'wlvideoformat.c',
-@@ -20,6 +21,7 @@ if use_wayland
- ['/unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml',
- 'fullscreen-shell-unstable-v1-protocol.c', 'fullscreen-shell-unstable-v1-client-protocol.h'],
- ['/stable/xdg-shell/xdg-shell.xml', 'xdg-shell-protocol.c', 'xdg-shell-client-protocol.h'],
-+ ['/stable/wayland-drm/wayland-drm.xml', 'wayland-drm-protocol.c', 'wayland-drm-client-protocol.h'],
- ]
- protocols_files = []
-
-@@ -42,7 +44,7 @@ if use_wayland
- c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'],
- include_directories : [configinc],
- dependencies : [gst_dep, gstvideo_dep, gstwayland_dep, gstallocators_dep,
-- wl_client_dep, wl_protocol_dep, libdrm_dep],
-+ gstdrm_dep, wl_client_dep, wl_protocol_dep, libdrm_dep],
- install : true,
- install_dir : plugins_install_dir,
- )
-diff --git a/gst-libs/gst/drm/meson.build b/gst-libs/gst/drm/meson.build
-new file mode 100644
-index 0000000..3310cc6
---- /dev/null
-+++ b/gst-libs/gst/drm/meson.build
-@@ -0,0 +1,25 @@
-+gstdrm_sources = [
-+ 'gstdrmallocator.c',
-+]
-+gstdrm_headers = [
-+ 'gstdrmallocator.h',
-+]
-+install_headers(gstdrm_headers, subdir : 'gstreamer-1.0/gst/drm')
-+
-+libdrm_dep = dependency('libdrm', version: '>= 2.4.55', required: get_option('wayland'))
-+if libdrm_dep.found()
-+ gstdrm = library('gstdrm-' + api_version,
-+ gstdrm_sources,
-+ c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'],
-+ include_directories : [configinc, libsinc],
-+ version : libversion,
-+ soversion : soversion,
-+ darwin_versions : osxversion,
-+ install : true,
-+ dependencies : [gstbase_dep, gstallocators_dep, libdrm_dep],
-+ )
-+
-+ gstdrm_dep = declare_dependency(link_with : gstdrm,
-+ include_directories : [libsinc],
-+ dependencies : [gstbase_dep, gstallocators_dep, libdrm_dep])
-+endif
-diff --git a/gst-libs/gst/meson.build b/gst-libs/gst/meson.build
-index 5d90a91..e069327 100644
---- a/gst-libs/gst/meson.build
-+++ b/gst-libs/gst/meson.build
-@@ -4,6 +4,7 @@ subdir('adaptivedemux')
- subdir('audio')
- subdir('basecamerabinsrc')
- subdir('codecparsers')
-+subdir('drm')
- subdir('insertbin')
- subdir('interfaces')
- subdir('isoff')
-diff --git a/pkgconfig/gstreamer-drm-uninstalled.pc.in b/pkgconfig/gstreamer-drm-uninstalled.pc.in
-index 9dcf978..ec705e4 100644
---- a/pkgconfig/gstreamer-drm-uninstalled.pc.in
-+++ b/pkgconfig/gstreamer-drm-uninstalled.pc.in
-@@ -1,7 +1,7 @@
- prefix=
- exec_prefix=
--libdir=${pcfiledir}/../gst-libs/gst/drm
--includedir=${pcfiledir}/../gst-libs
-+libdir=@drmlibdir@
-+includedir=@abs_top_builddir@/gst-libs
-
- Name: GStreamer DRM Allocator, Uninstalled
- Description: DRM Allocator for GStreamer elements, uninstalled
-diff --git a/pkgconfig/meson.build b/pkgconfig/meson.build
-index 7ddfafb..35cd7bf 100644
---- a/pkgconfig/meson.build
-+++ b/pkgconfig/meson.build
-@@ -12,6 +12,7 @@ pkgconf.set('abs_top_builddir', join_paths(meson.current_build_dir(), '..'))
- pkgconf.set('abs_top_srcdir', join_paths(meson.current_source_dir(), '..'))
- pkgconf.set('audiolibdir', join_paths(meson.build_root(), gstbadaudio.outdir()))
- pkgconf.set('codecparserslibdir', join_paths(meson.build_root(), gstcodecparsers.outdir()))
-+pkgconf.set('drmlibdir', join_paths(meson.build_root(), gstdrm.outdir()))
- pkgconf.set('insertbinlibdir', join_paths(meson.build_root(), gstinsertbin.outdir()))
- pkgconf.set('mpegtslibdir', join_paths(meson.build_root(), gstmpegts.outdir()))
- pkgconf.set('playerlibdir', join_paths(meson.build_root(), gstplayer.outdir()))
-@@ -24,6 +25,7 @@ pkg_install_dir = '@0@/pkgconfig'.format(get_option('libdir'))
- pkg_libs = [
- 'bad-audio',
- 'codecparsers',
-+ 'drm',
- 'insertbin',
- 'mpegts',
- 'player',
-diff --git a/sys/kms/meson.build b/sys/kms/meson.build
-index fbc1861..0a000fd 100644
---- a/sys/kms/meson.build
-+++ b/sys/kms/meson.build
-@@ -11,7 +11,7 @@ if libdrm_dep.found()
- kmssink_sources,
- c_args : gst_plugins_bad_args,
- include_directories : [configinc],
-- dependencies : [gstbase_dep, gstvideo_dep, gstallocators_dep, libdrm_dep],
-+ dependencies : [gstbase_dep, gstvideo_dep, gstallocators_dep, gstdrm_dep, libdrm_dep],
- install : true,
- install_dir : plugins_install_dir,
- )
-2.7.4
-
deleted file mode 100644
@@ -1,426 +0,0 @@
-From 2fbb4e711f2e413e20085cc771d3b3f77c5f6229 Mon Sep 17 00:00:00 2001
-From: Ramprasad N <x0038811@ti.com>
-Date: Wed, 28 Mar 2018 13:01:06 +0530
-Subject: [PATCH] waylandsink: Add mouse drag and drop support
-
-Signed-off-by: Ramprasad N <x0038811@ti.com>
----
- ext/wayland/wldisplay.c | 321 +++++++++++++++++++++++++++++++++++++++++++++++-
- ext/wayland/wldisplay.h | 5 +
- ext/wayland/wlwindow.c | 3 +
- 3 files changed, 328 insertions(+), 1 deletion(-)
-
-diff --git a/ext/wayland/wldisplay.c b/ext/wayland/wldisplay.c
-index 9400095..bdb4fee 100644
---- a/ext/wayland/wldisplay.c
-+++ b/ext/wayland/wldisplay.c
-@@ -22,18 +22,47 @@
- #include <config.h>
- #endif
-
-+#include <stdlib.h>
-+#include <stdio.h>
-+
- #include "wldisplay.h"
- #include "wlbuffer.h"
-+#include "wlwindow.h"
-+
- #include "wlvideoformat.h"
-+#include <wayland-client-protocol.h>
-
-+#include <unistd.h>
- #include <errno.h>
-+#include <linux/input.h>
-
- GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug);
- #define GST_CAT_DEFAULT gstwayland_debug
-
- G_DEFINE_TYPE (GstWlDisplay, gst_wl_display, G_TYPE_OBJECT);
-
-+struct touch_point
-+{
-+ int32_t id;
-+ struct wl_list link;
-+};
-+
-+struct input
-+{
-+ GstWlDisplay *display;
-+ struct wl_seat *seat;
-+ struct wl_pointer *pointer;
-+ struct wl_touch *touch;
-+ struct wl_list touch_point_list;
-+ GstWlWindow *pointer_focus;
-+ GstWlWindow *touch_focus;
-+ struct wl_list link;
-+ GstWlWindow *grab;
-+};
-+
- static void gst_wl_display_finalize (GObject * gobject);
-+static void input_grab (struct input *input, GstWlWindow *window);
-+static void input_ungrab (struct input *input);
-
- static void
- gst_wl_display_class_init (GstWlDisplayClass * klass)
-@@ -51,6 +80,53 @@ gst_wl_display_init (GstWlDisplay * self)
- self->buffers = g_hash_table_new (g_direct_hash, g_direct_equal);
- g_mutex_init (&self->buffers_mutex);
- }
-+static void
-+input_grab (struct input *input, GstWlWindow *window)
-+{
-+ input->grab = window;
-+}
-+
-+static void
-+input_ungrab (struct input *input)
-+{
-+ input->grab = NULL;
-+}
-+
-+static void
-+input_remove_pointer_focus (struct input *input)
-+{
-+ GstWlWindow *window = input->pointer_focus;
-+
-+ if (!window)
-+ return;
-+
-+ input->pointer_focus = NULL;
-+}
-+
-+static void
-+input_destroy (struct input *input)
-+{
-+ input_remove_pointer_focus (input);
-+
-+ if (input->display->seat_version >= 3) {
-+ if (input->pointer)
-+ wl_pointer_release (input->pointer);
-+ }
-+
-+ wl_list_remove (&input->link);
-+ wl_seat_destroy (input->seat);
-+ free (input);
-+}
-+
-+static void
-+display_destroy_inputs (GstWlDisplay *display)
-+{
-+ struct input *tmp;
-+ struct input *input;
-+
-+ wl_list_for_each_safe (input, tmp, &display->input_list, link)
-+ input_destroy (input);
-+}
-
- static void
- gst_wl_display_finalize (GObject * gobject)
-@@ -130,6 +206,239 @@ shm_format (void *data, struct wl_shm *wl_shm, uint32_t format)
- static const struct wl_shm_listener shm_listener = {
- shm_format
- };
-+static void
-+pointer_handle_enter (void *data, struct wl_pointer *pointer,
-+ uint32_t serial, struct wl_surface *surface,
-+ wl_fixed_t sx_w, wl_fixed_t sy_w)
-+{
-+ struct input *input = data;
-+
-+ if (!surface) {
-+ /* enter event for a window we've just destroyed */
-+ return;
-+ }
-+
-+ input->display->serial = serial;
-+ input->pointer_focus = wl_surface_get_user_data (surface);
-+}
-+
-+static void
-+pointer_handle_leave (void *data, struct wl_pointer *pointer,
-+ uint32_t serial, struct wl_surface *surface)
-+{
-+ struct input *input = data;
-+
-+ input_remove_pointer_focus (input);
-+}
-+
-+static void
-+pointer_handle_motion (void *data, struct wl_pointer *pointer,
-+ uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w)
-+{
-+ struct input *input = data;
-+ GstWlWindow *window = input->pointer_focus;
-+
-+ if (!window)
-+ return;
-+
-+ if (input->grab)
-+ wl_shell_surface_move (input->grab->wl_shell_surface, input->seat,
-+ input->display->serial);
-+
-+}
-+
-+static void
-+pointer_handle_button (void *data, struct wl_pointer *pointer, uint32_t serial,
-+ uint32_t time, uint32_t button, uint32_t state_w)
-+{
-+ struct input *input = data;
-+ enum wl_pointer_button_state state = state_w;
-+ input->display->serial = serial;
-+
-+ if (button == BTN_LEFT) {
-+ if (state == WL_POINTER_BUTTON_STATE_PRESSED)
-+ input_grab (input, input->pointer_focus);
-+
-+ if (input->grab && state == WL_POINTER_BUTTON_STATE_RELEASED)
-+ input_ungrab (input);
-+ }
-+
-+ if (input->grab)
-+ wl_shell_surface_move (input->grab->wl_shell_surface, input->seat,
-+ input->display->serial);
-+}
-+
-+static void
-+pointer_handle_axis (void *data, struct wl_pointer *pointer,
-+ uint32_t time, uint32_t axis, wl_fixed_t value)
-+{
-+}
-+
-+static void pointer_frame(void *data, struct wl_pointer *wl_pointer)
-+{
-+}
-+
-+static void pointer_axis_source(void *data, struct wl_pointer *wl_pointer, uint32_t axis_source)
-+{
-+}
-+static void pointer_axis_stop(void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis)
-+{
-+}
-+
-+static const struct wl_pointer_listener pointer_listener = {
-+ pointer_handle_enter,
-+ pointer_handle_leave,
-+ pointer_handle_motion,
-+ pointer_handle_button,
-+ pointer_handle_axis,
-+ pointer_frame,
-+ pointer_axis_source,
-+ pointer_axis_stop
-+
-+};
-+
-+static void
-+touch_handle_down (void *data, struct wl_touch *wl_touch,
-+ uint32_t serial, uint32_t time, struct wl_surface *surface,
-+ int32_t id, wl_fixed_t x_w, wl_fixed_t y_w)
-+{
-+ struct input *input = data;
-+ struct touch_point *tp;
-+
-+ input->display->serial = serial;
-+ input->touch_focus = wl_surface_get_user_data (surface);
-+ if (!input->touch_focus) {
-+ return;
-+ }
-+
-+ tp = malloc (sizeof *tp);
-+ if (tp) {
-+ tp->id = id;
-+ wl_list_insert (&input->touch_point_list, &tp->link);
-+ wl_shell_surface_move (input->touch_focus->wl_shell_surface, input->seat,
-+ serial);
-+ }
-+}
-+
-+static void
-+touch_handle_motion (void *data, struct wl_touch *wl_touch,
-+ uint32_t time, int32_t id, wl_fixed_t x_w, wl_fixed_t y_w)
-+{
-+ struct input *input = data;
-+ struct touch_point *tp;
-+
-+ if (!input->touch_focus) {
-+ return;
-+ }
-+ wl_list_for_each (tp, &input->touch_point_list, link) {
-+ if (tp->id != id)
-+ continue;
-+
-+ wl_shell_surface_move (input->touch_focus->wl_shell_surface, input->seat,
-+ input->display->serial);
-+
-+ return;
-+ }
-+}
-+
-+static void
-+touch_handle_frame (void *data, struct wl_touch *wl_touch)
-+{
-+}
-+
-+static void
-+touch_handle_cancel (void *data, struct wl_touch *wl_touch)
-+{
-+}
-+
-+static void
-+touch_handle_up (void *data, struct wl_touch *wl_touch,
-+ uint32_t serial, uint32_t time, int32_t id)
-+{
-+ struct input *input = data;
-+ struct touch_point *tp, *tmp;
-+
-+ if (!input->touch_focus) {
-+ return;
-+ }
-+
-+ wl_list_for_each_safe (tp, tmp, &input->touch_point_list, link) {
-+ if (tp->id != id)
-+ continue;
-+
-+ wl_list_remove (&tp->link);
-+ free (tp);
-+
-+ return;
-+ }
-+}
-+
-+static const struct wl_touch_listener touch_listener = {
-+ touch_handle_down,
-+ touch_handle_up,
-+ touch_handle_motion,
-+ touch_handle_frame,
-+ touch_handle_cancel,
-+};
-+
-+static void
-+seat_handle_capabilities (void *data, struct wl_seat *seat,
-+ enum wl_seat_capability caps)
-+{
-+ struct input *input = data;
-+
-+ if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) {
-+ input->pointer = wl_seat_get_pointer (seat);
-+ wl_pointer_set_user_data (input->pointer, input);
-+ wl_pointer_add_listener (input->pointer, &pointer_listener, input);
-+ } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) {
-+ wl_pointer_destroy (input->pointer);
-+ input->pointer = NULL;
-+ }
-+
-+ if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) {
-+ input->touch = wl_seat_get_touch (seat);
-+ wl_touch_set_user_data (input->touch, input);
-+ wl_touch_add_listener (input->touch, &touch_listener, input);
-+ } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) {
-+ wl_touch_destroy (input->touch);
-+ input->touch = NULL;
-+ }
-+}
-+
-+static void
-+seat_handle_name (void *data, struct wl_seat *seat, const char *name)
-+{
-+
-+}
-+
-+static const struct wl_seat_listener seat_listener = {
-+ seat_handle_capabilities,
-+ seat_handle_name
-+};
-+
-+static void
-+display_add_input (GstWlDisplay *d, uint32_t id)
-+{
-+ struct input *input;
-+
-+ input = calloc (1, sizeof (*input));
-+ if (input == NULL) {
-+ fprintf (stderr, "%s: out of memory\n", "gst-wayland-sink");
-+ exit (EXIT_FAILURE);
-+ }
-+ input->display = d;
-+ input->seat = wl_registry_bind (d->registry, id, &wl_seat_interface,
-+ MAX (d->seat_version, 3));
-+ input->touch_focus = NULL;
-+ input->pointer_focus = NULL;
-+ wl_list_init (&input->touch_point_list);
-+ wl_list_insert (d->input_list.prev, &input->link);
-+
-+ wl_seat_add_listener (input->seat, &seat_listener, input);
-+ wl_seat_set_user_data (input->seat, input);
-+
-+}
-
- static void
- dmabuf_format (void *data, struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf,
-@@ -224,6 +533,9 @@ registry_handle_global (void *data, struct wl_registry *registry,
- } else if (g_strcmp0 (interface, "wl_shm") == 0) {
- self->shm = wl_registry_bind (registry, id, &wl_shm_interface, 1);
- wl_shm_add_listener (self->shm, &shm_listener, self);
-+ } else if (g_strcmp0 (interface, "wl_seat") == 0) {
-+ self->seat_version = version;
-+ display_add_input (self, id);
- } else if (g_strcmp0 (interface, "wp_viewporter") == 0) {
- self->viewporter =
- wl_registry_bind (registry, id, &wp_viewporter_interface, 1);
-@@ -233,9 +545,15 @@ registry_handle_global (void *data, struct wl_registry *registry,
- zwp_linux_dmabuf_v1_add_listener (self->dmabuf, &dmabuf_listener, self);
- }
- }
-+static void
-+registry_handle_global_remove(void *data, struct wl_registry *registry,
-+ uint32_t name)
-+{
-+}
-
- static const struct wl_registry_listener registry_listener = {
-- registry_handle_global
-+ registry_handle_global,
-+ registry_handle_global_remove
- };
-
- static gpointer
-@@ -306,6 +624,7 @@ gst_wl_display_new_existing (struct wl_display * display,
- self->display_wrapper = wl_proxy_create_wrapper (display);
- self->own_display = take_ownership;
-
-+ wl_list_init (&self->input_list);
- self->queue = wl_display_create_queue (self->display);
- wl_proxy_set_queue ((struct wl_proxy *) self->display_wrapper, self->queue);
- self->registry = wl_display_get_registry (self->display_wrapper);
-diff --git a/ext/wayland/wldisplay.h b/ext/wayland/wldisplay.h
-index 4ecc0d6..b4339c0 100644
---- a/ext/wayland/wldisplay.h
-+++ b/ext/wayland/wldisplay.h
-@@ -71,6 +71,11 @@ struct _GstWlDisplay
- GMutex buffers_mutex;
- GHashTable *buffers;
- gboolean shutting_down;
-+
-+ struct wl_list input_list;
-+ int seat_version;
-+ uint32_t serial;
-+
- };
-
- struct _GstWlDisplayClass
-diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c
-index 9ebbcaf..8dd5420 100644
---- a/ext/wayland/wlwindow.c
-+++ b/ext/wayland/wlwindow.c
-@@ -199,6 +199,9 @@ gst_wl_window_new_internal (GstWlDisplay * display, GMutex * render_lock)
- window->area_surface = wl_compositor_create_surface (display->compositor);
- window->video_surface = wl_compositor_create_surface (display->compositor);
-
-+ wl_surface_set_user_data (window->area_surface, window);
-+ wl_surface_set_user_data (window->video_surface, window);
-+
- window->area_surface_wrapper = wl_proxy_create_wrapper (window->area_surface);
- window->video_surface_wrapper =
- wl_proxy_create_wrapper (window->video_surface);
-1.9.1
-
deleted file mode 100644
@@ -1,145 +0,0 @@
-From 39013d1e9c42018d1848a9c34538db46230120e2 Mon Sep 17 00:00:00 2001
-From: Ramprasad N <x0038811@ti.com>
-Date: Thu, 18 Jan 2018 17:01:37 +0530
-Subject: [PATCH 2/5] parsers: Pick bug fixes on different parsers
-
-The following bug fixes which were previously identified are picked :
-1. Increase rank for vc1parse and jpegparse
-2. Modify h264 and mpeg4 parsers to interpolate pts
-3. Fix create() width and height calculation on h264parse
-
-Signed-off-by: Pooja Prajod <a0132412@ti.com>
-Signed-off-by: Ramprasad N <x0038811@ti.com>
-
----
- gst/jpegformat/gstjpegformat.c | 2 +-
- gst/jpegformat/gstjpegparse.c | 2 +-
- gst/videoparsers/gsth264parse.c | 22 +++++++---------------
- gst/videoparsers/gstmpeg4videoparse.c | 2 +-
- gst/videoparsers/gstmpegvideoparse.c | 2 +-
- gst/videoparsers/plugin.c | 2 +-
- 6 files changed, 12 insertions(+), 20 deletions(-)
-
-diff --git a/gst/jpegformat/gstjpegformat.c b/gst/jpegformat/gstjpegformat.c
-index b410466..ecb9311 100644
---- a/gst/jpegformat/gstjpegformat.c
-+++ b/gst/jpegformat/gstjpegformat.c
-@@ -30,7 +30,7 @@
- static gboolean
- plugin_init (GstPlugin * plugin)
- {
-- if (!gst_element_register (plugin, "jpegparse", GST_RANK_NONE,
-+ if (!gst_element_register (plugin, "jpegparse", GST_RANK_PRIMARY + 2,
- GST_TYPE_JPEG_PARSE))
- return FALSE;
- if (!gst_element_register (plugin, "jifmux", GST_RANK_SECONDARY,
-diff --git a/gst/jpegformat/gstjpegparse.c b/gst/jpegformat/gstjpegparse.c
-index 17cbec9..a10e9e0 100644
---- a/gst/jpegformat/gstjpegparse.c
-+++ b/gst/jpegformat/gstjpegparse.c
-@@ -113,7 +113,7 @@ gst_jpeg_parse_class_init (GstJpegParseClass * klass)
-
- gst_element_class_set_static_metadata (gstelement_class,
- "JPEG stream parser",
-- "Video/Parser",
-+ "Codec/Parser/Video",
- "Parse JPEG images into single-frame buffers",
- "Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>");
-
-diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c
-index f4d82e5..6228b98 100644
---- a/gst/videoparsers/gsth264parse.c
-+++ b/gst/videoparsers/gsth264parse.c
-@@ -161,7 +161,7 @@ static void
- gst_h264_parse_init (GstH264Parse * h264parse)
- {
- h264parse->frame_out = gst_adapter_new ();
-- gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (h264parse), FALSE);
-+ gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (h264parse), TRUE);
- GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (h264parse));
- GST_PAD_SET_ACCEPT_TEMPLATE (GST_BASE_PARSE_SINK_PAD (h264parse));
-
-@@ -1901,13 +1901,8 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps)
- gint fps_num, fps_den;
- gint par_n, par_d;
-
-- if (sps->frame_cropping_flag) {
-- crop_width = sps->crop_rect_width;
-- crop_height = sps->crop_rect_height;
-- } else {
-- crop_width = sps->width;
-- crop_height = sps->height;
-- }
-+ crop_width = (sps->crop_rect_width > sps->width)? sps->crop_rect_width: sps->width;
-+ crop_height = (sps->crop_rect_height > sps->height)? sps->crop_rect_height: sps->height;
-
- if (G_UNLIKELY (h264parse->width != crop_width ||
- h264parse->height != crop_height)) {
-@@ -1942,7 +1937,7 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps)
-
- if (G_UNLIKELY (modified || h264parse->update_caps)) {
- GstVideoInterlaceMode imode = GST_VIDEO_INTERLACE_MODE_PROGRESSIVE;
-- gint width, height;
-+ gint width=0, height=0;
- GstClockTime latency;
-
- const gchar *caps_mview_mode = NULL;
-@@ -1956,16 +1951,13 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps)
-
- caps = gst_caps_copy (sink_caps);
-
-- /* sps should give this but upstream overrides */
- if (s && gst_structure_has_field (s, "width"))
- gst_structure_get_int (s, "width", &width);
-- else
-- width = h264parse->width;
--
-+ width = (width > h264parse->width)? width: h264parse->width;
-+
- if (s && gst_structure_has_field (s, "height"))
- gst_structure_get_int (s, "height", &height);
-- else
-- height = h264parse->height;
-+ height = (height > h264parse->height)? height: h264parse->height;
-
- if (s == NULL ||
- !gst_structure_get_fraction (s, "pixel-aspect-ratio", &par_n,
-diff --git a/gst/videoparsers/gstmpeg4videoparse.c b/gst/videoparsers/gstmpeg4videoparse.c
-index 38e1f45..49434c7 100644
---- a/gst/videoparsers/gstmpeg4videoparse.c
-+++ b/gst/videoparsers/gstmpeg4videoparse.c
-@@ -183,7 +183,7 @@ gst_mpeg4vparse_init (GstMpeg4VParse * parse)
- parse->interval = DEFAULT_CONFIG_INTERVAL;
- parse->last_report = GST_CLOCK_TIME_NONE;
-
-- gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (parse), FALSE);
-+ gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (parse), TRUE);
- GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (parse));
- GST_PAD_SET_ACCEPT_TEMPLATE (GST_BASE_PARSE_SINK_PAD (parse));
- }
-diff --git a/gst/videoparsers/gstmpegvideoparse.c b/gst/videoparsers/gstmpegvideoparse.c
-index eef79bc..e9ddda1 100644
---- a/gst/videoparsers/gstmpegvideoparse.c
-+++ b/gst/videoparsers/gstmpegvideoparse.c
-@@ -173,7 +173,7 @@ gst_mpegv_parse_init (GstMpegvParse * parse)
- {
- parse->config_flags = FLAG_NONE;
-
-- gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (parse), FALSE);
-+ gst_base_parse_set_pts_interpolation (GST_BASE_PARSE (parse), TRUE);
- GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (parse));
- GST_PAD_SET_ACCEPT_TEMPLATE (GST_BASE_PARSE_SINK_PAD (parse));
- }
-diff --git a/gst/videoparsers/plugin.c b/gst/videoparsers/plugin.c
-index 2deddf4..c622b50 100644
---- a/gst/videoparsers/plugin.c
-+++ b/gst/videoparsers/plugin.c
-@@ -54,7 +54,7 @@ plugin_init (GstPlugin * plugin)
- ret |= gst_element_register (plugin, "h265parse",
- GST_RANK_SECONDARY, GST_TYPE_H265_PARSE);
- ret |= gst_element_register (plugin, "vc1parse",
-- GST_RANK_NONE, GST_TYPE_VC1_PARSE);
-+ GST_RANK_PRIMARY + 2, GST_TYPE_VC1_PARSE);
-
- return ret;
- }
deleted file mode 100644
@@ -1,160 +0,0 @@
-From 4e36ace0ac217a3c7b0ae5548ad6fa3e31028edb Mon Sep 17 00:00:00 2001
-From: Ramprasad N <x0038811@ti.com>
-Date: Mon, 28 Jan 2019 13:45:08 +0530
-Subject: [PATCH 3/5] kmssink: Add omapdrm and tidss in the list of drivers
-
-In gstreamer-bad v1.14.4 kmssink plugin is available
-but omapdrm and tidss drivers are not added in the
-list of driver modules.
-
-DRM and DMABUF are treated differently by gstreamer
-eventhough they are based on fd allocator.
-GST1.14 has many changes to dmabuf allocator and
-hence DRM and DMABUF will be treated differently.
-
-Added support for DRM buffer importing. Without
-this addition, there will be frame-copy happens and
-slows down the playback.
-
-Signed-off-by: Ramprasad N <x0038811@ti.com>
-
----
- sys/kms/Makefile.am | 1 +
- sys/kms/gstkmssink.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++-
- 2 files changed, 97 insertions(+), 1 deletion(-)
-
-diff --git a/sys/kms/Makefile.am b/sys/kms/Makefile.am
-index f13ccc5..b4eab3a 100644
---- a/sys/kms/Makefile.am
-+++ b/sys/kms/Makefile.am
-@@ -23,6 +23,7 @@ libgstkms_la_LIBADD = \
- $(GST_ALLOCATORS_LIBS) \
- $(GST_LIBS) \
- $(KMS_DRM_LIBS) \
-+ $(top_builddir)/gst-libs/gst/drm/libgstdrm-$(GST_API_VERSION).la \
- $(NULL)
-
- libgstkms_la_LDFLAGS = \
-diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c
-index cdecbf6..f59eb3c 100644
---- a/sys/kms/gstkmssink.c
-+++ b/sys/kms/gstkmssink.c
-@@ -178,7 +178,7 @@ kms_open (gchar ** driver)
- static const char *drivers[] = { "i915", "radeon", "nouveau", "vmwgfx",
- "exynos", "amdgpu", "imx-drm", "rockchip", "atmel-hlcdc", "msm",
- "xlnx", "vc4", "meson", "sun4i-drm", "mxsfb-drm",
-- "xilinx_drm", /* DEPRECATED. Replaced by xlnx */
-+ "xilinx_drm", "omapdrm", "tidss", /* DEPRECATED. Replaced by xlnx */
- };
- int i, fd = -1;
-
-@@ -1342,7 +1342,99 @@ event_failed:
- return FALSE;
- }
- }
-+ static gboolean
-+gst_kms_sink_import_drmbuf (GstKMSSink * self, GstBuffer * inbuf,
-+ GstBuffer ** outbuf)
-+{
-+ gint prime_fds[GST_VIDEO_MAX_PLANES] = { 0, };
-+ GstVideoMeta *meta;
-+ guint i, n_mem, n_planes;
-+ GstKMSMemory *kmsmem;
-+ guint mems_idx[GST_VIDEO_MAX_PLANES];
-+ gsize mems_skip[GST_VIDEO_MAX_PLANES];
-+ GstMemory *mems[GST_VIDEO_MAX_PLANES];
-+
-+ if (!self->has_prime_import)
-+ return FALSE;
-+
-+ /* This will eliminate most non-dmabuf out there */
-+ if (!gst_is_drm_memory (gst_buffer_peek_memory (inbuf, 0)))
-+ return FALSE;
-+
-+ n_planes = GST_VIDEO_INFO_N_PLANES (&self->vinfo);
-+ n_mem = gst_buffer_n_memory (inbuf);
-+ meta = gst_buffer_get_video_meta (inbuf);
-+
-+ GST_TRACE_OBJECT (self, "Found a drmbuf with %u planes and %u memories",
-+ n_planes, n_mem);
-+
-+ /* We cannot have multiple dmabuf per plane */
-+ if (n_mem > n_planes)
-+ return FALSE;
-+ g_assert (n_planes != 0);
-+
-+ /* Update video info based on video meta */
-+ if (meta) {
-+ GST_VIDEO_INFO_WIDTH (&self->vinfo) = meta->width;
-+ GST_VIDEO_INFO_HEIGHT (&self->vinfo) = meta->height;
-+
-+ for (i = 0; i < meta->n_planes; i++) {
-+ GST_VIDEO_INFO_PLANE_OFFSET (&self->vinfo, i) = meta->offset[i];
-+ GST_VIDEO_INFO_PLANE_STRIDE (&self->vinfo, i) = meta->stride[i];
-+ }
-+ }
-+
-+ /* Find and validate all memories */
-+ for (i = 0; i < n_planes; i++) {
-+ guint length;
-+
-+ if (!gst_buffer_find_memory (inbuf,
-+ GST_VIDEO_INFO_PLANE_OFFSET (&self->vinfo, i), 1,
-+ &mems_idx[i], &length, &mems_skip[i]))
-+ return FALSE;
-+
-+ mems[i] = gst_buffer_peek_memory (inbuf, mems_idx[i]);
-+
-+ /* adjust for memory offset, in case data does not
-+ * start from byte 0 in the dmabuf fd */
-+ mems_skip[i] += mems[i]->offset;
-+
-+ /* And all memory found must be dmabuf */
-+ if (!gst_is_drm_memory (mems[i]))
-+ return FALSE;
-+ }
-+
-+ kmsmem = (GstKMSMemory *) gst_kms_allocator_get_cached (mems[0]);
-+ if (kmsmem) {
-+ GST_LOG_OBJECT (self, "found KMS mem %p in DMABuf mem %p with fb id = %d",
-+ kmsmem, mems[0], kmsmem->fb_id);
-+ goto wrap_mem;
-+ }
-+
-+ for (i = 0; i < n_planes; i++)
-+ prime_fds[i] = gst_fd_memory_get_fd (mems[i]);
-
-+ GST_LOG_OBJECT (self, "found these prime ids: %d, %d, %d, %d", prime_fds[0],
-+ prime_fds[1], prime_fds[2], prime_fds[3]);
-+
-+ kmsmem = gst_kms_allocator_dmabuf_import (self->allocator, prime_fds,
-+ n_planes, mems_skip, &self->vinfo);
-+ if (!kmsmem)
-+ return FALSE;
-+
-+ GST_LOG_OBJECT (self, "setting KMS mem %p to DMABuf mem %p with fb id = %d",
-+ kmsmem, mems[0], kmsmem->fb_id);
-+ gst_kms_allocator_cache (self->allocator, mems[0], GST_MEMORY_CAST (kmsmem));
-+
-+wrap_mem:
-+ *outbuf = gst_buffer_new ();
-+ if (!*outbuf)
-+ return FALSE;
-+ gst_buffer_append_memory (*outbuf, gst_memory_ref (GST_MEMORY_CAST (kmsmem)));
-+ gst_buffer_add_parent_buffer_meta (*outbuf, inbuf);
-+
-+ return TRUE;
-+}
- static gboolean
- gst_kms_sink_import_dmabuf (GstKMSSink * self, GstBuffer * inbuf,
- GstBuffer ** outbuf)
-@@ -1516,6 +1608,9 @@ gst_kms_sink_get_input_buffer (GstKMSSink * self, GstBuffer * inbuf)
- if (gst_is_kms_memory (mem))
- return gst_buffer_ref (inbuf);
-
-+ if (gst_kms_sink_import_drmbuf (self, inbuf, &buf))
-+ goto done;
-+
- if (gst_kms_sink_import_dmabuf (self, inbuf, &buf))
- goto done;
-
deleted file mode 100644
@@ -1,703 +0,0 @@
-From 0f7df5b0b7ec131d9d7af76005dbe3b78521b58f Mon Sep 17 00:00:00 2001
-From: Ramprasad N <x0038811@ti.com>
-Date: Thu, 20 Feb 2020 14:38:55 +0530
-Subject: [PATCH 4/5] waylandsink: Add drm support in waylandsink
-
-Waylandsink works out of shm memory. We have a DRM
-based memory allocator in place. Adding wl_drm support
-enables us to use DRM buffers without copy
-
-Following features are also added
-1) YUY2 and BGRA input format support
-2) Crop support
-3) Window resolution configuration support
-4) A property use-drm to command DRM buffer allocation
- when propose_allocation is called
-
-Signed-off-by: Ramprasad N <x0038811@ti.com>
----
- ext/wayland/Makefile.am | 11 +++-
- ext/wayland/gstwaylandsink.c | 89 +++++++++++++++++++++++++++++--
- ext/wayland/gstwaylandsink.h | 2 +
- ext/wayland/wldisplay.c | 56 +++++++++++++++++++
- ext/wayland/wldisplay.h | 9 ++++
- ext/wayland/wldrm.c | 124 +++++++++++++++++++++++++++++++++++++++++++
- ext/wayland/wldrm.h | 21 ++++++++
- ext/wayland/wlwindow.c | 63 +++++++++++++++++++---
- 8 files changed, 363 insertions(+), 12 deletions(-)
- create mode 100644 ext/wayland/wldrm.c
- create mode 100644 ext/wayland/wldrm.h
-
-diff --git a/ext/wayland/Makefile.am b/ext/wayland/Makefile.am
-index 95bb97e..a118033 100644
---- a/ext/wayland/Makefile.am
-+++ b/ext/wayland/Makefile.am
-@@ -8,12 +8,15 @@ BUILT_SOURCES = \
- fullscreen-shell-unstable-v1-protocol.c \
- fullscreen-shell-unstable-v1-client-protocol.h \
- xdg-shell-protocol.c \
-- xdg-shell-client-protocol.h
-+ xdg-shell-client-protocol.h \
-+ wayland-drm-protocol.c \
-+ wayland-drm-client-protocol.h
-
- libgstwaylandsink_la_SOURCES = \
- gstwaylandsink.c \
- wlshmallocator.c \
- wlbuffer.c \
-+ wldrm.c \
- wldisplay.c \
- wlwindow.c \
- wlvideoformat.c \
-@@ -23,18 +26,21 @@ nodist_libgstwaylandsink_la_SOURCES = \
- viewporter-protocol.c \
- linux-dmabuf-unstable-v1-protocol.c \
- fullscreen-shell-unstable-v1-protocol.c \
-- xdg-shell-protocol.c
-+ xdg-shell-protocol.c \
-+ wayland-drm-protocol.c
-
- libgstwaylandsink_la_CFLAGS = \
- $(GST_PLUGINS_BAD_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_CFLAGS) \
-+ $(DRM_CFLAGS) \
- $(WAYLAND_CFLAGS)
- libgstwaylandsink_la_LIBADD = \
- $(top_builddir)/gst-libs/gst/wayland/libgstwayland-$(GST_API_VERSION).la \
- $(GST_PLUGINS_BASE_LIBS) \
- -lgstvideo-$(GST_API_VERSION) \
- -lgstallocators-$(GST_API_VERSION) \
-+ $(top_builddir)/gst-libs/gst/drm/libgstdrm-$(GST_API_VERSION).la \
- $(WAYLAND_LIBS)
- libgstwaylandsink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-
-@@ -42,6 +48,7 @@ noinst_HEADERS = \
- gstwaylandsink.h \
- wlshmallocator.h \
- wlbuffer.h \
-+ wldrm.h \
- wldisplay.h \
- wlwindow.h \
- wlvideoformat.h \
-diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
-index 78dd294..9441232 100644
---- a/ext/wayland/gstwaylandsink.c
-+++ b/ext/wayland/gstwaylandsink.c
-@@ -46,6 +46,7 @@
- #include "wlbuffer.h"
- #include "wlshmallocator.h"
- #include "wllinuxdmabuf.h"
-+#include "wldrm.h"
-
- #include <gst/wayland/wayland.h>
- #include <gst/video/videooverlay.h>
-@@ -62,7 +63,9 @@ enum
- {
- PROP_0,
- PROP_DISPLAY,
-- PROP_FULLSCREEN
-+ PROP_FULLSCREEN,
-+ PROP_ALLOCATION,
-+ PROP_SCALE
- };
-
- GST_DEBUG_CATEGORY (gstwayland_debug);
-@@ -208,6 +211,18 @@ gst_wayland_sink_class_init (GstWaylandSinkClass * klass)
- g_param_spec_boolean ("fullscreen", "Fullscreen",
- "Whether the surface should be made fullscreen ", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-+
-+ g_object_class_install_property (gobject_class, PROP_ALLOCATION,
-+ g_param_spec_boolean ("use-drm", "Wayland Allocation name", "Wayland "
-+ "Use DRM based memory for allocation",
-+ FALSE, G_PARAM_WRITABLE));
-+
-+ g_object_class_install_property (gobject_class, PROP_SCALE,
-+ g_param_spec_string ("window-resolution", "window resolution on display",
-+ "resolution of video widthxheight ",
-+ "NULL",
-+ G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
-+
- }
-
- static void
-@@ -215,6 +230,7 @@ gst_wayland_sink_init (GstWaylandSink * sink)
- {
- g_mutex_init (&sink->display_lock);
- g_mutex_init (&sink->render_lock);
-+ sink->scale_width = sink->scale_height = 0;
- }
-
- static void
-@@ -257,6 +273,7 @@ gst_wayland_sink_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
- {
- GstWaylandSink *sink = GST_WAYLAND_SINK (object);
-+ gchar *string = NULL, *end;
-
- switch (prop_id) {
- case PROP_DISPLAY:
-@@ -269,6 +286,24 @@ gst_wayland_sink_set_property (GObject * object,
- gst_wayland_sink_set_fullscreen (sink, g_value_get_boolean (value));
- GST_OBJECT_UNLOCK (sink);
- break;
-+ case PROP_ALLOCATION:
-+ GST_OBJECT_LOCK (sink);
-+ sink->use_drm = g_value_get_boolean (value);
-+ GST_OBJECT_UNLOCK (sink);
-+ break;
-+ case PROP_SCALE:
-+ GST_OBJECT_LOCK (sink);
-+ string = g_value_dup_string (value);
-+ sink->scale_width = g_ascii_strtoull (string, &end, 10);
-+ if (*end != 'x')
-+ sink->scale_width = 0 ;
-+
-+ sink->scale_height = g_ascii_strtoull (end+1, &end, 10);
-+ if(string)
-+ g_free(string);
-+ GST_OBJECT_UNLOCK (sink);
-+ break;
-+
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
-@@ -353,6 +388,9 @@ gst_wayland_sink_find_display (GstWaylandSink * sink)
- /* if the application didn't set a display, let's create it ourselves */
- GST_OBJECT_LOCK (sink);
- sink->display = gst_wl_display_new (sink->display_name, &error);
-+ sink->display->use_drm = sink->use_drm;
-+ sink->display->scale_width = sink->scale_width;
-+ sink->display->scale_height = sink->scale_height;
- GST_OBJECT_UNLOCK (sink);
-
- if (error) {
-@@ -529,7 +567,11 @@ gst_wayland_create_pool (GstWaylandSink * sink, GstCaps * caps)
- structure = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set_params (structure, caps, size, 2, 0);
-
-- alloc = gst_wl_shm_allocator_get ();
-+ if(sink->display->use_drm)
-+ alloc = gst_drm_allocator_get ();
-+ else
-+ alloc = gst_wl_shm_allocator_get ();
-+
- gst_buffer_pool_config_set_allocator (structure, alloc, NULL);
- if (!gst_buffer_pool_set_config (pool, structure)) {
- g_object_unref (pool);
-@@ -540,16 +582,34 @@ gst_wayland_create_pool (GstWaylandSink * sink, GstCaps * caps)
- return pool;
- }
-
-+static void
-+wait_authentication (GstWaylandSink * sink)
-+{
-+ GST_DEBUG_OBJECT (sink, "Before wait aunthenticated value is %d : \n", sink->display->authenticated );
-+ while (!sink->display->authenticated) {
-+ GST_DEBUG_OBJECT (sink, "waiting for authentication");
-+ wl_display_roundtrip (sink->display->display);
-+ }
-+ GST_DEBUG_OBJECT (sink, "After wait aunthenticated value is %d : \n", sink->display->authenticated );
-+}
-+
- static gboolean
- gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
- {
- GstWaylandSink *sink;
- gboolean use_dmabuf;
-+ gboolean use_drm = 0;
- GstVideoFormat format;
-+ GstStructure *s;
-
- sink = GST_WAYLAND_SINK (bsink);
-
- GST_DEBUG_OBJECT (sink, "set caps %" GST_PTR_FORMAT, caps);
-+ wait_authentication (sink);
-+
-+ while (!sink->display->authenticated) {
-+ GST_DEBUG_OBJECT (sink, "not authenticated yet");
-+ }
-
- /* extract info from caps */
- if (!gst_video_info_from_caps (&sink->video_info, caps))
-@@ -558,6 +618,12 @@ gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
- format = GST_VIDEO_INFO_FORMAT (&sink->video_info);
- sink->video_info_changed = TRUE;
-
-+ s = gst_caps_get_structure (caps, 0);
-+ gst_structure_get_boolean (s, "drm_mem", &use_drm);
-+
-+ if(use_drm)
-+ sink->display->use_drm = TRUE;
-+
- /* create a new pool for the new caps */
- if (sink->pool)
- gst_object_unref (sink->pool);
-@@ -610,7 +676,12 @@ gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
- if (pool)
- g_object_unref (pool);
-
-- alloc = gst_wl_shm_allocator_get ();
-+
-+ if(sink->display->use_drm)
-+ alloc = gst_drm_allocator_get ();
-+ else
-+ alloc = gst_wl_shm_allocator_get ();
-+
- gst_query_add_allocation_param (query, alloc, NULL);
- gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL);
- g_object_unref (alloc);
-@@ -687,6 +758,10 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
-
- GST_LOG_OBJECT (sink, "render buffer %p", buffer);
-
-+ if (sink->display) {
-+ sink->display->crop = gst_buffer_get_video_crop_meta (buffer);
-+ }
-+
- if (G_UNLIKELY (!sink->window)) {
- /* ask for window handle. Unlock render_lock while doing that because
- * set_window_handle & friends will lock it in this context */
-@@ -741,7 +816,13 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
- "display, creating it", buffer);
-
- format = GST_VIDEO_INFO_FORMAT (&sink->video_info);
-- if (gst_wl_display_check_format_for_dmabuf (sink->display, format)) {
-+
-+ if (gst_is_drm_memory (mem)) {
-+ wbuf = gst_wl_drm_memory_construct_wl_buffer (mem, sink->display,
-+ &sink->video_info);
-+ }
-+
-+ if (!wbuf && gst_wl_display_check_format_for_dmabuf (sink->display, format)) {
- guint i, nb_dmabuf = 0;
-
- for (i = 0; i < gst_buffer_n_memory (buffer); i++)
-diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h
-index be92fe7..f6d010e 100644
---- a/ext/wayland/gstwaylandsink.h
-+++ b/ext/wayland/gstwaylandsink.h
-@@ -64,6 +64,8 @@ struct _GstWaylandSink
-
- gchar *display_name;
-
-+ gboolean use_drm;
-+ gint scale_width, scale_height;
- gboolean redraw_pending;
- GMutex render_lock;
- GstBuffer *last_buffer;
-diff --git a/ext/wayland/wldisplay.c b/ext/wayland/wldisplay.c
-index 9400095..363e817 100644
---- a/ext/wayland/wldisplay.c
-+++ b/ext/wayland/wldisplay.c
-@@ -26,6 +26,10 @@
- #include "wlbuffer.h"
- #include "wlvideoformat.h"
-
-+#include "wayland-drm-client-protocol.h"
-+#include <fcntl.h>
-+#include <xf86drm.h>
-+#include <xf86drmMode.h>
- #include <errno.h>
-
- GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug);
-@@ -46,9 +50,12 @@ static void
- gst_wl_display_init (GstWlDisplay * self)
- {
- self->shm_formats = g_array_new (FALSE, FALSE, sizeof (uint32_t));
-+ self->drm_formats = g_array_new (FALSE, FALSE, sizeof (uint32_t));
- self->dmabuf_formats = g_array_new (FALSE, FALSE, sizeof (uint32_t));
- self->wl_fd_poll = gst_poll_new (TRUE);
- self->buffers = g_hash_table_new (g_direct_hash, g_direct_equal);
-+ self->fd = -1;
-+ self->use_drm = FALSE;
- g_mutex_init (&self->buffers_mutex);
- }
-
-@@ -73,11 +80,15 @@ gst_wl_display_finalize (GObject * gobject)
- g_hash_table_remove_all (self->buffers);
-
- g_array_unref (self->shm_formats);
-+ g_array_unref (self->drm_formats);
- g_array_unref (self->dmabuf_formats);
- gst_poll_free (self->wl_fd_poll);
- g_hash_table_unref (self->buffers);
- g_mutex_clear (&self->buffers_mutex);
-
-+ if(self->fd != -1)
-+ close(self->fd);
-+
- if (self->viewporter)
- wp_viewporter_destroy (self->viewporter);
-
-@@ -87,6 +98,9 @@ gst_wl_display_finalize (GObject * gobject)
- if (self->dmabuf)
- zwp_linux_dmabuf_v1_destroy (self->dmabuf);
-
-+ if (self->drm)
-+ wl_drm_destroy (self->drm);
-+
- if (self->wl_shell)
- wl_shell_destroy (self->wl_shell);
-
-@@ -200,6 +214,44 @@ static const struct xdg_wm_base_listener xdg_wm_base_listener = {
- handle_xdg_wm_base_ping
- };
-
-+/* For wl_drm_listener */
-+static void
-+drm_handle_device (void *data, struct wl_drm *drm, const char *device)
-+{
-+ GstWlDisplay *d = data;
-+ drm_magic_t magic;
-+ d->fd = open (device, O_RDWR | O_CLOEXEC);
-+ if (d->fd == -1) {
-+ GST_ERROR ("could not open %s: %m", device);
-+ return;
-+ }
-+ drmGetMagic (d->fd, &magic);
-+ wl_drm_authenticate (d->drm, magic);
-+}
-+
-+static void
-+drm_handle_format (void *data, struct wl_drm *drm, uint32_t format)
-+{
-+ GstWlDisplay *self = data;
-+ g_array_append_val (self->drm_formats, format);
-+ GST_DEBUG ("got format: %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (format));
-+}
-+
-+static void
-+drm_handle_authenticated (void *data, struct wl_drm *drm)
-+{
-+ GstWlDisplay *d = data;
-+ GST_DEBUG ("authenticated");
-+ d->authenticated = 1;
-+ GST_DEBUG ("drm_handle_authenticated: d->authenticated: %d\n",d->authenticated);
-+}
-+
-+static const struct wl_drm_listener drm_listener = {
-+ drm_handle_device,
-+ drm_handle_format,
-+ drm_handle_authenticated
-+};
-+
- static void
- registry_handle_global (void *data, struct wl_registry *registry,
- uint32_t id, const char *interface, uint32_t version)
-@@ -224,6 +276,9 @@ registry_handle_global (void *data, struct wl_registry *registry,
- } else if (g_strcmp0 (interface, "wl_shm") == 0) {
- self->shm = wl_registry_bind (registry, id, &wl_shm_interface, 1);
- wl_shm_add_listener (self->shm, &shm_listener, self);
-+ } else if (g_strcmp0 (interface, "wl_drm") == 0) {
-+ self->drm = wl_registry_bind (registry, id, &wl_drm_interface, 1);
-+ wl_drm_add_listener (self->drm, &drm_listener, self);
- } else if (g_strcmp0 (interface, "wp_viewporter") == 0) {
- self->viewporter =
- wl_registry_bind (registry, id, &wp_viewporter_interface, 1);
-@@ -334,6 +389,7 @@ gst_wl_display_new_existing (struct wl_display * display,
- VERIFY_INTERFACE_EXISTS (compositor, "wl_compositor");
- VERIFY_INTERFACE_EXISTS (subcompositor, "wl_subcompositor");
- VERIFY_INTERFACE_EXISTS (shm, "wl_shm");
-+ VERIFY_INTERFACE_EXISTS (drm, "wl_drm");
-
- #undef VERIFY_INTERFACE_EXISTS
-
-diff --git a/ext/wayland/wldisplay.h b/ext/wayland/wldisplay.h
-index 4ecc0d6..81e96bc 100644
---- a/ext/wayland/wldisplay.h
-+++ b/ext/wayland/wldisplay.h
-@@ -58,9 +58,11 @@ struct _GstWlDisplay
- struct xdg_wm_base *xdg_wm_base;
- struct zwp_fullscreen_shell_v1 *fullscreen_shell;
- struct wl_shm *shm;
-+ struct wl_drm *drm;
- struct wp_viewporter *viewporter;
- struct zwp_linux_dmabuf_v1 *dmabuf;
- GArray *shm_formats;
-+ GArray *drm_formats;
- GArray *dmabuf_formats;
-
- /* private */
-@@ -71,6 +73,13 @@ struct _GstWlDisplay
- GMutex buffers_mutex;
- GHashTable *buffers;
- gboolean shutting_down;
-+
-+ int fd;
-+ int authenticated;
-+ gboolean use_drm;
-+ gint scale_width, scale_height;
-+ GstVideoCropMeta *crop;
-+
- };
-
- struct _GstWlDisplayClass
-diff --git a/ext/wayland/wldrm.c b/ext/wayland/wldrm.c
-new file mode 100644
-index 0000000..0da9b73
---- /dev/null
-+++ b/ext/wayland/wldrm.c
-@@ -0,0 +1,124 @@
-+#include "wldisplay.h"
-+#include <gst/drm/gstdrmallocator.h>
-+#include "wayland-drm-client-protocol.h"
-+#include <wayland-client.h>
-+
-+GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug);
-+#define GST_CAT_DEFAULT gstwayland_debug
-+
-+
-+struct wl_buffer *
-+gst_wl_drm_memory_construct_wl_buffer (GstMemory * mem, GstWlDisplay * display,
-+ const GstVideoInfo * info)
-+{
-+ gint video_width = GST_VIDEO_INFO_WIDTH (info);
-+ gint video_height = GST_VIDEO_INFO_HEIGHT (info);
-+ GstVideoFormat format = GST_VIDEO_INFO_FORMAT (info);
-+ int fd = -1;
-+ struct wl_buffer *buffer;
-+ uint32_t fourcc;
-+ uint32_t bpp;
-+ uint32_t name;
-+ int singlePlane = 0;
-+ int ret;
-+ struct drm_prime_handle req1;
-+ struct drm_gem_flink req2;
-+ /* note: wayland and mesa use the terminology:
-+ * stride - rowstride in bytes
-+ * pitch - rowstride in pixels
-+ */
-+ uint32_t strides[3] = {
-+ GST_ROUND_UP_4 (video_width), 0, 0,
-+ };
-+ uint32_t offsets[3] = {
-+ 0, strides[0] * video_height, 0
-+ };
-+
-+ if (format == GST_VIDEO_FORMAT_NV12)
-+ {
-+ /* NV12 */
-+ fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2');
-+ strides[0] = GST_VIDEO_INFO_PLANE_STRIDE (info, 0);
-+ strides[1] = GST_VIDEO_INFO_PLANE_STRIDE (info, 1);
-+ offsets[0] = GST_VIDEO_INFO_PLANE_OFFSET (info, 0);
-+ offsets[1] = GST_VIDEO_INFO_PLANE_OFFSET (info, 1);
-+ }
-+ else if(format == GST_VIDEO_FORMAT_I420)
-+ {
-+ /* YUV420 */
-+ fourcc = GST_MAKE_FOURCC ('Y', 'U', '1', '2');
-+ strides[0] = GST_VIDEO_INFO_PLANE_STRIDE (info, 0);
-+ strides[1] = GST_VIDEO_INFO_PLANE_STRIDE (info, 1);
-+ strides[2] = GST_VIDEO_INFO_PLANE_STRIDE (info, 2);
-+ offsets[0] = GST_VIDEO_INFO_PLANE_OFFSET (info, 0);
-+ offsets[1] = GST_VIDEO_INFO_PLANE_OFFSET (info, 1);
-+ offsets[2] = GST_VIDEO_INFO_PLANE_OFFSET (info, 2);
-+
-+ }
-+ else if(format == GST_VIDEO_FORMAT_BGRA)
-+ {
-+ singlePlane = 1;
-+ bpp = 4;
-+ fourcc = GST_MAKE_FOURCC ('A', 'R', '2', '4');
-+ }
-+ else if(format == GST_VIDEO_FORMAT_YUY2)
-+ {
-+ singlePlane = 1;
-+ bpp = 2;
-+ fourcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', 'V');
-+ }
-+ else
-+ {
-+
-+ GST_DEBUG ("Unsupported video format: %d", format);
-+ /*
-+ * There are two xRGB frames with width and height = 1 required in the begining of a video stream.
-+ * If we consider them as errot, then it will case libwayland-clent.so crashes
-+ * due to invalid error handling.
-+ * Consider them as NV12 until we can figure out a better solution
-+ */
-+ fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2');
-+ strides[1] = GST_ROUND_UP_4 (video_width);
-+ }
-+
-+ fd = gst_fd_memory_get_fd (mem);
-+
-+ if (fd < 0 ) {
-+ GST_DEBUG ("Invalid fd");
-+ return NULL;
-+ }
-+ req1.fd = fd,
-+
-+ ret = drmIoctl(display->fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &req1);
-+ if (ret) {
-+ GST_DEBUG ("could not get handle, DRM_IOCTL_PRIME_FD_TO_HANDLE returned %d", ret);
-+ return NULL;
-+ }
-+
-+ req2.handle = req1.handle;
-+
-+ ret = drmIoctl(display->fd, DRM_IOCTL_GEM_FLINK, &req2);
-+ if (ret) {
-+ GST_DEBUG ("could not get name, DRM_IOCTL_GEM_FLINK returned %d", ret);
-+ return NULL;
-+ }
-+
-+ name = req2.name;
-+ GST_LOG ("width = %d , height = %d , fourcc = %d ", video_width, video_height, fourcc );
-+
-+ if(!singlePlane)
-+ buffer = wl_drm_create_planar_buffer (display->drm, name,
-+ video_width, video_height, fourcc,
-+ offsets[0], strides[0],
-+ offsets[1], strides[1],
-+ offsets[2], strides[2]);
-+ else
-+ buffer = wl_drm_create_buffer(display->drm, name, video_width, video_height,
-+ video_width * bpp, fourcc);
-+
-+ GST_DEBUG ("create planar buffer: %p (name=%d)",
-+ buffer, name);
-+
-+ return buffer;
-+}
-+
-diff --git a/ext/wayland/wldrm.h b/ext/wayland/wldrm.h
-new file mode 100644
-index 0000000..c6b4ae1
---- /dev/null
-+++ b/ext/wayland/wldrm.h
-@@ -0,0 +1,21 @@
-+/*
-+ *******************************************************************************
-+ *
-+ * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
-+ * ALL RIGHTS RESERVED
-+ *
-+ *******************************************************************************
-+ */
-+#ifndef __GST_WL_DRM_H__
-+#define __GST_WL_DRM_H__
-+
-+#include <gst/drm/gstdrmallocator.h>
-+#include "wayland-drm-client-protocol.h"
-+#include <wayland-client.h>
-+
-+struct wl_buffer *
-+gst_wl_drm_memory_construct_wl_buffer (GstMemory * mem, GstWlDisplay * display,
-+ const GstVideoInfo * info);
-+
-+
-+#endif /* __GST_WL_DRM_H__ */
-diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c
-index 9ebbcaf..b184dfc 100644
---- a/ext/wayland/wlwindow.c
-+++ b/ext/wayland/wlwindow.c
-@@ -221,6 +221,17 @@ gst_wl_window_new_internal (GstWlDisplay * display, GMutex * render_lock)
- window->video_surface);
- }
-
-+ if (display->crop) {
-+ GST_DEBUG ("Setting source crop : %d %d %d %d",display->crop->x, display->crop->y,
-+ display->crop->width, display->crop->height);
-+ wp_viewport_set_source (window->video_viewport,
-+ wl_fixed_from_int(display->crop->x),
-+ wl_fixed_from_int(display->crop->y),
-+ wl_fixed_from_int(display->crop->width),
-+ wl_fixed_from_int(display->crop->height));
-+
-+ }
-+
- /* do not accept input */
- wl_surface_set_input_region (window->area_surface, NULL);
- wl_surface_set_input_region (window->video_surface, NULL);
-@@ -380,6 +391,8 @@ gst_wl_window_resize_video_surface (GstWlWindow * window, gboolean commit)
- GstVideoRectangle src = { 0, };
- GstVideoRectangle dst = { 0, };
- GstVideoRectangle res;
-+ gint scale_width = window->display->scale_width;
-+ gint scale_height = window->display->scale_height;
-
- /* center the video_subsurface inside area_subsurface */
- src.w = window->video_width;
-@@ -389,8 +402,28 @@ gst_wl_window_resize_video_surface (GstWlWindow * window, gboolean commit)
-
- if (window->video_viewport) {
- gst_video_sink_center_rect (src, dst, &res, TRUE);
-- wp_viewport_set_destination (window->video_viewport, res.w, res.h);
-- } else {
-+
-+ if(scale_width > 0 && scale_height > 0)
-+ {
-+ res.x = 0;
-+ res.y = 0;
-+ res.w = scale_width;
-+ res.h = scale_height;
-+ if (window->display->crop) {
-+ window->display->crop->width = scale_width;
-+ window->display->crop->height = scale_height;
-+ }
-+ }
-+
-+ if (window->display->crop) {
-+ wp_viewport_set_destination (window->area_viewport, window->display->crop->width, window->display->crop->height);
-+ wp_viewport_set_destination (window->video_viewport, window->display->crop->width, window->display->crop->height);
-+ } else
-+ {
-+ wp_viewport_set_destination (window->video_viewport, res.w, res.h);
-+ }
-+ }
-+ else {
- gst_video_sink_center_rect (src, dst, &res, FALSE);
- }
-
-@@ -507,13 +540,23 @@ gst_wl_window_update_borders (GstWlWindow * window)
- /* draw the area_subsurface */
- gst_video_info_set_format (&info, format, width, height);
-
-- alloc = gst_wl_shm_allocator_get ();
-+ if(!window->display->use_drm)
-+ alloc = gst_wl_shm_allocator_get ();
-+ else
-+ alloc = gst_drm_allocator_get ();
-
- buf = gst_buffer_new_allocate (alloc, info.size, NULL);
- gst_buffer_memset (buf, 0, 0, info.size);
-- wlbuf =
-- gst_wl_shm_memory_construct_wl_buffer (gst_buffer_peek_memory (buf, 0),
-- window->display, &info);
-+
-+ if(!window->display->use_drm)
-+ wlbuf =
-+ gst_wl_shm_memory_construct_wl_buffer (gst_buffer_peek_memory (buf, 0),
-+ window->display, &info);
-+ else
-+ wlbuf =
-+ gst_wl_drm_memory_construct_wl_buffer (gst_buffer_peek_memory (buf, 0),
-+ window->display, &info);
-+
- gwlbuf = gst_buffer_add_wl_buffer (buf, wlbuf, window->display);
- gst_wl_buffer_attach (gwlbuf, window->area_surface_wrapper);
-
-@@ -527,8 +570,16 @@ void
- gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
- gint w, gint h)
- {
-+ gint scale_width = window->display->scale_width;
-+ gint scale_height = window->display->scale_height;
-+
- g_return_if_fail (window != NULL);
-
-+ if(scale_width > 0 && scale_height > 0) {
-+ w = scale_width;
-+ h = scale_height;
-+ }
-+
- window->render_rectangle.x = x;
- window->render_rectangle.y = y;
- window->render_rectangle.w = w;
-1.9.1
-
deleted file mode 100644
@@ -1,1022 +0,0 @@
-From 0368b83f0cce76c00954577e037cc64c42a99bac Mon Sep 17 00:00:00 2001
-From: Ramprasad N <x0038811@ti.com>
-Date: Thu, 20 Feb 2020 15:36:10 +0530
-Subject: [PATCH 5/5] waylandsink: Add input device support
-
-Remove wldispay.h and wlwindow.h to avoid
-circular dependency and create a single .h
-
-Signed-off-by: Ramprasad N <x0038811@ti.com>
----
- ext/wayland/Makefile.am | 4 +-
- ext/wayland/gstwaylandsink.c | 1 -
- ext/wayland/gstwaylandsink.h | 3 +-
- ext/wayland/wlbuffer.c | 2 +-
- ext/wayland/wlbuffer.h | 67 -------
- ext/wayland/wldisplay-wlwindow-wlbuffer.h | 243 +++++++++++++++++++++++++
- ext/wayland/wldisplay.c | 292 +++++++++++++++++++++++++++++-
- ext/wayland/wldisplay.h | 107 -----------
- ext/wayland/wldrm.c | 2 +-
- ext/wayland/wlshmallocator.h | 2 +-
- ext/wayland/wlwindow.c | 7 +-
- ext/wayland/wlwindow.h | 102 -----------
- 12 files changed, 543 insertions(+), 289 deletions(-)
- delete mode 100644 ext/wayland/wlbuffer.h
- create mode 100644 ext/wayland/wldisplay-wlwindow-wlbuffer.h
- delete mode 100644 ext/wayland/wldisplay.h
- delete mode 100644 ext/wayland/wlwindow.h
-
-diff --git a/ext/wayland/Makefile.am b/ext/wayland/Makefile.am
-index a118033..6f222b7 100644
---- a/ext/wayland/Makefile.am
-+++ b/ext/wayland/Makefile.am
-@@ -47,10 +47,8 @@ libgstwaylandsink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
- noinst_HEADERS = \
- gstwaylandsink.h \
- wlshmallocator.h \
-- wlbuffer.h \
- wldrm.h \
-- wldisplay.h \
-- wlwindow.h \
-+ wldisplay-wlwindow-wlbuffer.h \
- wlvideoformat.h \
- wllinuxdmabuf.h
-
-diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
-index 9441232..752a0b6 100644
---- a/ext/wayland/gstwaylandsink.c
-+++ b/ext/wayland/gstwaylandsink.c
-@@ -43,7 +43,6 @@
-
- #include "gstwaylandsink.h"
- #include "wlvideoformat.h"
--#include "wlbuffer.h"
- #include "wlshmallocator.h"
- #include "wllinuxdmabuf.h"
- #include "wldrm.h"
-diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h
-index f6d010e..3917918 100644
---- a/ext/wayland/gstwaylandsink.h
-+++ b/ext/wayland/gstwaylandsink.h
-@@ -27,8 +27,7 @@
-
- #include <wayland-client.h>
-
--#include "wldisplay.h"
--#include "wlwindow.h"
-+#include "wldisplay-wlwindow-wlbuffer.h"
-
- G_BEGIN_DECLS
-
-diff --git a/ext/wayland/wlbuffer.c b/ext/wayland/wlbuffer.c
-index 2121460..3642d17 100644
---- a/ext/wayland/wlbuffer.c
-+++ b/ext/wayland/wlbuffer.c
-@@ -76,7 +76,7 @@
- * as soon as we remove the reference that GstWlDisplay holds.
- */
-
--#include "wlbuffer.h"
-+#include "wldisplay-wlwindow-wlbuffer.h"
-
- GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug);
- #define GST_CAT_DEFAULT gstwayland_debug
-diff --git a/ext/wayland/wlbuffer.h b/ext/wayland/wlbuffer.h
-deleted file mode 100644
-index cbb50f7..0000000
---- a/ext/wayland/wlbuffer.h
-+++ /dev/null
-@@ -1,67 +0,0 @@
--/* GStreamer Wayland video sink
-- *
-- * Copyright (C) 2014 Collabora Ltd.
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the Free
-- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-- * Boston, MA 02110-1301 USA.
-- */
--
--#ifndef __GST_WL_BUFFER_H__
--#define __GST_WL_BUFFER_H__
--
--#include "wldisplay.h"
--
--G_BEGIN_DECLS
--
--#define GST_TYPE_WL_BUFFER (gst_wl_buffer_get_type ())
--#define GST_WL_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_BUFFER, GstWlBuffer))
--#define GST_IS_WL_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_BUFFER))
--#define GST_WL_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_BUFFER, GstWlBufferClass))
--#define GST_IS_WL_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_BUFFER))
--#define GST_WL_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_BUFFER, GstWlBufferClass))
--
--typedef struct _GstWlBuffer GstWlBuffer;
--typedef struct _GstWlBufferClass GstWlBufferClass;
--
--struct _GstWlBuffer
--{
-- GObject parent_instance;
--
-- struct wl_buffer * wlbuffer;
-- GstBuffer *gstbuffer;
--
-- GstWlDisplay *display;
--
-- gboolean used_by_compositor;
--};
--
--struct _GstWlBufferClass
--{
-- GObjectClass parent_class;
--};
--
--GType gst_wl_buffer_get_type (void);
--
--GstWlBuffer * gst_buffer_add_wl_buffer (GstBuffer * gstbuffer,
-- struct wl_buffer * wlbuffer, GstWlDisplay * display);
--GstWlBuffer * gst_buffer_get_wl_buffer (GstBuffer * gstbuffer);
--
--void gst_wl_buffer_force_release_and_unref (GstWlBuffer * self);
--
--void gst_wl_buffer_attach (GstWlBuffer * self, struct wl_surface *surface);
--
--G_END_DECLS
--
--#endif /* __GST_WL_BUFFER_H__ */
-diff --git a/ext/wayland/wldisplay-wlwindow-wlbuffer.h b/ext/wayland/wldisplay-wlwindow-wlbuffer.h
-new file mode 100644
-index 0000000..face05f
---- /dev/null
-+++ b/ext/wayland/wldisplay-wlwindow-wlbuffer.h
-@@ -0,0 +1,243 @@
-+/* GStreamer Wayland video sink
-+ *
-+ * Copyright (C) 2014 Collabora Ltd.
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Library General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Library General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Library General Public
-+ * License along with this library; if not, write to the Free
-+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-+ * Boston, MA 02110-1301 USA.
-+ */
-+
-+#ifndef __GST_WL_DISPLAY_H__
-+#define __GST_WL_DISPLAY_H__
-+
-+#include <gst/gst.h>
-+#include <stdlib.h>
-+#include <stdio.h>
-+#include <gst/video/video.h>
-+#include <gst/gstbuffer.h>
-+#include <gst/drm/gstdrmallocator.h>
-+#include <wayland-client.h>
-+#include "xdg-shell-client-protocol.h"
-+#include "viewporter-client-protocol.h"
-+#include "linux-dmabuf-unstable-v1-client-protocol.h"
-+#include "fullscreen-shell-unstable-v1-client-protocol.h"
-+
-+G_BEGIN_DECLS
-+
-+#define GST_TYPE_WL_BUFFER (gst_wl_buffer_get_type ())
-+#define GST_WL_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_BUFFER, GstWlBuffer))
-+#define GST_IS_WL_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_BUFFER))
-+#define GST_WL_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_BUFFER, GstWlBufferClass))
-+#define GST_IS_WL_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_BUFFER))
-+#define GST_WL_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_BUFFER, GstWlBufferClass))
-+
-+
-+#define GST_TYPE_WL_WINDOW (gst_wl_window_get_type ())
-+#define GST_WL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_WINDOW, GstWlWindow))
-+#define GST_IS_WL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_WINDOW))
-+#define GST_WL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_WINDOW, GstWlWindowClass))
-+#define GST_IS_WL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_WINDOW))
-+#define GST_WL_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_WINDOW, GstWlWindowClass))
-+
-+
-+#define GST_TYPE_WL_DISPLAY (gst_wl_display_get_type ())
-+#define GST_WL_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_DISPLAY, GstWlDisplay))
-+#define GST_IS_WL_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_DISPLAY))
-+#define GST_WL_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_DISPLAY, GstWlDisplayClass))
-+#define GST_IS_WL_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_DISPLAY))
-+#define GST_WL_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_DISPLAY, GstWlDisplayClass))
-+
-+typedef struct _GstWlBuffer GstWlBuffer;
-+typedef struct _GstWlBufferClass GstWlBufferClass;
-+
-+typedef struct _GstWlWindow GstWlWindow;
-+typedef struct _GstWlWindowClass GstWlWindowClass;
-+
-+typedef struct _GstWlDisplay GstWlDisplay;
-+typedef struct _GstWlDisplayClass GstWlDisplayClass;
-+
-+struct _GstWlBuffer
-+{
-+ GObject parent_instance;
-+
-+ struct wl_buffer * wlbuffer;
-+ GstBuffer *gstbuffer;
-+
-+ GstWlDisplay *display;
-+
-+ gboolean used_by_compositor;
-+};
-+
-+struct _GstWlBufferClass
-+{
-+ GObjectClass parent_class;
-+};
-+
-+GType gst_wl_buffer_get_type (void);
-+
-+GstWlBuffer * gst_buffer_add_wl_buffer (GstBuffer * gstbuffer,
-+ struct wl_buffer * wlbuffer, GstWlDisplay * display);
-+GstWlBuffer * gst_buffer_get_wl_buffer (GstBuffer * gstbuffer);
-+
-+void gst_wl_buffer_force_release_and_unref (GstWlBuffer * self);
-+
-+void gst_wl_buffer_attach (GstWlBuffer * self, struct wl_surface *surface);
-+
-+
-+struct _GstWlWindow
-+{
-+ GObject parent_instance;
-+
-+ GMutex *render_lock;
-+
-+ GstWlDisplay *display;
-+ struct wl_surface *area_surface;
-+ struct wl_surface *area_surface_wrapper;
-+ struct wl_subsurface *area_subsurface;
-+ struct wp_viewport *area_viewport;
-+ struct wl_surface *video_surface;
-+ struct wl_surface *video_surface_wrapper;
-+ struct wl_subsurface *video_subsurface;
-+ struct wp_viewport *video_viewport;
-+ struct wl_shell_surface *wl_shell_surface;
-+ struct xdg_surface *xdg_surface;
-+ struct xdg_toplevel *xdg_toplevel;
-+ gboolean configured;
-+ GCond configure_cond;
-+ GMutex configure_mutex;
-+
-+ /* the size and position of the area_(sub)surface */
-+ GstVideoRectangle render_rectangle;
-+
-+ /* the size and position of the video_subsurface */
-+ GstVideoRectangle video_rectangle;
-+
-+ /* the size of the video in the buffers */
-+ gint video_width, video_height;
-+
-+ /* this will be set when viewporter is available and black background has
-+ * already been set on the area_subsurface */
-+ gboolean no_border_update;
-+
-+};
-+
-+struct _GstWlWindowClass
-+{
-+ GObjectClass parent_class;
-+};
-+
-+GType gst_wl_window_get_type (void);
-+void gst_wl_window_ensure_fullscreen (GstWlWindow * window,
-+ gboolean fullscreen);
-+
-+GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display,
-+ const GstVideoInfo * info, gboolean fullscreen, GMutex * render_lock);
-+GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display,
-+ struct wl_surface * parent, GMutex * render_lock);
-+
-+GstWlDisplay *gst_wl_window_get_display (GstWlWindow * window);
-+struct wl_surface *gst_wl_window_get_wl_surface (GstWlWindow * window);
-+gboolean gst_wl_window_is_toplevel (GstWlWindow *window);
-+
-+void gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer,
-+ const GstVideoInfo * info);
-+void gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
-+ gint w, gint h);
-+
-+struct touch_point
-+{
-+ int32_t id;
-+ struct wl_list link;
-+};
-+
-+struct input
-+{
-+ GstWlDisplay *display;
-+ struct wl_seat *seat;
-+ struct wl_pointer *pointer;
-+ struct wl_touch *touch;
-+ struct wl_list touch_point_list;
-+ GstWlWindow *pointer_focus;
-+ GstWlWindow *touch_focus;
-+ struct wl_list link;
-+ GstWlWindow *grab;
-+};
-+
-+struct _GstWlDisplay
-+{
-+ GObject parent_instance;
-+
-+ /* public objects */
-+ struct wl_display *display;
-+ struct wl_display *display_wrapper;
-+ struct wl_event_queue *queue;
-+
-+ /* globals */
-+ struct wl_registry *registry;
-+ struct wl_compositor *compositor;
-+ struct wl_subcompositor *subcompositor;
-+ struct wl_shell *wl_shell;
-+ struct xdg_wm_base *xdg_wm_base;
-+ struct zwp_fullscreen_shell_v1 *fullscreen_shell;
-+ struct wl_shm *shm;
-+ struct wl_drm *drm;
-+ struct wp_viewporter *viewporter;
-+ struct zwp_linux_dmabuf_v1 *dmabuf;
-+ GArray *shm_formats;
-+ GArray *dmabuf_formats;
-+ GArray *drm_formats;
-+
-+ /* private */
-+ gboolean own_display;
-+ GThread *thread;
-+ GstPoll *wl_fd_poll;
-+
-+ GMutex buffers_mutex;
-+ GHashTable *buffers;
-+ gboolean shutting_down;
-+
-+ int fd;
-+ int authenticated;
-+ gboolean use_drm;
-+ gint scale_width, scale_height;
-+ GstVideoCropMeta *crop;
-+
-+ struct wl_list input_list;
-+ int seat_version;
-+ uint32_t serial;
-+};
-+
-+struct _GstWlDisplayClass
-+{
-+ GObjectClass parent_class;
-+};
-+
-+GType gst_wl_display_get_type (void);
-+
-+GstWlDisplay *gst_wl_display_new (const gchar * name, GError ** error);
-+GstWlDisplay *gst_wl_display_new_existing (struct wl_display * display,
-+ gboolean take_ownership, GError ** error);
-+
-+/* see wlbuffer.c for explanation */
-+void gst_wl_display_register_buffer (GstWlDisplay * self, gpointer buf);
-+void gst_wl_display_unregister_buffer (GstWlDisplay * self, gpointer buf);
-+
-+gboolean gst_wl_display_check_format_for_shm (GstWlDisplay * display,
-+ GstVideoFormat format);
-+gboolean gst_wl_display_check_format_for_dmabuf (GstWlDisplay * display,
-+ GstVideoFormat format);
-+
-+G_END_DECLS
-+
-+#endif /* __GST_WL_DISPLAY_H__ */
-diff --git a/ext/wayland/wldisplay.c b/ext/wayland/wldisplay.c
-index 363e817..7ae952c 100644
---- a/ext/wayland/wldisplay.c
-+++ b/ext/wayland/wldisplay.c
-@@ -22,14 +22,15 @@
- #include <config.h>
- #endif
-
--#include "wldisplay.h"
--#include "wlbuffer.h"
-+#include "wldisplay-wlwindow-wlbuffer.h"
- #include "wlvideoformat.h"
-
- #include "wayland-drm-client-protocol.h"
-+#include <linux/input.h>
- #include <fcntl.h>
- #include <xf86drm.h>
- #include <xf86drmMode.h>
-+#include <unistd.h>
- #include <errno.h>
-
- GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug);
-@@ -58,6 +59,53 @@ gst_wl_display_init (GstWlDisplay * self)
- self->use_drm = FALSE;
- g_mutex_init (&self->buffers_mutex);
- }
-+static void
-+input_grab (struct input *input, GstWlWindow *window)
-+{
-+ input->grab = window;
-+}
-+
-+static void
-+input_ungrab (struct input *input)
-+{
-+ input->grab = NULL;
-+}
-+
-+static void
-+input_remove_pointer_focus (struct input *input)
-+{
-+ GstWlWindow *window = input->pointer_focus;
-+
-+ if (!window)
-+ return;
-+
-+ input->pointer_focus = NULL;
-+}
-+
-+static void
-+input_destroy (struct input *input)
-+{
-+ input_remove_pointer_focus (input);
-+
-+ if (input->display->seat_version >= 3) {
-+ if (input->pointer)
-+ wl_pointer_release (input->pointer);
-+ }
-+
-+ wl_list_remove (&input->link);
-+ wl_seat_destroy (input->seat);
-+ free (input);
-+}
-+
-+static void
-+display_destroy_inputs (GstWlDisplay *display)
-+{
-+ struct input *tmp;
-+ struct input *input;
-+
-+ wl_list_for_each_safe (input, tmp, &display->input_list, link)
-+ input_destroy (input);
-+}
-
- static void
- gst_wl_display_finalize (GObject * gobject)
-@@ -86,6 +134,8 @@ gst_wl_display_finalize (GObject * gobject)
- g_hash_table_unref (self->buffers);
- g_mutex_clear (&self->buffers_mutex);
-
-+ display_destroy_inputs (self);
-+
- if(self->fd != -1)
- close(self->fd);
-
-@@ -252,6 +302,240 @@ static const struct wl_drm_listener drm_listener = {
- drm_handle_authenticated
- };
-
-+ static void
-+pointer_handle_enter (void *data, struct wl_pointer *pointer,
-+ uint32_t serial, struct wl_surface *surface,
-+ wl_fixed_t sx_w, wl_fixed_t sy_w)
-+{
-+ struct input *input = data;
-+
-+ if (!surface) {
-+ /* enter event for a window we've just destroyed */
-+ return;
-+ }
-+
-+ input->display->serial = serial;
-+ input->pointer_focus = wl_surface_get_user_data (surface);
-+}
-+
-+static void
-+pointer_handle_leave (void *data, struct wl_pointer *pointer,
-+ uint32_t serial, struct wl_surface *surface)
-+{
-+ struct input *input = data;
-+
-+ input_remove_pointer_focus (input);
-+}
-+
-+static void
-+pointer_handle_motion (void *data, struct wl_pointer *pointer,
-+ uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w)
-+{
-+ struct input *input = data;
-+ GstWlWindow *window = input->pointer_focus;
-+
-+ if (!window)
-+ return;
-+
-+ if (input->grab)
-+ wl_shell_surface_move (input->grab->wl_shell_surface, input->seat,
-+ input->display->serial);
-+
-+}
-+
-+static void
-+pointer_handle_button (void *data, struct wl_pointer *pointer, uint32_t serial,
-+ uint32_t time, uint32_t button, uint32_t state_w)
-+{
-+ struct input *input = data;
-+ enum wl_pointer_button_state state = state_w;
-+ input->display->serial = serial;
-+
-+ if (button == BTN_LEFT) {
-+ if (state == WL_POINTER_BUTTON_STATE_PRESSED)
-+ input_grab (input, input->pointer_focus);
-+
-+ if (input->grab && state == WL_POINTER_BUTTON_STATE_RELEASED)
-+ input_ungrab (input);
-+ }
-+
-+ if (input->grab)
-+ wl_shell_surface_move (input->grab->wl_shell_surface, input->seat,
-+ input->display->serial);
-+}
-+
-+static void
-+pointer_handle_axis (void *data, struct wl_pointer *pointer,
-+ uint32_t time, uint32_t axis, wl_fixed_t value)
-+{
-+}
-+
-+static void pointer_frame(void *data, struct wl_pointer *wl_pointer)
-+{
-+}
-+static void pointer_axis_source(void *data, struct wl_pointer *wl_pointer, uint32_t axis_source)
-+{
-+}
-+static void pointer_axis_stop(void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis)
-+{
-+}
-+
-+static const struct wl_pointer_listener pointer_listener = {
-+ pointer_handle_enter,
-+ pointer_handle_leave,
-+ pointer_handle_motion,
-+ pointer_handle_button,
-+ pointer_handle_axis,
-+ pointer_frame,
-+ pointer_axis_source,
-+ pointer_axis_stop
-+};
-+
-+static void
-+touch_handle_down (void *data, struct wl_touch *wl_touch,
-+ uint32_t serial, uint32_t time, struct wl_surface *surface,
-+ int32_t id, wl_fixed_t x_w, wl_fixed_t y_w)
-+{
-+ struct input *input = data;
-+ struct touch_point *tp;
-+
-+ input->display->serial = serial;
-+ input->touch_focus = wl_surface_get_user_data (surface);
-+ if (!input->touch_focus) {
-+ return;
-+ }
-+
-+ tp = malloc (sizeof *tp);
-+ if (tp) {
-+ tp->id = id;
-+ wl_list_insert (&input->touch_point_list, &tp->link);
-+ wl_shell_surface_move (input->touch_focus->wl_shell_surface, input->seat,
-+ serial);
-+ }
-+}
-+
-+static void
-+touch_handle_motion (void *data, struct wl_touch *wl_touch,
-+ uint32_t time, int32_t id, wl_fixed_t x_w, wl_fixed_t y_w)
-+{
-+ struct input *input = data;
-+ struct touch_point *tp;
-+
-+
-+ if (!input->touch_focus) {
-+ return;
-+ }
-+ wl_list_for_each (tp, &input->touch_point_list, link) {
-+ if (tp->id != id)
-+ continue;
-+
-+ wl_shell_surface_move (input->touch_focus->wl_shell_surface, input->seat,
-+ input->display->serial);
-+
-+ return;
-+ }
-+}
-+
-+static void
-+touch_handle_frame (void *data, struct wl_touch *wl_touch)
-+{
-+}
-+
-+static void
-+touch_handle_cancel (void *data, struct wl_touch *wl_touch)
-+{
-+}
-+
-+static void
-+touch_handle_up (void *data, struct wl_touch *wl_touch,
-+ uint32_t serial, uint32_t time, int32_t id)
-+{
-+ struct input *input = data;
-+ struct touch_point *tp, *tmp;
-+
-+ if (!input->touch_focus) {
-+ return;
-+ }
-+
-+ wl_list_for_each_safe (tp, tmp, &input->touch_point_list, link) {
-+ if (tp->id != id)
-+ continue;
-+
-+ wl_list_remove (&tp->link);
-+ free (tp);
-+
-+ return;
-+ }
-+}
-+
-+static const struct wl_touch_listener touch_listener = {
-+ touch_handle_down,
-+ touch_handle_up,
-+ touch_handle_motion,
-+ touch_handle_frame,
-+ touch_handle_cancel,
-+};
-+
-+static void
-+seat_handle_capabilities (void *data, struct wl_seat *seat,
-+ enum wl_seat_capability caps)
-+{
-+ struct input *input = data;
-+
-+ if ((caps & WL_SEAT_CAPABILITY_POINTER) && !input->pointer) {
-+ input->pointer = wl_seat_get_pointer (seat);
-+ wl_pointer_set_user_data (input->pointer, input);
-+ wl_pointer_add_listener (input->pointer, &pointer_listener, input);
-+ } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) {
-+ wl_pointer_destroy (input->pointer);
-+ input->pointer = NULL;
-+ }
-+
-+ if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) {
-+ input->touch = wl_seat_get_touch (seat);
-+ wl_touch_set_user_data (input->touch, input);
-+ wl_touch_add_listener (input->touch, &touch_listener, input);
-+ } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) {
-+ wl_touch_destroy (input->touch);
-+ input->touch = NULL;
-+ }
-+}
-+
-+static void
-+seat_handle_name (void *data, struct wl_seat *seat, const char *name)
-+{
-+
-+}
-+
-+static const struct wl_seat_listener seat_listener = {
-+ seat_handle_capabilities,
-+ seat_handle_name
-+};
-+
-+static void
-+display_add_input (GstWlDisplay *d, uint32_t id)
-+{
-+ struct input *input;
-+
-+ input = calloc (1, sizeof (*input));
-+ if (input == NULL) {
-+ fprintf (stderr, "%s: out of memory\n", "gst-wayland-sink");
-+ exit (EXIT_FAILURE);
-+ }
-+ input->display = d;
-+ input->seat = wl_registry_bind (d->registry, id, &wl_seat_interface,
-+ MAX (d->seat_version, 3));
-+ input->touch_focus = NULL;
-+ input->pointer_focus = NULL;
-+ wl_list_init (&input->touch_point_list);
-+ wl_list_insert (d->input_list.prev, &input->link);
-+
-+ wl_seat_add_listener (input->seat, &seat_listener, input);
-+ wl_seat_set_user_data (input->seat, input);
-+
-+}
-+
-+
- static void
- registry_handle_global (void *data, struct wl_registry *registry,
- uint32_t id, const char *interface, uint32_t version)
-@@ -279,6 +563,9 @@ registry_handle_global (void *data, struct wl_registry *registry,
- } else if (g_strcmp0 (interface, "wl_drm") == 0) {
- self->drm = wl_registry_bind (registry, id, &wl_drm_interface, 1);
- wl_drm_add_listener (self->drm, &drm_listener, self);
-+ } else if (g_strcmp0 (interface, "wl_seat") == 0) {
-+ self->seat_version = version;
-+ display_add_input (self, id);
- } else if (g_strcmp0 (interface, "wp_viewporter") == 0) {
- self->viewporter =
- wl_registry_bind (registry, id, &wp_viewporter_interface, 1);
-@@ -361,6 +648,7 @@ gst_wl_display_new_existing (struct wl_display * display,
- self->display_wrapper = wl_proxy_create_wrapper (display);
- self->own_display = take_ownership;
-
-+ wl_list_init (&self->input_list);
- self->queue = wl_display_create_queue (self->display);
- wl_proxy_set_queue ((struct wl_proxy *) self->display_wrapper, self->queue);
- self->registry = wl_display_get_registry (self->display_wrapper);
-diff --git a/ext/wayland/wldisplay.h b/ext/wayland/wldisplay.h
-deleted file mode 100644
-index 81e96bc..0000000
---- a/ext/wayland/wldisplay.h
-+++ /dev/null
-@@ -1,107 +0,0 @@
--/* GStreamer Wayland video sink
-- *
-- * Copyright (C) 2014 Collabora Ltd.
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the Free
-- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-- * Boston, MA 02110-1301 USA.
-- */
--
--#ifndef __GST_WL_DISPLAY_H__
--#define __GST_WL_DISPLAY_H__
--
--#include <gst/gst.h>
--#include <gst/video/video.h>
--#include <wayland-client.h>
--#include "xdg-shell-client-protocol.h"
--#include "viewporter-client-protocol.h"
--#include "linux-dmabuf-unstable-v1-client-protocol.h"
--#include "fullscreen-shell-unstable-v1-client-protocol.h"
--
--G_BEGIN_DECLS
--
--#define GST_TYPE_WL_DISPLAY (gst_wl_display_get_type ())
--#define GST_WL_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_DISPLAY, GstWlDisplay))
--#define GST_IS_WL_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_DISPLAY))
--#define GST_WL_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_DISPLAY, GstWlDisplayClass))
--#define GST_IS_WL_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_DISPLAY))
--#define GST_WL_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_DISPLAY, GstWlDisplayClass))
--
--typedef struct _GstWlDisplay GstWlDisplay;
--typedef struct _GstWlDisplayClass GstWlDisplayClass;
--
--struct _GstWlDisplay
--{
-- GObject parent_instance;
--
-- /* public objects */
-- struct wl_display *display;
-- struct wl_display *display_wrapper;
-- struct wl_event_queue *queue;
--
-- /* globals */
-- struct wl_registry *registry;
-- struct wl_compositor *compositor;
-- struct wl_subcompositor *subcompositor;
-- struct wl_shell *wl_shell;
-- struct xdg_wm_base *xdg_wm_base;
-- struct zwp_fullscreen_shell_v1 *fullscreen_shell;
-- struct wl_shm *shm;
-- struct wl_drm *drm;
-- struct wp_viewporter *viewporter;
-- struct zwp_linux_dmabuf_v1 *dmabuf;
-- GArray *shm_formats;
-- GArray *drm_formats;
-- GArray *dmabuf_formats;
--
-- /* private */
-- gboolean own_display;
-- GThread *thread;
-- GstPoll *wl_fd_poll;
--
-- GMutex buffers_mutex;
-- GHashTable *buffers;
-- gboolean shutting_down;
--
-- int fd;
-- int authenticated;
-- gboolean use_drm;
-- gint scale_width, scale_height;
-- GstVideoCropMeta *crop;
--
--};
--
--struct _GstWlDisplayClass
--{
-- GObjectClass parent_class;
--};
--
--GType gst_wl_display_get_type (void);
--
--GstWlDisplay *gst_wl_display_new (const gchar * name, GError ** error);
--GstWlDisplay *gst_wl_display_new_existing (struct wl_display * display,
-- gboolean take_ownership, GError ** error);
--
--/* see wlbuffer.c for explanation */
--void gst_wl_display_register_buffer (GstWlDisplay * self, gpointer buf);
--void gst_wl_display_unregister_buffer (GstWlDisplay * self, gpointer buf);
--
--gboolean gst_wl_display_check_format_for_shm (GstWlDisplay * display,
-- GstVideoFormat format);
--gboolean gst_wl_display_check_format_for_dmabuf (GstWlDisplay * display,
-- GstVideoFormat format);
--
--G_END_DECLS
--
--#endif /* __GST_WL_DISPLAY_H__ */
-diff --git a/ext/wayland/wldrm.c b/ext/wayland/wldrm.c
-index 0da9b73..0b72896 100644
---- a/ext/wayland/wldrm.c
-+++ b/ext/wayland/wldrm.c
-@@ -1,4 +1,4 @@
--#include "wldisplay.h"
-+#include "wldisplay-wlwindow-wlbuffer.h"
- #include <gst/drm/gstdrmallocator.h>
- #include "wayland-drm-client-protocol.h"
- #include <wayland-client.h>
-diff --git a/ext/wayland/wlshmallocator.h b/ext/wayland/wlshmallocator.h
-index 07ae17f..2860fc3 100644
---- a/ext/wayland/wlshmallocator.h
-+++ b/ext/wayland/wlshmallocator.h
-@@ -26,7 +26,7 @@
- #include <gst/video/video.h>
- #include <gst/allocators/allocators.h>
- #include <wayland-client-protocol.h>
--#include "wldisplay.h"
-+#include "wldisplay-wlwindow-wlbuffer.h"
-
- G_BEGIN_DECLS
-
-diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c
-index b184dfc..2c768f2 100644
---- a/ext/wayland/wlwindow.c
-+++ b/ext/wayland/wlwindow.c
-@@ -24,9 +24,9 @@
- #include <config.h>
- #endif
-
--#include "wlwindow.h"
- #include "wlshmallocator.h"
--#include "wlbuffer.h"
-+#include "wldisplay-wlwindow-wlbuffer.h"
-+#include "wldrm.h"
-
- GST_DEBUG_CATEGORY_EXTERN (gstwayland_debug);
- #define GST_CAT_DEFAULT gstwayland_debug
-@@ -199,6 +199,9 @@ gst_wl_window_new_internal (GstWlDisplay * display, GMutex * render_lock)
- window->area_surface = wl_compositor_create_surface (display->compositor);
- window->video_surface = wl_compositor_create_surface (display->compositor);
-
-+ wl_surface_set_user_data (window->area_surface, window);
-+ wl_surface_set_user_data (window->video_surface, window);
-+
- window->area_surface_wrapper = wl_proxy_create_wrapper (window->area_surface);
- window->video_surface_wrapper =
- wl_proxy_create_wrapper (window->video_surface);
-diff --git a/ext/wayland/wlwindow.h b/ext/wayland/wlwindow.h
-deleted file mode 100644
-index c3f0172..0000000
---- a/ext/wayland/wlwindow.h
-+++ /dev/null
-@@ -1,102 +0,0 @@
--/* GStreamer Wayland video sink
-- *
-- * Copyright (C) 2014 Collabora Ltd.
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the Free
-- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-- * Boston, MA 02110-1301 USA.
-- */
--
--#ifndef __GST_WL_WINDOW_H__
--#define __GST_WL_WINDOW_H__
--
--#include "wldisplay.h"
--#include "wlbuffer.h"
--#include <gst/video/video.h>
--
--G_BEGIN_DECLS
--
--#define GST_TYPE_WL_WINDOW (gst_wl_window_get_type ())
--#define GST_WL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_WINDOW, GstWlWindow))
--#define GST_IS_WL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_WINDOW))
--#define GST_WL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_WINDOW, GstWlWindowClass))
--#define GST_IS_WL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_WINDOW))
--#define GST_WL_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_WINDOW, GstWlWindowClass))
--
--typedef struct _GstWlWindow GstWlWindow;
--typedef struct _GstWlWindowClass GstWlWindowClass;
--
--struct _GstWlWindow
--{
-- GObject parent_instance;
--
-- GMutex *render_lock;
--
-- GstWlDisplay *display;
-- struct wl_surface *area_surface;
-- struct wl_surface *area_surface_wrapper;
-- struct wl_subsurface *area_subsurface;
-- struct wp_viewport *area_viewport;
-- struct wl_surface *video_surface;
-- struct wl_surface *video_surface_wrapper;
-- struct wl_subsurface *video_subsurface;
-- struct wp_viewport *video_viewport;
-- struct wl_shell_surface *wl_shell_surface;
-- struct xdg_surface *xdg_surface;
-- struct xdg_toplevel *xdg_toplevel;
-- gboolean configured;
-- GCond configure_cond;
-- GMutex configure_mutex;
--
-- /* the size and position of the area_(sub)surface */
-- GstVideoRectangle render_rectangle;
--
-- /* the size and position of the video_subsurface */
-- GstVideoRectangle video_rectangle;
--
-- /* the size of the video in the buffers */
-- gint video_width, video_height;
--
-- /* this will be set when viewporter is available and black background has
-- * already been set on the area_subsurface */
-- gboolean no_border_update;
--
--};
--
--struct _GstWlWindowClass
--{
-- GObjectClass parent_class;
--};
--
--GType gst_wl_window_get_type (void);
--
--void gst_wl_window_ensure_fullscreen (GstWlWindow * window,
-- gboolean fullscreen);
--GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display,
-- const GstVideoInfo * info, gboolean fullscreen, GMutex * render_lock);
--GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display,
-- struct wl_surface * parent, GMutex * render_lock);
--
--GstWlDisplay *gst_wl_window_get_display (GstWlWindow * window);
--struct wl_surface *gst_wl_window_get_wl_surface (GstWlWindow * window);
--gboolean gst_wl_window_is_toplevel (GstWlWindow *window);
--
--void gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer,
-- const GstVideoInfo * info);
--void gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
-- gint w, gint h);
--
--G_END_DECLS
--
--#endif /* __GST_WL_WINDOW_H__ */
-1.9.1
-
deleted file mode 100644
@@ -1,37 +0,0 @@
-FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
-
-PACKAGECONFIG:append = " faad kms"
-
-GSTDRM_WAYLANDSINK_PATCHES = " \
- file://0001-gstdrmallocator-Add-DRM-allocator-support.patch \
- file://0002-parsers-bug-fixes-on-parsers.patch \
- file://0003-kmssink-Add-omapdrm-and-tidss-in-the-list-of-drivers.patch \
- file://0004-waylandsink-Add-drm-support-in-waylandsink.patch \
- file://0005-waylandsink-Add-input-device-support.patch \
- file://0001-wayland-drm-kms-add-support-for-meson-build-system.patch \
- file://0001-gstdrm-Remove-wayland-as-required-dependency.patch \
-"
-
-SRC_URI:append:ti43x = " \
- ${GSTDRM_WAYLANDSINK_PATCHES} \
-"
-
-SRC_URI:append:ti33x = " \
- file://0001-waylandsink-Add-mouse-drag-and-drop-support.patch \
-"
-
-SRC_URI:append:omap-a15 = " \
- ${GSTDRM_WAYLANDSINK_PATCHES} \
-"
-
-SRC_URI:append:am65xx = " \
- ${GSTDRM_WAYLANDSINK_PATCHES} \
-"
-
-SRC_URI:append:j721e = " \
- ${GSTDRM_WAYLANDSINK_PATCHES} \
-"
-
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-
-PR:append = ".arago4"
deleted file mode 100644
@@ -1,61 +0,0 @@
-From ab95684623120c3f1a95b9030109bb6afe2280f5 Mon Sep 17 00:00:00 2001
-From: Angela Stegmaier <angelabaker@ti.com>
-Date: Tue, 20 Aug 2019 15:59:02 -0500
-Subject: [PATCH] v4l2object: Update formats table to include YUV422
- multiplanar
-
-YUV422 multiplanar is missing from the table. Add the support
-for this format.
-
-Upstream-Status: Pending
-
-Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
-
----
- sys/v4l2/gstv4l2object.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
-index 6fd3080..2d401a7 100644
---- a/sys/v4l2/gstv4l2object.c
-+++ b/sys/v4l2/gstv4l2object.c
-@@ -130,6 +130,7 @@ static const GstV4L2FormatDesc gst_v4l2_formats[] = {
- {V4L2_PIX_FMT_UYVY, TRUE, GST_V4L2_RAW},
- {V4L2_PIX_FMT_VYUY, TRUE, GST_V4L2_RAW},
- {V4L2_PIX_FMT_YUV422P, TRUE, GST_V4L2_RAW},
-+ {V4L2_PIX_FMT_YUV422M, TRUE, GST_V4L2_RAW},
- {V4L2_PIX_FMT_YUV411P, TRUE, GST_V4L2_RAW},
- {V4L2_PIX_FMT_Y41P, TRUE, GST_V4L2_RAW},
- {V4L2_PIX_FMT_YUV444, TRUE, GST_V4L2_RAW},
-@@ -1090,6 +1091,7 @@ gst_v4l2_object_format_get_rank (const struct v4l2_fmtdesc *fmt)
- rank = YUV_BASE_RANK + 4;
- break;
- case V4L2_PIX_FMT_YUV422P: /* Y42B, 16 bits per pixel */
-+ case V4L2_PIX_FMT_YUV422M:
- rank = YUV_BASE_RANK + 8;
- break;
-
-@@ -1345,6 +1347,7 @@ gst_v4l2_object_v4l2fourcc_to_video_format (guint32 fourcc)
- format = GST_VIDEO_FORMAT_Y41B;
- break;
- case V4L2_PIX_FMT_YUV422P:
-+ case V4L2_PIX_FMT_YUV422M:
- format = GST_VIDEO_FORMAT_Y42B;
- break;
- case V4L2_PIX_FMT_YVYU:
-@@ -1493,6 +1496,7 @@ gst_v4l2_object_v4l2fourcc_to_bare_struct (guint32 fourcc)
- case V4L2_PIX_FMT_YVU420:
- case V4L2_PIX_FMT_UYVY:
- case V4L2_PIX_FMT_YUV422P:
-+ case V4L2_PIX_FMT_YUV422M:
- case V4L2_PIX_FMT_YVYU:
- case V4L2_PIX_FMT_YUV411P:{
- GstVideoFormat format;
-@@ -1723,6 +1727,7 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps,
- break;
- case GST_VIDEO_FORMAT_Y42B:
- fourcc = V4L2_PIX_FMT_YUV422P;
-+ fourcc_nc = V4L2_PIX_FMT_YUV422M;
- break;
- case GST_VIDEO_FORMAT_NV12:
- fourcc = V4L2_PIX_FMT_NV12;
deleted file mode 100644
@@ -1,33 +0,0 @@
-From 6cd7e4a3647b6000c03db008e9dc06a7dc52e875 Mon Sep 17 00:00:00 2001
-From: Ramprasad N <x0038811@ti.com>
-Date: Fri, 21 Feb 2020 12:07:05 +0530
-Subject: [PATCH] v4l2src: Check for drm memory support in try_import
-
-In Gstreamer 1.16.1, if buffer pool is from a downstream
-element, v4l2 first tries to import.
-
-Check if the memory type is DRM memory.
-
-Signed-off-by: Ramprasad N <x0038811@ti.com>
----
- sys/v4l2/gstv4l2object.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
-index 2d401a7..5143e2c 100644
---- a/sys/v4l2/gstv4l2object.c
-+++ b/sys/v4l2/gstv4l2object.c
-@@ -4768,7 +4768,9 @@ gst_v4l2_object_try_import (GstV4l2Object * obj, GstBuffer * buffer)
- for (i = 0; i < n_mem; i++) {
- GstMemory *mem = gst_buffer_peek_memory (buffer, i);
-
-- if (!gst_is_dmabuf_memory (mem)) {
-+ if (!gst_is_dmabuf_memory (mem) &&
-+ !gst_memory_is_type (mem, GST_ALLOCATOR_DMABUF)) {
-+
- GST_DEBUG_OBJECT (obj->dbg_obj, "Cannot import non-DMABuf memory.");
- return FALSE;
- }
-1.9.1
-
deleted file mode 100644
@@ -1,29 +0,0 @@
-From d53f20877fb916e31fc1ecbfdc74bcd09b8481e1 Mon Sep 17 00:00:00 2001
-From: Ramprasad N <x0038811@ti.com>
-Date: Mon, 28 Jan 2019 13:19:30 +0530
-Subject: [PATCH 1/2] v4l2src: Increase minimum num buffers by 3
-
-v4l2src plugin allocates 5 buffers for the pipeline.
-To capture video in realtime the pipeline without frameloss,
-four buffers are not sufficient. Increase the
-number of buffers by 3 more.
-
-Signed-off-by: Ramprasad N <x0038811@ti.com>
-
----
- sys/v4l2/gstv4l2object.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
-index dad426a..6fd3080 100644
---- a/sys/v4l2/gstv4l2object.c
-+++ b/sys/v4l2/gstv4l2object.c
-@@ -4399,7 +4399,7 @@ gst_v4l2_object_decide_allocation (GstV4l2Object * obj, GstQuery * query)
- * held by the decoder. We account 2 buffers for v4l2 so when one is being
- * pushed downstream the other one can already be queued for the next
- * frame. */
-- own_min = min + obj->min_buffers + 2;
-+ own_min = min + obj->min_buffers + 5;
-
- /* If no allocation parameters where provided, allow for a little more
- * buffers and enable copy threshold */
deleted file mode 100644
@@ -1,43 +0,0 @@
-From deaff8caeff753e27bcc796cf4a7d0ad7f324986 Mon Sep 17 00:00:00 2001
-From: Ramprasad N <x0038811@ti.com>
-Date: Thu, 22 Mar 2018 12:02:59 +0530
-Subject: [PATCH 2/2] v4l2src: Use generic dmabuf import in v4l2src
-
-In Gstreamer 1.12.2 dmabuf interpreation has got
-changed and it doesn't consider DRM Fds as dmabuf since
-they are not allocated from dmabuf allocator.
-Because of this dmabuf_import will fail for the usecase
-wher v4l2src imports drm buffers allocated from ducati.
-
-With earlier Gstreamer versions, gst_mem_is_dmabuf()
-used to consider if mem_type is DMABUF or not.
-
-Since both dmabuf and drmallocator are derived from
-fdallocator, a generic fd mechanism is used in this patch.
-
-Signed-off-by: Ramprasad N <x0038811@ti.com>
-
----
- sys/v4l2/gstv4l2allocator.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/sys/v4l2/gstv4l2allocator.c b/sys/v4l2/gstv4l2allocator.c
-index 05bde3d..e468e3e 100644
---- a/sys/v4l2/gstv4l2allocator.c
-+++ b/sys/v4l2/gstv4l2allocator.c
-@@ -1102,12 +1102,13 @@ gst_v4l2_allocator_import_dmabuf (GstV4l2Allocator * allocator,
- gint dmafd;
- gsize size, offset, maxsize;
-
-- if (!gst_is_dmabuf_memory (dma_mem[i]))
-+ if (!gst_is_dmabuf_memory (dma_mem[i]) &&
-+ !gst_memory_is_type (dma_mem[i], GST_ALLOCATOR_DMABUF))
- goto not_dmabuf;
-
- size = gst_memory_get_sizes (dma_mem[i], &offset, &maxsize);
-
-- dmafd = gst_dmabuf_memory_get_fd (dma_mem[i]);
-+ dmafd = gst_fd_memory_get_fd (dma_mem[i]);
-
- GST_LOG_OBJECT (allocator, "[%i] imported DMABUF as fd %i plane %d",
- group->buffer.index, dmafd, i);
deleted file mode 100644
@@ -1,12 +0,0 @@
-FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
-
-PACKAGECONFIG:append = " qt5"
-
-SRC_URI += " \
- file://0001-v4l2src-Increase-minimum-num-buffers-by-3.patch \
- file://0002-v4l2src-Use-generic-dmabuf-import-in-v4l2src.patch \
- file://0001-v4l2object-Update-formats-table-to-include-YUV422-mu.patch \
- file://0001-v4l2src-Check-for-drm-memory-support-in-try_import.patch \
-"
-
-PR:append = ".arago3"
These files are no longer required for two reasons. Firstly, the DRM allocation patches for gstreamer-plugins-bad pertain to old platforms that are no longer going to be supported. Secondly, the patches to gstreamer-plugins-good are hacks that have been used on K3 platforms in previous releases to get functioning v4l2 drivers. The drivers have been updated to work with baseline gstreamer. Signed-off-by: Brandon Brnich <b-brnich@ti.com> --- ...emove-wayland-as-required-dependency.patch | 32 - ...mallocator-Add-DRM-allocator-support.patch | 469 -------- ...s-add-support-for-meson-build-system.patch | 140 --- ...sink-Add-mouse-drag-and-drop-support.patch | 426 ------- .../0002-parsers-bug-fixes-on-parsers.patch | 145 --- ...drm-and-tidss-in-the-list-of-drivers.patch | 160 --- ...dsink-Add-drm-support-in-waylandsink.patch | 703 ------------ ...waylandsink-Add-input-device-support.patch | 1022 ----------------- .../gstreamer1.0-plugins-bad_1.16.%.bbappend | 37 - ...e-formats-table-to-include-YUV422-mu.patch | 61 - ...for-drm-memory-support-in-try_import.patch | 33 - ...rc-Increase-minimum-num-buffers-by-3.patch | 29 - ...Use-generic-dmabuf-import-in-v4l2src.patch | 43 - .../gstreamer1.0-plugins-good_1.18.%.bbappend | 12 - 14 files changed, 3312 deletions(-) delete mode 100644 meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-gstdrm-Remove-wayland-as-required-dependency.patch delete mode 100644 meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-gstdrmallocator-Add-DRM-allocator-support.patch delete mode 100644 meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-wayland-drm-kms-add-support-for-meson-build-system.patch delete mode 100644 meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-waylandsink-Add-mouse-drag-and-drop-support.patch delete mode 100644 meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-parsers-bug-fixes-on-parsers.patch delete mode 100644 meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0003-kmssink-Add-omapdrm-and-tidss-in-the-list-of-drivers.patch delete mode 100644 meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0004-waylandsink-Add-drm-support-in-waylandsink.patch delete mode 100644 meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-waylandsink-Add-input-device-support.patch delete mode 100644 meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.16.%.bbappend delete mode 100644 meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0001-v4l2object-Update-formats-table-to-include-YUV422-mu.patch delete mode 100644 meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0001-v4l2src-Check-for-drm-memory-support-in-try_import.patch delete mode 100644 meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0001-v4l2src-Increase-minimum-num-buffers-by-3.patch delete mode 100644 meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0002-v4l2src-Use-generic-dmabuf-import-in-v4l2src.patch delete mode 100644 meta-arago-extras/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.18.%.bbappend