summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYew, Chang Ching <chang.ching.yew@intel.com>2021-08-12 14:43:35 +0800
committerAnuj Mittal <anuj.mittal@intel.com>2021-08-13 10:09:14 +0800
commit0529a5442c4a2e4325ca19aa4c6279fff65d69cc (patch)
tree6dedf8ed9ba880d1b73ac11b6c1b36a682568640
parent31fe817cf481229c7a465bcd2ff62d2e9a7ca6d3 (diff)
downloadmeta-intel-0529a5442c4a2e4325ca19aa4c6279fff65d69cc.tar.gz
onevpl: upgrade 2021.4.0 -> 2021.5.0
What's new in this release: * Added option to build dispatcher as a static library * Added ability to build dispatcher under MinGW * Fixes for tools and samples Added patch: 0001-Fix-compile-issue-with-CMAKE_CXX_FLAGS-setting.patch Dropped upstreamed patches: 0001-Adding-Wayland-support-to-legacy-tools.patch 0001-Adding-X11-DRI3-support.patch 0001-Corrected-the-install-path.patch 0001-Fix-sample_multi_transcode-join-issue.patch Signed-off-by: Yew, Chang Ching <chang.ching.yew@intel.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
-rw-r--r--recipes-multimedia/onevpl/onevpl/0001-Adding-Wayland-support-to-legacy-tools.patch1416
-rw-r--r--recipes-multimedia/onevpl/onevpl/0001-Adding-X11-DRI3-support.patch39
-rw-r--r--recipes-multimedia/onevpl/onevpl/0001-Corrected-the-install-path.patch53
-rw-r--r--recipes-multimedia/onevpl/onevpl/0001-Fix-compile-issue-with-CMAKE_CXX_FLAGS-setting.patch31
-rw-r--r--recipes-multimedia/onevpl/onevpl/0001-Fix-sample_multi_transcode-join-issue.patch37
-rw-r--r--recipes-multimedia/onevpl/onevpl_2021.5.0.bb (renamed from recipes-multimedia/onevpl/onevpl_2021.4.0.bb)11
6 files changed, 35 insertions, 1552 deletions
diff --git a/recipes-multimedia/onevpl/onevpl/0001-Adding-Wayland-support-to-legacy-tools.patch b/recipes-multimedia/onevpl/onevpl/0001-Adding-Wayland-support-to-legacy-tools.patch
deleted file mode 100644
index 69d4a417..00000000
--- a/recipes-multimedia/onevpl/onevpl/0001-Adding-Wayland-support-to-legacy-tools.patch
+++ /dev/null
@@ -1,1416 +0,0 @@
1From 2d72bd9c295ac84654e0f24b64675d3c95a15c2e Mon Sep 17 00:00:00 2001
2From: "Yew, Chang Ching" <chang.ching.yew@intel.com>
3Date: Tue, 29 Jun 2021 15:51:41 +0800
4Subject: [PATCH] Adding Wayland support to legacy tools
5
6Upstream-Status: Submitted
7https://github.com/oneapi-src/oneVPL/pull/6
8
9Signed-off-by: jinchung <jin.chung.teng@intel.com>
10Signed-off-by: Yew, Chang Ching <chang.ching.yew@intel.com>
11---
12 tools/legacy/CMakeLists.txt | 1 +
13 tools/legacy/sample_common/CMakeLists.txt | 8 +
14 .../legacy/sample_common/CMakeLists.txt.orig | 105 ++++
15 .../legacy/sample_common/src/vaapi_device.cpp | 2 +-
16 .../legacy/sample_misc/wayland/CMakeLists.txt | 29 +
17 .../wayland/include/class_wayland.h | 160 ++++++
18 .../wayland/include/listener_wayland.h | 66 +++
19 .../include/wayland-drm-client-protocol.h | 235 ++++++++
20 .../sample_misc/wayland/src/class_wayland.cpp | 500 ++++++++++++++++++
21 .../wayland/src/listener_wayland.cpp | 105 ++++
22 .../wayland/src/wayland-drm-protocol.c | 84 +++
23 11 files changed, 1294 insertions(+), 1 deletion(-)
24 create mode 100644 tools/legacy/sample_common/CMakeLists.txt.orig
25 create mode 100644 tools/legacy/sample_misc/wayland/CMakeLists.txt
26 create mode 100644 tools/legacy/sample_misc/wayland/include/class_wayland.h
27 create mode 100644 tools/legacy/sample_misc/wayland/include/listener_wayland.h
28 create mode 100644 tools/legacy/sample_misc/wayland/include/wayland-drm-client-protocol.h
29 create mode 100644 tools/legacy/sample_misc/wayland/src/class_wayland.cpp
30 create mode 100644 tools/legacy/sample_misc/wayland/src/listener_wayland.cpp
31 create mode 100644 tools/legacy/sample_misc/wayland/src/wayland-drm-protocol.c
32
33diff --git a/tools/legacy/CMakeLists.txt b/tools/legacy/CMakeLists.txt
34index 59e1ad2..de7c452 100644
35--- a/tools/legacy/CMakeLists.txt
36+++ b/tools/legacy/CMakeLists.txt
37@@ -11,4 +11,5 @@ add_subdirectory(sample_common)
38 add_subdirectory(sample_decode)
39 add_subdirectory(sample_vpp)
40 add_subdirectory(sample_encode)
41+add_subdirectory(sample_misc/wayland)
42 add_subdirectory(sample_multi_transcode)
43diff --git a/tools/legacy/sample_common/CMakeLists.txt b/tools/legacy/sample_common/CMakeLists.txt
44index 32b7944..b4710f6 100644
45--- a/tools/legacy/sample_common/CMakeLists.txt
46+++ b/tools/legacy/sample_common/CMakeLists.txt
47@@ -73,6 +73,7 @@ if(UNIX)
48 pkg_check_modules(PKG_LIBDRM libdrm)
49 pkg_check_modules(PKG_X11 x11)
50 pkg_check_modules(PKG_LIBVA_X11 libva-x11>=1.10.0)
51+ pkg_check_modules(PKG_WAYLAND_CLIENT wayland-client)
52 if(PKG_LIBVA_FOUND)
53 target_compile_definitions(${TARGET} PUBLIC -DLIBVA_SUPPORT)
54 target_compile_definitions(${TARGET} PUBLIC -DLIBVA_DRM_SUPPORT)
55@@ -91,6 +92,13 @@ if(UNIX)
56 else()
57 message(WARNING "x11 modules not found: building without libVA X11 support")
58 endif()
59+ if(PKG_WAYLAND_CLIENT_FOUND)
60+ target_compile_definitions(${TARGET} PUBLIC -DLIBVA_WAYLAND_SUPPORT)
61+ target_include_directories(${TARGET} PUBLIC ${PKG_WAYLAND_CLIENT_LIBRARY_DIRS})
62+ target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../sample_misc/wayland/include)
63+ else()
64+ message(WARNING "wayland modules not found: building without Wayland support")
65+ endif()
66
67 target_link_libraries(${TARGET} ${CMAKE_DL_LIBS})
68
69diff --git a/tools/legacy/sample_common/CMakeLists.txt.orig b/tools/legacy/sample_common/CMakeLists.txt.orig
70new file mode 100644
71index 0000000..32b7944
72--- /dev/null
73+++ b/tools/legacy/sample_common/CMakeLists.txt.orig
74@@ -0,0 +1,105 @@
75+# ##############################################################################
76+# Copyright (C) Intel Corporation
77+#
78+# SPDX-License-Identifier: MIT
79+# ##############################################################################
80+cmake_minimum_required(VERSION 3.10.2)
81+
82+set(TARGET sample_common)
83+
84+set(sources "")
85+list(
86+ APPEND
87+ sources
88+ src/base_allocator.cpp
89+ src/decode_render.cpp
90+ src/mfx_buffering.cpp
91+ src/sysmem_allocator.cpp
92+ src/general_allocator.cpp
93+ src/sample_utils.cpp
94+ src/plugin_utils.cpp
95+ src/preset_manager.cpp
96+ src/parameters_dumper.cpp
97+ src/vpl_implementation_loader.cpp
98+ src/vm/atomic.cpp
99+ src/vm/time.cpp)
100+
101+if(UNIX)
102+ list(
103+ APPEND
104+ sources
105+ src/vaapi_utils.cpp
106+ src/vaapi_device.cpp
107+ src/vaapi_allocator.cpp
108+ src/vm/time_linux.cpp
109+ src/vm/atomic_linux.cpp
110+ src/vm/thread_linux.cpp
111+ src/vaapi_utils_x11.cpp
112+ src/vaapi_utils_drm.cpp)
113+else()
114+ list(
115+ APPEND
116+ sources
117+ src/d3d11_allocator.cpp
118+ src/d3d11_device.cpp
119+ src/d3d_allocator.cpp
120+ src/vm/thread_windows.cpp
121+ src/d3d_device.cpp)
122+endif()
123+
124+set(CMAKE_POSITION_INDEPENDENT_CODE true)
125+add_library(${TARGET} STATIC ${sources})
126+target_include_directories(
127+ ${TARGET} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
128+
129+if(MSVC)
130+ add_definitions(-D_CRT_SECURE_NO_WARNINGS)
131+endif()
132+
133+add_definitions(-DMFX_DEPRECATED_OFF)
134+
135+if(POLICY CMP0074)
136+ # ignore warning of VPL_ROOT in find_package search path
137+ cmake_policy(SET CMP0074 OLD)
138+endif()
139+
140+find_package(VPL REQUIRED)
141+target_link_libraries(${TARGET} VPL::dispatcher media_sdk_compatibility_headers)
142+
143+if(UNIX)
144+ find_package(PkgConfig REQUIRED)
145+ # note: pkg-config version for libva is *API* version
146+ pkg_check_modules(PKG_LIBVA libva>=1.2 libva-drm>=1.2)
147+ pkg_check_modules(PKG_LIBDRM libdrm)
148+ pkg_check_modules(PKG_X11 x11)
149+ pkg_check_modules(PKG_LIBVA_X11 libva-x11>=1.10.0)
150+ if(PKG_LIBVA_FOUND)
151+ target_compile_definitions(${TARGET} PUBLIC -DLIBVA_SUPPORT)
152+ target_compile_definitions(${TARGET} PUBLIC -DLIBVA_DRM_SUPPORT)
153+ target_include_directories(${TARGET} PUBLIC ${PKG_LIBVA_INCLUDE_DIRS})
154+ else()
155+ message(WARNING "libva not found: building without libVA support")
156+ endif()
157+ if(PKG_LIBDRM_FOUND)
158+ target_include_directories(${TARGET} PUBLIC ${PKG_LIBDRM_INCLUDE_DIRS})
159+ else()
160+ message(WARNING "libva-drm not found: building without libVA DRM support")
161+ endif()
162+ if(PKG_X11_FOUND)
163+ target_compile_definitions(${TARGET} PUBLIC -DLIBVA_X11_SUPPORT)
164+ target_include_directories(${TARGET} PUBLIC ${PKG_X11_LIBRARY_DIRS})
165+ else()
166+ message(WARNING "x11 modules not found: building without libVA X11 support")
167+ endif()
168+
169+ target_link_libraries(${TARGET} ${CMAKE_DL_LIBS})
170+
171+ set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
172+ set(THREADS_PREFER_PTHREAD_FLAG TRUE)
173+ find_package(Threads REQUIRED)
174+ target_link_libraries(${TARGET} Threads::Threads)
175+
176+else()
177+ target_compile_definitions(${TARGET} PUBLIC -DMFX_D3D11_SUPPORT)
178+ target_link_libraries(${TARGET} DXGI D3D11 D3D9 DXVA2)
179+endif()
180diff --git a/tools/legacy/sample_common/src/vaapi_device.cpp b/tools/legacy/sample_common/src/vaapi_device.cpp
181index 3f6d3ba..b034376 100644
182--- a/tools/legacy/sample_common/src/vaapi_device.cpp
183+++ b/tools/legacy/sample_common/src/vaapi_device.cpp
184@@ -396,7 +396,7 @@ mfxStatus CVAAPIDeviceWayland::RenderFrame(mfxFrameSurface1* pSurface,
185 return mfx_res;
186 }
187
188- m_Wayland->RenderBuffer(m_wl_buffer, pSurface->Info.CropW, pSurface->Info.CropH);
189+ m_Wayland->RenderBuffer(m_wl_buffer, pSurface);
190
191 return mfx_res;
192 }
193diff --git a/tools/legacy/sample_misc/wayland/CMakeLists.txt b/tools/legacy/sample_misc/wayland/CMakeLists.txt
194new file mode 100644
195index 0000000..95057d4
196--- /dev/null
197+++ b/tools/legacy/sample_misc/wayland/CMakeLists.txt
198@@ -0,0 +1,29 @@
199+if (NOT PKG_WAYLAND_CLIENT_FOUND)
200+ return()
201+endif()
202+
203+set(TARGET mfx_wayland)
204+
205+find_package(PkgConfig REQUIRED)
206+pkg_check_modules(PKG_WAYLAND_CLIENT wayland-client)
207+pkg_check_modules(PKG_LIBVA libva libva-drm)
208+pkg_check_modules(PKG_LIBDRM libdrm)
209+
210+include_directories (
211+ ${CMAKE_CURRENT_SOURCE_DIR}/../../sample_common/include
212+ ${CMAKE_CURRENT_SOURCE_DIR}/include
213+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../api/vpl
214+ ${PKG_LIBDRM_INCLUDE_DIRS}
215+ ${PKG_WAYLAND_CLIENT_LIBRARY_DIRS}
216+)
217+
218+add_definitions(-DLIBVA_WAYLAND_SUPPORT)
219+add_library(${TARGET} SHARED "")
220+target_sources(${TARGET} PRIVATE
221+ ${CMAKE_CURRENT_SOURCE_DIR}/src/class_wayland.cpp
222+ ${CMAKE_CURRENT_SOURCE_DIR}/src/listener_wayland.cpp
223+ ${CMAKE_CURRENT_SOURCE_DIR}/src/wayland-drm-protocol.c)
224+
225+target_link_libraries(${TARGET} sample_common wayland-client va drm drm_intel)
226+
227+install( TARGETS ${TARGETS} LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR} )
228diff --git a/tools/legacy/sample_misc/wayland/include/class_wayland.h b/tools/legacy/sample_misc/wayland/include/class_wayland.h
229new file mode 100644
230index 0000000..1c64f9c
231--- /dev/null
232+++ b/tools/legacy/sample_misc/wayland/include/class_wayland.h
233@@ -0,0 +1,160 @@
234+/******************************************************************************\
235+Copyright (c) 2005-2019, Intel Corporation
236+All rights reserved.
237+
238+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
239+
240+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
241+
242+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
243+
244+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
245+
246+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
247+
248+This sample was distributed or derived from the Intel's Media Samples package.
249+The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
250+or https://software.intel.com/en-us/media-client-solutions-support.
251+\**********************************************************************************/
252+
253+#ifndef WAYLAND_CLASS_H
254+#define WAYLAND_CLASS_H
255+
256+#if defined(LIBVA_WAYLAND_SUPPORT)
257+
258+extern "C"
259+{
260+ #include <intel_bufmgr.h>
261+}
262+#include <poll.h>
263+#include <wayland-client.h>
264+#include <list>
265+#include "wayland-drm-client-protocol.h"
266+#include "vpl/mfxstructures.h"
267+#include "mfx_buffering.h"
268+#include "sample_defs.h"
269+
270+typedef struct buffer wld_buffer;
271+
272+/* ShmPool Struct */
273+struct ShmPool {
274+ int fd;
275+ uint32_t *memory;
276+ unsigned capacity;
277+ unsigned size;
278+};
279+
280+class Wayland: public CBuffering {
281+ public:
282+ Wayland();
283+ virtual ~Wayland();
284+ virtual bool InitDisplay();
285+ virtual bool CreateSurface();
286+ virtual void FreeSurface();
287+ virtual void SetRenderWinPos(int x, int y);
288+ virtual void RenderBuffer(struct wl_buffer *buffer
289+ , mfxFrameSurface1 *surface);
290+ virtual void RenderBufferWinPosSize(struct wl_buffer *buffer
291+ , int x
292+ , int y
293+ , int32_t width
294+ , int32_t height);
295+ bool CreateShmPool(int fd, int32_t size, int prot);
296+ void FreeShmPool();
297+ /* Create wl_buffer from shm_pool */
298+ struct wl_buffer * CreateShmBuffer(unsigned width
299+ , unsigned height
300+ , unsigned stride
301+ , uint32_t PIXEL_FORMAT_ID);
302+ void FreeShmBuffer(struct wl_buffer *buffer);
303+ int Dispatch();
304+ struct wl_buffer * CreatePlanarBuffer(uint32_t name
305+ , int32_t width
306+ , int32_t height
307+ , uint32_t format
308+ , int32_t offsets[3]
309+ , int32_t pitches[3]);
310+ virtual struct wl_buffer * CreatePrimeBuffer(uint32_t name
311+ , int32_t width
312+ , int32_t height
313+ , uint32_t format
314+ , int32_t offsets[3]
315+ , int32_t pitches[3]);
316+ struct wl_display * GetDisplay() { return m_display; }
317+ struct wl_registry * GetRegistry() { return m_registry; }
318+ struct wl_compositor * GetCompositor() { return m_compositor; }
319+ struct wl_shell * GetShell() { return m_shell; }
320+ struct wl_drm * GetDrm() { return m_drm; }
321+ struct wl_shm * GetShm() { return m_shm; };
322+ struct wl_shm_pool * GetShmPool() { return m_pool; }
323+ struct wl_surface * GetSurface() { return m_surface; }
324+ struct wl_shell_surface * GetShellSurface() { return m_shell_surface; }
325+ struct wl_callback * GetCallback() { return m_callback; }
326+ void SetCompositor(struct wl_compositor *compositor)
327+ {
328+ m_compositor = compositor;
329+ }
330+ void SetShell(struct wl_shell *shell)
331+ {
332+ m_shell = shell;
333+ }
334+ void SetShm(struct wl_shm *shm)
335+ {
336+ m_shm = shm;
337+ }
338+ void SetDrm(struct wl_drm *drm)
339+ {
340+ m_drm = drm;
341+ }
342+ void DrmHandleDevice(const char* device);
343+ void DrmHandleAuthenticated();
344+ void RegistryGlobal(struct wl_registry *registry
345+ , uint32_t name
346+ , const char *interface
347+ , uint32_t version);
348+ void DisplayFlush()
349+ {
350+ wl_display_flush(m_display);
351+ }
352+ virtual int DisplayRoundtrip();
353+ void DestroyCallback();
354+ virtual void Sync();
355+ virtual void SetPerfMode(bool perf_mode);
356+ void AddBufferToList(wld_buffer *buffer);
357+ void RemoveBufferFromList(struct wl_buffer *buffer);
358+ void DestroyBufferList();
359+ private:
360+ //no copies allowed
361+ Wayland(const Wayland &);
362+ void operator = (const Wayland&);
363+
364+ struct wl_display *m_display;
365+ struct wl_registry *m_registry;
366+ struct wl_compositor *m_compositor;
367+ struct wl_shell *m_shell;
368+ struct wl_drm *m_drm;
369+ struct wl_shm *m_shm;
370+ struct wl_shm_pool *m_pool;
371+ struct wl_surface *m_surface;
372+ struct wl_shell_surface *m_shell_surface;
373+ struct wl_callback *m_callback;
374+ struct wl_event_queue *m_event_queue;
375+ volatile int m_pending_frame;
376+ struct ShmPool *m_shm_pool;
377+ int m_display_fd;
378+ int m_fd;
379+ struct pollfd m_poll;
380+ drm_intel_bufmgr *m_bufmgr;
381+ char *m_device_name;
382+ int m_x, m_y;
383+ bool m_perf_mode;
384+ protected:
385+ std::list<wld_buffer*> m_buffers_list;
386+};
387+
388+extern "C" Wayland* WaylandCreate();
389+extern "C" void WaylandDestroy(Wayland *pWld);
390+
391+#endif //LIBVA_WAYLAND_SUPPORT
392+
393+#endif /* WAYLAND_CLASS_H */
394diff --git a/tools/legacy/sample_misc/wayland/include/listener_wayland.h b/tools/legacy/sample_misc/wayland/include/listener_wayland.h
395new file mode 100644
396index 0000000..1bbaa91
397--- /dev/null
398+++ b/tools/legacy/sample_misc/wayland/include/listener_wayland.h
399@@ -0,0 +1,66 @@
400+/******************************************************************************\
401+Copyright (c) 2005-2019, Intel Corporation
402+All rights reserved.
403+
404+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
405+
406+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
407+
408+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
409+
410+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
411+
412+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
413+
414+This sample was distributed or derived from the Intel's Media Samples package.
415+The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
416+or https://software.intel.com/en-us/media-client-solutions-support.
417+\**********************************************************************************/
418+
419+#ifndef LISTENER_WAYLAND_H
420+#define LISTENER_WAYLAND_H
421+
422+#include "class_wayland.h"
423+
424+/* drm listeners */
425+void drm_handle_device(void *data
426+ , struct wl_drm *drm
427+ , const char *device);
428+
429+void drm_handle_format(void *data
430+ , struct wl_drm *drm
431+ , uint32_t format);
432+
433+void drm_handle_authenticated(void *data
434+ , struct wl_drm *drm);
435+
436+void drm_handle_capabilities(void *data
437+ , struct wl_drm *drm
438+ , uint32_t value);
439+
440+/* registry listeners */
441+void registry_handle_global(void *data
442+ , struct wl_registry *registry
443+ , uint32_t name
444+ , const char *interface
445+ , uint32_t version);
446+
447+void remove_registry_global(void *data
448+ , struct wl_registry *regsitry
449+ , uint32_t name);
450+
451+/* surface listener */
452+void shell_surface_ping(void *data
453+ , struct wl_shell_surface *shell_surface
454+ , uint32_t serial);
455+
456+void shell_surface_configure(void *data
457+ , struct wl_shell_surface *shell_surface
458+ , uint32_t edges
459+ , int32_t width
460+ , int32_t height);
461+
462+void handle_done(void *data, struct wl_callback *callback, uint32_t time);
463+
464+void buffer_release(void *data, struct wl_buffer *buffer);
465+#endif /* LISTENER_WAYLAND_H */
466diff --git a/tools/legacy/sample_misc/wayland/include/wayland-drm-client-protocol.h b/tools/legacy/sample_misc/wayland/include/wayland-drm-client-protocol.h
467new file mode 100644
468index 0000000..e8f33c0
469--- /dev/null
470+++ b/tools/legacy/sample_misc/wayland/include/wayland-drm-client-protocol.h
471@@ -0,0 +1,235 @@
472+/*
473+ * Copyright � 2008-2011 Kristian H�gsberg
474+ * Copyright � 2010-2011 Intel Corporation
475+ *
476+ * Permission to use, copy, modify, distribute, and sell this
477+ * software and its documentation for any purpose is hereby granted
478+ * without fee, provided that\n the above copyright notice appear in
479+ * all copies and that both that copyright notice and this permission
480+ * notice appear in supporting documentation, and that the name of
481+ * the copyright holders not be used in advertising or publicity
482+ * pertaining to distribution of the software without specific,
483+ * written prior permission. The copyright holders make no
484+ * representations about the suitability of this software for any
485+ * purpose. It is provided "as is" without express or implied
486+ * warranty.
487+ *
488+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
489+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
490+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
491+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
492+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
493+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
494+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
495+ * THIS SOFTWARE.
496+ */
497+
498+#ifndef DRM_CLIENT_PROTOCOL_H
499+#define DRM_CLIENT_PROTOCOL_H
500+
501+#ifdef __cplusplus
502+extern "C" {
503+#endif
504+
505+#include <stdint.h>
506+#include <stddef.h>
507+#include "wayland-client.h"
508+
509+struct wl_client;
510+struct wl_resource;
511+
512+struct wl_drm;
513+
514+extern const struct wl_interface wl_drm_interface;
515+
516+#ifndef WL_DRM_ERROR_ENUM
517+#define WL_DRM_ERROR_ENUM
518+enum wl_drm_error {
519+ WL_DRM_ERROR_AUTHENTICATE_FAIL = 0,
520+ WL_DRM_ERROR_INVALID_FORMAT = 1,
521+ WL_DRM_ERROR_INVALID_NAME = 2,
522+};
523+#endif /* WL_DRM_ERROR_ENUM */
524+
525+#ifndef WL_DRM_FORMAT_ENUM
526+#define WL_DRM_FORMAT_ENUM
527+enum wl_drm_format {
528+ WL_DRM_FORMAT_C8 = 0x20203843,
529+ WL_DRM_FORMAT_RGB332 = 0x38424752,
530+ WL_DRM_FORMAT_BGR233 = 0x38524742,
531+ WL_DRM_FORMAT_XRGB4444 = 0x32315258,
532+ WL_DRM_FORMAT_XBGR4444 = 0x32314258,
533+ WL_DRM_FORMAT_RGBX4444 = 0x32315852,
534+ WL_DRM_FORMAT_BGRX4444 = 0x32315842,
535+ WL_DRM_FORMAT_ARGB4444 = 0x32315241,
536+ WL_DRM_FORMAT_ABGR4444 = 0x32314241,
537+ WL_DRM_FORMAT_RGBA4444 = 0x32314152,
538+ WL_DRM_FORMAT_BGRA4444 = 0x32314142,
539+ WL_DRM_FORMAT_XRGB1555 = 0x35315258,
540+ WL_DRM_FORMAT_XBGR1555 = 0x35314258,
541+ WL_DRM_FORMAT_RGBX5551 = 0x35315852,
542+ WL_DRM_FORMAT_BGRX5551 = 0x35315842,
543+ WL_DRM_FORMAT_ARGB1555 = 0x35315241,
544+ WL_DRM_FORMAT_ABGR1555 = 0x35314241,
545+ WL_DRM_FORMAT_RGBA5551 = 0x35314152,
546+ WL_DRM_FORMAT_BGRA5551 = 0x35314142,
547+ WL_DRM_FORMAT_RGB565 = 0x36314752,
548+ WL_DRM_FORMAT_BGR565 = 0x36314742,
549+ WL_DRM_FORMAT_RGB888 = 0x34324752,
550+ WL_DRM_FORMAT_BGR888 = 0x34324742,
551+ WL_DRM_FORMAT_XRGB8888 = 0x34325258,
552+ WL_DRM_FORMAT_XBGR8888 = 0x34324258,
553+ WL_DRM_FORMAT_RGBX8888 = 0x34325852,
554+ WL_DRM_FORMAT_BGRX8888 = 0x34325842,
555+ WL_DRM_FORMAT_ARGB8888 = 0x34325241,
556+ WL_DRM_FORMAT_ABGR8888 = 0x34324241,
557+ WL_DRM_FORMAT_RGBA8888 = 0x34324152,
558+ WL_DRM_FORMAT_BGRA8888 = 0x34324142,
559+ WL_DRM_FORMAT_XRGB2101010 = 0x30335258,
560+ WL_DRM_FORMAT_XBGR2101010 = 0x30334258,
561+ WL_DRM_FORMAT_RGBX1010102 = 0x30335852,
562+ WL_DRM_FORMAT_BGRX1010102 = 0x30335842,
563+ WL_DRM_FORMAT_ARGB2101010 = 0x30335241,
564+ WL_DRM_FORMAT_ABGR2101010 = 0x30334241,
565+ WL_DRM_FORMAT_RGBA1010102 = 0x30334152,
566+ WL_DRM_FORMAT_BGRA1010102 = 0x30334142,
567+ WL_DRM_FORMAT_YUYV = 0x56595559,
568+ WL_DRM_FORMAT_YVYU = 0x55595659,
569+ WL_DRM_FORMAT_UYVY = 0x59565955,
570+ WL_DRM_FORMAT_VYUY = 0x59555956,
571+ WL_DRM_FORMAT_AYUV = 0x56555941,
572+ WL_DRM_FORMAT_NV12 = 0x3231564e,
573+ WL_DRM_FORMAT_NV21 = 0x3132564e,
574+ WL_DRM_FORMAT_NV16 = 0x3631564e,
575+ WL_DRM_FORMAT_NV61 = 0x3136564e,
576+ WL_DRM_FORMAT_YUV410 = 0x39565559,
577+ WL_DRM_FORMAT_YVU410 = 0x39555659,
578+ WL_DRM_FORMAT_YUV411 = 0x31315559,
579+ WL_DRM_FORMAT_YVU411 = 0x31315659,
580+ WL_DRM_FORMAT_YUV420 = 0x32315559,
581+ WL_DRM_FORMAT_YVU420 = 0x32315659,
582+ WL_DRM_FORMAT_YUV422 = 0x36315559,
583+ WL_DRM_FORMAT_YVU422 = 0x36315659,
584+ WL_DRM_FORMAT_YUV444 = 0x34325559,
585+ WL_DRM_FORMAT_YVU444 = 0x34325659,
586+};
587+#endif /* WL_DRM_FORMAT_ENUM */
588+
589+#ifndef WL_DRM_CAPABILITY_ENUM
590+#define WL_DRM_CAPABILITY_ENUM
591+/**
592+ * wl_drm_capability - wl_drm capability bitmask
593+ * @WL_DRM_CAPABILITY_PRIME: wl_drm prime available
594+ *
595+ * Bitmask of capabilities.
596+ */
597+enum wl_drm_capability {
598+ WL_DRM_CAPABILITY_PRIME = 1,
599+};
600+#endif /* WL_DRM_CAPABILITY_ENUM */
601+
602+struct wl_drm_listener {
603+ /**
604+ * device - (none)
605+ * @name: (none)
606+ */
607+ void (*device)(void *data,
608+ struct wl_drm *wl_drm,
609+ const char *name);
610+ /**
611+ * format - (none)
612+ * @format: (none)
613+ */
614+ void (*format)(void *data,
615+ struct wl_drm *wl_drm,
616+ uint32_t format);
617+ /**
618+ * authenticated - (none)
619+ */
620+ void (*authenticated)(void *data,
621+ struct wl_drm *wl_drm);
622+ /**
623+ * capabilities - (none)
624+ * @value: (none)
625+ */
626+ void (*capabilities)(void *data,
627+ struct wl_drm *wl_drm,
628+ uint32_t value);
629+};
630+
631+static inline int
632+wl_drm_add_listener(struct wl_drm *wl_drm,
633+ const struct wl_drm_listener *listener, void *data)
634+{
635+ return wl_proxy_add_listener((struct wl_proxy *) wl_drm,
636+ (void (**)(void)) listener, data);
637+}
638+
639+#define WL_DRM_AUTHENTICATE 0
640+#define WL_DRM_CREATE_BUFFER 1
641+#define WL_DRM_CREATE_PLANAR_BUFFER 2
642+#define WL_DRM_CREATE_PRIME_BUFFER 3
643+
644+static inline void
645+wl_drm_set_user_data(struct wl_drm *wl_drm, void *user_data)
646+{
647+ wl_proxy_set_user_data((struct wl_proxy *) wl_drm, user_data);
648+}
649+
650+static inline void *
651+wl_drm_get_user_data(struct wl_drm *wl_drm)
652+{
653+ return wl_proxy_get_user_data((struct wl_proxy *) wl_drm);
654+}
655+
656+static inline void
657+wl_drm_destroy(struct wl_drm *wl_drm)
658+{
659+ wl_proxy_destroy((struct wl_proxy *) wl_drm);
660+}
661+
662+static inline void
663+wl_drm_authenticate(struct wl_drm *wl_drm, uint32_t id)
664+{
665+ wl_proxy_marshal((struct wl_proxy *) wl_drm,
666+ WL_DRM_AUTHENTICATE, id);
667+}
668+
669+static inline struct wl_buffer *
670+wl_drm_create_buffer(struct wl_drm *wl_drm, uint32_t name, int32_t width, int32_t height, uint32_t stride, uint32_t format)
671+{
672+ struct wl_proxy *id;
673+
674+ id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_drm,
675+ WL_DRM_CREATE_BUFFER, &wl_buffer_interface, NULL, name, width, height, stride, format);
676+
677+ return (struct wl_buffer *) id;
678+}
679+
680+static inline struct wl_buffer *
681+wl_drm_create_planar_buffer(struct wl_drm *wl_drm, uint32_t name, int32_t width, int32_t height, uint32_t format, int32_t offset0, int32_t stride0, int32_t offset1, int32_t stride1, int32_t offset2, int32_t stride2)
682+{
683+ struct wl_proxy *id;
684+
685+ id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_drm,
686+ WL_DRM_CREATE_PLANAR_BUFFER, &wl_buffer_interface, NULL, name, width, height, format, offset0, stride0, offset1, stride1, offset2, stride2);
687+
688+ return (struct wl_buffer *) id;
689+}
690+
691+static inline struct wl_buffer *
692+wl_drm_create_prime_buffer(struct wl_drm *wl_drm, int32_t name, int32_t width, int32_t height, uint32_t format, int32_t offset0, int32_t stride0, int32_t offset1, int32_t stride1, int32_t offset2, int32_t stride2)
693+{
694+ struct wl_proxy *id;
695+
696+ id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_drm,
697+ WL_DRM_CREATE_PRIME_BUFFER, &wl_buffer_interface, NULL, name, width, height, format, offset0, stride0, offset1, stride1, offset2, stride2);
698+
699+ return (struct wl_buffer *) id;
700+}
701+
702+#ifdef __cplusplus
703+}
704+#endif
705+
706+#endif
707diff --git a/tools/legacy/sample_misc/wayland/src/class_wayland.cpp b/tools/legacy/sample_misc/wayland/src/class_wayland.cpp
708new file mode 100644
709index 0000000..2bafdb2
710--- /dev/null
711+++ b/tools/legacy/sample_misc/wayland/src/class_wayland.cpp
712@@ -0,0 +1,500 @@
713+/******************************************************************************\
714+Copyright (c) 2005-2019, Intel Corporation
715+All rights reserved.
716+
717+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
718+
719+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
720+
721+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
722+
723+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
724+
725+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
726+
727+This sample was distributed or derived from the Intel's Media Samples package.
728+The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
729+or https://software.intel.com/en-us/media-client-solutions-support.
730+\**********************************************************************************/
731+
732+#include <iostream>
733+#include <exception>
734+#include <cstring>
735+#include <fcntl.h>
736+#include <unistd.h>
737+#include <poll.h>
738+#include <sys/mman.h>
739+extern "C" {
740+#include <drm.h>
741+#include <xf86drm.h>
742+#include <intel_bufmgr.h>
743+}
744+#include "class_wayland.h"
745+#include "listener_wayland.h"
746+#include "wayland-drm-client-protocol.h"
747+
748+#define BATCH_SIZE 0x80000
749+
750+struct buffer {
751+ struct wl_buffer *buffer;
752+ mfxFrameSurface1 *pInSurface;
753+};
754+
755+static const struct wl_callback_listener frame_listener = {
756+ handle_done
757+};
758+
759+static const struct wl_buffer_listener buffer_listener = {
760+ buffer_release
761+};
762+
763+Wayland::Wayland()
764+ : m_display(NULL)
765+ , m_registry(NULL)
766+ , m_compositor(NULL)
767+ , m_shell(NULL)
768+ , m_drm(NULL)
769+ , m_shm(NULL)
770+ , m_pool(NULL)
771+ , m_surface(NULL)
772+ , m_shell_surface(NULL)
773+ , m_callback(NULL)
774+ , m_event_queue(NULL)
775+ , m_pending_frame(0)
776+ , m_shm_pool(NULL)
777+ , m_display_fd(-1)
778+ , m_fd(-1)
779+ , m_bufmgr(NULL)
780+ , m_device_name(NULL)
781+ , m_x(0), m_y(0)
782+ , m_perf_mode(false)
783+{
784+ std::memset(&m_poll, 0, sizeof(m_poll));
785+}
786+
787+bool Wayland::InitDisplay()
788+{
789+ static const struct wl_registry_listener registry_listener = {
790+ .global = registry_handle_global,
791+ .global_remove = remove_registry_global
792+ };
793+
794+ m_display = wl_display_connect(NULL);
795+ if (NULL == m_display) {
796+ std::cout << "Error: Cannot connect to wayland display\n";
797+ return false;
798+ }
799+ m_registry = wl_display_get_registry(m_display);
800+ wl_registry_add_listener(m_registry
801+ , &registry_listener
802+ , this);
803+
804+ m_display_fd = wl_display_get_fd(m_display);
805+ wl_display_roundtrip(m_display);
806+ wl_display_roundtrip(m_display);
807+ m_event_queue = wl_display_create_queue(m_display);
808+ if(NULL == m_event_queue)
809+ return false;
810+
811+ m_poll.fd = m_display_fd;
812+ m_poll.events = POLLIN;
813+ return true;
814+}
815+
816+int Wayland::DisplayRoundtrip()
817+{
818+ return wl_display_roundtrip(m_display);
819+}
820+
821+bool Wayland::CreateSurface()
822+{
823+ static const struct wl_shell_surface_listener
824+ shell_surface_listener = {
825+ shell_surface_ping,
826+ shell_surface_configure
827+ };
828+
829+ m_surface = wl_compositor_create_surface(m_compositor);
830+ if (NULL == m_surface)
831+ return false;
832+
833+ m_shell_surface = wl_shell_get_shell_surface(m_shell
834+ , m_surface);
835+ if(NULL == m_shell_surface)
836+ {
837+ wl_surface_destroy(m_surface);
838+ return false;
839+ }
840+
841+ wl_shell_surface_add_listener(m_shell_surface
842+ , &shell_surface_listener
843+ , 0);
844+ wl_shell_surface_set_toplevel(m_shell_surface);
845+ wl_shell_surface_set_user_data(m_shell_surface, m_surface);
846+ wl_surface_set_user_data(m_surface, NULL);
847+ return true;
848+}
849+
850+
851+void Wayland::FreeSurface()
852+{
853+ if(NULL != m_shell_surface)
854+ wl_shell_surface_destroy(m_shell_surface);
855+ if(NULL != m_surface)
856+ wl_surface_destroy(m_surface);
857+}
858+
859+void Wayland::Sync()
860+{
861+ int ret;
862+ while(NULL != m_callback)
863+ {
864+ while(wl_display_prepare_read_queue(m_display, m_event_queue) < 0)
865+ wl_display_dispatch_queue_pending(m_display, m_event_queue);
866+
867+ wl_display_flush(m_display);
868+
869+ ret = poll(&m_poll,1,-1);
870+ if(ret < 0 )
871+ wl_display_cancel_read(m_display);
872+ else
873+ wl_display_read_events(m_display);
874+ wl_display_dispatch_queue_pending(m_display, m_event_queue);
875+ }
876+}
877+
878+void Wayland::SetPerfMode(bool perf_mode)
879+{
880+ m_perf_mode = perf_mode;
881+}
882+
883+void Wayland::SetRenderWinPos(int x, int y)
884+{
885+ m_x = x; m_y = y;
886+}
887+
888+void Wayland::RenderBuffer(struct wl_buffer *buffer
889+ , mfxFrameSurface1 *surface)
890+{
891+ wld_buffer *m_buffer = new wld_buffer;
892+ if (m_buffer == NULL)
893+ return;
894+
895+ m_buffer->buffer = buffer;
896+ m_buffer->pInSurface = surface;
897+
898+ wl_surface_attach(m_surface, buffer, 0, 0);
899+ wl_surface_damage(m_surface, m_x, m_y, surface->Info.CropW, surface->Info.CropH);
900+
901+ wl_proxy_set_queue((struct wl_proxy *) buffer, m_event_queue);
902+
903+ AddBufferToList(m_buffer);
904+ wl_buffer_add_listener(buffer, &buffer_listener, this);
905+ m_pending_frame=1;
906+ if (m_perf_mode)
907+ m_callback = wl_display_sync(m_display);
908+ else
909+ m_callback = wl_surface_frame(m_surface);
910+ wl_callback_add_listener(m_callback, &frame_listener, this);
911+ wl_proxy_set_queue((struct wl_proxy *) m_callback, m_event_queue);
912+ wl_surface_commit(m_surface);
913+ wl_display_dispatch_queue(m_display, m_event_queue);
914+ /* Force a Sync before and after render to ensure client handles
915+ wayland events in a timely fashion. This also fixes the one time
916+ flicker issue on wl_shell_surface pointer enter */
917+ Sync();
918+
919+}
920+
921+void Wayland::RenderBufferWinPosSize(struct wl_buffer *buffer
922+ , int x
923+ , int y
924+ , int32_t width
925+ , int32_t height)
926+{
927+ wl_surface_attach(m_surface, buffer, 0, 0);
928+ wl_surface_damage(m_surface, x, y, width, height);
929+
930+ wl_proxy_set_queue((struct wl_proxy *) buffer, m_event_queue);
931+
932+ wl_buffer_add_listener(buffer, &buffer_listener, NULL);
933+ m_pending_frame=1;
934+ if (m_perf_mode)
935+ m_callback = wl_display_sync(m_display);
936+ else
937+ m_callback = wl_surface_frame(m_surface);
938+ wl_callback_add_listener(m_callback, &frame_listener, this);
939+ wl_proxy_set_queue((struct wl_proxy *) m_callback, m_event_queue);
940+ wl_surface_commit(m_surface);
941+ wl_display_dispatch_queue(m_display, m_event_queue);
942+}
943+
944+
945+void Wayland::DestroyCallback()
946+{
947+ if(m_callback)
948+ {
949+ wl_callback_destroy(m_callback);
950+ m_callback = NULL;
951+ m_pending_frame=0;
952+ }
953+}
954+
955+//ShmPool
956+bool Wayland::CreateShmPool(int fd, int32_t size, int prot)
957+{
958+ m_shm_pool = new struct ShmPool;
959+ if (NULL == m_shm_pool)
960+ return false;
961+
962+ m_shm_pool->capacity = size;
963+ m_shm_pool->size = 0;
964+ m_shm_pool->fd = fd;
965+
966+ m_shm_pool->memory = static_cast<uint32_t*>(mmap(0
967+ , size
968+ , prot
969+ , MAP_SHARED
970+ , m_shm_pool->fd
971+ , 0));
972+ if (MAP_FAILED == m_shm_pool->memory)
973+ {
974+ delete m_shm_pool;
975+ return false;
976+ }
977+
978+ m_pool = wl_shm_create_pool(m_shm
979+ , m_shm_pool->fd
980+ , size);
981+ if (NULL == m_pool)
982+ {
983+ munmap(m_shm_pool->memory, size);
984+ delete m_shm_pool;
985+ return false;
986+ }
987+ wl_shm_pool_set_user_data(m_pool, m_shm_pool);
988+ return true;
989+}
990+
991+
992+void Wayland::FreeShmPool()
993+{
994+ wl_shm_pool_destroy(m_pool);
995+ munmap(m_shm_pool->memory, m_shm_pool->capacity);
996+ delete m_shm_pool;
997+}
998+
999+
1000+struct wl_buffer * Wayland::CreateShmBuffer(unsigned width
1001+ , unsigned height
1002+ , unsigned stride
1003+ , uint32_t PIXEL_FORMAT_ID)
1004+{
1005+ struct wl_buffer *buffer;
1006+ buffer = wl_shm_pool_create_buffer(m_pool
1007+ , m_shm_pool->size*sizeof(uint32_t)
1008+ , width
1009+ , height
1010+ , stride
1011+ , PIXEL_FORMAT_ID);
1012+ if(NULL == buffer)
1013+ return NULL;
1014+
1015+ m_shm_pool->size += stride*height;
1016+ return buffer;
1017+}
1018+
1019+void Wayland::FreeShmBuffer(struct wl_buffer *buffer)
1020+{
1021+ wl_buffer_destroy(buffer);
1022+}
1023+
1024+int Wayland::Dispatch()
1025+{
1026+ return wl_display_dispatch(m_display);
1027+}
1028+
1029+struct wl_buffer * Wayland::CreatePlanarBuffer(uint32_t name
1030+ , int32_t width
1031+ , int32_t height
1032+ , uint32_t format
1033+ , int32_t offsets[3]
1034+ , int32_t pitches[3])
1035+{
1036+ struct wl_buffer * buffer = NULL;
1037+ if(NULL == m_drm)
1038+ return NULL;
1039+
1040+ buffer = wl_drm_create_planar_buffer(m_drm
1041+ , name
1042+ , width
1043+ , height
1044+ , format
1045+ , offsets[0]
1046+ , pitches[0]
1047+ , offsets[1]
1048+ , pitches[1]
1049+ , offsets[2]
1050+ , pitches[2]);
1051+ return buffer;
1052+}
1053+
1054+struct wl_buffer * Wayland::CreatePrimeBuffer(uint32_t name
1055+ , int32_t width
1056+ , int32_t height
1057+ , uint32_t format
1058+ , int32_t offsets[3]
1059+ , int32_t pitches[3])
1060+{
1061+ struct wl_buffer * buffer = NULL;
1062+ if(NULL == m_drm)
1063+ return NULL;
1064+
1065+ buffer = wl_drm_create_prime_buffer(m_drm
1066+ , name
1067+ , width
1068+ , height
1069+ , format
1070+ , offsets[0]
1071+ , pitches[0]
1072+ , offsets[1]
1073+ , pitches[1]
1074+ , offsets[2]
1075+ , pitches[2]);
1076+ return buffer;
1077+}
1078+
1079+Wayland::~Wayland()
1080+{
1081+ if(NULL != m_shell)
1082+ wl_shell_destroy(m_shell);
1083+ if(NULL != m_shm)
1084+ wl_shm_destroy(m_shm);
1085+ if(NULL != m_bufmgr) {
1086+ drm_intel_bufmgr_destroy(m_bufmgr);
1087+ }
1088+ if(NULL != m_compositor)
1089+ wl_compositor_destroy(m_compositor);
1090+ if(NULL != m_event_queue)
1091+ wl_event_queue_destroy(m_event_queue);
1092+ if(0 != m_buffers_list.size())
1093+ DestroyBufferList();
1094+ if(NULL != m_registry)
1095+ wl_registry_destroy(m_registry);
1096+ if(NULL != m_display)
1097+ wl_display_disconnect(m_display);
1098+ if(NULL != m_device_name)
1099+ delete m_device_name;
1100+}
1101+
1102+// Registry
1103+void Wayland::RegistryGlobal(struct wl_registry *registry
1104+ , uint32_t name
1105+ , const char *interface
1106+ , uint32_t version)
1107+{
1108+ if(0 == strcmp(interface, "wl_compositor"))
1109+ m_compositor = static_cast<wl_compositor*>
1110+ (wl_registry_bind(registry
1111+ , name
1112+ , &wl_compositor_interface
1113+ , version));
1114+ else if(0 == strcmp(interface, "wl_shell"))
1115+ m_shell = static_cast<wl_shell*>
1116+ (wl_registry_bind(registry
1117+ , name
1118+ , &wl_shell_interface
1119+ , version));
1120+ else if(0 == strcmp(interface, "wl_drm")) {
1121+ static const struct wl_drm_listener drm_listener = {
1122+ drm_handle_device,
1123+ drm_handle_format,
1124+ drm_handle_authenticated,
1125+ drm_handle_capabilities
1126+ };
1127+ m_drm = static_cast<wl_drm*>(wl_registry_bind(registry
1128+ , name
1129+ , &wl_drm_interface
1130+ , 2));
1131+ wl_drm_add_listener(m_drm, &drm_listener, this);
1132+ }
1133+}
1134+
1135+void Wayland::DrmHandleDevice(const char *name)
1136+{
1137+ m_device_name = strdup(name);
1138+ if (!m_device_name)
1139+ return;
1140+
1141+ drm_magic_t magic;
1142+ m_fd = open(m_device_name, O_RDWR | O_CLOEXEC);
1143+ if (-1 == m_fd) {
1144+ std::cout << "Error: Could not open " <<
1145+ m_device_name << "\n";
1146+ return;
1147+ }
1148+ int type = drmGetNodeTypeFromFd(m_fd);
1149+ if (type != DRM_NODE_RENDER) {
1150+ drmGetMagic(m_fd, &magic);
1151+ wl_drm_authenticate(m_drm, magic);
1152+ }
1153+}
1154+
1155+void Wayland::DrmHandleAuthenticated()
1156+{
1157+ m_bufmgr = drm_intel_bufmgr_gem_init(m_fd, BATCH_SIZE);
1158+}
1159+
1160+void Wayland::AddBufferToList(wld_buffer *buffer)
1161+{
1162+ if (buffer == NULL)
1163+ return;
1164+
1165+ if (buffer->pInSurface) {
1166+ msdkFrameSurface *surface = FindUsedSurface(buffer->pInSurface);
1167+ msdk_atomic_inc16(&(surface->render_lock));
1168+ m_buffers_list.push_back(buffer);
1169+ }
1170+}
1171+
1172+void Wayland::RemoveBufferFromList(struct wl_buffer *buffer)
1173+{
1174+ wld_buffer *m_buffer = NULL;
1175+ m_buffer = m_buffers_list.front();
1176+ if (NULL != m_buffer && (m_buffer->buffer == buffer)) {
1177+ if (m_buffer->pInSurface) {
1178+ msdkFrameSurface *surface = FindUsedSurface(m_buffer->pInSurface);
1179+ msdk_atomic_dec16(&(surface->render_lock));
1180+ }
1181+ m_buffer->buffer = NULL;
1182+ m_buffer->pInSurface = NULL;
1183+ m_buffers_list.pop_front();
1184+ delete m_buffer;
1185+ }
1186+}
1187+
1188+void Wayland::DestroyBufferList()
1189+{
1190+ wld_buffer *m_buffer = NULL;
1191+ while (!m_buffers_list.empty())
1192+ {
1193+ m_buffer = m_buffers_list.front();
1194+ if (m_buffer->pInSurface)
1195+ {
1196+ msdkFrameSurface *surface = FindUsedSurface(m_buffer->pInSurface);
1197+ msdk_atomic_dec16(&(surface->render_lock));
1198+ }
1199+ m_buffers_list.pop_front();
1200+ delete m_buffer;
1201+ }
1202+}
1203+
1204+Wayland* WaylandCreate()
1205+{
1206+ return new Wayland;
1207+}
1208+
1209+void WaylandDestroy(Wayland *pWld)
1210+{
1211+ delete pWld;
1212+}
1213diff --git a/tools/legacy/sample_misc/wayland/src/listener_wayland.cpp b/tools/legacy/sample_misc/wayland/src/listener_wayland.cpp
1214new file mode 100644
1215index 0000000..90f582a
1216--- /dev/null
1217+++ b/tools/legacy/sample_misc/wayland/src/listener_wayland.cpp
1218@@ -0,0 +1,105 @@
1219+/******************************************************************************\
1220+Copyright (c) 2005-2019, Intel Corporation
1221+All rights reserved.
1222+
1223+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1224+
1225+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
1226+
1227+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
1228+
1229+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
1230+
1231+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1232+
1233+This sample was distributed or derived from the Intel's Media Samples package.
1234+The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
1235+or https://software.intel.com/en-us/media-client-solutions-support.
1236+\**********************************************************************************/
1237+
1238+#include <iostream>
1239+#include "listener_wayland.h"
1240+#include "class_wayland.h"
1241+
1242+/* drm listener */
1243+void drm_handle_device(void *data
1244+ , struct wl_drm *drm
1245+ , const char *device)
1246+{
1247+ Wayland *wayland = static_cast<Wayland*>(data);
1248+ wayland->DrmHandleDevice(device);
1249+}
1250+
1251+void drm_handle_format(void *data
1252+ , struct wl_drm *drm
1253+ , uint32_t format)
1254+{
1255+ /* NOT IMPLEMENTED */
1256+}
1257+
1258+void drm_handle_capabilities(void *data
1259+ , struct wl_drm *drm
1260+ , uint32_t value)
1261+{
1262+ /* NOT IMPLEMENTED */
1263+}
1264+
1265+void drm_handle_authenticated(void *data
1266+ , struct wl_drm *drm)
1267+{
1268+ Wayland *wayland = static_cast<Wayland*>(data);
1269+ wayland->DrmHandleAuthenticated();
1270+}
1271+
1272+/* registry listener */
1273+void registry_handle_global(void *data
1274+ , struct wl_registry *registry
1275+ , uint32_t name
1276+ , const char *interface
1277+ , uint32_t version)
1278+{
1279+ Wayland *wayland = static_cast<Wayland*>(data);
1280+ wayland->RegistryGlobal(registry
1281+ , name
1282+ , interface
1283+ , version);
1284+}
1285+
1286+void remove_registry_global(void *data
1287+ , struct wl_registry *registy
1288+ , uint32_t name)
1289+{
1290+ /* NOT IMPLEMENTED */
1291+}
1292+
1293+
1294+/* surface listener */
1295+void shell_surface_ping(void *data
1296+ , struct wl_shell_surface *shell_surface
1297+ , uint32_t serial)
1298+{
1299+ wl_shell_surface_pong(shell_surface, serial);
1300+}
1301+
1302+void shell_surface_configure(void *data
1303+ , struct wl_shell_surface *shell_surface
1304+ , uint32_t edges
1305+ , int32_t width
1306+ , int32_t height)
1307+{
1308+ /* NOT IMPLEMENTED */
1309+}
1310+
1311+void handle_done(void *data, struct wl_callback *callback, uint32_t time)
1312+{
1313+ Wayland *wayland = static_cast<Wayland*>(data);
1314+ wayland->DestroyCallback();
1315+}
1316+
1317+void buffer_release(void *data, struct wl_buffer *buffer)
1318+{
1319+ Wayland *wayland = static_cast<Wayland*>(data);
1320+ wayland->RemoveBufferFromList(buffer);
1321+ wl_buffer_destroy(buffer);
1322+ buffer = NULL;
1323+}
1324diff --git a/tools/legacy/sample_misc/wayland/src/wayland-drm-protocol.c b/tools/legacy/sample_misc/wayland/src/wayland-drm-protocol.c
1325new file mode 100644
1326index 0000000..7640883
1327--- /dev/null
1328+++ b/tools/legacy/sample_misc/wayland/src/wayland-drm-protocol.c
1329@@ -0,0 +1,84 @@
1330+/*
1331+ * Copyright � 2008-2011 Kristian H�gsberg
1332+ * Copyright � 2010-2011 Intel Corporation
1333+ *
1334+ * Permission to use, copy, modify, distribute, and sell this
1335+ * software and its documentation for any purpose is hereby granted
1336+ * without fee, provided that\n the above copyright notice appear in
1337+ * all copies and that both that copyright notice and this permission
1338+ * notice appear in supporting documentation, and that the name of
1339+ * the copyright holders not be used in advertising or publicity
1340+ * pertaining to distribution of the software without specific,
1341+ * written prior permission. The copyright holders make no
1342+ * representations about the suitability of this software for any
1343+ * purpose. It is provided "as is" without express or implied
1344+ * warranty.
1345+ *
1346+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
1347+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
1348+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
1349+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1350+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
1351+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
1352+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
1353+ * THIS SOFTWARE.
1354+ */
1355+
1356+#include <stdlib.h>
1357+#include <stdint.h>
1358+#include "wayland-util.h"
1359+
1360+extern const struct wl_interface wl_buffer_interface;
1361+
1362+static const struct wl_interface *types[] = {
1363+ NULL,
1364+ &wl_buffer_interface,
1365+ NULL,
1366+ NULL,
1367+ NULL,
1368+ NULL,
1369+ NULL,
1370+ &wl_buffer_interface,
1371+ NULL,
1372+ NULL,
1373+ NULL,
1374+ NULL,
1375+ NULL,
1376+ NULL,
1377+ NULL,
1378+ NULL,
1379+ NULL,
1380+ NULL,
1381+ &wl_buffer_interface,
1382+ NULL,
1383+ NULL,
1384+ NULL,
1385+ NULL,
1386+ NULL,
1387+ NULL,
1388+ NULL,
1389+ NULL,
1390+ NULL,
1391+ NULL,
1392+};
1393+
1394+static const struct wl_message wl_drm_requests[] = {
1395+ { "authenticate", "u", types + 0 },
1396+ { "create_buffer", "nuiiuu", types + 1 },
1397+ { "create_planar_buffer", "nuiiuiiiiii", types + 7 },
1398+ { "create_prime_buffer", "2nhiiuiiiiii", types + 18 },
1399+};
1400+
1401+static const struct wl_message wl_drm_events[] = {
1402+ { "device", "s", types + 0 },
1403+ { "format", "u", types + 0 },
1404+ { "authenticated", "", types + 0 },
1405+ { "capabilities", "u", types + 0 },
1406+};
1407+
1408+WL_EXPORT const struct wl_interface wl_drm_interface = {
1409+ "wl_drm", 2,
1410+ 4, wl_drm_requests,
1411+ 4, wl_drm_events,
1412+};
1413+
1414--
14152.32.0
1416
diff --git a/recipes-multimedia/onevpl/onevpl/0001-Adding-X11-DRI3-support.patch b/recipes-multimedia/onevpl/onevpl/0001-Adding-X11-DRI3-support.patch
deleted file mode 100644
index 4539c69b..00000000
--- a/recipes-multimedia/onevpl/onevpl/0001-Adding-X11-DRI3-support.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From 5943f3dcca3ce715e7f721535a031d137255fb70 Mon Sep 17 00:00:00 2001
2From: "Yew, Chang Ching" <chang.ching.yew@intel.com>
3Date: Thu, 1 Jul 2021 11:16:33 +0800
4Subject: [PATCH] Adding X11 DRI3 support
5
6Upstream-Status: Backport
7inner-source #e8e7b97
8
9Signed-off-by: Teng, Jin Chung <jin.chung.teng@intel.com>
10Signed-off-by: Yew, Chang Ching <chang.ching.yew@intel.com>
11---
12 tools/legacy/sample_common/CMakeLists.txt | 4 ++++
13 1 file changed, 4 insertions(+)
14
15diff --git a/tools/legacy/sample_common/CMakeLists.txt b/tools/legacy/sample_common/CMakeLists.txt
16index b4710f6..5fd97da 100644
17--- a/tools/legacy/sample_common/CMakeLists.txt
18+++ b/tools/legacy/sample_common/CMakeLists.txt
19@@ -73,6 +73,7 @@ if(UNIX)
20 pkg_check_modules(PKG_LIBDRM libdrm)
21 pkg_check_modules(PKG_X11 x11)
22 pkg_check_modules(PKG_LIBVA_X11 libva-x11>=1.10.0)
23+ pkg_check_modules(PKG_XCB xcb xcb-dri3 x11-xcb xcb-present)
24 pkg_check_modules(PKG_WAYLAND_CLIENT wayland-client)
25 if(PKG_LIBVA_FOUND)
26 target_compile_definitions(${TARGET} PUBLIC -DLIBVA_SUPPORT)
27@@ -89,6 +90,9 @@ if(UNIX)
28 if(PKG_X11_FOUND)
29 target_compile_definitions(${TARGET} PUBLIC -DLIBVA_X11_SUPPORT)
30 target_include_directories(${TARGET} PUBLIC ${PKG_X11_LIBRARY_DIRS})
31+ if(PKG_XCB_FOUND)
32+ target_compile_definitions(${TARGET} PUBLIC -DX11_DRI3_SUPPORT)
33+ endif()
34 else()
35 message(WARNING "x11 modules not found: building without libVA X11 support")
36 endif()
37--
382.32.0
39
diff --git a/recipes-multimedia/onevpl/onevpl/0001-Corrected-the-install-path.patch b/recipes-multimedia/onevpl/onevpl/0001-Corrected-the-install-path.patch
deleted file mode 100644
index 032c416d..00000000
--- a/recipes-multimedia/onevpl/onevpl/0001-Corrected-the-install-path.patch
+++ /dev/null
@@ -1,53 +0,0 @@
1From 0e2c56260a3ccddcccb5daa0c8aac3c6b92214ac Mon Sep 17 00:00:00 2001
2From: tengjinchung <jin.chung.teng@intel.com>
3Date: Thu, 17 Jun 2021 14:43:48 +0800
4Subject: [PATCH] Corrected the install path
5
6Fix CMake install path of libvpl_wayland.so to
7$LIBDIR
8
9Upstream-Status: Pending
10inner-source pr #133
11
12Signed-off-by: jinchung <jin.chung.teng@intel.com>
13Signed-off-by: Yew, Chang Ching <chang.ching.yew@intel.com>
14---
15 tools/legacy/sample_common/src/vaapi_utils.cpp | 2 +-
16 tools/legacy/sample_misc/wayland/CMakeLists.txt | 4 ++--
17 2 files changed, 3 insertions(+), 3 deletions(-)
18
19diff --git a/tools/legacy/sample_common/src/vaapi_utils.cpp b/tools/legacy/sample_common/src/vaapi_utils.cpp
20index 833b4c1..23edf86 100644
21--- a/tools/legacy/sample_common/src/vaapi_utils.cpp
22+++ b/tools/legacy/sample_common/src/vaapi_utils.cpp
23@@ -163,7 +163,7 @@ Xcbpresent_Proxy::~Xcbpresent_Proxy() {}
24 #if defined(LIBVA_WAYLAND_SUPPORT)
25
26 VA_WaylandClientProxy::VA_WaylandClientProxy()
27- : lib("libmfx_wayland.so"),
28+ : lib("libvpl_wayland.so"),
29 SIMPLE_LOADER_FUNCTION(WaylandCreate) {}
30
31 VA_WaylandClientProxy::~VA_WaylandClientProxy() {}
32diff --git a/tools/legacy/sample_misc/wayland/CMakeLists.txt b/tools/legacy/sample_misc/wayland/CMakeLists.txt
33index 95057d4..90b55ca 100644
34--- a/tools/legacy/sample_misc/wayland/CMakeLists.txt
35+++ b/tools/legacy/sample_misc/wayland/CMakeLists.txt
36@@ -2,7 +2,7 @@ if (NOT PKG_WAYLAND_CLIENT_FOUND)
37 return()
38 endif()
39
40-set(TARGET mfx_wayland)
41+set(TARGET vpl_wayland)
42
43 find_package(PkgConfig REQUIRED)
44 pkg_check_modules(PKG_WAYLAND_CLIENT wayland-client)
45@@ -26,4 +26,4 @@ target_sources(${TARGET} PRIVATE
46
47 target_link_libraries(${TARGET} sample_common wayland-client va drm drm_intel)
48
49-install( TARGETS ${TARGETS} LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR} )
50+install( TARGETS ${TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
51--
522.32.0
53
diff --git a/recipes-multimedia/onevpl/onevpl/0001-Fix-compile-issue-with-CMAKE_CXX_FLAGS-setting.patch b/recipes-multimedia/onevpl/onevpl/0001-Fix-compile-issue-with-CMAKE_CXX_FLAGS-setting.patch
new file mode 100644
index 00000000..40c5f8f5
--- /dev/null
+++ b/recipes-multimedia/onevpl/onevpl/0001-Fix-compile-issue-with-CMAKE_CXX_FLAGS-setting.patch
@@ -0,0 +1,31 @@
1From f6af035d8cfee4a40a5d02349bf111c3af25432e Mon Sep 17 00:00:00 2001
2From: "Yew, Chang Ching" <chang.ching.yew@intel.com>
3Date: Thu, 12 Aug 2021 07:33:39 +0800
4Subject: [PATCH] Fix compile issue with CMAKE_CXX_FLAGS setting
5
6Appends new options to CMAKE_CXX_FLAGS
7
8Upstream-Status: Submitted
9innersource PR #193
10
11Signed-off-by: Yew, Chang Ching <chang.ching.yew@intel.com>
12---
13 cmake/CompileOptions.cmake | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
15
16diff --git a/cmake/CompileOptions.cmake b/cmake/CompileOptions.cmake
17index 2a941b10..97c3f47a 100644
18--- a/cmake/CompileOptions.cmake
19+++ b/cmake/CompileOptions.cmake
20@@ -50,7 +50,7 @@ else()
21 add_compile_options("-fstack-protector-strong")
22 endif()
23 if(NOT MINGW)
24- set(CMAKE_CXX_FLAGS "-z relro -z now -z noexecstack")
25+ set(CMAKE_CXX_FLAGS "-z relro -z now -z noexecstack ${CMAKE_CXX_FLAGS}")
26 endif()
27 add_compile_options("-Wall")
28 if(ENABLE_WARNING_AS_ERROR)
29--
302.32.0
31
diff --git a/recipes-multimedia/onevpl/onevpl/0001-Fix-sample_multi_transcode-join-issue.patch b/recipes-multimedia/onevpl/onevpl/0001-Fix-sample_multi_transcode-join-issue.patch
deleted file mode 100644
index 2d19430e..00000000
--- a/recipes-multimedia/onevpl/onevpl/0001-Fix-sample_multi_transcode-join-issue.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1From 607535701900cb0d46354d70e2cfceb1986e7051 Mon Sep 17 00:00:00 2001
2From: "Park, Seunghyuk H" <seunghyuk.h.park@intel.com>
3Date: Sat, 17 Jul 2021 10:37:08 -0700
4Subject: [PATCH] Fix sample_multi_transcode join issue
5
6Upstream-Status: Backport
7inner-source #157fadd2f
8
9---
10 .../sample_multi_transcode/src/pipeline_transcode.cpp | 6 +++---
11 1 file changed, 3 insertions(+), 3 deletions(-)
12
13diff --git a/tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp b/tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp
14index fee3b9e0..50a000d0 100644
15--- a/tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp
16+++ b/tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp
17@@ -342,14 +342,14 @@ mfxStatus CTranscodingPipeline::DecodePreInit(sInputParams *pParams) {
18 MSDK_CHECK_STATUS(sts, "InitDecMfxParams failed");
19 }
20 }
21-#if !defined(MFX_ONEVPL)
22 else {
23- m_mfxDecParams = m_pParentPipeline->GetDecodeParam(TargetID);
24+ m_mfxDecParams = m_pParentPipeline->GetDecodeParam(TargetID);
25+#if !defined(MFX_ONEVPL)
26 auto mvc = m_mfxDecParams.AddExtBuffer<mfxExtMVCSeqDesc>();
27 *mvc = m_pParentPipeline->GetDecMVCSeqDesc();
28 m_bOwnMVCSeqDescMemory = false;
29- }
30 #endif
31+ }
32
33 if (pParams->nFPS) {
34 this->m_nReqFrameTime = 1000000 / pParams->nFPS;
35--
362.32.0
37
diff --git a/recipes-multimedia/onevpl/onevpl_2021.4.0.bb b/recipes-multimedia/onevpl/onevpl_2021.5.0.bb
index 5982c18a..26b3d89c 100644
--- a/recipes-multimedia/onevpl/onevpl_2021.4.0.bb
+++ b/recipes-multimedia/onevpl/onevpl_2021.5.0.bb
@@ -9,21 +9,18 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=c18ea6bb4786a26bf4eee88a7424a408 \
9 file://third-party-programs.txt;md5=52d2c0c51bb5c0d9d9c16ae91d66c8fb" 9 file://third-party-programs.txt;md5=52d2c0c51bb5c0d9d9c16ae91d66c8fb"
10 10
11SRC_URI = "git://github.com/oneapi-src/oneVPL.git;protocol=https \ 11SRC_URI = "git://github.com/oneapi-src/oneVPL.git;protocol=https \
12 file://0001-Adding-Wayland-support-to-legacy-tools.patch \
13 file://0001-Corrected-the-install-path.patch \
14 file://0001-Adding-X11-DRI3-support.patch \
15 file://0001-Fix-sample_multi_transcode-join-issue.patch \
16 file://0001-Fix-the-rendering-to-X11-failures.patch \ 12 file://0001-Fix-the-rendering-to-X11-failures.patch \
13 file://0001-Fix-compile-issue-with-CMAKE_CXX_FLAGS-setting.patch \
17 " 14 "
18SRCREV = "d5c072584ee6f81305ed85de8759658ab7854606" 15SRCREV = "dde640ef0872b645d6e0275a6aaec26c01a9c0b9"
19S = "${WORKDIR}/git" 16S = "${WORKDIR}/git"
20 17
21inherit cmake 18inherit cmake
22DEPENDS = "libva" 19DEPENDS += "libva"
23 20
24COMPATIBLE_HOST = '(x86_64).*-linux' 21COMPATIBLE_HOST = '(x86_64).*-linux'
25 22
26PACKAGES =+ "${PN}-examples" 23PACKAGES += "${PN}-examples"
27 24
28FILES:${PN}-examples = "${datadir}/oneVPL/examples \ 25FILES:${PN}-examples = "${datadir}/oneVPL/examples \
29 " 26 "