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 047b7865a69e26c9091b22dceceae1b609a3efbc 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
---
tools/legacy/sample_misc/wayland/include/class_wayland.h | 16 ++++++++++++++++
tools/legacy/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 29f724f..753b8b1 100644
--- a/tools/legacy/sample_misc/wayland/include/class_wayland.h
+++ b/tools/legacy/sample_misc/wayland/include/class_wayland.h
@@ -19,6 +19,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;
@@ -80,6 +83,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;
};
@@ -107,6 +115,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,
@@ -134,6 +147,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 c5e3359..7eac204 100644
--- a/tools/legacy/sample_misc/wayland/src/class_wayland.cpp
+++ b/tools/legacy/sample_misc/wayland/src/class_wayland.cpp
@@ -37,6 +37,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),
@@ -347,6 +350,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.7.4
|