2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "OptionalsReg.h"
11 //-----------------------------------------------------------------------------
13 //-----------------------------------------------------------------------------
14 #if defined (HAVE_LIBVA)
15 #include <va/va_x11.h>
16 #include "cores/VideoPlayer/DVDCodecs/Video/VAAPI.h"
18 #include "cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVAAPIGL.h"
21 #include "cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVAAPIGLES.h"
24 using namespace KODI::WINDOWING::X11
;
33 class CWinSystemX11GLContext
;
35 class CVaapiProxy
: public VAAPI::IVaapiWinSystem
38 CVaapiProxy() = default;
39 virtual ~CVaapiProxy() = default;
40 VADisplay
GetVADisplay() override
{ return vaGetDisplay(dpy
); };
41 void *GetEGLDisplay() override
{ return eglDisplay
; };
47 CVaapiProxy
* VaapiProxyCreate()
49 return new CVaapiProxy();
52 void VaapiProxyDelete(CVaapiProxy
*proxy
)
57 void VaapiProxyConfig(CVaapiProxy
*proxy
, void *dpy
, void *eglDpy
)
59 proxy
->dpy
= static_cast<Display
*>(dpy
);
60 proxy
->eglDisplay
= eglDpy
;
63 void VAAPIRegister(CVaapiProxy
*winSystem
, bool deepColor
)
65 VAAPI::CDecoder::Register(winSystem
, deepColor
);
69 void VAAPIRegisterRenderGL(CVaapiProxy
* winSystem
, bool& general
, bool& deepColor
)
71 EGLDisplay eglDpy
= winSystem
->eglDisplay
;
72 VADisplay vaDpy
= vaGetDisplay(winSystem
->dpy
);
73 CRendererVAAPIGL::Register(winSystem
, vaDpy
, eglDpy
, general
, deepColor
);
78 void VAAPIRegisterRenderGLES(CVaapiProxy
* winSystem
, bool& general
, bool& deepColor
)
80 EGLDisplay eglDpy
= winSystem
->eglDisplay
;
81 VADisplay vaDpy
= vaGetDisplay(winSystem
->dpy
);
82 CRendererVAAPIGLES::Register(winSystem
, vaDpy
, eglDpy
, general
, deepColor
);
101 CVaapiProxy
* VaapiProxyCreate()
106 void VaapiProxyDelete(CVaapiProxy
*proxy
)
110 void VaapiProxyConfig(CVaapiProxy
*proxy
, void *dpy
, void *eglDpy
)
114 void VAAPIRegister(CVaapiProxy
*winSystem
, bool deepColor
)
118 void VAAPIRegisterRenderGL(CVaapiProxy
* winSystem
, bool& general
, bool& deepColor
)
122 void VAAPIRegisterRenderGLES(CVaapiProxy
* winSystem
, bool& general
, bool& deepColor
)
131 //-----------------------------------------------------------------------------
133 //-----------------------------------------------------------------------------
137 #include "VideoSyncGLX.h"
138 #include "GLContextGLX.h"
147 XID
GLXGetWindow(void* context
)
149 return static_cast<CGLContextGLX
*>(context
)->m_glxWindow
;
152 void* GLXGetContext(void* context
)
154 return static_cast<CGLContextGLX
*>(context
)->m_glxContext
;
157 CGLContext
* GLXContextCreate(Display
*dpy
)
159 return new CGLContextGLX(dpy
);
163 CVideoSync
* GLXVideoSyncCreate(void* clock
, CWinSystemX11GLContext
& winSystem
)
165 return new CVideoSyncGLX(clock
, winSystem
);
180 XID
GLXGetWindow(void* context
)
185 void* GLXGetContext(void* context
)
190 CGLContext
* GLXContextCreate(Display
*dpy
)
195 CVideoSync
* GLXVideoSyncCreate(void* clock
, CWinSystemX11GLContext
& winSystem
)
205 //-----------------------------------------------------------------------------
207 //-----------------------------------------------------------------------------
209 #if defined (HAVE_LIBVDPAU)
210 #include "cores/VideoPlayer/DVDCodecs/Video/VDPAU.h"
211 #include "cores/VideoPlayer/VideoRenderers/HwDecRender/RendererVDPAU.h"
220 void VDPAURegisterRender()
222 CRendererVDPAU::Register();
227 VDPAU::CDecoder::Register();
242 void VDPAURegisterRender()