1 /*
2  *  Copyright (C) 2005-2018 Team Kodi
3  *  This file is part of Kodi - https://kodi.tv
4  *
5  *  SPDX-License-Identifier: GPL-2.0-or-later
6  *  See LICENSES/README.md for more information.
7  */
8 
9 #include "OptionalsReg.h"
10 
11 //-----------------------------------------------------------------------------
12 // VAAPI
13 //-----------------------------------------------------------------------------
14 #if defined(HAVE_LIBVA) && defined(HAS_EGL)
15 #include <va/va_wayland.h>
16 #include "cores/VideoPlayer/DVDCodecs/Video/VAAPI.h"
17 #include "cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVAAPIGL.h"
18 
19 namespace KODI
20 {
21 namespace WINDOWING
22 {
23 namespace WAYLAND
24 {
25 
26 class CVaapiProxy : public VAAPI::IVaapiWinSystem
27 {
28 public:
29   CVaapiProxy() = default;
30   virtual ~CVaapiProxy() = default;
GetVADisplay()31   VADisplay GetVADisplay() override { return vaGetDisplayWl(dpy); };
GetEGLDisplay()32   void *GetEGLDisplay() override { return eglDisplay; };
33 
34   wl_display *dpy;
35   void *eglDisplay;
36 };
37 
VaapiProxyCreate()38 CVaapiProxy* VaapiProxyCreate()
39 {
40   return new CVaapiProxy();
41 }
42 
VaapiProxyDelete(CVaapiProxy * proxy)43 void VaapiProxyDelete(CVaapiProxy* proxy)
44 {
45   delete proxy;
46 }
47 
VaapiProxyConfig(CVaapiProxy * proxy,void * dpy,void * eglDpy)48 void VaapiProxyConfig(CVaapiProxy* proxy, void* dpy, void* eglDpy)
49 {
50   proxy->dpy = static_cast<wl_display*>(dpy);
51   proxy->eglDisplay = eglDpy;
52 }
53 
VAAPIRegister(CVaapiProxy * winSystem,bool deepColor)54 void VAAPIRegister(CVaapiProxy* winSystem, bool deepColor)
55 {
56   VAAPI::CDecoder::Register(winSystem, deepColor);
57 }
58 
VAAPIRegisterRender(CVaapiProxy * winSystem,bool & general,bool & deepColor)59 void VAAPIRegisterRender(CVaapiProxy* winSystem, bool& general, bool& deepColor)
60 {
61   EGLDisplay eglDpy = winSystem->eglDisplay;
62   VADisplay vaDpy = vaGetDisplayWl(winSystem->dpy);
63   CRendererVAAPI::Register(winSystem, vaDpy, eglDpy, general, deepColor);
64 }
65 
66 } // namespace WAYLAND
67 } // namespace WINDOWING
68 } // namespace KODI
69 
70 #else
71 
72 namespace KODI
73 {
74 namespace WINDOWING
75 {
76 namespace WAYLAND
77 {
78 
79 class CVaapiProxy
80 {
81 };
82 
VaapiProxyCreate()83 CVaapiProxy* VaapiProxyCreate()
84 {
85   return nullptr;
86 }
87 
VaapiProxyDelete(CVaapiProxy * proxy)88 void VaapiProxyDelete(CVaapiProxy* proxy)
89 {
90 }
91 
VaapiProxyConfig(CVaapiProxy * proxy,void * dpy,void * eglDpy)92 void VaapiProxyConfig(CVaapiProxy* proxy, void* dpy, void* eglDpy)
93 {
94 
95 }
96 
VAAPIRegister(CVaapiProxy * winSystem,bool deepColor)97 void VAAPIRegister(CVaapiProxy* winSystem, bool deepColor)
98 {
99 
100 }
101 
VAAPIRegisterRender(CVaapiProxy * winSystem,bool & general,bool & deepColor)102 void VAAPIRegisterRender(CVaapiProxy* winSystem, bool& general, bool& deepColor)
103 {
104 
105 }
106 
107 
108 } // namespace WAYLAND
109 } // namespace WINDOWING
110 } // namespace KODI
111 
112 #endif
113 
114