xbmc
WinSystemX11GLContext.h
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 #pragma once
10 
11 #include "WinSystemX11.h"
12 #include "rendering/gl/RenderSystemGL.h"
13 #include "system_egl.h"
14 
15 #include <memory>
16 
17 class CGLContext;
18 
19 namespace KODI
20 {
21 namespace WINDOWING
22 {
23 namespace X11
24 {
25 
26 class CVaapiProxy;
27 
29 {
30 public:
31  CWinSystemX11GLContext() = default;
32  ~CWinSystemX11GLContext() override;
33 
34  static void Register();
35  static std::unique_ptr<CWinSystemBase> CreateWinSystem();
36 
37  // Implementation of CWinSystem via CWinSystemX11
38  CRenderSystemBase *GetRenderSystem() override { return this; }
39  bool CreateNewWindow(const std::string& name, bool fullScreen, RESOLUTION_INFO& res) override;
40  bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) override;
41  void FinishWindowResize(int newWidth, int newHeight) override;
42  bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) override;
43  bool DestroyWindowSystem() override;
44  bool DestroyWindow() override;
45 
46  bool IsExtSupported(const char* extension) const override;
47 
48  // videosync
49  std::unique_ptr<CVideoSync> GetVideoSync(void *clock) override;
50  float GetFrameLatencyAdjustment() override;
51  uint64_t GetVblankTiming(uint64_t &msc, uint64_t &interval);
52 
53  XID GetWindow() const;
54  void* GetGlxContext() const;
55  EGLDisplay GetEGLDisplay() const;
56  EGLSurface GetEGLSurface() const;
57  EGLContext GetEGLContext() const;
58  EGLConfig GetEGLConfig() const;
59 
60 protected:
61  bool SetWindow(int width, int height, bool fullscreen, const std::string &output, int *winstate = NULL) override;
62  void PresentRenderImpl(bool rendered) override;
63  void SetVSyncImpl(bool enable) override;
64  bool RefreshGLContext(bool force);
65  XVisualInfo* GetVisual() override;
66 
67  CGLContext *m_pGLContext = nullptr;
68  bool m_newGlContext;
69 
71  {
72  void operator()(CVaapiProxy *p) const;
73  };
74  std::unique_ptr<CVaapiProxy, delete_CVaapiProxy> m_vaapiProxy;
75 };
76 
77 }
78 }
79 }
Definition: RenderSystemGL.h:64
Definition: RenderSystem.h:27
float GetFrameLatencyAdjustment() override
Get time that should be subtracted from the display latency for this frame in milliseconds.
Definition: WinSystemX11GLContext.cpp:332
Provide info of a resolution.
Definition: Resolution.h:66
Definition: OptionalsReg.cpp:97
Controller configuration window.
Definition: AudioDecoder.h:18
Definition: WinSystemX11.h:34
Definition: WinSystemX11GLContext.h:28
Definition: GLContext.h:16