| 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 "VideoLayerBridge.h" |
| 12 |
#include "drm/DRMUtils.h" |
| 13 |
#include "threads/CriticalSection.h" |
| 14 |
#include "threads/SystemClock.h" |
| 15 |
#include "windowing/WinSystem.h" |
| 16 |
|
| 17 |
#include "platform/linux/input/LibInputHandler.h" |
| 18 |
|
| 19 |
#include <utility> |
| 20 |
|
| 21 |
#include <gbm.h> |
| 22 |
|
| 23 |
class IDispResource; |
| 24 |
|
| 25 |
namespace KODI |
| 26 |
{ |
| 27 |
namespace UTILS |
| 28 |
{ |
| 29 |
class CDisplayInfo; |
| 30 |
} |
| 31 |
namespace WINDOWING |
| 32 |
{ |
| 33 |
namespace GBM |
| 34 |
{ |
| 35 |
|
| 36 |
class CWinSystemGbm : public CWinSystemBase |
| 37 |
{ |
| 38 |
public: |
| 39 |
CWinSystemGbm(); |
| 40 |
~CWinSystemGbm() override; |
| 41 |
|
| 42 |
const std::string GetName() override { return "gbm"; } |
| 43 |
|
| 44 |
bool InitWindowSystem() override; |
| 45 |
bool DestroyWindowSystem() override; |
| 46 |
|
| 47 |
bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) override; |
| 48 |
bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) override; |
| 49 |
bool DisplayHardwareScalingEnabled() override; |
| 50 |
void UpdateDisplayHardwareScaling(const RESOLUTION_INFO& resInfo) override; |
| 51 |
|
| 52 |
void FlipPage(bool rendered, bool videoLayer, bool async); |
| 53 |
|
| 54 |
bool CanDoWindowed() override { return false; } |
| 55 |
void UpdateResolutions() override; |
| 56 |
|
| 57 |
bool UseLimitedColor() override; |
| 58 |
|
| 59 |
bool Hide() override; |
| 60 |
bool Show(bool raise = true) override; |
| 61 |
void Register(IDispResource* resource) override; |
| 62 |
void Unregister(IDispResource* resource) override; |
| 63 |
|
| 64 |
bool SetHDR(const VideoPicture* videoPicture) override; |
| 65 |
bool IsHDRDisplay() override; |
| 66 |
CHDRCapabilities GetDisplayHDRCapabilities() const override; |
| 67 |
|
| 68 |
std::shared_ptr<CVideoLayerBridge> GetVideoLayerBridge() const { return m_videoLayerBridge; } |
| 69 |
void RegisterVideoLayerBridge(std::shared_ptr<CVideoLayerBridge> bridge) |
| 70 |
{ |
| 71 |
m_videoLayerBridge = std::move(bridge); |
| 72 |
}; |
| 73 |
|
| 74 |
CGBMUtils::CGBMDevice& GetGBMDevice() const { return m_GBM->GetDevice(); } |
| 75 |
std::shared_ptr<CDRMUtils> GetDrm() const { return m_DRM; } |
| 76 |
|
| 77 |
std::vector<std::string> GetConnectedOutputs() override; |
| 78 |
|
| 79 |
protected: |
| 80 |
void OnLostDevice(); |
| 81 |
|
| 82 |
std::unique_ptr<CVideoSync> GetVideoSync(CVideoReferenceClock* clock) override; |
| 83 |
|
| 84 |
std::shared_ptr<CDRMUtils> m_DRM; |
| 85 |
std::unique_ptr<CGBMUtils> m_GBM; |
| 86 |
std::shared_ptr<CVideoLayerBridge> m_videoLayerBridge; |
| 87 |
|
| 88 |
CCriticalSection m_resourceSection; |
| 89 |
std::vector<IDispResource*> m_resources; |
| 90 |
|
| 91 |
bool m_dispReset = false; |
| 92 |
XbmcThreads::EndTime<> m_dispResetTimer; |
| 93 |
std::unique_ptr<CLibInputHandler> m_libinput; |
| 94 |
|
| 95 |
private: |
| 96 |
uint32_t m_hdr_blob_id = 0; |
| 97 |
|
| 98 |
std::unique_ptr<UTILS::CDisplayInfo> m_info; |
| 99 |
}; |
| 100 |
|
| 101 |
} |
| 102 |
} |
| 103 |
} // namespace KODI |