summaryrefslogtreecommitdiffstats
path: root/xbmc/windowing/gbm/drm/OffScreenModeSetting.cpp
blob: dc69fdc4de4a0609abb41a81822f7272d5b66ed0 (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
/*
 *  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.
 */

#include "OffScreenModeSetting.h"

#include "utils/log.h"

using namespace KODI::WINDOWING::GBM;

namespace
{
constexpr int DISPLAY_WIDTH = 1280;
constexpr int DISPLAY_HEIGHT = 720;
constexpr float DISPLAY_REFRESH = 50.0f;
} // namespace

bool COffScreenModeSetting::InitDrm()
{
  if (!CDRMUtils::OpenDrm(false))
    return false;

  CLog::Log(LOGDEBUG, "COffScreenModeSetting::{} - initialized offscreen DRM", __FUNCTION__);
  return true;
}

std::vector<RESOLUTION_INFO> COffScreenModeSetting::GetModes()
{
    std::vector<RESOLUTION_INFO> resolutions;
    resolutions.push_back(GetCurrentMode());
    return resolutions;
}

RESOLUTION_INFO COffScreenModeSetting::GetCurrentMode()
{
  RESOLUTION_INFO res;
  res.iScreenWidth = DISPLAY_WIDTH;
  res.iWidth = DISPLAY_WIDTH;
  res.iScreenHeight = DISPLAY_HEIGHT;
  res.iHeight = DISPLAY_HEIGHT;
  res.fRefreshRate = DISPLAY_REFRESH;
  res.iSubtitles = res.iHeight;
  res.fPixelRatio = 1.0f;
  res.bFullScreen = true;
  res.strId = "0";

  return res;
}