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