summaryrefslogtreecommitdiffstats
path: root/xbmc/windowing/android/WinSystemAndroidGLESContext.h
blob: b04ff41c3069ab5a5b37447ef2e85d4c2eb23836 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 *  Copyright (C) 2005-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#pragma once

#include "WinSystemAndroid.h"
#include "rendering/gles/RenderSystemGLES.h"
#include "utils/EGLUtils.h"
#include "utils/GlobalsHandling.h"

struct AVMasteringDisplayMetadata;
struct AVContentLightMetadata;

class CWinSystemAndroidGLESContext : public CWinSystemAndroid, public CRenderSystemGLES
{
public:
  CWinSystemAndroidGLESContext() = default;
  ~CWinSystemAndroidGLESContext() override = default;

  static void Register();
  static std::unique_ptr<CWinSystemBase> CreateWinSystem();

  // Implementation of CWinSystemBase via CWinSystemAndroid
  CRenderSystemBase *GetRenderSystem() override { return this; }
  bool InitWindowSystem() override;
  bool CreateNewWindow(const std::string& name,
                       bool fullScreen,
                       RESOLUTION_INFO& res) override;

  bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) override;
  bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) override;

  std::unique_ptr<CVideoSync> GetVideoSync(void* clock) override;

  float GetFrameLatencyAdjustment() override;
  bool IsHDRDisplay() override;
  bool SetHDR(const VideoPicture* videoPicture) override;

  EGLDisplay GetEGLDisplay() const;
  EGLSurface GetEGLSurface() const;
  EGLContext GetEGLContext() const;
  EGLConfig  GetEGLConfig() const;
protected:
  void SetVSyncImpl(bool enable) override;
  void PresentRenderImpl(bool rendered) override;

private:
  bool CreateSurface();

  CEGLContextUtils m_pGLContext;
  bool m_hasHDRConfig = false;

  std::unique_ptr<AVMasteringDisplayMetadata> m_displayMetadata;
  std::unique_ptr<AVContentLightMetadata> m_lightMetadata;
  EGLint m_HDRColorSpace = EGL_NONE;
  bool m_hasEGL_ST2086_Extension = false;
  bool m_hasEGL_BT2020_PQ_Colorspace_Extension = false;
};