summaryrefslogtreecommitdiffstats
path: root/recipes-multimedia/onevpl/files/0002-Fix-sample_multi_transcode-segfault-on-wayland.patch
blob: b776270962215f1159f0c4a34bea326f6f9cc233 (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
From 72ef4e2878f8cc2df431411027c92dc41ff26a2b Mon Sep 17 00:00:00 2001
From: Vincent Cheah Beng Keat <vincent.beng.keat.cheah@intel.com>
Date: Wed, 15 Mar 2023 22:37:08 +0800
Subject: [PATCH 2/5] Fix sample_multi_transcode segfault on wayland

HSD ID: 15012772965
Tested command: ./sample_multi_transcode -par ../../config.par

Upstream-Status: Backport
Expect it to be removed once move to v2023.2.0 and above.
https://github.com/oneapi-src/oneVPL/commit/59c850db505d32e6b7e4d68ced8d714afe390a70
---
 .../sample_misc/wayland/src/class_wayland.cpp | 27 +++++++++++++++----
 .../src/pipeline_transcode.cpp                |  6 ++++-
 2 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/tools/legacy/sample_misc/wayland/src/class_wayland.cpp b/tools/legacy/sample_misc/wayland/src/class_wayland.cpp
index 8f6edbb..af4d3f3 100644
--- a/tools/legacy/sample_misc/wayland/src/class_wayland.cpp
+++ b/tools/legacy/sample_misc/wayland/src/class_wayland.cpp
@@ -144,19 +144,36 @@ bool Wayland::CreateSurface() {
 }
 
 void Wayland::FreeSurface() {
-    if (NULL != m_shell_surface)
+    if (NULL != m_shell_surface) {
         wl_shell_surface_destroy(m_shell_surface);
-    if (NULL != m_surface)
+        m_shell_surface = NULL;
+    }
+    if (NULL != m_surface) {
+        while (!m_buffers_list.empty()) {
+            wl_surface_attach(m_surface, NULL, 0, 0);
+            wl_surface_commit(m_surface);
+            if (wl_display_dispatch_queue(m_display, m_event_queue) < 1)
+                break;
+        }
+
         wl_surface_destroy(m_surface);
+        m_surface = NULL;
+    }
 #if defined(WAYLAND_LINUX_XDG_SHELL_SUPPORT)
-    if (NULL != m_xdg_toplevel)
+    if (NULL != m_xdg_toplevel) {
         xdg_toplevel_destroy(m_xdg_toplevel);
-    if (NULL != m_xdg_surface)
+        m_xdg_toplevel = NULL;
+    }
+    if (NULL != m_xdg_surface) {
         xdg_surface_destroy(m_xdg_surface);
+        m_xdg_surface = NULL;
+    }
 #endif
 #if defined(WAYLAND_LINUX_DMABUF_SUPPORT)
-    if (NULL != m_dmabuf)
+    if (NULL != m_dmabuf) {
         zwp_linux_dmabuf_v1_destroy(m_dmabuf);
+        m_dmabuf = NULL;
+    }
 #endif
 }
 
diff --git a/tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp b/tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp
index 1c39daf..5e69a94 100644
--- a/tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp
+++ b/tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp
@@ -4675,12 +4675,16 @@ void CTranscodingPipeline::Close() {
         m_bIsJoinSession = false;
     }
 
-    //Destroy renderer
 #if defined(_WIN32) || defined(_WIN64)
+    //Destroy renderer
     if (m_hwdev4Rendering) {
         delete m_hwdev4Rendering;
         m_hwdev4Rendering = NULL;
     }
+#else
+    if (m_hwdev4Rendering) {
+        m_hwdev4Rendering->Close();
+    }
 #endif
 
     if (m_b3DLutEnable) {
-- 
2.40.1