summaryrefslogtreecommitdiffstats
path: root/recipes-multimedia/onevpl/onevpl/0001-sample_misc-Addin-basic-wayland-dmabuf-support.patch
blob: 96110ef8911ad5d7ffb0250c42997dbe456b5d1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
From 2e2bcb1817f2dc91adf85f5255a4792a6213a74e Mon Sep 17 00:00:00 2001
From: "Ung, Teng En" <teng.en.ung@intel.com>
Date: Fri, 8 Oct 2021 14:19:40 +0000
Subject: [PATCH 2/3] sample_misc: Addin basic wayland dmabuf support.

Upstream-Status: Submitted
innersource PR #269

---
 .../sample_misc/wayland/include/class_wayland.h  | 16 ++++++++++++++++
 .../sample_misc/wayland/src/class_wayland.cpp    |  8 ++++++++
 2 files changed, 24 insertions(+)

diff --git a/tools/legacy/sample_misc/wayland/include/class_wayland.h b/tools/legacy/sample_misc/wayland/include/class_wayland.h
index 564b9b8b..e5267ec2 100644
--- a/tools/legacy/sample_misc/wayland/include/class_wayland.h
+++ b/tools/legacy/sample_misc/wayland/include/class_wayland.h
@@ -32,6 +32,9 @@ extern "C" {
     #include "sample_defs.h"
     #include "vpl/mfxstructures.h"
     #include "wayland-drm-client-protocol.h"
+#if defined(WAYLAND_LINUX_DMABUF_SUPPORT)
+    #include "linux-dmabuf-unstable-v1.h"
+#endif
 
 typedef struct buffer wld_buffer;
 
@@ -93,6 +96,11 @@ public:
     struct wl_drm* GetDrm() {
         return m_drm;
     }
+#if defined(WAYLAND_LINUX_DMABUF_SUPPORT)
+    struct zwp_linux_dmabuf_v1* GetDMABuf() {
+        return m_dmabuf;
+    }
+#endif
     struct wl_shm* GetShm() {
         return m_shm;
     };
@@ -120,6 +128,11 @@ public:
     void SetDrm(struct wl_drm* drm) {
         m_drm = drm;
     }
+#if defined(WAYLAND_LINUX_DMABUF_SUPPORT)
+    void SetDMABuf(struct zwp_linux_dmabuf_v1* dmabuf) {
+        m_dmabuf = dmabuf;
+    }
+#endif
     void DrmHandleDevice(const char* device);
     void DrmHandleAuthenticated();
     void RegistryGlobal(struct wl_registry* registry,
@@ -147,6 +160,9 @@ private:
     struct wl_compositor* m_compositor;
     struct wl_shell* m_shell;
     struct wl_drm* m_drm;
+#if defined(WAYLAND_LINUX_DMABUF_SUPPORT)
+    struct zwp_linux_dmabuf_v1* m_dmabuf;
+#endif
     struct wl_shm* m_shm;
     struct wl_shm_pool* m_pool;
     struct wl_surface* m_surface;
diff --git a/tools/legacy/sample_misc/wayland/src/class_wayland.cpp b/tools/legacy/sample_misc/wayland/src/class_wayland.cpp
index 65147973..dc2fc718 100644
--- a/tools/legacy/sample_misc/wayland/src/class_wayland.cpp
+++ b/tools/legacy/sample_misc/wayland/src/class_wayland.cpp
@@ -50,6 +50,9 @@ Wayland::Wayland()
           m_compositor(NULL),
           m_shell(NULL),
           m_drm(NULL),
+#if defined(WAYLAND_LINUX_DMABUF_SUPPORT)
+          m_dmabuf(NULL),
+#endif
           m_shm(NULL),
           m_pool(NULL),
           m_surface(NULL),
@@ -360,6 +363,11 @@ void Wayland::RegistryGlobal(struct wl_registry* registry,
         m_drm = static_cast<wl_drm*>(wl_registry_bind(registry, name, &wl_drm_interface, 2));
         wl_drm_add_listener(m_drm, &drm_listener, this);
     }
+#if defined(WAYLAND_LINUX_DMABUF_SUPPORT)
+    else if(0 == strcmp(interface, "zwp_linux_dmabuf_v1"))
+        m_dmabuf = static_cast<zwp_linux_dmabuf_v1*>(
+            wl_registry_bind(registry, name, &zwp_linux_dmabuf_v1_interface, version));
+#endif
 }
 
 void Wayland::DrmHandleDevice(const char* name) {
-- 
2.31.1