| 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 |
class CVideoReferenceClock; |
| 19 |
|
| 20 |
namespace KODI |
| 21 |
{ |
| 22 |
namespace WINDOWING |
| 23 |
{ |
| 24 |
namespace X11 |
| 25 |
{ |
| 26 |
|
| 27 |
class CVaapiProxy; |
| 28 |
|
| 29 |
class CWinSystemX11GLContext : public CWinSystemX11, public CRenderSystemGL |
| 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 |
|
| 71 |
struct delete_CVaapiProxy |
| 72 |
{ |
| 73 |
void operator()(CVaapiProxy *p) const; |
| 74 |
}; |
| 75 |
std::unique_ptr<CVaapiProxy, delete_CVaapiProxy> m_vaapiProxy; |
| 76 |
}; |
| 77 |
|
| 78 |
} |
| 79 |
} |
| 80 |
} |