Merge pull request #26312 from garbear/update-controllers
[xbmc.git] / xbmc / windowing / X11 / WinSystemX11GLContext.h
blob5b879c96b30975e11a14614b425b4e5bab2ea2a0
1 /*
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.
7 */
9 #pragma once
11 #include "WinSystemX11.h"
12 #include "rendering/gl/RenderSystemGL.h"
13 #include "windowing/X11/GLContext.h"
15 #include <memory>
17 #include "system_egl.h"
19 class CGLContext;
20 class CVideoReferenceClock;
22 namespace KODI
24 namespace WINDOWING
26 namespace X11
29 class CVaapiProxy;
31 class CWinSystemX11GLContext : public CWinSystemX11, public CRenderSystemGL
33 public:
34 CWinSystemX11GLContext() = default;
35 ~CWinSystemX11GLContext() override;
37 static void Register();
38 static std::unique_ptr<CWinSystemBase> CreateWinSystem();
40 // Implementation of CWinSystem via CWinSystemX11
41 CRenderSystemBase *GetRenderSystem() override { return this; }
42 bool CreateNewWindow(const std::string& name, bool fullScreen, RESOLUTION_INFO& res) override;
43 bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) override;
44 void FinishWindowResize(int newWidth, int newHeight) override;
45 bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) override;
46 bool DestroyWindowSystem() override;
47 bool DestroyWindow() override;
48 int GetBufferAge() override { return m_bufferAgeSupport ? m_pGLContext->GetBufferAge() : 2; }
50 bool IsExtSupported(const char* extension) const override;
52 // videosync
53 std::unique_ptr<CVideoSync> GetVideoSync(CVideoReferenceClock* clock) override;
54 float GetFrameLatencyAdjustment() override;
55 uint64_t GetVblankTiming(uint64_t &msc, uint64_t &interval);
57 XID GetWindow() const;
58 void* GetGlxContext() const;
59 EGLDisplay GetEGLDisplay() const;
60 EGLSurface GetEGLSurface() const;
61 EGLContext GetEGLContext() const;
62 EGLConfig GetEGLConfig() const;
64 bool BindTextureUploadContext() override;
65 bool UnbindTextureUploadContext() override;
66 bool HasContext() override;
68 protected:
69 bool SetWindow(int width, int height, bool fullscreen, const std::string &output, int *winstate = NULL) override;
70 void PresentRenderImpl(bool rendered) override;
71 void SetVSyncImpl(bool enable) override;
72 bool RefreshGLContext(bool force);
73 XVisualInfo* GetVisual() override;
75 CGLContext *m_pGLContext = nullptr;
76 bool m_newGlContext;
78 struct delete_CVaapiProxy
80 void operator()(CVaapiProxy *p) const;
82 std::unique_ptr<CVaapiProxy, delete_CVaapiProxy> m_vaapiProxy;
84 bool m_bufferAgeSupport{false};