Debian Codegraph @

xbmc/windowing/gbm/OptionalsReg.cpp

raw
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)
15 #include <va/va_drm.h>
16 #include "cores/VideoPlayer/DVDCodecs/Video/VAAPI.h"
17 #if defined(HAS_GL)
18 #include "cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVAAPIGL.h"
19 #endif
20 #if defined(HAS_GLES)
21 #include "cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVAAPIGLES.h"
22 #endif
23
24 namespace KODI
25 {
26 namespace WINDOWING
27 {
28 namespace GBM
29 {
30
31 class CVaapiProxy : public VAAPI::IVaapiWinSystem
32 {
33 public:
34 CVaapiProxy(int fd) : m_fd(fd) {};
35 virtual ~CVaapiProxy() = default;
36 VADisplay GetVADisplay() override;
37 void *GetEGLDisplay() override { return eglDisplay; };
38
39 VADisplay vaDpy;
40 void *eglDisplay;
41
42 private:
43 int m_fd{-1};
44 };
45
46 VADisplay CVaapiProxy::GetVADisplay()
47 {
48 return vaGetDisplayDRM(m_fd);
49 }
50
51 CVaapiProxy* VaapiProxyCreate(int fd)
52 {
53 return new CVaapiProxy(fd);
54 }
55
56 void VaapiProxyDelete(CVaapiProxy *proxy)
57 {
58 delete proxy;
59 }
60
61 void VaapiProxyConfig(CVaapiProxy *proxy, void *eglDpy)
62 {
63 proxy->vaDpy = proxy->GetVADisplay();
64 proxy->eglDisplay = eglDpy;
65 }
66
67 void VAAPIRegister(CVaapiProxy *winSystem, bool deepColor)
68 {
69 VAAPI::CDecoder::Register(winSystem, deepColor);
70 }
71
72 #if defined(HAS_GL)
73 void VAAPIRegisterRenderGL(CVaapiProxy* winSystem, bool& general, bool& deepColor)
74 {
75 CRendererVAAPIGL::Register(winSystem, winSystem->vaDpy, winSystem->eglDisplay, general,
76 deepColor);
77 }
78 #endif
79
80 #if defined(HAS_GLES)
81 void VAAPIRegisterRenderGLES(CVaapiProxy* winSystem, bool& general, bool& deepColor)
82 {
83 CRendererVAAPIGLES::Register(winSystem, winSystem->vaDpy, winSystem->eglDisplay, general,
84 deepColor);
85 }
86 #endif
87 }
88 }
89 }
90
91 #else
92
93 namespace KODI
94 {
95 namespace WINDOWING
96 {
97 namespace GBM
98 {
99
100 class CVaapiProxy
101 {
102 };
103
104 CVaapiProxy* VaapiProxyCreate(int fd)
105 {
106 return nullptr;
107 }
108
109 void VaapiProxyDelete(CVaapiProxy *proxy)
110 {
111 }
112
113 void VaapiProxyConfig(CVaapiProxy *proxy, void *eglDpy)
114 {
115
116 }
117
118 void VAAPIRegister(CVaapiProxy *winSystem, bool deepColor)
119 {
120
121 }
122
123 #if defined(HAS_GL)
124 void VAAPIRegisterRenderGL(CVaapiProxy* winSystem, bool& general, bool& deepColor)
125 {
126
127 }
128 #endif
129
130 #if defined(HAS_GLES)
131 void VAAPIRegisterRenderGLES(CVaapiProxy* winSystem, bool& general, bool& deepColor)
132 {
133 }
134 #endif
135 }
136 }
137 }
138
139 #endif